Files
dailygrubs_console_build/build/static/js/7138.9be49588.chunk.js
2026-06-26 11:37:36 +05:30

1 line
33 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[7138],{38215:function(e,t,r){r.d(t,{Z:function(){return c}});var n=r(17592),o=r(85281),i=r(46417),a=(0,n.ZP)("div")((function(){return{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:2001,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255, 255, 255, 0.7)",padding:"20px",borderRadius:"10px"}})),s=(0,n.ZP)("div")((function(){return{position:"absolute",width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center"}})),c=function(){return(0,i.jsxs)(a,{children:[(0,i.jsx)(o.Z,{color:"primary",size:80,thickness:6}),(0,i.jsx)(s,{children:(0,i.jsx)("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAA+CAYAAABzwahEAAAPnUlEQVR4AdVae3AU9R3/7d4jdyGQQKAhECBAJBSmEAtFSQUjqPgAHGlhRm0lDkWY6Tg+O9qiErR26h8WR8ZWqTMN1ur4qMpDrTyjtDwDJloeCYiBvAgkaZ53l7vb3X4/v9vfZS/Zu9uFwLSfmb3d293f7u/z+z5/399K7CphdW5JrupgBZosZ0ialmu8pklSjUOTamRJbvvjqTUV7CpAYlcIj+SWZHQ55WJZlm7UNK2IXpRhpZ3GWJskSWXUZrPD4Sp77eSva9gVwIATXz35+SJNYWs1phWxAYDEpDKVaZv+fOrZUjaAGDDiK695rpgetpYOc82upw72sMycdJbz/SzmHeKl/ynRay31bbS1s7rjTczXGYj3ihrShnUDNQCXTXzlNS8UyExdbybhSdeNYwXz81nBzflE2pKms7oT51ntiSa276NKVn3wrNktNcGQelNpTUkNuwxcFvFV+S88rKnKy8ZzkOz84uvYvOJZ/PhyAE3Y/+HXbN+HFVwjjJAlR8lr1WueY9wt2MclEYfj8rnkj+nwRnHOLuGWhnbmpfuMKh/3Xn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voEeGoNcgTtWUHiqW8OO8vLww+R5lz5494UT2PBDEY9rSQqOTHAmP91TFdNGChJsyPTdlelztqcMu6i+XvNiIkBQRHlcPHGv6sUbHIKzo56J1AZBkvR5cSFhUVBR2CbD69bIpysvLecdoAHqINOytm0ijJt9J3r+TVBLHXfrGkwsiJRIMLF1i76MBEue7qE0XqTPadYiNnFen3j6Ad5HGYSDwTcslkQYGamVULLrLpH7y6dOnuY1TGctFFR0hcYfhvujinQ6eaNBgYc6sEHm+0WAKqatEWJkwYYI6depUjYhbtuWrBW775GGd1FEXFQA8FFsR8+HRMdFBKocgPrTvRkgnh4l70ijPxtwAzpLnCLpDvSztvFqQ9C8PuAPEINDeTdpgjADYjOFQhESn3s6hP+OKr9dfSUhCaiIcYjNIMur52f850f95/BfoYlARf1CQvwAAAABJRU5ErkJggg==",alt:"Logo",style:{width:"100%",height:"100%"}})})]})}},78710:function(e,t,r){r.d(t,{Z:function(){return j}});var n=r(94469),o=r(33604),i=r(42832),a=r(61113),s=r(96467),c=r(4117),l=r(69099),d=r(25223),u=r(10658),h=r.n(u),x=r(99004),f=r(59376),p=r(34605),g=r(78392),v=r(41156),Z=r(98589),b=r(79254),m=r(46417);function j(e){var t=e.open,r=e.onClose,u=e.onApply,j=[{label:"Today",startDate:new Date,endDate:new Date},{label:"Yesterday",startDate:(0,x.Z)(new Date,-1),endDate:(0,x.Z)(new Date,-1)},{label:"Tomorrow",startDate:(0,x.Z)(new Date,1),endDate:(0,x.Z)(new Date,1)},{label:"This Week",startDate:(0,f.Z)(new Date),endDate:(0,p.Z)(new Date)},{label:"Last Week",startDate:(0,f.Z)((0,g.Z)(new Date,-1)),endDate:(0,p.Z)((0,g.Z)(new Date,-1))},{label:"Last 7 Days",startDate:(0,x.Z)(new Date,-7),endDate:new Date},{label:"This Month",startDate:(0,v.Z)(new Date),endDate:(0,Z.Z)(new Date)},{label:"Last Month",startDate:(0,v.Z)((0,b.Z)(new Date,-1)),endDate:(0,Z.Z)((0,b.Z)(new Date,-1))}];return(0,m.jsxs)(n.Z,{open:t,onClose:function(){return onclose()},fullWidth:!0,maxWidth:"sm",children:[(0,m.jsx)(o.Z,{disableTypography:!0,children:(0,m.jsx)(i.Z,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",sx:{width:"100%"},children:(0,m.jsx)(a.Z,{variant:"h4",children:"Select Date Range"})})}),(0,m.jsx)(s.Z,{sx:{"& .MuiPaper-root":{boxShadow:"none !important"}},children:(0,m.jsx)(d.D,{open:t,toggle:r,definedRanges:j,onChange:function(e){null!==e&&void 0!==e&&e.startDate&&null!==e&&void 0!==e&&e.endDate&&(u({startDate:h()(e.startDate).format("YYYY-MM-DD"),endDate:h()(e.endDate).format("YYYY-MM-DD"),label:e.label||""}),r())},closeOnClickOutside:!1})}),(0,m.jsx)(c.Z,{children:(0,m.jsx)(l.Z,{variant:"contained",onClick:r,sx:{cursor:"pointer"},children:"Close"})})]})}},95872:function(e,t,r){r.d(t,{f:function(){return o}});var n=r(47313),o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"k";(0,n.useEffect)((function(){if(null!==e&&void 0!==e&&e.current){var r=function(r){var n;r.key.toLowerCase()===t.toLowerCase()&&(r.metaKey||r.ctrlKey)&&(r.preventDefault(),null===(n=e.current)||void 0===n||n.focus());"Escape"===r.key&&document.activeElement===e.current&&e.current.blur()};return document.addEventListener("keydown",r),function(){return document.removeEventListener("keydown",r)}}}),[e,t])}},36186:function(e,t,r){r.r(t),r.d(t,{default:function(){return ae}});r(93433);var n=r(1413),o=r(74165),i=r(15861),a=r(29439),s=r(47313),c=r(90842),l=r(10658),d=r.n(l),u=r(56573),h=r(57829),x=r(61113),f=r(69099),p=r(70501),g=r(42832),v=r(48119),Z=r(51629),b=r(66835),m=r(23477),j=r(24076),y=r(67478),S=r(57861),w=r(84488),k=r(61689),W=r(47131),C=r(85281),D=r(94469),R=r(96467),Y=r(22539),M=r(11577),A=r(95872),z=r(78710),T=r(38215),P=(r.p,r(41962)),O=r(25963),L=r(50581),K=r(58467),B=r(71049),H=r(46417),F=r(91635);d().extend(F);var I="0 8px 24px rgba(15, 23, 42, 0.08)",J="#0f172a",N="#64748b",E="#94a3b8",q="#e2e8f0",G="#f1f5f9",V="#f8fafc",U=function(e,t){return"".concat(e).concat(t)},Q=function(e){return U(e,"08")},X=function(e){return U(e,"18")},_=function(e){return U(e,"26")},$=function(e){return U(e,"55")},ee="#662582",te="#9255AB",re={created:{label:"Created",color:"#3b82f6",icon:Y.ili},pending:{label:"Pending",color:"#f59e0b",icon:Y.Ley},processing:{label:"Processing",color:"#3b82f6",icon:Y.dKE},modified:{label:"Confirmed",color:"#10b981",icon:Y.ZSR},confirmed:{label:"Confirmed",color:"#10b981",icon:Y.ZSR},ready:{label:"Accepted",color:"#6366f1",icon:Y.ZSR},active:{label:"Picked",color:"#8b5cf6",icon:Y.ili},onhold:{label:"On Hold",color:"#8b5cf6",icon:Y.Y8K},closed:{label:"Closed",color:"#06b6d4",icon:Y.ZSR},delivered:{label:"Delivered",color:"#10b981",icon:Y.ZSR},failed:{label:"Failed",color:"#991b1b",icon:Y.B4e},cancelled:{label:"Cancelled",color:"#ef4444",icon:Y.B4e}},ne=[{idx:0,status:"created",label:"Created",color:ee,icon:Y.ili,countKey:"created"}],oe=function(e){var t=e.status,r=re[String(t||"").toLowerCase()]||{label:t||"\u2014",color:E,icon:Y.Y8K},n=r.icon;return(0,H.jsxs)(h.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1.125,py:.375,borderRadius:999,bgcolor:r.color,color:"#fff",fontSize:11,fontWeight:700,letterSpacing:.2,whiteSpace:"nowrap",minWidth:86,justifyContent:"center",boxShadow:"0 1px 2px ".concat(_(r.color))},children:[(0,H.jsx)(n,{size:12})," ",r.label]})},ie=function(e){var t=e.value,r=e.color,n=e.icon,o=e.isMoney,i=void 0!==o&&o,a=Number(t),s=i?"\u20b9".concat(Number.isFinite(a)?a.toFixed(2):"0.00"):Number.isFinite(a)?a:t||0;return!Number.isFinite(a)||0===a?(0,H.jsx)(x.Z,{variant:"caption",sx:{color:E,fontWeight:700},children:s}):(0,H.jsxs)(h.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:.875,py:.25,borderRadius:999,bgcolor:Q(r),border:"1px solid ".concat($(r)),color:r,fontSize:12,fontWeight:800,whiteSpace:"nowrap"},children:[n,s]})},ae=function(){var e=(0,K.s0)(),t=((0,K.TH)(),localStorage.getItem("tenantid")),r=(0,s.useRef)(),l=(0,s.useRef)(),F=(0,s.useState)(0),U=(0,a.Z)(F,2),re=U[0],ae=U[1],se=(0,s.useState)(10),ce=(0,a.Z)(se,2),le=ce[0],de=ce[1],ue=(0,s.useState)(0),he=(0,a.Z)(ue,2),xe=he[0],fe=he[1],pe=(0,s.useState)("Created"),ge=(0,a.Z)(pe,2),ve=ge[0],Ze=ge[1],be=(0,s.useState)("created"),me=(0,a.Z)(be,2),je=me[0],ye=me[1],Se=(0,s.useState)(!1),we=(0,a.Z)(Se,2),ke=we[0],We=we[1],Ce=(0,s.useState)(""),De=(0,a.Z)(Ce,2),Re=De[0],Ye=De[1],Me=(0,s.useState)(!1),Ae=(0,a.Z)(Me,2),ze=Ae[0],Te=Ae[1],Pe=(0,s.useState)("Today"),Oe=(0,a.Z)(Pe,2),Le=Oe[0],Ke=Oe[1],Be=(0,s.useState)(d()().format("YYYY-MM-DD")),He=(0,a.Z)(Be,2),Fe=He[0],Ie=He[1],Je=(0,s.useState)(d()().format("YYYY-MM-DD")),Ne=(0,a.Z)(Je,2),Ee=Ne[0],qe=Ne[1],Ge=(0,s.useState)(""),Ve=(0,a.Z)(Ge,2),Ue=Ve[0],Qe=Ve[1],Xe=(0,s.useState)(""),_e=(0,a.Z)(Xe,2),$e=_e[0],et=_e[1],tt=(0,s.useState)(!1),rt=(0,a.Z)(tt,2),nt=(rt[0],rt[1],(0,s.useState)(!1)),ot=(0,a.Z)(nt,2),it=ot[0],at=ot[1],st=(0,s.useState)(!1),ct=(0,a.Z)(st,2),lt=ct[0],dt=ct[1],ut=(0,s.useState)(!1),ht=(0,a.Z)(ut,2),xt=ht[0],ft=ht[1],pt=(0,s.useState)([]),gt=(0,a.Z)(pt,2),vt=gt[0],Zt=gt[1];(0,s.useEffect)((function(){var e=setTimeout((function(){et(Ue)}),400);return function(){return clearTimeout(e)}}),[Ue]);var bt=(0,s.useRef)(null);(0,A.f)(bt,"k");var mt=(0,P.a)({queryKey:["percentageData",0,Fe,Ee,t,0],queryFn:B.Wo,enabled:!0,refetchInterval:15e3}),jt=mt.data,yt=mt.isLoading,St=mt.refetch,wt=(0,P.a)({queryKey:["ordersCount",0,Fe,Ee,je,t,0],queryFn:B.RO,refetchOnMount:!0,refetchOnWindowFocus:!0,refetchInterval:15e3}),kt=wt.data,Wt=wt.refetch,Ct=(0,P.a)({queryKey:["getallriders"],queryFn:B.n7,refetchOnMount:!0,refetchOnWindowFocus:!0}).data,Dt=function(){var e=(0,i.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.Z.put("".concat("https://jupiter.nearle.app/live/api/v1","/orders/updateorder"),{orderheaderid:Re,orderstatus:"cancelled",cancelled:d()().format("YYYY-MM-DD HH:mm:ss")}).then((function(e){e.data.status&&((0,c.yv)("Order Cancelled Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3}),Ot(),Wt(),St(),We(!1))})).catch((function(e){console.log(e)}));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Rt=function(){var e=(0,i.Z)((0,o.Z)().mark((function e(r){var n,i,a;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.pageParam,i=void 0===n?1:n,e.next=3,u.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/orders/tenant/getorders/?tenantid=").concat(t,"&locationid=").concat(0,"&status=").concat(je,"&fromdate=").concat(Fe,"&todate=").concat(Ee,"&pageno=").concat(i,"&pagesize=").concat(le,"&keyword=").concat($e));case 3:return a=e.sent,e.abrupt("return",{data:a.data.details,nextPage:a.data.details.length===le?i+1:void 0});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Yt=(0,O.N)({queryKey:[ve,Fe,Ee,re,le,$e,0],queryFn:Rt,getNextPageParam:function(e){return e.nextPage},refetchInterval:15e3}),Mt=Yt.data,At=Yt.fetchNextPage,zt=Yt.isLoading,Tt=Yt.hasNextPage,Pt=Yt.isFetchingNextPage,Ot=Yt.refetch,Lt=Mt?Mt.pages.flatMap((function(e){return e.data})):[];(0,s.useEffect)((function(){if(Tt){var e=new IntersectionObserver((function(e){e[0].isIntersecting&&At()}),{root:null,rootMargin:"0px 0px 400px 0px",threshold:0});return r.current&&e.observe(r.current),function(){r.current&&e.unobserve(r.current)}}}),[Tt,At]);var Kt=(0,L.D)({mutationFn:B.f2,onSuccess:function(r,n){(0,c.yv)("Orders Optimised Successfully",{variant:"success",autoHideDuration:2e3,anchorOrigin:{vertical:"top",horizontal:"right"}}),Wt(),Ot(),dt(!1),e("/nearle/dispatch/preview",{state:{dispatchPreviewData:r,aiMode:1,selectedMode:{value:1},deliveryData:(null===n||void 0===n?void 0:n.deliveries)||[],appId:0,startdate:Fe,tenantId:t,autoRiders:Ct||[]}})},onError:function(e){(0,c.yv)(e.message,{variant:"error",autoHideDuration:4e3}),dt(!1)},onSettled:function(){dt(!1),ft(!1)}}),Bt=(0,L.D)({mutationFn:B.Sr,onSuccess:function(e){e.status&&(at(!1),(0,c.yv)("Orders Cancelled Successfully",{variant:"success",autoHideDuration:2e3}),Ot(),Wt(),St(),Zt([]))},onError:function(e){(0,c.yv)(e.message,{variant:"error",autoHideDuration:4e3})}}),Ht=function(){var e=(0,i.Z)((0,o.Z)().mark((function e(){var t;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==Lt.length){e.next=2;break}return e.abrupt("return");case 2:ft(!0),dt(!0),t=Lt.map((function(e){return(0,n.Z)((0,n.Z)({},e),{},{deliveryid:0,deliverydate:d()(e.deliverydate).utc().format("YYYY-MM-DD HH:mm:ss"),assigntime:d()().format("YYYY-MM-DD HH:mm:ss"),orderstatus:"pending",orderamount:e.deliverycharge,droplat:e.deliverylat,droplon:e.deliverylong,pickuplat:e.pickuplat,pickuplon:e.pickuplong,ordernotes:e.ordernotes,deliverycharges:e.deliverycharge,pickuplocation:e.pickupsuburb,deliverylocation:e.deliverysuburb})})),Kt.mutate({deliveries:t,selectedMode:{value:1},hypertuning_params:"balanced",absent_riders:[]});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Y.ili,null===jt||void 0===jt||jt.created,null===jt||void 0===jt||jt.percentage1,Y.Ley,null===jt||void 0===jt||jt.uncoveredOrders,null===jt||void 0===jt||jt.percentage2;return(0,H.jsxs)(s.Fragment,{children:[(yt||zt||xt||lt)&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(M.Z,{}),(0,H.jsx)(T.Z,{})]}),Lt.length>0&&"created"===je&&(0,H.jsxs)(f.Z,{variant:"contained",onClick:Ht,sx:{position:"fixed",bottom:32,right:24,bgcolor:ee,color:"#fff",px:3,py:1.5,borderRadius:999,fontWeight:850,boxShadow:"0 10px 30px ".concat(_(ee)),zIndex:1e3,textTransform:"none",fontSize:"14px",gap:1,"&:hover":{bgcolor:te,transform:"translateY(-2px)"}},startIcon:(0,H.jsx)(Y.ili,{size:18}),children:["Assign Orders (",Lt.length,")"]}),(0,H.jsx)(p.Z,{elevation:0,sx:{mb:{xs:1,md:1.25},px:{xs:1.5,sm:2},py:{xs:1,sm:1.25},borderRadius:2,border:"1px solid",borderColor:q,background:"linear-gradient(135deg, ".concat(Q(ee)," 0%, ").concat(Q(te)," 100%)"),boxShadow:I},children:(0,H.jsx)(g.Z,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:{xs:1,sm:1.5},children:(0,H.jsxs)(g.Z,{direction:"row",alignItems:"center",spacing:1.25,children:[(0,H.jsx)(v.Z,{variant:"rounded",sx:{width:36,height:36,bgcolor:ee,color:"#fff",borderRadius:1.5,boxShadow:"0 4px 12px ".concat(_(ee))},children:(0,H.jsx)(Y.ili,{size:19})}),(0,H.jsxs)(g.Z,{spacing:.125,children:[(0,H.jsx)(x.Z,{variant:"h3",sx:{fontWeight:800,color:J,lineHeight:1.1,fontSize:{xs:"1.1rem",sm:"1.25rem",md:"1.375rem"}},children:"Orders"}),(0,H.jsxs)(g.Z,{direction:"row",alignItems:"center",spacing:.75,children:[(0,H.jsx)(h.Z,{sx:{width:7,height:7,borderRadius:"50%",bgcolor:"#10b981",boxShadow:"0 0 0 3px rgba(16,185,129,0.18)"}}),(0,H.jsxs)(x.Z,{sx:{fontSize:11.5,color:N,fontWeight:600},children:["Live \xb7 ","All Locations"," \xb7 ",Le]})]})]})]})})}),(0,H.jsx)(p.Z,{elevation:0,sx:{mt:{xs:1,md:1.25},p:{xs:.875,md:1.125},borderTopLeftRadius:2,borderTopRightRadius:2,borderBottomLeftRadius:0,borderBottomRightRadius:0,border:"1px solid",borderColor:q,borderBottom:0,background:"#fff"},children:(0,H.jsx)(g.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:1.5,sx:{flexWrap:"wrap-reverse"},children:(0,H.jsx)(g.Z,{direction:"row",spacing:.75,sx:{flex:1,overflowX:"auto",py:.5,px:.25,"&::-webkit-scrollbar":{height:6},"&::-webkit-scrollbar-thumb":{backgroundColor:q,borderRadius:4}},children:ne.map((function(e){var t,r=e.icon,n=xe===e.idx,o=null!==(t=null===kt||void 0===kt?void 0:kt[e.countKey])&&void 0!==t?t:0;return(0,H.jsxs)(h.Z,{onClick:function(t){return function(e,t){Qe(""),de(10),fe(t);var r=ne[t];Ze(r.label),ye(r.status),ae(0)}(0,e.idx)},sx:{display:"inline-flex",alignItems:"center",gap:{xs:.625,md:.875},pl:.5,pr:{xs:1,md:1.25},py:.5,flexShrink:0,cursor:"pointer",borderRadius:999,border:"1.5px solid ".concat(n?e.color:$(e.color)),bgcolor:n?e.color:Q(e.color),color:n?"#fff":e.color,fontWeight:700,boxShadow:n?"0 6px 18px ".concat(_(e.color)):"none",transition:"all 0.18s","&:hover":{borderColor:e.color,boxShadow:n?"0 6px 18px ".concat(_(e.color)):"0 0 0 3px ".concat(_(e.color))}},children:[(0,H.jsx)(v.Z,{sx:{width:{xs:22,md:26},height:{xs:22,md:26},bgcolor:n?"rgba(255,255,255,0.22)":X(e.color),color:n?"#fff":e.color},children:(0,H.jsx)(r,{size:13})}),(0,H.jsx)(x.Z,{variant:"caption",sx:{fontWeight:800,fontSize:{xs:11.5,md:13},lineHeight:1},children:e.label}),(0,H.jsx)(h.Z,{sx:{minWidth:{xs:22,md:26},height:{xs:18,md:22},px:.625,display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:999,fontSize:{xs:10,md:11},fontWeight:800,bgcolor:n?"rgba(255,255,255,0.22)":"#fff",color:n?"#fff":e.color,border:n?"none":"1px solid ".concat($(e.color))},children:null!==o&&void 0!==o?o:0})]},e.status)}))})})}),(0,H.jsx)(p.Z,{elevation:0,sx:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomLeftRadius:2,borderBottomRightRadius:2,border:"1px solid",borderColor:q,overflow:"hidden",background:"#fff"},children:(0,H.jsx)(Z.Z,{onScroll:function(e){var t=e.currentTarget,r=t.scrollTop,n=t.scrollHeight;r+t.clientHeight>=n-50&&Tt&&!Pt&&At()},ref:l,sx:{overflowX:"auto",overflowY:"visible","&::-webkit-scrollbar":{width:10,height:10},"&::-webkit-scrollbar-thumb":{backgroundColor:$(ee),borderRadius:8,"&:hover":{backgroundColor:ee}},"&::-webkit-scrollbar-track":{backgroundColor:V}},children:(0,H.jsxs)(b.Z,{stickyHeader:!0,size:"small",sx:{minWidth:{xs:960,md:1100}},children:[(0,H.jsx)(m.Z,{children:(0,H.jsxs)(j.Z,{sx:{"& th":{backgroundColor:V,color:N,fontSize:10.5,fontWeight:800,letterSpacing:.5,textTransform:"uppercase",whiteSpace:"nowrap",borderBottom:"1px solid ".concat(q),py:.75,px:1}},children:[(0,H.jsx)(y.Z,{children:"#"}),(0,H.jsx)(y.Z,{children:"Order Location"}),(0,H.jsx)(y.Z,{children:"Pickup"}),(0,H.jsx)(y.Z,{children:"Drop"}),(0,H.jsx)(y.Z,{align:"center",children:"Qty"}),(0,H.jsx)(y.Z,{align:"right",children:"COD"}),(0,H.jsx)(y.Z,{align:"center",children:"Kms"}),(0,H.jsx)(y.Z,{align:"right",children:"Charges"}),(0,H.jsx)(y.Z,{children:"Notes"}),(0,H.jsx)(y.Z,{children:"Status"}),"created"===je&&(0,H.jsx)(y.Z,{align:"right",children:"Actions"})]})}),(0,H.jsxs)(S.Z,{children:[(zt||lt)&&0===Lt.length&&Array.from({length:10}).map((function(e,t){return(0,H.jsx)(j.Z,{children:Array.from({length:"created"===je?12:11}).map((function(e,t){return(0,H.jsx)(y.Z,{sx:{borderBottom:"1px solid ".concat(G),py:.625,px:1},children:(0,H.jsx)(w.Z,{animation:"wave",height:20})},t)}))},"sk-".concat(t))})),!zt&&0===Lt.length&&(0,H.jsx)(j.Z,{children:(0,H.jsx)(y.Z,{colSpan:"created"===je?12:11,sx:{py:7,borderBottom:"none"},children:(0,H.jsxs)(g.Z,{alignItems:"center",spacing:1.25,children:[(0,H.jsx)(v.Z,{variant:"rounded",sx:{width:56,height:56,bgcolor:X("#94a3b8"),color:E,borderRadius:2},children:(0,H.jsx)(Y.ili,{size:26})}),(0,H.jsxs)(x.Z,{sx:{fontWeight:700,color:J,fontSize:14},children:["No ",je," orders"]}),(0,H.jsx)(x.Z,{sx:{color:N,fontSize:12},children:Ue?"Try a different keyword or clear the search.":"Adjust the location, status, or date range above."}),Ue&&(0,H.jsx)(f.Z,{size:"small",onClick:function(){return Qe("")},sx:{mt:.5,height:28,textTransform:"none",fontSize:12,fontWeight:700,color:ee,borderRadius:1.25,"&:hover":{bgcolor:Q(ee)}},startIcon:(0,H.jsx)(Y.lUB,{size:14}),children:"Clear search"})]})})}),Lt.map((function(e,t){var r;vt.find((function(t){return t.orderheaderid===e.orderheaderid}));return(0,H.jsxs)(j.Z,{sx:{cursor:"pointer",transition:"background-color 0.12s, box-shadow 0.12s",backgroundColor:"transparent","& td":{borderBottom:"1px solid ".concat(G),py:.5,px:1,verticalAlign:"top"},"&:hover":{backgroundColor:V,boxShadow:"inset 3px 0 0 ".concat(ee)}},children:[(0,H.jsx)(y.Z,{children:(0,H.jsx)(x.Z,{sx:{fontWeight:700,color:N},children:re*le+t+1})}),(0,H.jsxs)(y.Z,{children:[(0,H.jsxs)(x.Z,{variant:"subtitle2",sx:{fontWeight:700,color:J},noWrap:!0,children:[e.locationname,e.locationsuburb&&" - ".concat(e.locationsuburb)]}),(0,H.jsx)(k.Z,{title:"Order Id",children:(0,H.jsx)(x.Z,{variant:"caption",sx:{color:N},noWrap:!0,children:e.orderid})}),(0,H.jsxs)(g.Z,{direction:"row",spacing:.5,alignItems:"center",sx:{mt:.125},children:[(0,H.jsx)(Y.dKE,{size:10,style:{color:E,flexShrink:0}}),function(){var t=e.pickupslot&&d()(e.pickupslot).isValid()?d()(e.pickupslot):d()(e.deliverydate||e.orderdate);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(x.Z,{sx:{fontSize:10.5,color:N,fontWeight:700},noWrap:!0,children:t.format("hh:mm A")}),(0,H.jsxs)(x.Z,{sx:{fontSize:10.5,color:E,fontWeight:600},noWrap:!0,children:["\xb7 ",t.format("DD MMM YY")]})]})}()]})]}),(0,H.jsx)(y.Z,{children:(0,H.jsxs)(g.Z,{direction:"column",children:[(0,H.jsx)(x.Z,{variant:"subtitle2",sx:{fontWeight:700,color:J},noWrap:!0,children:e.pickupcustomer}),(0,H.jsx)(x.Z,{variant:"caption",sx:{color:N},children:e.pickupcontactno}),(0,H.jsx)(k.Z,{title:e.pickupaddress,children:(0,H.jsx)(x.Z,{variant:"caption",sx:{color:E},noWrap:!0,children:e.pickupsuburb||(e.pickupaddress?"".concat(e.pickupaddress.slice(0,20),"\u2026"):"\u2014")})})]})}),(0,H.jsx)(y.Z,{children:(0,H.jsxs)(g.Z,{direction:"column",children:[(0,H.jsx)(x.Z,{variant:"subtitle2",sx:{fontWeight:700,color:J},noWrap:!0,children:e.deliverycustomer}),(0,H.jsx)(x.Z,{variant:"caption",sx:{color:N},children:e.deliverycontactno}),(0,H.jsx)(k.Z,{title:e.deliveryaddress,children:(0,H.jsx)(x.Z,{variant:"caption",sx:{color:E},noWrap:!0,children:e.deliverysuburb||((null===(r=e.deliveryaddress)||void 0===r?void 0:r.length)>20?"".concat(e.deliveryaddress.slice(0,20),"\u2026"):e.deliveryaddress||"\u2014")})})]})}),(0,H.jsx)(y.Z,{align:"center",children:(0,H.jsx)(ie,{value:e.quantity,color:"#0ea5e9",icon:(0,H.jsx)(Y.ByW,{size:11})})}),(0,H.jsx)(y.Z,{align:"right",children:(0,H.jsx)(ie,{value:e.collectionamt,color:"#10b981",icon:(0,H.jsx)(Y.vCl,{size:11}),isMoney:!0})}),(0,H.jsx)(y.Z,{align:"center",children:(0,H.jsx)(ie,{value:e.kms,color:"#f59e0b",icon:(0,H.jsx)(Y.v93,{size:11})})}),(0,H.jsx)(y.Z,{align:"right",children:(0,H.jsx)(ie,{value:e.deliverycharge,color:ee,icon:(0,H.jsx)(Y.vCl,{size:11}),isMoney:!0})}),(0,H.jsx)(y.Z,{children:e.ordernotes?(0,H.jsxs)(g.Z,{direction:"row",spacing:.5,alignItems:"center",sx:{color:N},children:[(0,H.jsx)(Y.hKf,{size:12,style:{color:E,flexShrink:0}}),(0,H.jsx)(x.Z,{variant:"caption",sx:{maxWidth:140,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontWeight:600},children:e.ordernotes})]}):(0,H.jsx)(x.Z,{variant:"caption",sx:{color:E},children:"\u2014"})}),(0,H.jsx)(y.Z,{children:(0,H.jsx)(oe,{status:e.orderstatus})}),"created"===je&&(0,H.jsx)(y.Z,{align:"right",children:"created"===e.orderstatus&&(0,H.jsx)(k.Z,{title:"Cancel Order",children:(0,H.jsx)(W.Z,{size:"small",onClick:function(t){t.stopPropagation(),Ye(e.orderheaderid),We(!0)},sx:{bgcolor:Q("#ef4444"),border:"1px solid ".concat($("#ef4444")),color:"#ef4444",borderRadius:999,p:.75,"&:hover":{bgcolor:X("#ef4444"),borderColor:"#ef4444"}},children:(0,H.jsx)(Y.FU5,{size:14})})})})]},"".concat(e.orderheaderid,"-").concat(t))})),0!==Lt.length&&(0,H.jsx)(j.Z,{sx:{"&:hover":{backgroundColor:"transparent !important"}},children:(0,H.jsx)(y.Z,{colSpan:"created"===je?12:11,sx:{borderBottom:"none",py:1,bgcolor:V},children:(0,H.jsx)(g.Z,{ref:r,direction:"row",alignItems:"center",justifyContent:"center",spacing:1,sx:{minHeight:32},children:Pt||Tt?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.Z,{size:14,sx:{color:ee}}),(0,H.jsx)(x.Z,{sx:{fontSize:11.5,color:N,fontWeight:700},children:"Loading more orders\u2026"})]}):(0,H.jsxs)(x.Z,{sx:{fontSize:11.5,color:E,fontWeight:700,letterSpacing:.3},children:[Lt.length," order",1===Lt.length?"":"s"," \xb7 End of list"]})})})})]})]})})}),(0,H.jsxs)(D.Z,{open:ke,onClose:function(){return We(!1)},maxWidth:"xs",PaperProps:{sx:{borderRadius:3}},children:[(0,H.jsx)(h.Z,{sx:{p:2.5,background:"linear-gradient(135deg, ".concat(Q("#ef4444")," 0%, ").concat(Q("#f59e0b")," 100%)"),borderBottom:"1px solid ".concat(q)},children:(0,H.jsxs)(g.Z,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,H.jsx)(v.Z,{sx:{bgcolor:"#ef4444",color:"#fff",width:40,height:40},children:(0,H.jsx)(Y.F1H,{size:20})}),(0,H.jsx)(x.Z,{variant:"h5",sx:{fontWeight:800,color:J},children:"Cancel Order"})]})}),(0,H.jsx)(R.Z,{sx:{pt:3},children:(0,H.jsxs)(g.Z,{alignItems:"center",spacing:3,children:[(0,H.jsx)(x.Z,{variant:"body1",align:"center",sx:{color:N,fontWeight:600},children:"Are you sure you want to cancel this order? This action cannot be undone."}),(0,H.jsxs)(g.Z,{direction:"row",spacing:1.5,sx:{width:1},children:[(0,H.jsx)(f.Z,{fullWidth:!0,onClick:function(){return We(!1)},variant:"outlined",sx:{borderRadius:999,py:1,borderColor:q,color:N,fontWeight:700,"&:hover":{borderColor:N,bgcolor:V}},children:"No"}),(0,H.jsx)(f.Z,{fullWidth:!0,variant:"contained",onClick:Dt,autoFocus:!0,sx:{borderRadius:999,py:1,bgcolor:"#ef4444",fontWeight:700,boxShadow:"0 6px 18px ".concat(_("#ef4444")),"&:hover":{bgcolor:"#dc2626"}},children:"Yes, Cancel"})]})]})})]}),(0,H.jsx)(z.Z,{open:ze,onClose:function(){return Te(!1)},onApply:function(e){var t=e.startDate,r=e.endDate,n=e.label;Ie(t),qe(r),Ke(n)}}),(0,H.jsxs)(D.Z,{open:it,onClose:function(){return at(!1)},maxWidth:"xs",PaperProps:{sx:{borderRadius:3}},children:[(0,H.jsx)(h.Z,{sx:{p:2.5,background:"linear-gradient(135deg, ".concat(Q("#ef4444")," 0%, ").concat(Q("#f59e0b")," 100%)"),borderBottom:"1px solid ".concat(q)},children:(0,H.jsxs)(g.Z,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,H.jsx)(v.Z,{sx:{bgcolor:"#ef4444",color:"#fff",width:40,height:40},children:(0,H.jsx)(Y.F1H,{size:20})}),(0,H.jsx)(x.Z,{variant:"h5",sx:{fontWeight:800,color:J},children:"Cancel Selected Orders"})]})}),(0,H.jsx)(R.Z,{sx:{pt:3},children:(0,H.jsxs)(g.Z,{alignItems:"center",spacing:3,children:[(0,H.jsxs)(x.Z,{variant:"body1",align:"center",sx:{color:N,fontWeight:600},children:["Are you sure you want to cancel the ",vt.length," selected orders? This action cannot be undone."]}),(0,H.jsxs)(g.Z,{direction:"row",spacing:1.5,sx:{width:1},children:[(0,H.jsx)(f.Z,{fullWidth:!0,onClick:function(){return at(!1)},variant:"outlined",sx:{borderRadius:999,py:1,borderColor:q,color:N,fontWeight:700,"&:hover":{borderColor:N,bgcolor:V}},children:"No"}),(0,H.jsx)(f.Z,{fullWidth:!0,variant:"contained",onClick:function(){return Bt.mutate(vt)},autoFocus:!0,sx:{borderRadius:999,py:1,bgcolor:"#ef4444",fontWeight:700,boxShadow:"0 6px 18px ".concat(_("#ef4444")),"&:hover":{bgcolor:"#dc2626"}},children:"Yes, Cancel"})]})]})})]})]})}},50581:function(e,t,r){r.d(t,{D:function(){return M}});var n,o,i,a,s,c,l=r(1413),d=r(29439),u=r(47313),h=r(15671),x=r(43144),f=r(97326),p=r(60136),g=r(27277),v=r(40101),Z=r(72346),b=r(86033),m=r(43889),j=r(13092),y=r(73547),S=r(28127),w=r(27542),k=r(66587),W=(n=new WeakMap,o=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakSet,c=new WeakSet,function(e){(0,p.Z)(r,e);var t=(0,g.Z)(r);function r(e,l){var d;return(0,h.Z)(this,r),d=t.call(this),(0,v.Z)((0,f.Z)(d),c),(0,v.Z)((0,f.Z)(d),s),(0,Z.Z)((0,f.Z)(d),n,{writable:!0,value:void 0}),(0,Z.Z)((0,f.Z)(d),o,{writable:!0,value:void 0}),(0,Z.Z)((0,f.Z)(d),i,{writable:!0,value:void 0}),(0,Z.Z)((0,f.Z)(d),a,{writable:!0,value:void 0}),(0,j.Z)((0,f.Z)(d),n,e),d.setOptions(l),d.bindMethods(),(0,m.Z)((0,f.Z)(d),s,C).call((0,f.Z)(d)),d}return(0,x.Z)(r,[{key:"bindMethods",value:function(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}},{key:"setOptions",value:function(e){var t,r=this.options;(this.options=(0,b.Z)(this,n).defaultMutationOptions(e),(0,k.VS)(this.options,r)||(0,b.Z)(this,n).getMutationCache().notify({type:"observerOptionsUpdated",mutation:(0,b.Z)(this,i),observer:this}),null!==r&&void 0!==r&&r.mutationKey&&this.options.mutationKey&&(0,k.Ym)(r.mutationKey)!==(0,k.Ym)(this.options.mutationKey))?this.reset():null===(t=(0,b.Z)(this,i))||void 0===t||t.setOptions(this.options)}},{key:"onUnsubscribe",value:function(){var e;this.hasListeners()||(null===(e=(0,b.Z)(this,i))||void 0===e||e.removeObserver(this))}},{key:"onMutationUpdate",value:function(e){(0,m.Z)(this,s,C).call(this),(0,m.Z)(this,c,D).call(this,e)}},{key:"getCurrentResult",value:function(){return(0,b.Z)(this,o)}},{key:"reset",value:function(){var e;null===(e=(0,b.Z)(this,i))||void 0===e||e.removeObserver(this),(0,j.Z)(this,i,void 0),(0,m.Z)(this,s,C).call(this),(0,m.Z)(this,c,D).call(this)}},{key:"mutate",value:function(e,t){var r;return(0,j.Z)(this,a,t),null===(r=(0,b.Z)(this,i))||void 0===r||r.removeObserver(this),(0,j.Z)(this,i,(0,b.Z)(this,n).getMutationCache().build((0,b.Z)(this,n),this.options)),(0,b.Z)(this,i).addObserver(this),(0,b.Z)(this,i).execute(e)}}]),r}(w.l));function C(){var e,t,r=null!==(e=null===(t=(0,b.Z)(this,i))||void 0===t?void 0:t.state)&&void 0!==e?e:(0,y.R)();(0,j.Z)(this,o,(0,l.Z)((0,l.Z)({},r),{},{isPending:"pending"===r.status,isSuccess:"success"===r.status,isError:"error"===r.status,isIdle:"idle"===r.status,mutate:this.mutate,reset:this.reset}))}function D(e){var t=this;S.V.batch((function(){if((0,b.Z)(t,a)&&t.hasListeners()){var r,n,i,s,c=(0,b.Z)(t,o).variables,l=(0,b.Z)(t,o).context;if("success"===(null===e||void 0===e?void 0:e.type))null===(r=(n=(0,b.Z)(t,a)).onSuccess)||void 0===r||r.call(n,e.data,c,l),null===(i=(s=(0,b.Z)(t,a)).onSettled)||void 0===i||i.call(s,e.data,null,c,l);else if("error"===(null===e||void 0===e?void 0:e.type)){var d,u,h,x;null===(d=(u=(0,b.Z)(t,a)).onError)||void 0===d||d.call(u,e.error,c,l),null===(h=(x=(0,b.Z)(t,a)).onSettled)||void 0===h||h.call(x,void 0,e.error,c,l)}}t.listeners.forEach((function(e){e((0,b.Z)(t,o))}))}))}var R=r(67109),Y=r(24772);function M(e,t){var r=(0,R.NL)(t),n=u.useState((function(){return new W(r,e)})),o=(0,d.Z)(n,1)[0];u.useEffect((function(){o.setOptions(e)}),[o,e]);var i=u.useSyncExternalStore(u.useCallback((function(e){return o.subscribe(S.V.batchCalls(e))}),[o]),(function(){return o.getCurrentResult()}),(function(){return o.getCurrentResult()})),a=u.useCallback((function(e,t){o.mutate(e,t).catch(A)}),[o]);if(i.error&&(0,Y.L)(o.options.throwOnError,[i.error]))throw i.error;return(0,l.Z)((0,l.Z)({},i),{},{mutate:a,mutateAsync:i.mutate})}function A(){}}}]);