Files
dailygrubs_console_build/build/static/js/9132.a9dfb683.chunk.js

1 line
12 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[9132],{3561:function(e,t,r){var n=r(1413),i=r(47313),o=r(19860),a=r(1550),s=r(49914),c=r(41727),l=r(47131),u=r(38393),d=r(23195),h=r(46417);t.Z=function(e){var t=e.value,r=e.onChange,f=e.sx,v=e.placeholder,Z=void 0===v?"Search (Ctrl + K)":v,x=(0,o.Z)(),p=(0,i.useRef)(null);return(0,i.useEffect)((function(){var e=function(e){var t;"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),null===(t=p.current)||void 0===t||t.focus());"Escape"===e.key&&document.activeElement===p.current&&p.current.blur()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}}),[]),(0,h.jsx)(a.Z,{fullWidth:!0,sx:{},children:(0,h.jsx)(s.Z,{inputRef:p,placeholder:Z,sx:(0,n.Z)({borderRadius:0},f),value:t,onChange:r,autoComplete:"off",size:"large",startAdornment:(0,h.jsx)(c.Z,{position:"start",sx:{mr:-.5,color:x.palette.secondary.main},children:(0,h.jsx)(u.Z,{})}),endAdornment:(0,h.jsx)(l.Z,{sx:{visibility:t?"visible":"hidden"},onClick:function(){return r({target:{value:""}})},children:(0,h.jsx)(d.Z,{style:{fontSize:"large",color:x.palette.primary.main}})})})})}},49132:function(e,t,r){r.r(t);var n=r(29439),i=r(47313),o=r(7266),a=r(69099),s=r(51629),c=r(66835),l=r(23477),u=r(24076),d=r(67478),h=r(57861),f=r(42832),v=r(61113),Z=r(66212),x=r(85281),p=r(97316),g=r(25963),m=r(71049),b=r(19860),k=r(58467),y=r(3561),j=r(95569),S=r(46417);t.default=function(){var e=(0,k.s0)(),t=(0,b.Z)(),r=(0,i.useRef)(),w=(0,i.useRef)(),P=i.useState(0),C=(0,n.Z)(P,2),M=(C[0],C[1],i.useState(10)),N=(0,n.Z)(M,2),R=N[0],F=(N[1],(0,i.useState)("")),z=(0,n.Z)(F,2),D=z[0],E=z[1],A=(0,i.useState)(""),L=(0,n.Z)(A,2),I=L[0],O=L[1];(0,i.useEffect)((function(){var e=setTimeout((function(){O(D)}),400);return function(){return clearTimeout(e)}}),[D]);var T=(0,g.N)({queryKey:["customers",R,I],queryFn:m.kc,getNextPageParam:function(e){return e.nextPage}}),W=T.data,H=(T.isLoading,T.isError,T.error,T.fetchNextPage),K=T.hasNextPage,_=T.isFetchingNextPage,q=W?W.pages.flatMap((function(e){return e.details})):[];(0,i.useEffect)((function(){W&&console.log(W)}),[W]),(0,i.useEffect)((function(){if(K){var e=new IntersectionObserver((function(e){e[0].isIntersecting&&H()}),{root:document.querySelector(".MuiTableContainer-root"),rootMargin:"0px",threshold:1});return r.current&&e.observe(r.current),function(){r.current&&e.unobserve(r.current)}}}),[K,H]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o.Z,{title:"Customers",secondary:(0,S.jsx)(a.Z,{variant:"contained",onClick:function(){return e("/nearle/customers/create")},children:"Create Customers"})}),(0,S.jsx)(p.Z,{content:!1,sx:{width:"100%",overflow:"hidden"},title:(0,S.jsx)(y.Z,{value:D,placeholder:"Search Location",onChange:function(e){return E(e.target.value)},sx:{width:"100%",maxWidth:300,minWidth:200,bgcolor:"white"}}),children:(0,S.jsx)(s.Z,{onScroll:function(e){var t=e.currentTarget,r=t.scrollTop,n=t.scrollHeight;r+t.clientHeight>=n-50&&K&&!_&&H()},ref:w,sx:{width:"100%",borderBottom:1,borderColor:"divider",maxHeight:"calc(100vh - 200px)",overflow:"auto","&::-webkit-scrollbar":{width:"12px",cursor:"pointer"},"&::-webkit-scrollbar-thumb":{backgroundColor:t.palette.primary.main,borderRadius:"8px",cursor:"pointer"},"&::-webkit-scrollbar-thumb:hover":{backgroundColor:t.palette.primary.dark,cursor:"pointer"},"&::-webkit-scrollbar-track":{backgroundColor:t.palette.primary.lighter,cursor:"pointer"}},children:(0,S.jsxs)(c.Z,{stickyHeader:!0,children:[(0,S.jsx)(l.Z,{sx:{},children:(0,S.jsxs)(u.Z,{sx:{backgroundColor:t.palette.primary.main},children:[(0,S.jsx)(d.Z,{sx:{position:"sticky!important",bgcolor:"secondary.light"},children:"#"}),(0,S.jsx)(d.Z,{sx:{position:"sticky!important",bgcolor:"secondary.light"},children:"Name"}),(0,S.jsx)(d.Z,{sx:{position:"sticky!important",bgcolor:"secondary.light"},children:"suburb"}),(0,S.jsx)(d.Z,{sx:{position:"sticky!important",bgcolor:"secondary.light"},children:"Address"}),(0,S.jsx)(d.Z,{sx:{position:"sticky!important",bgcolor:"secondary.light"},children:"Lat/Lng"})]})}),(0,S.jsxs)(h.Z,{children:[0==(null===q||void 0===q?void 0:q.length)&&(0,S.jsx)(u.Z,{children:(0,S.jsx)(d.Z,{colSpan:5,children:(0,S.jsx)(j.Z,{description:"Customer Not Found"})})}),null===q||void 0===q?void 0:q.map((function(e,t){return(0,S.jsxs)(u.Z,{children:[(0,S.jsx)(d.Z,{children:t+1}),(0,S.jsx)(d.Z,{children:(0,S.jsxs)(f.Z,{children:[(0,S.jsx)(v.Z,{variant:"subtitle1",children:e.firstname}),(0,S.jsx)(v.Z,{variant:"subtitle2",children:e.contactno}),(0,S.jsx)(v.Z,{variant:"subtitle2",children:"ID : ".concat(e.customerid)})]})}),(0,S.jsx)(d.Z,{children:(0,S.jsxs)(f.Z,{children:[(0,S.jsx)(v.Z,{variant:"subtitle1",children:e.suburb}),(0,S.jsx)(v.Z,{variant:"subtitle2",children:e.city})]})}),(0,S.jsx)(d.Z,{children:e.address}),(0,S.jsx)(d.Z,{children:(0,S.jsxs)(f.Z,{display:"flex",flexDirection:"column",gap:2,children:[(0,S.jsx)(Z.Z,{size:"small",label:e.latitude}),(0,S.jsx)(Z.Z,{size:"small",label:e.longitude})]})})]},t)})),0!=(null===q||void 0===q?void 0:q.length)&&(0,S.jsx)(u.Z,{children:(0,S.jsx)(d.Z,{colSpan:15,rowSpan:3,children:(0,S.jsx)("div",{ref:r,style:{height:40,textAlign:"center"},children:_||K?(0,S.jsx)(x.Z,{}):"No More Orders"})})})]})]})})})]})}},7266:function(e,t,r){var n=r(1413),i=(r(47313),r(19860)),o=r(9019),a=r(56104),s=r(42832),c=r(61113),l=r(46417);t.Z=function(e){var t=e.title,r=e.secondary,u=e.sx,d=(0,i.Z)();return(0,l.jsx)(o.ZP,{container:!0,spacing:2,children:(0,l.jsx)(a.Z,{sx:(0,n.Z)({position:"sticky",top:"60px",bgcolor:d.palette.background.default,zIndex:1,width:"100%"},u),children:(0,l.jsx)(o.ZP,{item:!0,xs:12,children:(0,l.jsxs)(s.Z,{direction:"row",justifyContent:"space-between",sx:{p:1,flexWrap:"wrap"},children:[(0,l.jsx)(c.Z,{variant:"h3",children:t}),r&&r]})})})})}},38393:function(e,t,r){var n=r(64836);t.Z=void 0;var i=n(r(45045)),o=r(46417),a=(0,i.default)((0,o.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),"SearchOutlined");t.Z=a},56104:function(e,t,r){r.d(t,{Z:function(){return x}});var n=r(63366),i=r(87462),o=r(47313),a=r(83061),s=r(21921),c=r(17592),l=r(77342),u=r(77430),d=r(32298);function h(e){return(0,d.Z)("MuiCardActions",e)}(0,u.Z)("MuiCardActions",["root","spacing"]);var f=r(46417),v=["disableSpacing","className"],Z=(0,c.ZP)("div",{name:"MuiCardActions",slot:"Root",overridesResolver:function(e,t){var r=e.ownerState;return[t.root,!r.disableSpacing&&t.spacing]}})((function(e){var t=e.ownerState;return(0,i.Z)({display:"flex",alignItems:"center",padding:8},!t.disableSpacing&&{"& > :not(:first-of-type)":{marginLeft:8}})})),x=o.forwardRef((function(e,t){var r=(0,l.Z)({props:e,name:"MuiCardActions"}),o=r.disableSpacing,c=void 0!==o&&o,u=r.className,d=(0,n.Z)(r,v),x=(0,i.Z)({},r,{disableSpacing:c}),p=function(e){var t=e.classes,r={root:["root",!e.disableSpacing&&"spacing"]};return(0,s.Z)(r,h,t)}(x);return(0,f.jsx)(Z,(0,i.Z)({className:(0,a.Z)(p.root,u),ownerState:x,ref:t},d))}))},85281:function(e,t,r){r.d(t,{Z:function(){return z}});var n=r(30168),i=r(63366),o=r(87462),a=r(47313),s=r(83061),c=r(21921),l=r(30686),u=r(91615),d=r(77342),h=r(17592),f=r(77430),v=r(32298);function Z(e){return(0,v.Z)("MuiCircularProgress",e)}(0,f.Z)("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);var x,p,g,m,b,k,y,j,S=r(46417),w=["className","color","disableShrink","size","style","thickness","value","variant"],P=44,C=(0,l.F4)(b||(b=x||(x=(0,n.Z)(["\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n"])))),M=(0,l.F4)(k||(k=p||(p=(0,n.Z)(["\n 0% {\n stroke-dasharray: 1px, 200px;\n stroke-dashoffset: 0;\n }\n\n 50% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -15px;\n }\n\n 100% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -125px;\n }\n"])))),N=(0,h.ZP)("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:function(e,t){var r=e.ownerState;return[t.root,t[r.variant],t["color".concat((0,u.Z)(r.color))]]}})((function(e){var t=e.ownerState,r=e.theme;return(0,o.Z)({display:"inline-block"},"determinate"===t.variant&&{transition:r.transitions.create("transform")},"inherit"!==t.color&&{color:(r.vars||r).palette[t.color].main})}),(function(e){return"indeterminate"===e.ownerState.variant&&(0,l.iv)(y||(y=g||(g=(0,n.Z)(["\n animation: "," 1.4s linear infinite;\n "]))),C)})),R=(0,h.ZP)("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:function(e,t){return t.svg}})({display:"block"}),F=(0,h.ZP)("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:function(e,t){var r=e.ownerState;return[t.circle,t["circle".concat((0,u.Z)(r.variant))],r.disableShrink&&t.circleDisableShrink]}})((function(e){var t=e.ownerState,r=e.theme;return(0,o.Z)({stroke:"currentColor"},"determinate"===t.variant&&{transition:r.transitions.create("stroke-dashoffset")},"indeterminate"===t.variant&&{strokeDasharray:"80px, 200px",strokeDashoffset:0})}),(function(e){var t=e.ownerState;return"indeterminate"===t.variant&&!t.disableShrink&&(0,l.iv)(j||(j=m||(m=(0,n.Z)(["\n animation: "," 1.4s ease-in-out infinite;\n "]))),M)})),z=a.forwardRef((function(e,t){var r=(0,d.Z)({props:e,name:"MuiCircularProgress"}),n=r.className,a=r.color,l=void 0===a?"primary":a,h=r.disableShrink,f=void 0!==h&&h,v=r.size,x=void 0===v?40:v,p=r.style,g=r.thickness,m=void 0===g?3.6:g,b=r.value,k=void 0===b?0:b,y=r.variant,j=void 0===y?"indeterminate":y,C=(0,i.Z)(r,w),M=(0,o.Z)({},r,{color:l,disableShrink:f,size:x,thickness:m,value:k,variant:j}),z=function(e){var t=e.classes,r=e.variant,n=e.color,i=e.disableShrink,o={root:["root",r,"color".concat((0,u.Z)(n))],svg:["svg"],circle:["circle","circle".concat((0,u.Z)(r)),i&&"circleDisableShrink"]};return(0,c.Z)(o,Z,t)}(M),D={},E={},A={};if("determinate"===j){var L=2*Math.PI*((P-m)/2);D.strokeDasharray=L.toFixed(3),A["aria-valuenow"]=Math.round(k),D.strokeDashoffset="".concat(((100-k)/100*L).toFixed(3),"px"),E.transform="rotate(-90deg)"}return(0,S.jsx)(N,(0,o.Z)({className:(0,s.Z)(z.root,n),style:(0,o.Z)({width:x,height:x},E,p),ownerState:M,ref:t,role:"progressbar"},A,C,{children:(0,S.jsx)(R,{className:z.svg,ownerState:M,viewBox:"".concat(22," ").concat(22," ").concat(P," ").concat(P),children:(0,S.jsx)(F,{className:z.circle,style:D,ownerState:M,cx:P,cy:P,r:(P-m)/2,fill:"none",strokeWidth:m})})}))}))},25963:function(e,t,r){r.d(t,{N:function(){return v}});var n=r(1413),i=r(15671),o=r(43144),a=r(11752),s=r(61120),c=r(60136),l=r(27277),u=r(18948),d=r(52100),h=function(e){(0,c.Z)(r,e);var t=(0,l.Z)(r);function r(e,n){return(0,i.Z)(this,r),t.call(this,e,n)}return(0,o.Z)(r,[{key:"bindMethods",value:function(){(0,a.Z)((0,s.Z)(r.prototype),"bindMethods",this).call(this),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}},{key:"setOptions",value:function(e,t){(0,a.Z)((0,s.Z)(r.prototype),"setOptions",this).call(this,(0,n.Z)((0,n.Z)({},e),{},{behavior:(0,d.Gm)()}),t)}},{key:"getOptimisticResult",value:function(e){return e.behavior=(0,d.Gm)(),(0,a.Z)((0,s.Z)(r.prototype),"getOptimisticResult",this).call(this,e)}},{key:"fetchNextPage",value:function(e){return this.fetch((0,n.Z)((0,n.Z)({},e),{},{meta:{fetchMore:{direction:"forward"}}}))}},{key:"fetchPreviousPage",value:function(e){return this.fetch((0,n.Z)((0,n.Z)({},e),{},{meta:{fetchMore:{direction:"backward"}}}))}},{key:"createResult",value:function(e,t){var i,o,c,l,u=e.state,h=(0,a.Z)((0,s.Z)(r.prototype),"createResult",this).call(this,e,t),f=h.isFetching,v=h.isRefetching,Z=f&&"forward"===(null===(i=u.fetchMeta)||void 0===i||null===(o=i.fetchMore)||void 0===o?void 0:o.direction),x=f&&"backward"===(null===(c=u.fetchMeta)||void 0===c||null===(l=c.fetchMore)||void 0===l?void 0:l.direction);return(0,n.Z)((0,n.Z)({},h),{},{fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,d.Qy)(t,u.data),hasPreviousPage:(0,d.ZF)(t,u.data),isFetchingNextPage:Z,isFetchingPreviousPage:x,isRefetching:v&&!Z&&!x})}}]),r}(u.z),f=r(51695);function v(e,t){return(0,f.r)(e,h,t)}}}]);