1 line
62 KiB
JavaScript
1 line
62 KiB
JavaScript
"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[2851],{22851:(e,o,r)=>{r.r(o),r.d(o,{default:()=>Fe});var t=r(89379),n=r(85571),i=r(8881),l=r(24513),s=r(36256),d=r(9950),a=r(4159),c=r.n(a),h=r(26910),x=r(14857),u=r(31222),p=r(51778),g=r(36150),f=r(60010),b=r(2235),v=r(41413),A=r(55158),m=r(93230),j=r(82053),w=r(16491),S=r(60899),y=r(82917),C=r(77922),k=r(25277),W=r(29925),R=r(1320),D=r(15769),P=r(69780),M=r(9213),I=r(21671),z=r(93038),L=r(34075),T=r(83274),Y=r(25333),F=r(17239),E=r(23266),K=r(33738),O=r(96583),N=r(28170),H=r(82223),J=r(40033),B=r(79739),q=r(37476),Z=r(56712),U=r(81417),G=r(96600),V=r(53132),Q=r(94289),X=r(57326),_=r(50624),$=r(55916),ee=r(52351),oe=r(67562),re=r(49883),te=r(81425),ne=r(56311),ie=r(20466),le=r(96646),se=r(59212),de=r(58691),ae=r(44414),ce=r(36220);c().extend(ce);const he=999,xe=16,ue="0 8px 24px rgba(15, 23, 42, 0.08)",pe="0 18px 50px rgba(15, 23, 42, 0.18)",ge="#0f172a",fe="#64748b",be="#94a3b8",ve="#e2e8f0",Ae="#f1f5f9",me="#f8fafc",je=(e,o)=>"".concat(e).concat(o),we=e=>je(e,"08"),Se=e=>je(e,"18"),ye=e=>je(e,"26"),Ce=e=>je(e,"55"),ke=e=>({cursor:"pointer","& .MuiOutlinedInput-root":{borderRadius:he+"px",bgcolor:we(e),fontWeight:600,color:ge,paddingRight:"8px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s, background-color 0.2s","& fieldset":{borderColor:Ce(e),borderWidth:1.5},"&:hover fieldset":{borderColor:e},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(ye(e))},"&.Mui-focused fieldset":{borderColor:e,borderWidth:2}},"& .MuiAutocomplete-endAdornment .MuiSvgIcon-root":{color:e}}),We={pending:{label:"Pending",color:"#f59e0b",icon:u.tX0},accepted:{label:"Accepted",color:"#6366f1",icon:u.Azs},arrived:{label:"Arrived",color:"#06b6d4",icon:u.gwi},picked:{label:"Picked",color:"#8b5cf6",icon:u.gsJ},active:{label:"Active",color:"#14b8a6",icon:u.pk7},skipped:{label:"Skipped",color:"#f97316",icon:u.ivF},delivered:{label:"Delivered",color:"#10b981",icon:u.mU9},cancelled:{label:"Cancelled",color:"#ef4444",icon:u.uDv}},Re=[{status:"pending",countKey:"uncoveredLength"},{status:"accepted",countKey:"assignedLength"},{status:"arrived",countKey:"arrivedLength"},{status:"picked",countKey:"pickedLength"},{status:"active",countKey:"activeLength"},{status:"skipped",countKey:"skippedLength"},{status:"delivered",countKey:"coveredLength"},{status:"cancelled",countKey:"cancelLength"}],De=[{key:"created",label:"Created Orders",color:"#0ea5e9",icon:u.F6S},{key:"pending",label:"Pending Orders",color:"#f59e0b",icon:u.tX0},{key:"delivered",label:"Delivered Orders",color:"#10b981",icon:u.mU9},{key:"cancelled",label:"Cancelled Orders",color:"#ef4444",icon:u.uDv}],Pe=[{id:"all",label:"All Batches",range:"Across the day",color:"#7c3aed",iconKey:"all"},{id:"morning",label:"Morning Batch",range:"12 AM to 8 AM",color:"#0ea5e9",iconKey:"morning",startHour:0,endHour:8},{id:"afternoon",label:"Afternoon Batch",range:"9 AM to 12:30 PM",color:"#f59e0b",iconKey:"afternoon",startHour:9,endHour:12.5},{id:"evening",label:"Evening Batch",range:"4 PM to 7 PM",color:"#6366f1",iconKey:"evening",startHour:16,endHour:19}],Me={all:u.lB9,morning:u.N3N,afternoon:u.aSE,evening:u.giK},Ie=()=>{const e=c()(),o=e.hour()+e.minute()/60;for(const r of Pe)if("all"!==r.id&&o>=r.startHour&&o<r.endHour)return r.id;return"all"},ze=["assigntime"],Le=e=>{let o=null;for(const i of ze)if(null!==e&&void 0!==e&&e[i]){o=e[i];break}if(!o)return null;const r=String(o).trim();if(/^\d{4}-\d{2}-\d{2}$/.test(r))return null;const t=c()(o);if(!t.isValid())return null;const n=t.hour()+t.minute()/60;for(const i of Pe)if("all"!==i.id&&n>=i.startHour&&n<i.endHour)return i.id;return null},Te=e=>(0,ae.jsx)(b.A,(0,t.A)((0,t.A)({},e),{},{sx:{mt:.75,borderRadius:2,boxShadow:pe,border:"1px solid",borderColor:"divider",overflow:"hidden"}})),Ye=e=>{let{color:o,selected:r,size:t=24,children:n}=e;return(0,ae.jsx)(v.A,{sx:{width:t,height:t,bgcolor:r?o:Se(o),color:r?"#fff":o,transition:"background-color 0.15s, color 0.15s"},children:n})},Fe=()=>{const e=localStorage.getItem("userid"),o=((0,x.A)(),(0,d.useRef)()),r=(0,d.useRef)(),[a,ce]=(0,d.useState)([]),[he,je]=(0,d.useState)(!1),[ze,Fe]=(0,d.useState)("All"),[Ee,Ke]=(0,d.useState)(0),[Oe,Ne]=(0,d.useState)(c()().format("YYYY-MM-DD")),[He,Je]=(0,d.useState)(c()().format("YYYY-MM-DD")),[Be,qe]=(0,d.useState)("Pending"),[Ze,Ue]=(0,d.useState)(0),[Ge,Ve]=(0,d.useState)(!1),[Qe,Xe]=(0,d.useState)("Today"),[_e,$e]=(0,d.useState)(""),[eo,oo]=(0,d.useState)(),[ro,to]=(0,d.useState)(),[no,io]=(0,d.useState)(""),[lo,so]=(0,d.useState)({}),[ao,co]=(0,d.useState)(""),[ho,xo]=(0,d.useState)(""),[uo,po]=(0,d.useState)("pending"),[go,fo]=(0,d.useState)("delivered"),bo=(0,d.useRef)(null),vo=(0,d.useRef)(null),[Ao,mo]=d.useState(0),[jo,wo]=d.useState(50),[So,yo]=d.useState(),[Co,ko]=(0,d.useState)(null),[Wo,Ro]=(0,d.useState)(null),[Do,Po]=(0,d.useState)(""),[Mo,Io]=(0,d.useState)(""),[zo,Lo]=d.useState(null),[To,Yo]=(0,d.useState)(null),[Fo,Eo]=(0,d.useState)(!1),[Ko,Oo]=d.useState(null),[No,Ho]=(0,d.useState)(""),[Jo,Bo]=(0,d.useState)(!1),[qo,Zo]=(0,d.useState)(!1),[Uo,Go]=(0,d.useState)(""),[Vo,Qo]=(0,d.useState)(null),[Xo,_o]=(0,d.useState)(0),[$o,er]=(0,d.useState)(0),[or,rr]=(0,d.useState)(null),[tr,nr]=(0,d.useState)(null),[ir,lr]=(0,d.useState)(0),[sr,dr]=(0,d.useState)(Ie),ar=localStorage.getItem("roleid");(0,d.useEffect)((()=>{_o(0),rr(null),er(0),nr(null)}),[Ee]),(0,d.useEffect)((()=>{er(0),nr(null)}),[Xo]);const cr=Boolean(zo),hr=()=>{Lo(null)},{mutate:xr}=(0,p.n)({mutationFn:e=>{let{selectedRow:o,cancelFeed:r}=e;return(0,te.zF)(o,r)},onSuccess:()=>{Sr("Delivery Cancelled Successfully","success"),Bo(!1),$r(),zr(),Kr()},onError:e=>{Sr(e.message,"error")}}),{data:ur,isLoading:pr,isError:gr,error:fr}=(0,g.I)({queryKey:["tenantlist",Ee],queryFn:()=>(0,te.Mn)(Ee),enabled:0!==Ee}),{data:br,isLoading:vr,isError:Ar,error:mr}=(0,g.I)({queryKey:["gettenantlocations",Xo],queryFn:()=>(0,te.DL)(Xo),enabled:0!==Xo}),jr=(0,p.n)({mutationFn:te.k3,onSuccess:()=>{(0,i.M8)("Notification sent Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3})},onError:e=>{(0,i.M8)(e.message,{variant:"error",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3})}}),wr=(0,p.n)({mutationFn:e=>{let{selectedRider:o,selectedRow:r}=e;return(0,te.R_)(o,r)},onSuccess:(e,o)=>{let{selectedRider:r,selectedRow:t}=o;Eo(!1),Zo(!1),"Success"===e.data.message&&(n.A.info("Rider changed successfully for order ID ".concat(null===t||void 0===t?void 0:t.orderid,". New Rider: ").concat(null===r||void 0===r?void 0:r.firstname," ").concat(null===r||void 0===r?void 0:r.lastname)),Sr("Rider Changed Successfully","success")),$r(),zr(),Kr(),jr.mutate(r.userfcmtoken)},onError:(e,o)=>{let{selectedRider:r,selectedRow:t}=o;n.A.error("Failed to change rider for order ID ".concat(null===t||void 0===t?void 0:t.orderid,":"),e),Sr(e.message,"error"),Eo(!1)}}),Sr=(e,o)=>{(0,i.M8)(e,{variant:o,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3})},{data:yr}=(0,g.I)({queryKey:["orderdetails",Wo],queryFn:()=>(0,te.z3)(Wo),enabled:!!Wo}),Cr=()=>{je(!1)},{data:kr,isLoading:Wr,isError:Rr,error:Dr,fetchNextPage:Pr,hasNextPage:Mr,isFetchingNextPage:Ir,refetch:zr}=(0,f.q)({queryKey:["fetchdeliveries",Ee,e,uo,Oe,He,jo,Mo,Xo,$o,ir],queryFn:te.tL,getNextPageParam:e=>{var o;return null!==(o=e.nextPage)&&void 0!==o?o:void 0}}),{data:Lr,fetchNextPage:Tr,hasNextPage:Yr,isFetchingNextPage:Fr,isLoading:Er,refetch:Kr}=(null===kr||void 0===kr||kr.pages.flatMap((e=>e.rows)),(0,f.q)({queryKey:["fetchdeliveries-batchcounts",Ee,e,"all",Oe,He,200,"",Xo,$o,ir],queryFn:te.tL,getNextPageParam:e=>{var o;return null!==(o=e.nextPage)&&void 0!==o?o:void 0}})),Or=(0,d.useMemo)((()=>((null===Lr||void 0===Lr?void 0:Lr.pages)||[]).flatMap((e=>e.rows||[]))),[Lr]);(0,d.useEffect)((()=>{Yr&&!Fr&&Tr()}),[Yr,Fr,Tr,Or.length]);const Nr=Yr||Fr,Hr=(0,d.useMemo)((()=>{const e=String(uo||"").toLowerCase(),o=String(Mo||"").trim().toLowerCase();return Or.filter((r=>{if("all"!==sr&&Le(r)!==sr)return!1;const t=String(r.orderstatus||"").toLowerCase();if(e&&t!==e)return!1;if(o){if(![r.deliverycustomer,r.deliveryaddress,r.deliverysuburb,r.pickupcustomer,r.pickupaddress,r.pickupsuburb,r.orderid,r.tenantname,r.ridername,r.username].map((e=>String(e||"").toLowerCase())).join(" ").includes(o))return!1}return!0}))}),[Or,sr,uo,Mo]),Jr=(0,d.useMemo)((()=>{const e={uncoveredLength:0,assignedLength:0,arrivedLength:0,pickedLength:0,activeLength:0,skippedLength:0,coveredLength:0,cancelLength:0};return Or.forEach((o=>{if("all"!==sr&&Le(o)!==sr)return;switch(String(o.orderstatus||"").toLowerCase()){case"pending":e.uncoveredLength+=1;break;case"accepted":case"assigned":e.assignedLength+=1;break;case"arrived":e.arrivedLength+=1;break;case"picked":e.pickedLength+=1;break;case"active":e.activeLength+=1;break;case"skipped":e.skippedLength+=1;break;case"delivered":e.coveredLength+=1;break;case"cancelled":case"canceled":e.cancelLength+=1}})),e}),[Or,sr]),Br=(0,d.useMemo)((()=>{const e={all:Or.length};return Pe.forEach((o=>{"all"!==o.id&&(e[o.id]=0)})),Or.forEach((o=>{const r=Le(o);r&&(e[r]=(e[r]||0)+1)})),e}),[Or]);(0,d.useEffect)((()=>{if(!Yr)return;const e=new IntersectionObserver((e=>{e[0].isIntersecting&&Tr()}),{root:document.querySelector(".MuiTableContainer-root"),rootMargin:"0px",threshold:1});return o.current&&e.observe(o.current),()=>{o.current&&e.unobserve(o.current)}}),[Yr,Tr]);const{data:qr,isLoading:Zr,isError:Ur,error:Gr}=(0,g.I)({queryKey:["fetchpercentageaPI",Ee],queryFn:()=>(0,te.RG)(Ee)});(0,d.useEffect)((()=>{qr&&console.log("percentageData",qr)}),[qr]);const{data:Vr={},isLoading:Qr,isError:Xr,error:_r,refetch:$r}=(0,g.I)({queryKey:["fetchCountData",Ee,e,Oe,He,jo,Mo,Xo,$o,ir,Be],queryFn:()=>(0,te.qB)(Ee,e,Oe,He,jo,Mo,Xo,$o,ir)});(0,d.useEffect)((()=>{console.log("countData",Vr),0===Ze&&Vr&&yo(Vr.uncoveredLength)}),[Vr]);const{data:et=[],isLoading:ot,isError:rt,error:tt}=(0,g.I)({queryKey:["ridersList",Ee],queryFn:te.Sd,enabled:Boolean(Ee),onError:e=>{(0,ie.k)(e.message,"error",2e3)}}),nt=(0,p.n)({mutationFn:e=>(0,te.wT)(e),onSuccess:e=>{console.log(e),e.data.status&&(Sr("Updated Successfully","success"),to(""),io(""),je(!1),zr(),$r(),Kr())},onError:e=>{console.log(e),Sr(e.message,"success")}}),it=Rr?"Error fetching percentages: ".concat(null===Dr||void 0===Dr?void 0:Dr.message):Ur?"Error fetching percentages: ".concat(null===Gr||void 0===Gr?void 0:Gr.message):Xr?"Error fetching percentages: ".concat(null===_r||void 0===_r?void 0:_r.message):rt?"Error fetching percentages: ".concat(null===tt||void 0===tt?void 0:tt.message):gr?"Error tenant list: ".concat(null===fr||void 0===fr?void 0:fr.message):Ar?"Error location list: ".concat(null===mr||void 0===mr?void 0:mr.message):null;return it?(console.log("errorMessage",it),(0,ie.k)(it,"error",2e3),null):(0,ae.jsxs)(ae.Fragment,{children:[(Qr||Zr||Er||pr||vr||ot)&&(0,ae.jsx)(ae.Fragment,{children:(0,ae.jsx)(ee.A,{})}),(0,ae.jsx)(A.A,{sx:{color:"#fff",zIndex:e=>e.zIndex.drawer+1},open:Qr||Zr||Wr||pr||vr||ot}),(0,ae.jsx)(b.A,{elevation:0,sx:{mb:{xs:1.5,md:2},p:{xs:1.5,sm:2,md:2.5},borderRadius:xe/8,border:"1px solid",borderColor:ve,background:"linear-gradient(135deg, ".concat(we("#6366f1")," 0%, ").concat(we("#0ea5e9")," 100%)"),boxShadow:ue},children:(0,ae.jsxs)(m.A,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:{xs:1.5,sm:2},children:[(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",spacing:{xs:1.25,sm:1.75},children:[(0,ae.jsx)(v.A,{sx:{width:{xs:40,sm:48},height:{xs:40,sm:48},bgcolor:"#6366f1",color:"#fff",boxShadow:"0 6px 18px rgba(99,102,241,0.32)"},children:(0,ae.jsx)(u.F6S,{size:22})}),(0,ae.jsxs)(m.A,{children:[(0,ae.jsx)(j.A,{variant:"h3",sx:{fontWeight:800,color:ge,lineHeight:1.1,fontSize:{xs:"1.25rem",sm:"1.5rem",md:"1.75rem"}},children:"Deliveries"}),(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",spacing:.75,sx:{mt:.5},children:[(0,ae.jsx)(w.A,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:"#10b981",boxShadow:"0 0 0 4px rgba(16,185,129,0.18)"}}),(0,ae.jsxs)(j.A,{variant:"caption",sx:{color:fe,fontWeight:600},children:["Live \xb7 ",ze||"All Zones"]})]})]})]}),(0,ae.jsx)(se.A,{ref:bo,locaName:ze,setAppId:Ke,setLocoName:Fe,setPage:mo,pill:!0,accentColor:"#6366f1",icon:(0,ae.jsx)(u.HPi,{size:14}),placeholder:"Select Zone",paperComponent:Te,sx:{width:{xs:"100%",sm:280},zIndex:100}})]})}),(0,ae.jsx)(S.Ay,{container:!0,spacing:{xs:1.25,sm:1.5,md:2},sx:{mt:"1px"},children:[(0,t.A)((0,t.A)({},De[0]),{},{value:null===qr||void 0===qr?void 0:qr.uncoveredOrders,percentage:null===qr||void 0===qr?void 0:qr.percentage1}),(0,t.A)((0,t.A)({},De[1]),{},{value:null===qr||void 0===qr?void 0:qr.assignedOrders,percentage:null===qr||void 0===qr?void 0:qr.percentage2}),(0,t.A)((0,t.A)({},De[2]),{},{value:null===qr||void 0===qr?void 0:qr.pickedOrders,percentage:null===qr||void 0===qr?void 0:qr.percentage3}),(0,t.A)((0,t.A)({},De[3]),{},{value:null===qr||void 0===qr?void 0:qr.coveredOrders,percentage:null===qr||void 0===qr?void 0:qr.percentage4})].map((e=>{var o;const r=e.icon,t="number"===typeof e.percentage?e.percentage:Number(e.percentage),n=!Number.isNaN(t)&&void 0!==e.percentage&&null!==e.percentage,i=n?t>0?u.imn:t<0?u.Rod:u.CJb:u.CJb,l=n&&0!==t?t>0?"#10b981":"#ef4444":be;return(0,ae.jsx)(S.Ay,{item:!0,xs:6,sm:6,md:3,children:(0,ae.jsxs)(b.A,{elevation:0,sx:{position:"relative",overflow:"hidden",p:{xs:1.25,sm:1.75,md:2.25},borderRadius:xe/8,border:"1px solid",borderColor:ve,background:"#fff",transition:"transform 0.2s, box-shadow 0.2s, border-color 0.2s",cursor:"pointer","&:hover":{transform:"translateY(-3px)",boxShadow:ue,borderColor:Ce(e.color)}},children:[(0,ae.jsx)(w.A,{sx:{position:"absolute",top:0,left:0,right:0,height:3,background:"linear-gradient(90deg, ".concat(e.color," 0%, ").concat(Se(e.color)," 100%)")}}),(0,ae.jsxs)(m.A,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",spacing:1,children:[(0,ae.jsxs)(m.A,{spacing:.5,sx:{minWidth:0,flex:1},children:[(0,ae.jsx)(j.A,{variant:"caption",sx:{color:fe,fontWeight:700,letterSpacing:.4,textTransform:"uppercase",fontSize:{xs:10,sm:11},whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.label}),Zr?(0,ae.jsx)(y.A,{sx:{width:70,height:{xs:28,md:36}},animation:"wave"}):(0,ae.jsx)(j.A,{sx:{fontWeight:800,color:ge,lineHeight:1.1,fontSize:{xs:"1.5rem",sm:"1.75rem",md:"2rem"}},children:null!==(o=e.value)&&void 0!==o?o:0}),n&&(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",spacing:.5,sx:{mt:.5,flexWrap:"wrap"},children:[(0,ae.jsxs)(w.A,{sx:{display:"inline-flex",alignItems:"center",gap:.25,px:.75,py:.25,borderRadius:999,bgcolor:Se(l),color:l,fontSize:{xs:10,sm:11},fontWeight:800},children:[(0,ae.jsx)(i,{size:12}),Math.abs(t),"%"]}),(0,ae.jsx)(j.A,{variant:"caption",sx:{color:be,display:{xs:"none",sm:"inline"}},children:"vs. yesterday"})]})]}),(0,ae.jsx)(v.A,{sx:{width:{xs:36,sm:42,md:48},height:{xs:36,sm:42,md:48},bgcolor:Se(e.color),color:e.color,boxShadow:"inset 0 0 0 1px ".concat(Ce(e.color)),flexShrink:0},children:(0,ae.jsx)(r,{size:20})})]})]})},e.key)}))}),(0,ae.jsxs)(b.A,{elevation:0,sx:{mt:{xs:1.5,md:2},mb:{xs:1.5,md:2},p:{xs:1.5,md:2},borderRadius:xe/8,border:"1px solid",borderColor:ve,background:"#fff",boxShadow:ue},children:[(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",spacing:1,sx:{mb:{xs:1,md:1.5},color:fe},children:[(0,ae.jsx)(v.A,{sx:{width:28,height:28,bgcolor:Se("#6366f1"),color:"#6366f1"},children:(0,ae.jsx)(u.MiI,{size:16})}),(0,ae.jsx)(j.A,{variant:"caption",sx:{fontWeight:800,letterSpacing:.6,textTransform:"uppercase",color:fe},children:"Filters"})]}),(0,ae.jsxs)(m.A,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:1.25,sx:{flexWrap:"wrap"},children:[(0,ae.jsxs)(m.A,{direction:"row",flexWrap:"wrap",gap:1.5,alignItems:"center",children:[(()=>{const e=Pe.find((e=>e.id===sr))||Pe[0],o=Me[e.iconKey]||u.VP9;return(0,ae.jsx)(C.A,{disableClearable:!0,size:"small",openOnFocus:!0,selectOnFocus:!0,filterOptions:e=>e,options:Pe,value:e,onChange:(e,o)=>o&&dr(o.id),getOptionLabel:e=>e.label,isOptionEqualToValue:(e,o)=>e.id===o.id,PaperComponent:Te,ListboxProps:{sx:{py:0,maxHeight:360}},renderOption:(e,o,r)=>{var n;let{selected:i}=r;const l=Me[o.iconKey]||u.VP9,s=null!==(n=Br[o.id])&&void 0!==n?n:0;return(0,d.createElement)("li",(0,t.A)((0,t.A)({},e),{},{key:o.id,style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px",borderBottom:"1px solid #f1f5f9",backgroundColor:i?"".concat(o.color,"10"):"transparent",transition:"background-color 0.15s"}}),(0,ae.jsx)(v.A,{sx:{width:36,height:36,bgcolor:i?o.color:"".concat(o.color,"18"),color:i?"#fff":o.color,transition:"background-color 0.15s, color 0.15s"},children:(0,ae.jsx)(l,{size:20})}),(0,ae.jsxs)(m.A,{direction:"column",spacing:0,flex:1,minWidth:0,children:[(0,ae.jsx)(j.A,{variant:"body2",fontWeight:700,color:"#0f172a",noWrap:!0,children:o.label}),(0,ae.jsx)(j.A,{variant:"caption",color:"text.secondary",noWrap:!0,children:o.range})]}),(0,ae.jsx)(k.A,{size:"small",label:s,sx:{minWidth:36,height:22,fontWeight:800,fontSize:11,bgcolor:s>0?"".concat(o.color,"18"):"#f1f5f9",color:s>0?o.color:"#94a3b8",border:"1px solid ".concat(s>0?o.color+"55":"#e2e8f0"),"& .MuiChip-label":{px:.75}}}),i&&(0,ae.jsx)(v.A,{sx:{width:22,height:22,bgcolor:o.color,color:"#fff"},children:(0,ae.jsx)(u.g9_,{size:14})}))},renderInput:r=>{var n;return(0,ae.jsx)(W.A,(0,t.A)((0,t.A)({},r),{},{placeholder:"Batch",inputProps:(0,t.A)((0,t.A)({},r.inputProps),{},{readOnly:!0,style:(0,t.A)((0,t.A)({},(null===(n=r.inputProps)||void 0===n?void 0:n.style)||{}),{},{cursor:"pointer",caretColor:"transparent"})}),InputProps:(0,t.A)((0,t.A)({},r.InputProps),{},{startAdornment:(0,ae.jsx)(m.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5,mr:.25,flexShrink:0},children:(0,ae.jsx)(v.A,{sx:{width:24,height:24,bgcolor:"".concat(e.color,"18"),color:e.color},children:(0,ae.jsx)(o,{size:14})})})}),sx:{minWidth:{xs:180,sm:220,md:240},cursor:"pointer","& .MuiOutlinedInput-root":{borderRadius:"999px",bgcolor:"".concat(e.color,"08"),fontWeight:700,color:e.color,paddingRight:"8px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s, background-color 0.2s","& fieldset":{borderColor:"".concat(e.color,"55"),borderWidth:1.5},"&:hover fieldset":{borderColor:e.color},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(e.color,"26")},"&.Mui-focused fieldset":{borderColor:e.color,borderWidth:2}},"& .MuiAutocomplete-endAdornment .MuiSvgIcon-root":{color:e.color}}}))}})})(),Oe&&He&&(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",spacing:.75,onClick:()=>Ve(!0),sx:{pl:.5,pr:1.25,py:.5,borderRadius:999,cursor:"pointer",bgcolor:we("#f59e0b"),border:"1.5px solid ".concat(Ce("#f59e0b")),transition:"border-color 0.15s, box-shadow 0.15s","&:hover":{borderColor:"#f59e0b",boxShadow:"0 0 0 3px ".concat(ye("#f59e0b"))}},children:[(0,ae.jsx)(Ye,{color:"#f59e0b",children:(0,ae.jsx)(u.tjE,{size:14})}),(0,ae.jsxs)(j.A,{variant:"caption",sx:{fontWeight:700,color:"#f59e0b",whiteSpace:"nowrap"},children:[c()(Oe).format("DD MMM")," \u2013 ",c()(He).format("DD MMM")]})]})]}),(0,ae.jsx)(C.A,{disablePortal:!0,options:ur||[],value:or,PaperComponent:Te,sx:{flex:{xs:"1 1 100%",sm:"1 1 180px"},minWidth:{xs:"100%",sm:180}},onOpen:e=>{Ee||(e.preventDefault(),(0,ie.k)("Please select your zone first!","warning",3e3),setTimeout((()=>{var e;return null===(e=bo.current)||void 0===e?void 0:e.focus()}),0))},onChange:(e,o,r)=>{"clear"===r?(_o(0),rr(null),er(0),nr(null)):(_o((null===o||void 0===o?void 0:o.tenantid)||0),rr(o),er(0),nr(null))},renderInput:e=>(0,ae.jsx)(W.A,(0,t.A)((0,t.A)({},e),{},{inputRef:vo,placeholder:"Select Tenant",InputProps:(0,t.A)((0,t.A)({},e.InputProps),{},{startAdornment:(0,ae.jsx)(m.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5,mr:.25,flexShrink:0},children:(0,ae.jsx)(Ye,{color:"#0ea5e9",children:(0,ae.jsx)(u.gl1,{size:14})})})}),sx:ke("#0ea5e9")}))}),(0,ae.jsx)(C.A,{disablePortal:!0,options:br||[],getOptionLabel:e=>"".concat(e.locationname," (").concat(e.suburb,")")||0,value:tr,PaperComponent:Te,sx:{flex:{xs:"1 1 100%",sm:"1 1 180px"},minWidth:{xs:"100%",sm:180}},onOpen:e=>{Ee||Xo?Xo||(e.preventDefault(),(0,ie.k)("Please select your Tenant first!","warning",3e3),setTimeout((()=>{var e;return null===(e=vo.current)||void 0===e?void 0:e.focus()}),0)):(e.preventDefault(),(0,ie.k)("Please select your Zone and Tenant first!","warning",3e3),setTimeout((()=>{var e;return null===(e=bo.current)||void 0===e?void 0:e.focus()}),0))},onChange:(e,o,r)=>{"clear"===r?(er(0),nr(null)):(er(o.locationid||0),nr(o))},renderInput:e=>(0,ae.jsx)(W.A,(0,t.A)((0,t.A)({},e),{},{placeholder:"Select Location",InputProps:(0,t.A)((0,t.A)({},e.InputProps),{},{startAdornment:(0,ae.jsx)(m.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5,mr:.25,flexShrink:0},children:(0,ae.jsx)(Ye,{color:"#14b8a6",children:(0,ae.jsx)(u.gwi,{size:14})})})}),sx:ke("#14b8a6")}))}),(0,ae.jsx)(C.A,{disabled:ot,options:et,PaperComponent:Te,getOptionLabel:e=>"".concat(e.firstname," ").concat(e.lastname," (").concat(e.contactno,")"),sx:{flex:{xs:"1 1 100%",sm:"1 1 180px"},minWidth:{xs:"100%",sm:180}},onChange:(e,o,r)=>{lr("clear"===r?0:o.userid)},onOpen:e=>{Ee||(e.preventDefault(),(0,ie.k)("Please select your zone first!","warning",3e3),setTimeout((()=>{var e;return null===(e=bo.current)||void 0===e?void 0:e.focus()}),0))},renderInput:e=>(0,ae.jsx)(W.A,(0,t.A)((0,t.A)({},e),{},{placeholder:"Choose Rider",InputProps:(0,t.A)((0,t.A)({},e.InputProps),{},{startAdornment:(0,ae.jsx)(m.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5,mr:.25,flexShrink:0},children:(0,ae.jsx)(Ye,{color:"#8b5cf6",children:(0,ae.jsx)(u.bsz,{size:14})})})}),sx:ke("#8b5cf6")}))})]})]}),(0,ae.jsx)(b.A,{elevation:0,sx:{p:{xs:1,md:1.5},borderTopLeftRadius:xe/8,borderTopRightRadius:xe/8,borderBottomLeftRadius:0,borderBottomRightRadius:0,border:"1px solid",borderColor:ve,borderBottom:0,background:"#fff"},children:(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:1.5,sx:{flexWrap:"wrap-reverse"},children:[(0,ae.jsx)(m.A,{direction:"row",spacing:.75,sx:{flex:1,overflowX:"auto",py:.5,px:.25,"&::-webkit-scrollbar":{height:6},"&::-webkit-scrollbar-thumb":{backgroundColor:ve,borderRadius:4}},children:Re.map(((e,o)=>{var r;const t=We[e.status],n=t.icon,i=Ze===o,l=null!==(r=Jr[e.countKey])&&void 0!==r?r:0;return(0,ae.jsxs)(w.A,{onClick:e=>{return r=o,mo(0),Ue(r),wo(50),0===r&&(qe("Pending"),po("pending"),yo(null===Vr||void 0===Vr?void 0:Vr.uncoveredLength)),1===r&&(qe("Assigned"),po("accepted"),yo(null===Vr||void 0===Vr?void 0:Vr.assignedLength)),2===r&&(qe("Arrived"),po("arrived"),yo(null===Vr||void 0===Vr?void 0:Vr.arrivedLength)),3===r&&(qe("Picked"),po("picked"),yo(null===Vr||void 0===Vr?void 0:Vr.pickedLength)),4===r&&(qe("Active"),po("active"),yo(null===Vr||void 0===Vr?void 0:Vr.activeLength)),5===r&&(qe("Skipped"),po("skipped"),yo(null===Vr||void 0===Vr?void 0:Vr.skippedLength)),6===r&&(qe("Delivered"),po("delivered"),yo(null===Vr||void 0===Vr?void 0:Vr.coveredLength)),7===r&&(qe("Cancelled"),po("cancelled"),yo(null===Vr||void 0===Vr?void 0:Vr.cancelLength)),console.log(r),void Po("");var r},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(i?t.color:Ce(t.color)),bgcolor:i?t.color:we(t.color),color:i?"#fff":t.color,fontWeight:700,boxShadow:i?"0 6px 18px ".concat(ye(t.color)):"none",transition:"all 0.18s","&:hover":{borderColor:t.color,boxShadow:i?"0 6px 18px ".concat(ye(t.color)):"0 0 0 3px ".concat(ye(t.color))}},children:[(0,ae.jsx)(v.A,{sx:{width:{xs:22,md:26},height:{xs:22,md:26},bgcolor:i?"rgba(255,255,255,0.22)":Se(t.color),color:i?"#fff":t.color},children:(0,ae.jsx)(n,{size:13})}),(0,ae.jsx)(j.A,{variant:"caption",sx:{fontWeight:800,fontSize:{xs:11.5,md:13},lineHeight:1},children:t.label}),(0,ae.jsx)(w.A,{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:i?"rgba(255,255,255,0.22)":"#fff",color:i?"#fff":t.color,border:i?"none":"1px solid ".concat(Ce(t.color))},children:l})]},e.status)}))}),(0,ae.jsx)(w.A,{sx:{width:{xs:"100%",sm:240,lg:280},flex:{xs:"1 1 100%",sm:"0 0 auto"}},children:(0,ae.jsx)(ne.A,{value:Do,onChange:Po,onDebouncedChange:Io,sx:{m:0,width:"100%",borderRadius:999,bgcolor:we("#6366f1"),"& fieldset":{borderColor:Ce("#6366f1"),borderWidth:1.5},"&:hover fieldset":{borderColor:"#6366f1"},"&.Mui-focused fieldset":{borderColor:"#6366f1",borderWidth:2},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(ye("#6366f1"))}}})})]})}),(0,ae.jsx)(b.A,{elevation:0,sx:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomLeftRadius:xe/8,borderBottomRightRadius:xe/8,border:"1px solid",borderColor:ve,overflow:"hidden",background:"#fff"},children:(0,ae.jsx)(R.A,{ref:r,onScroll:e=>{const{scrollTop:o,scrollHeight:r,clientHeight:t}=e.currentTarget;o+t>=r-50&&Yr&&!Fr&&Tr()},sx:{maxHeight:{xs:"calc(100vh - 220px)",md:"calc(100vh - 190px)"},overflow:"auto",overflowX:"auto","&::-webkit-scrollbar":{width:"10px",height:"10px",cursor:"pointer"},"&::-webkit-scrollbar-thumb":{backgroundColor:Ce("#6366f1"),borderRadius:"8px",cursor:"pointer","&:hover":{backgroundColor:"#6366f1"}},"&::-webkit-scrollbar-track":{backgroundColor:me}},children:((e,r,n)=>{const i="Cancelled"!==Be&&"Delivered"!==Be,s="Created"==Be,h=15+(i?1:0)+(s?1:0);return(0,ae.jsxs)(D.A,{stickyHeader:!0,sx:{minWidth:{xs:1100,lg:1300,xl:1400}},children:[(0,ae.jsx)(P.A,{children:(0,ae.jsxs)(M.A,{sx:{"& th":{backgroundColor:me,color:fe,fontSize:{xs:10,md:11},fontWeight:800,letterSpacing:.6,textTransform:"uppercase",whiteSpace:"nowrap",borderBottom:"1px solid ".concat(ve),py:{xs:1,md:1.25},px:{xs:1,md:2}}},children:[s&&(0,ae.jsx)(I.A,{sx:{whiteSpace:"nowrap"},children:(0,ae.jsx)(z.A,{indeterminate:a.length>0&&a.length!=Hr.length,onChange:e=>{e.target.checked?ce([...Hr]):ce([])},checked:a.length>0&&a.length==Hr.length})}),(0,ae.jsx)(I.A,{children:"#"}),(0,ae.jsx)(I.A,{children:"Status"}),(0,ae.jsx)(I.A,{children:"Tenant"}),(0,ae.jsx)(I.A,{children:"Order / Location"}),(0,ae.jsx)(I.A,{children:"Pickup"}),(0,ae.jsx)(I.A,{children:"Drop"}),(0,ae.jsx)(I.A,{children:"Rider"}),(0,ae.jsx)(I.A,{children:"ETA"}),(0,ae.jsx)(I.A,{children:"Transit"}),(0,ae.jsx)(I.A,{children:"Kms"}),(0,ae.jsx)(I.A,{children:"Amount"}),(0,ae.jsx)(I.A,{children:"Notes"}),(0,ae.jsx)(I.A,{children:"Step"}),(0,ae.jsx)(I.A,{children:"Qty"}),(0,ae.jsx)(I.A,{children:"COD"}),i&&(0,ae.jsx)(I.A,{align:"right",children:"Action"})]})}),(Fo||Er)&&(0,ae.jsx)(le.r,{col:8}),(0,ae.jsxs)(L.A,{children:[0==Hr.length&&!Fo&&!Nr&&(0,ae.jsx)(M.A,{children:(0,ae.jsx)(I.A,{colSpan:h,sx:{py:6},children:(0,ae.jsxs)(m.A,{alignItems:"center",spacing:1.5,children:[(0,ae.jsx)(v.A,{sx:{width:64,height:64,bgcolor:Se("#94a3b8"),color:be},children:(0,ae.jsx)(u.gsJ,{size:28})}),(0,ae.jsx)(j.A,{variant:"subtitle1",sx:{fontWeight:700,color:ge},children:"No deliveries to show"}),(0,ae.jsx)(j.A,{variant:"caption",sx:{color:fe},children:"all"===sr?"No ".concat(((null===(e=We[uo])||void 0===e?void 0:e.label)||Be).toLowerCase()," orders for this filter."):"No ".concat(((null===(r=We[uo])||void 0===r?void 0:r.label)||Be).toLowerCase()," orders in ").concat((null===(n=Pe.find((e=>e.id===sr)))||void 0===n?void 0:n.label)||"this batch",".")})]})})}),0==Hr.length&&Nr&&(0,ae.jsx)(M.A,{children:(0,ae.jsxs)(I.A,{colSpan:h,sx:{textAlign:"center",py:6},children:[(0,ae.jsx)(de.A,{}),(0,ae.jsx)(j.A,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:1},children:"Loading deliveries\u2026"})]})}),Hr.map(((e,o)=>{var r,n,i,s,x,p,g,f;const v=We[String(e.orderstatus||"").toLowerCase()]||{label:e.orderstatus||"\u2014",color:"#94a3b8",icon:u.bfP},A=v.icon,S=!!a.find((o=>o.orderheaderid==e.orderheaderid));return(0,ae.jsxs)(d.Fragment,{children:[(0,ae.jsxs)(M.A,{role:"checkbox",tabIndex:-1,sx:{cursor:"pointer",transition:"background-color 0.15s","& td":{borderBottom:"1px solid ".concat(Ae),py:{xs:1,md:1.5},px:{xs:1,md:2}},backgroundColor:S?Se("#8b5cf6"):"transparent","&:hover":{backgroundColor:S?Se("#8b5cf6"):me}},children:["Created"==Be&&(0,ae.jsx)(I.A,{children:(0,ae.jsx)(z.A,{onChange:o=>{if(o.target.checked){let o=a;o.push((0,t.A)((0,t.A)({},e),{},{sno:a.length+1})),ce([...o])}else{if(a.find((o=>o.orderheaderid==e.orderheaderid))){let o=a,r=a.find((o=>o.orderheaderid==e.orderheaderid));o.splice(r.sno-1,1),o.map(((e,o)=>{e.sno=o+1})),ce([...o])}}console.log("list",a)},checked:a.find((o=>o.orderheaderid==e.orderheaderid))})}),(0,ae.jsx)(I.A,{children:(0,ae.jsx)(j.A,{variant:"caption",sx:{fontWeight:700,color:be},children:String(Ao*jo+o+1).padStart(2,"0")})}),(0,ae.jsx)(I.A,{children:(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",spacing:.5,sx:{display:"inline-flex",pl:.5,pr:1,py:.25,borderRadius:999,bgcolor:we(v.color),border:"1px solid ".concat(Ce(v.color)),color:v.color},children:[(0,ae.jsx)(Ye,{color:v.color,size:20,children:(0,ae.jsx)(A,{size:12})}),(0,ae.jsx)(j.A,{variant:"caption",sx:{fontWeight:800,fontSize:11,lineHeight:1},children:v.label})]})}),(0,ae.jsx)(I.A,{children:(0,ae.jsx)(T.A,{title:e.tenantadress,children:(0,ae.jsxs)(m.A,{children:[(0,ae.jsx)(j.A,{noWrap:!0,variant:"subtitle2",sx:{fontWeight:700,color:ge},children:e.tenantname}),(0,ae.jsx)(j.A,{noWrap:!0,variant:"caption",sx:{color:fe},children:e.tenantsuburb}),(0,ae.jsx)(j.A,{noWrap:!0,variant:"caption",sx:{color:be},children:e.applocation})]})})}),(0,ae.jsxs)(I.A,{align:"left",children:[(0,ae.jsx)(T.A,{title:"Location Name-Suburb",placement:"top",children:(0,ae.jsx)(j.A,{variant:"subtitle1",noWrap:!0,children:"".concat(e.locationname,"-(").concat(e.locationsuburb,")")})}),(0,ae.jsxs)(m.A,{display:"flex",flexDirection:"row",gap:3,children:[(0,ae.jsxs)(m.A,{children:[(0,ae.jsx)(T.A,{title:"Order Id",placement:"top",children:(0,ae.jsx)(j.A,{variant:"body2",noWrap:!0,children:e.orderid})}),(0,ae.jsxs)(T.A,{title:"Ordered date",placement:"top",children:[(0,ae.jsx)(j.A,{noWrap:!0,sx:{fontSize:"12px"},children:c()(e.orderdate).utc().format("DD/MM/YYYY")}),(0,ae.jsx)(j.A,{noWrap:!0,sx:{fontSize:"11px"},children:c()(e.orderdate).utc().format("hh:mm A")})]})]}),"-",(0,ae.jsxs)(m.A,{children:[(0,ae.jsx)(T.A,{title:"Delivery Id",placement:"top",children:(0,ae.jsx)(j.A,{variant:"body2",noWrap:!0,children:e.deliveryid})}),(0,ae.jsxs)(T.A,{title:"Delivery date",placement:"top",children:[(0,ae.jsx)(j.A,{noWrap:!0,sx:{fontSize:"12px"},children:c()(e.deliverydate).utc().format("DD/MM/YYYY")}),(0,ae.jsx)(j.A,{noWrap:!0,sx:{fontSize:"11px"},children:c()(e.deliverydate).utc().format("hh:mm A")})]})]})]})]}),(0,ae.jsx)(I.A,{align:"left",children:(0,ae.jsxs)(m.A,{children:[(0,ae.jsx)(j.A,{variant:"subtitle2",sx:{fontWeight:700,color:ge,whiteSpace:"nowrap"},children:e.pickupcustomer}),(0,ae.jsx)(j.A,{variant:"caption",sx:{color:fe},children:e.pickupcontactno}),(0,ae.jsx)(T.A,{title:e.Pickupaddress,sx:{whiteSpace:"nowrap"},children:(0,ae.jsx)(j.A,{variant:"caption",sx:{color:be},children:e.pickuplocation||(e.Pickupaddress?e.Pickupaddress.slice(0,14)+"\u2026":"\u2014")})})]})}),(0,ae.jsx)(I.A,{align:"left",children:(0,ae.jsxs)(m.A,{children:[(0,ae.jsx)(j.A,{variant:"subtitle2",sx:{fontWeight:700,color:ge,whiteSpace:"nowrap"},children:e.deliverycustomer}),(0,ae.jsx)(j.A,{variant:"caption",sx:{color:fe},children:e.deliverycontactno}),(0,ae.jsx)(T.A,{title:e.deliveryaddress,children:(0,ae.jsx)(j.A,{variant:"caption",sx:{color:be,whiteSpace:"nowrap"},children:e.deliverylocation||(e.deliveryaddress?e.deliveryaddress.slice(0,14)+"\u2026":"\u2014")})})]})}),(0,ae.jsx)(I.A,{children:e.ridername?(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",spacing:1,children:[(0,ae.jsx)(Ye,{color:"#8b5cf6",size:28,children:(0,ae.jsx)(u.bsz,{size:14})}),(0,ae.jsxs)(m.A,{children:[(0,ae.jsx)(j.A,{variant:"subtitle2",sx:{fontWeight:700,color:ge},noWrap:!0,children:e.ridername}),(0,ae.jsxs)(j.A,{variant:"caption",sx:{color:fe},children:["ID #",e.userid," \xb7 ",e.ridercontact||"\u2014"]})]})]}):(0,ae.jsx)(j.A,{variant:"caption",sx:{color:be,fontWeight:600},children:"Unassigned"})}),(0,ae.jsx)(I.A,{align:"left",children:(0,ae.jsx)(j.A,{variant:"subtitle2",sx:{fontWeight:700,color:ge,whiteSpace:"nowrap"},children:e.expecteddeliverytime?c()(e.expecteddeliverytime).format("hh:mm A"):"\u2014"})}),(0,ae.jsx)(I.A,{align:"left",children:(0,ae.jsxs)(w.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1,py:.5,borderRadius:999,bgcolor:we("#06b6d4"),color:"#06b6d4",fontWeight:700,fontSize:12,border:"1px solid ".concat(Ce("#06b6d4"))},children:[e.transitminutes||0,"m"]})}),(0,ae.jsx)(I.A,{children:(0,ae.jsxs)(m.A,{direction:"column",spacing:.5,alignItems:"flex-start",children:[(0,ae.jsx)(T.A,{title:"Planned KMS",placement:"top",children:(0,ae.jsxs)(w.A,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",px:1.25,py:.375,borderRadius:999,bgcolor:we("#ef4444"),color:"#ef4444",fontWeight:700,fontSize:11,border:"1px solid ".concat(Ce("#ef4444")),whiteSpace:"nowrap",minWidth:75},children:[e.kms||0," km"]})}),(0,ae.jsx)(T.A,{title:"Actual KMS",placement:"top",children:(0,ae.jsxs)(w.A,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",px:1.25,py:.375,borderRadius:999,bgcolor:we("#10b981"),color:"#10b981",fontWeight:700,fontSize:11,border:"1px solid ".concat(Ce("#10b981")),whiteSpace:"nowrap",minWidth:75},children:[e.cumulativekms||0," km"]})})]})}),(0,ae.jsx)(I.A,{align:"left",children:(0,ae.jsxs)(m.A,{direction:"column",spacing:.5,alignItems:"flex-start",children:[(0,ae.jsx)(T.A,{title:"Delivery Charge",placement:"top",children:(0,ae.jsxs)(w.A,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",px:1.25,py:.375,borderRadius:999,bgcolor:we("#ef4444"),color:"#ef4444",fontWeight:700,fontSize:11,border:"1px solid ".concat(Ce("#ef4444")),whiteSpace:"nowrap",minWidth:85},children:["\u20b9 ",null!==(n=null===(i=e.deliverycharges)||void 0===i?void 0:i.toFixed(2))&&void 0!==n?n:"0.00"]})}),(0,ae.jsx)(T.A,{title:"Delivery Amount",placement:"top",children:(0,ae.jsxs)(w.A,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",px:1.25,py:.375,borderRadius:999,bgcolor:we("#10b981"),color:"#10b981",fontWeight:700,fontSize:11,border:"1px solid ".concat(Ce("#10b981")),whiteSpace:"nowrap",minWidth:85},children:["\u20b9 ",null!==(s=null===(x=e.deliveryamt)||void 0===x?void 0:x.toFixed(2))&&void 0!==s?s:"0.00"]})})]})}),(0,ae.jsx)(I.A,{children:e.notes?(0,ae.jsx)(T.A,{title:e.notes,children:(0,ae.jsx)(j.A,{variant:"caption",sx:{color:fe,maxWidth:160,display:"inline-block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.notes})}):(0,ae.jsx)(j.A,{variant:"caption",sx:{color:be},children:"\u2014"})}),(0,ae.jsx)(I.A,{align:"center",children:e.step?(0,ae.jsx)(w.A,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:30,height:24,px:.875,borderRadius:999,bgcolor:we("#6366f1"),border:"1px solid ".concat(Ce("#6366f1")),color:"#6366f1",fontWeight:800,fontSize:11},children:e.step}):(0,ae.jsx)(j.A,{variant:"caption",sx:{color:be},children:"\u2014"})}),(0,ae.jsx)(I.A,{children:(0,ae.jsx)(j.A,{variant:"subtitle2",sx:{fontWeight:700,color:e.Quantity?ge:be,whiteSpace:"nowrap"},children:e.Quantity||"\u2014"})}),(0,ae.jsx)(I.A,{children:(0,ae.jsx)(j.A,{variant:"subtitle2",sx:{fontWeight:800,color:e.collectionamt?"#ef4444":be,whiteSpace:"nowrap"},children:e.collectionamt?"\u20b9 ".concat(e.collectionamt.toFixed(2)):"\u2014"})}),"Cancelled"!==Be&&"Delivered"!==Be&&(0,ae.jsx)(I.A,{align:"right",children:(0,ae.jsxs)(m.A,{direction:"row",justifyContent:"flex-end",spacing:.75,children:["C"==e.deliverytype&&(0,ae.jsx)(T.A,{title:"Product details",placement:"top",children:(0,ae.jsx)(Y.A,{size:"small",onClick:()=>{(null===Co||void 0===Co?void 0:Co.orderid)===e.orderid?(ko(null),Ro(null)):(ko(e),Ro(e.orderheaderid))},sx:{borderRadius:999,bgcolor:we("#06b6d4"),color:"#06b6d4",border:"1px solid ".concat(Ce("#06b6d4")),"&:hover":{bgcolor:Se("#06b6d4")}},children:(null===Co||void 0===Co?void 0:Co.orderid)===e.orderid?(0,ae.jsx)(oe.A,{fontSize:"small"}):(0,ae.jsx)(re.A,{fontSize:"small"})})}),(0,ae.jsx)(T.A,{title:"Actions",placement:"top",children:(0,ae.jsx)(Y.A,{size:"small",onClick:o=>((e,o)=>{Yo(o),console.log("selectedRow",o),Lo(e.currentTarget)})(o,e),sx:{borderRadius:999,bgcolor:we("#6366f1"),color:"#6366f1",border:"1px solid ".concat(Ce("#6366f1")),"&:hover":{bgcolor:Se("#6366f1")}},children:(0,ae.jsx)(l.A,{})})}),(0,ae.jsxs)(F.A,{anchorEl:zo,open:cr,onClose:hr,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},PaperProps:{elevation:0,sx:{minWidth:220,borderRadius:2,mt:.75,border:"1px solid",borderColor:ve,boxShadow:pe,overflow:"hidden","& .MuiMenuItem-root":{fontSize:13,fontWeight:600,py:1.1,px:1.5,gap:1,transition:"background-color 0.15s","&:hover":{bgcolor:me}}}},children:["delivered"!==(null===To||void 0===To?void 0:To.orderstatus)&&(0,ae.jsxs)(E.A,{onClick:()=>{jr.mutate(To.userfcmtoken),hr()},children:[(0,ae.jsx)(Ye,{color:"#0ea5e9",size:22,children:(0,ae.jsx)(u.q53,{size:13})}),"Notify Rider"]}),["pending","accepted","arrived"].includes(null===To||void 0===To?void 0:To.orderstatus)&&(0,ae.jsxs)(E.A,{onClick:()=>{var e;if(!Ee)return Sr("Please select a location first!","warning"),void(null===(e=bo.current)||void 0===e||e.focus());Zo(!0),hr()},children:[(0,ae.jsx)(Ye,{color:"#8b5cf6",size:22,children:(0,ae.jsx)(u.bsz,{size:13})}),"Change Rider"]}),(1==ar||2==ar)&&(0,ae.jsxs)(E.A,{onClick:()=>{$e(To.kms),oo(To.cumulativekms),co(To.droplat),xo(To.droplon),io(To.notes),to(To.deliveryamount),fo(To.orderstatus||"delivered"),so(To),je(!0),hr()},children:[(0,ae.jsx)(Ye,{color:"#10b981",size:22,children:(0,ae.jsx)(u.mU9,{size:13})}),"Update Status"]}),"cancelled"!==(null===To||void 0===To?void 0:To.orderstatus)&&"delivered"!==(null===To||void 0===To?void 0:To.orderstatus)&&(0,ae.jsxs)(E.A,{sx:{color:"#ef4444 !important"},onClick:()=>{Bo(!0),hr()},children:[(0,ae.jsx)(Ye,{color:"#ef4444",size:22,children:(0,ae.jsx)(u.uDv,{size:13})}),"Cancel Delivery"]})]})]})})]}),(null===Co||void 0===Co?void 0:Co.orderid)===(null===e||void 0===e?void 0:e.orderid)&&(0,ae.jsx)(M.A,{children:(0,ae.jsx)(I.A,{colSpan:h,sx:{p:0,border:0,backgroundColor:me},children:(0,ae.jsx)(K.A,{in:!0,timeout:"auto",unmountOnExit:!0,children:(0,ae.jsx)(w.A,{sx:{width:"100%",p:2.5},children:(0,ae.jsxs)(b.A,{elevation:0,sx:{borderRadius:2,border:"1px solid",borderColor:ve,overflow:"hidden",background:"#fff"},children:[(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",spacing:1,sx:{px:2,py:1.25,borderBottom:"1px solid ".concat(Ae),bgcolor:we("#6366f1")},children:[(0,ae.jsx)(Ye,{color:"#6366f1",children:(0,ae.jsx)(u.gsJ,{size:14})}),(0,ae.jsx)(j.A,{variant:"caption",sx:{fontWeight:800,letterSpacing:.5,textTransform:"uppercase",color:"#6366f1"},children:"Product Details"})]}),(0,ae.jsxs)(D.A,{size:"small",sx:{minWidth:800},children:[(0,ae.jsx)(P.A,{children:(0,ae.jsxs)(M.A,{sx:{"& th":{fontSize:11,fontWeight:800,letterSpacing:.5,textTransform:"uppercase",color:fe,borderBottom:"1px solid ".concat(Ae)},"&:hover":{backgroundColor:"transparent !important"}},children:[(0,ae.jsx)(I.A,{children:"#"}),(0,ae.jsx)(I.A,{children:"Product"}),(0,ae.jsx)(I.A,{children:"Description"}),(0,ae.jsx)(I.A,{align:"right",children:"Qty"}),(0,ae.jsx)(I.A,{align:"right",children:"Cost"}),(0,ae.jsx)(I.A,{align:"right",children:"Price"}),(0,ae.jsx)(I.A,{align:"right",children:"Tax"}),(0,ae.jsx)(I.A,{align:"right",children:"Amount"})]})}),(0,ae.jsxs)(L.A,{children:[null===yr||void 0===yr||null===(p=yr.details)||void 0===p?void 0:p.map(((e,o)=>{var r,t;return(0,ae.jsxs)(M.A,{sx:{"&:hover":{backgroundColor:me+" !important"}},children:[(0,ae.jsx)(I.A,{sx:{color:be,fontWeight:700},children:String(o+1).padStart(2,"0")}),(0,ae.jsx)(I.A,{children:(0,ae.jsxs)(m.A,{direction:"row",spacing:1.25,alignItems:"center",children:[(0,ae.jsx)(w.A,{component:"img",src:(null===e||void 0===e?void 0:e.productimage)||"https://via.placeholder.com/40",alt:null===e||void 0===e?void 0:e.productname,sx:{width:36,height:36,objectFit:"cover",borderRadius:1.5,border:"1px solid ".concat(Ae)}}),(0,ae.jsx)(j.A,{variant:"body2",sx:{fontWeight:600,color:ge},noWrap:!0,children:(null===e||void 0===e?void 0:e.productname)||"Unnamed"})]})}),(0,ae.jsx)(I.A,{sx:{color:fe},children:(null===e||void 0===e?void 0:e.productdescription)||"-"}),(0,ae.jsx)(I.A,{align:"right",sx:{fontWeight:700},children:(null===e||void 0===e?void 0:e.orderqty)||0}),(0,ae.jsxs)(I.A,{align:"right",children:["\u20b9 ",(null===e||void 0===e?void 0:e.price)||0]}),(0,ae.jsxs)(I.A,{align:"right",children:["\u20b9 ",(null!==(r=null===e||void 0===e?void 0:e.productsumprice)&&void 0!==r?r:0).toFixed(2)]}),(0,ae.jsxs)(I.A,{align:"right",children:["\u20b9 ",(null!==(t=null===e||void 0===e?void 0:e.taxamount)&&void 0!==t?t:0).toFixed(2)]}),(0,ae.jsxs)(I.A,{align:"right",sx:{fontWeight:800,color:ge},children:["\u20b9 ",((null===e||void 0===e?void 0:e.productsumprice)+(null===e||void 0===e?void 0:e.taxamount)).toFixed(2)||0]})]},o)})),(0,ae.jsxs)(M.A,{sx:{"&:hover":{backgroundColor:"transparent !important"}},children:[(0,ae.jsx)(I.A,{align:"right",colSpan:7,sx:{fontWeight:700,color:fe,borderTop:"1px solid ".concat(Ae)},children:"Total Amount"}),(0,ae.jsxs)(I.A,{align:"right",sx:{fontWeight:800,color:"#10b981",borderTop:"1px solid ".concat(Ae)},children:["\u20b9 ",null===yr||void 0===yr||null===(g=yr.pricedetails)||void 0===g||null===(f=g.orderamount)||void 0===f?void 0:f.toFixed(2)]})]})]})]})]})})})})})]},null!==(r=e.orderheaderid)&&void 0!==r?r:"".concat(e.tenantname,"-").concat(o))})),0!=(null===Or||void 0===Or?void 0:Or.length)&&(0,ae.jsx)(M.A,{children:(0,ae.jsx)(I.A,{colSpan:h,rowSpan:3,children:(0,ae.jsx)("div",{ref:o,style:{height:40,textAlign:"center"},children:Fr||Yr?(0,ae.jsx)(de.A,{}):(0,ae.jsx)(j.A,{variant:"caption",sx:{color:be,fontWeight:600},children:"\xb7 End of list \xb7"})})})})]})]})})()})}),(0,ae.jsxs)(O.A,{open:Jo,onClose:()=>Bo(!1),maxWidth:"xs",fullWidth:!0,PaperProps:{elevation:0,sx:{borderRadius:3,border:"1px solid",borderColor:ve,boxShadow:pe,overflow:"hidden"}},children:[(0,ae.jsx)(w.A,{sx:{height:4,background:"linear-gradient(90deg, #ef4444 0%, ".concat(Se("#ef4444")," 100%)")}}),(0,ae.jsx)(N.A,{sx:{p:3.5},children:(0,ae.jsxs)(m.A,{alignItems:"center",spacing:2.5,children:[(0,ae.jsx)(v.A,{sx:{width:64,height:64,bgcolor:Se("#ef4444"),color:"#ef4444"},children:(0,ae.jsx)(s.A,{style:{fontSize:28}})}),(0,ae.jsxs)(m.A,{spacing:.5,alignItems:"center",children:[(0,ae.jsx)(j.A,{variant:"h4",sx:{fontWeight:800,color:ge},children:"Cancel Delivery?"}),(0,ae.jsx)(j.A,{variant:"caption",sx:{color:fe,textAlign:"center",px:1},children:"This action will cancel the delivery and notify the rider. Please share a brief reason."})]}),(0,ae.jsx)(W.A,{fullWidth:!0,placeholder:"Reason for cancellation",multiline:!0,minRows:2,maxRows:4,onChange:e=>Go(e.target.value),sx:{"& .MuiOutlinedInput-root":{borderRadius:2,bgcolor:me,"& fieldset":{borderColor:ve},"&:hover fieldset":{borderColor:"#ef4444"},"&.Mui-focused fieldset":{borderColor:"#ef4444",borderWidth:2},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(ye("#ef4444"))}}}}),(0,ae.jsxs)(m.A,{direction:"row",spacing:1.5,sx:{width:1},children:[(0,ae.jsx)(H.A,{fullWidth:!0,onClick:()=>Bo(!1),variant:"outlined",sx:{borderRadius:999,py:1.1,fontWeight:700,borderColor:ve,color:fe,"&:hover":{borderColor:be,bgcolor:me}},children:"Keep Delivery"}),(0,ae.jsx)(H.A,{fullWidth:!0,variant:"contained",onClick:()=>{""==Uo?Sr("Enter FeedBack","error"):xr({selectedRow:To,cancelFeed:Uo}),(async()=>{console.log("cancelridernotification",To);try{return(await h.A.post("".concat("https://jupiter.nearle.app/live/api/v1","/utils/notifyuser"),{token:To.userfcmtoken,notification:{title:"NearleXpress",body:"".concat(To.orderid," have been Cancelled"),sound:"ring",image:""},data:{type:"cancel"}})).data}catch(e){Sr(e.message,"error",2e3),console.log(e)}})()},autoFocus:!0,sx:{borderRadius:999,py:1.1,fontWeight:800,bgcolor:"#ef4444",boxShadow:"0 6px 18px ".concat(ye("#ef4444")),"&:hover":{bgcolor:"#dc2626"}},children:"Yes, Cancel"})]})]})})]}),(0,ae.jsxs)(O.A,{open:qo,onClose:()=>Zo(!1),maxWidth:"sm",fullWidth:!0,TransitionComponent:q.s,PaperProps:{elevation:0,sx:{borderRadius:3,border:"1px solid",borderColor:ve,boxShadow:pe,overflow:"hidden"}},children:[(0,ae.jsx)(w.A,{sx:{height:4,background:"linear-gradient(90deg, #8b5cf6 0%, ".concat(Se("#8b5cf6")," 100%)")}}),(0,ae.jsx)(J.A,{sx:{p:3,pb:1.5},children:(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,ae.jsx)(v.A,{sx:{width:44,height:44,bgcolor:Se("#8b5cf6"),color:"#8b5cf6"},children:(0,ae.jsx)(u.bsz,{size:22})}),(0,ae.jsxs)(m.A,{children:[(0,ae.jsx)(j.A,{variant:"h4",sx:{fontWeight:800,color:ge},children:"Change Rider"}),(0,ae.jsx)(j.A,{variant:"caption",sx:{color:fe},children:"Assign this delivery to a different rider"})]})]})}),(0,ae.jsx)(N.A,{sx:{p:3,pt:2},children:(0,ae.jsx)(C.A,{fullWidth:!0,options:et,PaperComponent:Te,getOptionLabel:e=>"".concat(e.firstname," ").concat(e.lastname," (").concat(e.contactno,")"),onChange:(e,o)=>{Qo(o),n.A.debug("Rider selected in dropdown:",o?"".concat(o.firstname," ").concat(o.lastname):"None")},renderInput:e=>(0,ae.jsx)(W.A,(0,t.A)((0,t.A)({},e),{},{placeholder:"Choose Rider",InputProps:(0,t.A)((0,t.A)({},e.InputProps),{},{startAdornment:(0,ae.jsx)(m.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5,mr:.25,flexShrink:0},children:(0,ae.jsx)(Ye,{color:"#8b5cf6",children:(0,ae.jsx)(u.bsz,{size:14})})})}),sx:ke("#8b5cf6")}))})}),(0,ae.jsx)(B.A,{sx:{p:3,pt:1},children:(0,ae.jsxs)(m.A,{direction:"row",spacing:1.5,sx:{width:1},children:[(0,ae.jsx)(H.A,{fullWidth:!0,variant:"outlined",onClick:()=>Zo(!1),sx:{borderRadius:999,py:1.1,fontWeight:700,borderColor:ve,color:fe,"&:hover":{borderColor:be,bgcolor:me}},children:"Cancel"}),(0,ae.jsx)(H.A,{fullWidth:!0,variant:"contained",onClick:()=>{Eo(!0),n.A.info("Initiating rider assignment change for order ID ".concat(null===To||void 0===To?void 0:To.orderid," to rider: ").concat(null===Vo||void 0===Vo?void 0:Vo.firstname," ").concat(null===Vo||void 0===Vo?void 0:Vo.lastname)),wr.mutate({selectedRider:Vo,selectedRow:To})},sx:{borderRadius:999,py:1.1,fontWeight:800,bgcolor:"#8b5cf6",boxShadow:"0 6px 18px ".concat(ye("#8b5cf6")),"&:hover":{bgcolor:"#7c3aed"}},children:"Change Rider"})]})})]}),(0,ae.jsxs)(O.A,{open:Ge,onClose:()=>Ve(!1),PaperProps:{elevation:0,sx:{borderRadius:3,border:"1px solid",borderColor:ve,boxShadow:pe,overflow:"hidden"}},children:[(0,ae.jsx)(w.A,{sx:{height:4,background:"linear-gradient(90deg, #f59e0b 0%, ".concat(Se("#f59e0b")," 100%)")}}),(0,ae.jsx)(J.A,{align:"left",sx:{p:3,pb:1.5},children:(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,ae.jsx)(v.A,{sx:{width:44,height:44,bgcolor:Se("#f59e0b"),color:"#f59e0b"},children:(0,ae.jsx)(u.tjE,{size:22})}),(0,ae.jsxs)(m.A,{children:[(0,ae.jsx)(j.A,{variant:"h4",sx:{fontWeight:800,color:ge},children:"Date Range"}),(0,ae.jsx)(j.A,{variant:"caption",sx:{color:fe},children:"Pick a window to filter the deliveries"})]})]})}),(0,ae.jsx)(N.A,{sx:{width:"100%"},className:"datedialog",children:(0,ae.jsx)($.U,{open:Ge,toggle:()=>Ve(!Ge),id:"daterange1",onChange:e=>{"All"===e.label?(Ne(""),Je(""),Ve(!1)):(Ne(c()(e.startDate).format("YYYY-MM-DD")),Je(c()(e.endDate).format("YYYY-MM-DD")),e.label?Xe(e.label):Xe("")),console.log(e)},definedRanges:[{label:"Today",startDate:new Date,endDate:new Date},{label:"Yesterday",startDate:(0,Z.A)(new Date,-1),endDate:(0,Z.A)(new Date,-1)},{label:"Tomorrow",startDate:(0,Z.A)(new Date,1),endDate:(0,Z.A)(new Date,1)},{label:"This Week",startDate:(0,U.A)(new Date),endDate:(0,G.A)(new Date)},{label:"Last Week",startDate:(0,U.A)((0,V.A)(new Date,-1)),endDate:(0,G.A)((0,V.A)(new Date,-1))},{label:"Last 7 Days",startDate:(0,V.A)(new Date,-1),endDate:new Date},{label:"This Month",startDate:(0,Q.A)(new Date),endDate:(0,X.A)(new Date)},{label:"Last Month",startDate:(0,Q.A)((0,_.A)(new Date,-1)),endDate:(0,X.A)((0,_.A)(new Date,-1))}]})}),(0,ae.jsx)(m.A,{direction:"row",justifyContent:"flex-end",sx:{width:"100%",p:2.5,pt:1},children:(0,ae.jsx)(H.A,{variant:"contained",onClick:()=>{Ve(!1)},sx:{borderRadius:999,px:3,py:1,fontWeight:800,bgcolor:"#f59e0b",boxShadow:"0 6px 18px ".concat(ye("#f59e0b")),"&:hover":{bgcolor:"#d97706"}},children:"Apply"})})]}),(0,ae.jsxs)(O.A,{fullWidth:!0,open:he,onClose:Cr,scroll:"paper",maxWidth:"sm",TransitionComponent:q.s,PaperProps:{elevation:0,sx:{borderRadius:3,border:"1px solid",borderColor:ve,boxShadow:pe,overflow:"hidden"}},children:[(0,ae.jsx)(w.A,{sx:{height:4,background:"linear-gradient(90deg, #10b981 0%, ".concat(Se("#10b981")," 100%)")}}),(0,ae.jsx)(J.A,{sx:{p:3,pb:1.5},children:(0,ae.jsxs)(m.A,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,ae.jsx)(v.A,{sx:{width:44,height:44,bgcolor:Se("#10b981"),color:"#10b981"},children:(0,ae.jsx)(u.mU9,{size:22})}),(0,ae.jsxs)(m.A,{children:[(0,ae.jsx)(j.A,{variant:"h4",sx:{fontWeight:800,color:ge},children:"Update Delivery Status"}),(0,ae.jsx)(j.A,{variant:"caption",sx:{color:fe},children:null!==lo&&void 0!==lo&&lo.orderid?"Order #".concat(lo.orderid):"Modify delivery details"})]})]})}),(0,ae.jsx)(N.A,{dividers:!0,sx:{p:3,bgcolor:me},children:(0,ae.jsxs)(S.Ay,{container:!0,spacing:2,children:[[{label:"KMs",value:_e,set:e=>$e(e),color:"#ef4444"},{label:"Actual KMs",value:eo,set:e=>oo(+e),color:"#10b981"},{label:"Delivery Latitude",value:ao,set:e=>co(e),color:"#06b6d4"},{label:"Delivery Longitude",value:ho,set:e=>xo(e),color:"#06b6d4"}].map((e=>(0,ae.jsxs)(S.Ay,{item:!0,xs:12,sm:6,children:[(0,ae.jsx)(j.A,{variant:"caption",sx:{fontWeight:700,color:fe,letterSpacing:.5,textTransform:"uppercase"},children:e.label}),(0,ae.jsx)(W.A,{fullWidth:!0,value:e.value,type:"number",onChange:o=>e.set(o.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:2,bgcolor:"#fff","& fieldset":{borderColor:ve},"&:hover fieldset":{borderColor:e.color},"&.Mui-focused fieldset":{borderColor:e.color,borderWidth:2},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(ye(e.color))}}}})]},e.label))),(0,ae.jsxs)(S.Ay,{item:!0,xs:12,children:[(0,ae.jsx)(j.A,{variant:"caption",sx:{fontWeight:700,color:fe,letterSpacing:.5,textTransform:"uppercase"},children:"Amount"}),(0,ae.jsx)(W.A,{fullWidth:!0,type:"number",value:ro,onChange:e=>to(+e.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:2,bgcolor:"#fff","& fieldset":{borderColor:ve},"&:hover fieldset":{borderColor:"#10b981"},"&.Mui-focused fieldset":{borderColor:"#10b981",borderWidth:2},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(ye("#10b981"))}}}})]}),(0,ae.jsxs)(S.Ay,{item:!0,xs:12,children:[(0,ae.jsx)(j.A,{variant:"caption",sx:{fontWeight:700,color:fe,letterSpacing:.5,textTransform:"uppercase"},children:"Status"}),(0,ae.jsx)(W.A,{select:!0,fullWidth:!0,value:go,onChange:e=>fo(e.target.value),SelectProps:{MenuProps:{PaperProps:{sx:{borderRadius:2,mt:.5,boxShadow:pe}}}},sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:2,bgcolor:"#fff","& fieldset":{borderColor:ve},"&:hover fieldset":{borderColor:"#6366f1"},"&.Mui-focused fieldset":{borderColor:"#6366f1",borderWidth:2},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(ye("#6366f1"))}}},children:["pending","accepted","started","arrived","delivered","cancelled"].map((e=>{const o=We[e]||{label:e,color:"#6366f1",icon:u.bfP},r=o.icon;return(0,ae.jsxs)(E.A,{value:e,sx:{gap:1},children:[(0,ae.jsx)(Ye,{color:o.color,size:22,children:(0,ae.jsx)(r,{size:13})}),o.label]},e)}))})]}),(0,ae.jsxs)(S.Ay,{item:!0,xs:12,children:[(0,ae.jsx)(j.A,{variant:"caption",sx:{fontWeight:700,color:fe,letterSpacing:.5,textTransform:"uppercase"},children:"Notes"}),(0,ae.jsx)(W.A,{value:no,fullWidth:!0,multiline:!0,minRows:2,onChange:e=>io(e.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:2,bgcolor:"#fff","& fieldset":{borderColor:ve},"&:hover fieldset":{borderColor:"#6366f1"},"&.Mui-focused fieldset":{borderColor:"#6366f1",borderWidth:2},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(ye("#6366f1"))}}}})]})]})}),(0,ae.jsx)(B.A,{sx:{p:3},children:(0,ae.jsxs)(m.A,{direction:"row",spacing:1.5,sx:{width:1},children:[(0,ae.jsx)(H.A,{fullWidth:!0,variant:"outlined",onClick:Cr,sx:{borderRadius:999,py:1.1,fontWeight:700,borderColor:ve,color:fe,"&:hover":{borderColor:be,bgcolor:me}},children:"Close"}),(0,ae.jsx)(H.A,{fullWidth:!0,variant:"contained",onClick:()=>{_e?eo?ao?ho?ro?nt.mutate({deliveryid:lo.deliveryid,orderheaderid:lo.orderheaderid,orderstatus:go,deliverytime:c()().format("YYYY-MM-DD HH:mm:ss"),deliverylat:ao,deliverylong:ho,kms:_e,cumulativekms:eo,deliveryamt:parseFloat(ro),notes:no,userid:+To.userid}):Sr("Fill Delivery Amount","warning"):Sr("Fill Delivery Longitude","warning"):Sr("Fill Delivery Latitude","warning"):Sr("Fill Actual Kms","warning"):Sr("Fill Kms","warning")},sx:{borderRadius:999,py:1.1,fontWeight:800,bgcolor:"#10b981",boxShadow:"0 6px 18px ".concat(ye("#10b981")),"&:hover":{bgcolor:"#059669"}},children:"Update"})]})})]})]})}},56311:(e,o,r)=>{r.d(o,{A:()=>u});var t=r(89379),n=r(9950),i=r(2660),l=r(2046),s=r(83274),d=r(25333),a=r(97125),c=r(7762),h=r(52097),x=r(44414);const u=e=>{let{value:o,onChange:r,onDebouncedChange:u,debounceTime:p=500,placeholder:g="Search (ctrl+k)",sx:f}=e;const b=(0,n.useRef)(null),[v]=(0,h.d7)(o,p);return(0,n.useEffect)((()=>{u&&u(v)}),[v,u]),(0,n.useEffect)((()=>{const e=e=>{var o;"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),null===(o=b.current)||void 0===o||o.focus());"Escape"===e.key&&document.activeElement===b.current&&b.current.blur()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[]),(0,x.jsx)(i.A,{sx:(0,t.A)({},f),inputRef:b,placeholder:g,autoComplete:"off",value:o,fullWidth:!0,onChange:e=>r(e.target.value),startAdornment:(0,x.jsx)(l.A,{position:"start",sx:{mr:-.5},children:(0,x.jsx)(a.A,{})}),endAdornment:(0,x.jsx)(s.A,{title:"Clear",children:(0,x.jsx)(d.A,{sx:{visibility:o?"visible":"hidden"},onClick:()=>r(""),children:(0,x.jsx)(c.A,{})})})})}},58691:(e,o,r)=>{r.d(o,{A:()=>s});r(9950);var t=r(16491),n=r(46639),i=r(62217),l=r(44414);function s(e){let{size:o=70,imgSize:r=40,alt:s="loader"}=e;return(0,l.jsxs)(t.A,{position:"relative",display:"inline-flex",justifyContent:"center",alignItems:"center",children:[(0,l.jsx)(n.A,{size:o}),(0,l.jsx)(t.A,{position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",sx:{width:r,height:r},children:(0,l.jsx)("img",{src:i,alt:s,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"}})})]})}},59212:(e,o,r)=>{r.d(o,{A:()=>x});var t=r(89379),n=r(9950),i=r(93230),l=r(41413),s=r(77922),d=r(29925),a=r(26910),c=r(31222),h=r(44414);const x=(0,n.forwardRef)(((e,o)=>{let{setAppId:r,setLocoName:x,setPage:u,sx:p,textfeildSx:g,textfieldSx:f,pill:b=!1,accentColor:v="#6366f1",icon:A,placeholder:m="Select Zone",paperComponent:j}=e;const[w,S]=(0,n.useState)(JSON.parse(localStorage.getItem("applocations")||"[]"));(0,n.useEffect)((()=>{0===w.length&&(async()=>{try{const e=localStorage.getItem("userid");if(!e)return;const o=await a.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/partners/getlocations/?userid=").concat(e));if(o.data.status){const e=[...o.data.details,{locationname:"All",applocationid:0}];localStorage.setItem("applocations",JSON.stringify(e)),S(e)}}catch(e){console.error("Error fetching locations in LocationAutocomplete:",e)}})()}),[w.length]);const y=e=>"".concat(v).concat(e),C=y("08"),k=y("26"),W=y("55"),R=y("18"),D=b?{cursor:"pointer","& .MuiOutlinedInput-root":{borderRadius:"999px",bgcolor:C,fontWeight:600,color:"#0f172a",paddingRight:"8px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s, background-color 0.2s","& fieldset":{borderColor:W,borderWidth:1.5},"&:hover fieldset":{borderColor:v},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(k)},"&.Mui-focused fieldset":{borderColor:v,borderWidth:2}},"& .MuiAutocomplete-endAdornment .MuiSvgIcon-root":{color:v}}:{},P=b&&(0,h.jsx)(i.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5,mr:.25,flexShrink:0},children:(0,h.jsx)(l.A,{sx:{width:24,height:24,bgcolor:R,color:v,transition:"background-color 0.15s, color 0.15s"},children:A||(0,h.jsx)(c.HPi,{size:14})})});return(0,h.jsx)(s.A,{id:"location-autocomplete",options:w||[],getOptionLabel:e=>{var o;return null!==(o=null===e||void 0===e?void 0:e.locationname)&&void 0!==o?o:""},PaperComponent:j,sx:(0,t.A)({},p),onChange:(e,o,t)=>{"clear"===t?(null===r||void 0===r||r(0),null===x||void 0===x||x(""),null===u||void 0===u||u(0)):o&&(null===r||void 0===r||r(o.applocationid),null===x||void 0===x||x(o.locationname),null===u||void 0===u||u(0))},renderInput:e=>b?(0,h.jsx)(d.A,(0,t.A)((0,t.A)({},e),{},{inputRef:o,placeholder:m,InputProps:(0,t.A)((0,t.A)({},e.InputProps),{},{startAdornment:P}),sx:(0,t.A)((0,t.A)({},D),f||g||{})})):(0,h.jsx)(d.A,(0,t.A)((0,t.A)({},e),{},{inputRef:o,label:"Select Zones",sx:(0,t.A)({},f||g||{})}))})}))},62217:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAA+CAYAAABzwahEAAAPnUlEQVR4AdVae3AU9R3/7d4jdyGQQKAhECBAJBSmEAtFSQUjqPgAHGlhRm0lDkWY6Tg+O9qiErR26h8WR8ZWqTMN1ur4qMpDrTyjtDwDJloeCYiBvAgkaZ53l7vb3X4/v9vfZS/Zu9uFwLSfmb3d293f7u/z+z5/399K7CphdW5JrupgBZosZ0ialmu8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AOAQNhfcabrm9J/XtyGPIKn1Lp6B3X19tN6gJ/m29ymSUgKUlMzh2aEncUDmdRe1tXeaPce/dilbxgAOT99evbEQdOuHebJvsHrSC2gpec0Ky/RmNrlV3wVneHWrw427/hHc7C+k/IJEFZ1KSOjDFDIEtLmSRb1LUR94/dZeY+tVROoPDaQo1TQTS9PoSlfik4cA0B9c7mpc1z6GAByghISoZkjivI8MuVRjqEjU52DRuossXir+UJdFHcCXfW+b09VtR9tMnReoefxNJqeCbsF6R7KygL03B56N8/OWK/3tkTaNnHWa/M8zrNIru8iOik0GeADQGHFTabh0q85qL/8Kwu0xSBgTwPB6BiLGMZn83SZzmuQMAhTWz5voEeGoNcgTtWUHiqW8OO8vLww+R5lz5494UT2PBDEY9rSQqOTHAmP91TFdNGChJsyPTdlelztqcMu6i+XvNiIkBQRHlcPHGv6sUbHIKzo56J1AZBkvR5cSFhUVBR2CbD69bIpysvLecdoAHqINOytm0ijJt9J3r+TVBLHXfrGkwsiJRIMLF1i76MBEue7qE0XqTPadYiNnFen3j6Ad5HGYSDwTcslkQYGamVULLrLpH7y6dOnuY1TGctFFR0hcYfhvujinQ6eaNBgYc6sEHm+0WAKqatEWJkwYYI6depUjYhbtuWrBW775GGd1FEXFQA8FFsR8+HRMdFBKocgPrTvRkgnh4l70ijPxtwAzpLnCLpDvSztvFqQ9C8PuAPEINDeTdpgjADYjOFQhESn3s6hP+OKr9dfSUhCaiIcYjNIMur52f850f95/BfoYlARf1CQvwAAAABJRU5ErkJggg=="},96646:(e,o,r)=>{r.d(o,{r:()=>d});var t=r(9213),n=r(21671),i=r(82917),l=r(93230),s=r(44414);const d=e=>{let{rowsPerPage:o=5,col:r=1}=e;return(0,s.jsx)(s.Fragment,{children:Array.from(new Array(o)).map(((e,o)=>(0,s.jsxs)(t.A,{children:[(0,s.jsx)(n.A,{children:(0,s.jsx)(i.A,{variant:"circular",width:24,height:24})}),(0,s.jsx)(n.A,{children:(0,s.jsx)(i.A,{variant:"text",width:30})}),Array.from({length:r}).map(((e,o)=>(0,s.jsx)(n.A,{children:(0,s.jsxs)(l.A,{spacing:.5,children:[(0,s.jsx)(i.A,{variant:"text",width:100}),(0,s.jsx)(i.A,{variant:"text",width:80})]})},o))),(0,s.jsx)(n.A,{children:(0,s.jsx)(i.A,{variant:"text",width:150})}),(0,s.jsx)(n.A,{children:(0,s.jsx)(i.A,{variant:"rounded",width:60,height:24})}),(0,s.jsx)(n.A,{align:"center",children:(0,s.jsxs)(l.A,{direction:"row",spacing:1,justifyContent:"flex-end",children:[(0,s.jsx)(i.A,{variant:"circular",width:28,height:28}),(0,s.jsx)(i.A,{variant:"circular",width:28,height:28})]})})]},o)))})}}}]); |