Files
Express_console_build/build/static/js/8846.23c0ba58.chunk.js

1 line
54 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[8846],{11041:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Ce});var o=r(89379),n=r(9950),i=r(26910),a=r(60010),l=r(36150),s=r(2235),c=r(41413),d=r(83274),x=r(16491),h=r(93230),u=r(82917),p=r(82053),m=r(47223),g=r(55158),f=r(60899),b=r(77922),v=r(29925),A=r(82223),j=r(1320),y=r(25333),w=r(15769),S=r(69780),k=r(9213),D=r(21671),M=r(34075),C=r(74745),z=r(96583),I=r(40033),W=r(28170),P=r(25277),R=r(79739),Y=r(14857),T=r(31222),L=r(43302),N=r(99810),O=r(49029),F=r(47113),E=r(33516),K=r(82215),H=r(2527),_=r.n(H),B=(r(55392),r(4159)),q=r.n(B),J=r(57560),Z=r(94826),G=r(44414),U=r(36220);q().extend(U);const V=new(_().Icon)({iconUrl:"https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],shadowSize:[41,41]}),$=new(_().Icon)({iconUrl:"https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],shadowSize:[41,41]}),X=e=>{let{coordinates:t,additionalProps:r,order:o,setMapOpen:i}=e;console.log("additionalProps",r);const a=(0,n.useRef)(null),l=(0,Y.A)(),[s,c]=(0,n.useState)([]),[d,u]=(0,n.useState)(!1);if((0,n.useEffect)((()=>{if(a.current&&t.length>0){const e=[[Math.min(...t.map((e=>e.lat))),Math.min(...t.map((e=>e.lng)))],[Math.max(...t.map((e=>e.lat))),Math.max(...t.map((e=>e.lng)))]];a.current.fitBounds(e)}}),[t]),(0,n.useEffect)((()=>{(async()=>{if(u(!0),t.length<2)return c([]),void u(!1);const e=(e,t)=>{if(e.length<=t)return e;const r=Math.ceil(e.length/t),o=e.filter(((e,t)=>t%r===0)),n=e[e.length-1];return o[o.length-1]!==n&&o.push(n),o};try{const r=e(t,90).map((e=>"".concat(e.lng,",").concat(e.lat))).join(";"),o="https://router.project-osrm.org/match/v1/driving/".concat(r,"?overview=full&geometries=geojson&gaps=ignore&tidy=true"),n=await fetch(o),i=await n.json();if(i.matchings&&i.matchings.length>0){const e=i.matchings.flatMap((e=>{var t;return((null===(t=e.geometry)||void 0===t?void 0:t.coordinates)||[]).map((e=>{let[t,r]=e;return{lat:r,lng:t}}))}));if(e.length>=2)return c(e),void u(!1)}}catch(r){console.warn("OSRM Match error, trying route fallback:",r)}try{const r=e(t,25).map((e=>"".concat(e.lng,",").concat(e.lat))).join(";"),o="https://router.project-osrm.org/route/v1/driving/".concat(r,"?overview=full&geometries=geojson"),n=await fetch(o),i=await n.json();if(i.routes&&i.routes[0]){const e=i.routes[0].geometry.coordinates.map((e=>{let[t,r]=e;return{lat:r,lng:t}}));c(e)}else c(t)}catch(o){console.error("OSRM Route fallback error:",o),c(t)}finally{u(!1)}})()}),[t]),!t||0===t.length)return null;const m=t[0],g=t[t.length-1],f=t[Math.floor(t.length/2)],b=e=>{let{label:t,value:r}=e;return(0,G.jsxs)(h.A,{direction:"row",spacing:1,alignItems:"center",children:[(0,G.jsxs)(p.A,{variant:"subtitle1",sx:{fontWeight:600},children:[t,":"]}),(0,G.jsx)(P.A,{label:r||"0.00",color:"primary",sx:{fontWeight:700}})]})};return(0,G.jsxs)(x.A,{sx:{width:"100%",height:"100vh",position:"relative",overflow:"hidden"},children:[d&&(0,G.jsx)(Z.A,{}),(0,G.jsx)(P.A,{label:"Close",icon:(0,G.jsx)(J.A,{style:{fontSize:18}}),onClick:()=>i(!1),sx:{position:"absolute",top:12,right:12,zIndex:2e3,bgcolor:l.palette.error.main,color:"#fff",fontWeight:600,borderRadius:"12px",px:1.5,py:.5,boxShadow:l.shadows[4],cursor:"pointer","& .MuiChip-icon":{color:"#fff"}}}),(0,G.jsxs)(N.W,{center:f,zoom:14,scrollWheelZoom:!0,style:{height:"100%",width:"100%"},ref:a,children:[(0,G.jsx)(O.e,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,G.jsx)(F.p,{position:m,icon:V,children:(0,G.jsx)(E.m,{direction:"bottom",children:"Pickup: ".concat(q()(r.riderStart).format("DD-MM-YYYY hh:mm A"))})}),(0,G.jsx)(F.p,{position:g,icon:$,children:(0,G.jsx)(E.m,{direction:"bottom",children:"Drop: ".concat(q()(r.riderEnd).format("DD-MM-YYYY hh:mm A"))})}),s.length>0&&(0,G.jsx)(K.R,{positions:s,pathOptions:{color:"blue",weight:5}})]}),(0,G.jsx)(x.A,{sx:{position:"absolute",bottom:0,width:"100%",bgcolor:"rgba(255,255,255,0.96)",p:2,boxShadow:l.shadows[3],zIndex:1500},children:(0,G.jsxs)(h.A,{direction:"row",flexWrap:"wrap",rowGap:1.5,columnGap:3,alignItems:"center",children:[(0,G.jsx)(b,{label:"Tenant",value:null===o||void 0===o?void 0:o.tenantname}),(0,G.jsx)(b,{label:"Rider",value:null===o||void 0===o?void 0:o.ridername}),(0,G.jsx)(b,{label:"Pickup",value:null===o||void 0===o?void 0:o.pickupcustomer}),(0,G.jsx)(b,{label:"Drop",value:null===o||void 0===o?void 0:o.deliverycustomer}),(0,G.jsx)(b,{label:"Kms",value:null===o||void 0===o?void 0:o.kms}),(0,G.jsx)(b,{label:"Actual Kms",value:null===o||void 0===o?void 0:o.actualkms}),(0,G.jsx)(b,{label:"Rider Kms",value:null===o||void 0===o?void 0:o.riderkms})]})})]})};var Q=r(81425),ee=r(90376),te=r(52351),re=r(8881),oe=r(35678),ne=r(56311),ie=r(58691),ae=r(59212),le=r(20466);function se(e){let{rows:t=5,columns:r=6,height:o=40}=e;return(0,G.jsx)(G.Fragment,{children:[...Array(t)].map(((e,t)=>(0,G.jsx)(k.A,{children:[...Array(r)].map(((e,t)=>(0,G.jsx)(D.A,{children:(0,G.jsx)(u.A,{variant:"rectangular",height:o,width:70,animation:"wave"})},t)))},t)))})}var ce=r(23787),de=r(36220);q().extend(de);const xe=(e,t,r)=>{(0,re.M8)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:r||1500})},he={radiusPill:999,radiusCard:16,shadowSoft:"0 14px 40px rgba(15, 23, 42, 0.10)",shadowMd:"0 8px 24px rgba(15, 23, 42, 0.08)",shadowPop:"0 18px 50px rgba(15, 23, 42, 0.18)",textPrimary:"#0f172a",textSecondary:"#64748b",textMuted:"#94a3b8",borderSubtle:"#e2e8f0",divider:"#f1f5f9",surface:"#ffffff",surfaceAlt:"#f8fafc"},ue=(e,t)=>"".concat(e).concat(t),pe=e=>ue(e,"08"),me=e=>ue(e,"18"),ge=e=>ue(e,"26"),fe=e=>ue(e,"55"),be="#662582",ve="#9255AB",Ae=e=>(0,G.jsx)(s.A,(0,o.A)((0,o.A)({},e),{},{sx:{mt:.75,borderRadius:2,boxShadow:he.shadowPop,border:"1px solid",borderColor:"divider",overflow:"hidden"}})),je=e=>{let{color:t,selected:r,size:o=24,children:n}=e;return(0,G.jsx)(c.A,{sx:{width:o,height:o,bgcolor:r?t:me(t),color:r?"#fff":t,transition:"background-color 0.15s, color 0.15s"},children:n})},ye=e=>({"& .MuiOutlinedInput-root":{borderRadius:he.radiusPill+"px",bgcolor:pe(e),fontWeight:600,"& fieldset":{borderColor:fe(e),borderWidth:1.5},"&:hover fieldset":{borderColor:e},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(ge(e))},"&.Mui-focused fieldset":{borderColor:e,borderWidth:2}}}),we={all:{label:"All",color:be,icon:T.YBc},pending:{label:"Pending",color:"#f59e0b",icon:T.tX0},accepted:{label:"Accepted",color:"#6366f1",icon:T.Azs},arrived:{label:"Arrived",color:"#06b6d4",icon:T.gwi},picked:{label:"Picked",color:"#8b5cf6",icon:T.gsJ},active:{label:"Active",color:"#14b8a6",icon:T.pk7},delivered:{label:"Delivered",color:"#10b981",icon:T.mU9},skipped:{label:"Skipped",color:"#f97316",icon:T.ivF},cancelled:{label:"Cancelled",color:"#ef4444",icon:T.uDv}},Se=["all","pending","accepted","arrived","picked","active","delivered","skipped","cancelled"],ke=e=>{let{color:t,icon:r,label:o,tooltip:n}=e;return(0,G.jsx)(d.A,{title:n||"",placement:"top",children:(0,G.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1,py:.375,borderRadius:999,bgcolor:pe(t),border:"1px solid ".concat(fe(t)),color:t,fontSize:11,fontWeight:800,minWidth:80,justifyContent:"center",whiteSpace:"nowrap"},children:[r,o]})})},De=e=>{let{value:t,formatDate:r,formatTime:o,success:n}=e;return t?(0,G.jsxs)(h.A,{spacing:.25,children:[(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary,fontWeight:600,whiteSpace:"nowrap"},children:r(t)}),(0,G.jsxs)(h.A,{direction:"row",alignItems:"center",spacing:.5,children:[(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textPrimary,fontWeight:800,whiteSpace:"nowrap"},children:o(t)}),n&&(0,G.jsx)(L.cxC,{style:{color:"#10b981",fontSize:12}})]})]}):(0,G.jsxs)(h.A,{spacing:.5,children:[(0,G.jsx)(u.A,{animation:!1,variant:"text",width:70,height:12}),(0,G.jsx)(u.A,{animation:!1,variant:"text",width:55,height:14})]})};function Me(e,t){const r=e=>e*Math.PI/180,o=r(e[0]),n=r(t[0]),i=r(t[0]-e[0]),a=r(t[1]-e[1]),l=Math.sin(i/2)**2+Math.cos(o)*Math.cos(n)*Math.sin(a/2)**2;return 12742*Math.asin(Math.min(1,Math.sqrt(l)))}function Ce(){const e=(0,Y.A)(),t=(0,m.A)(e.breakpoints.down("md")),r=(0,n.useRef)(),u=(0,n.useRef)(),L=(0,n.useRef)(null),N=(0,n.useRef)(null),O=localStorage.getItem("userid"),[F,E]=(0,n.useState)(0),[K,H]=(0,n.useState)(50),[_,B]=(0,n.useState)("All"),[J,U]=(0,n.useState)(q()().format("YYYY-MM-DD")),[V,$]=(0,n.useState)(q()().format("YYYY-MM-DD")),[de,ue]=(0,n.useState)(!1),[Ce,ze]=(0,n.useState)(!1),[Ie,We]=(0,n.useState)("Today"),[Pe,Re]=(0,n.useState)(0),[Ye,Te]=(0,n.useState)(""),[Le,Ne]=(0,n.useState)(""),[Oe,Fe]=(0,n.useState)([]),[Ee,Ke]=(0,n.useState)(),[He,_e]=(0,n.useState)(),[Be,qe]=(0,n.useState)({}),[Je,Ze]=(0,n.useState)(!1);let[Ge,Ue]=(0,n.useState)(0),[Ve,$e]=(0,n.useState)(0),[Xe,Qe]=(0,n.useState)(0),[et,tt]=(0,n.useState)(0),[rt,ot]=(0,n.useState)(0),[nt,it]=(0,n.useState)(0),[at,lt]=(0,n.useState)(0),[st,ct]=(0,n.useState)(0),[dt,xt]=(0,n.useState)(0);const[ht,ut]=(0,n.useState)("All"),[pt,mt]=(0,n.useState)(0),[gt,ft]=(0,n.useState)(0),[bt,vt]=(0,n.useState)(null),[At,jt]=(0,n.useState)(null),[yt,wt]=(0,n.useState)(),[St,kt]=(0,n.useState)(null),[Dt,Mt]=(0,n.useState)(!1),[Ct,zt]=(0,n.useState)(!1),It={all:Ge,pending:Xe,accepted:rt,arrived:st,picked:nt,active:at,delivered:Ve,skipped:dt,cancelled:et};function Wt(e,t,r,o){const n=(r-e)*(Math.PI/180),i=(o-t)*(Math.PI/180),a=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*(Math.PI/180))*Math.cos(r*(Math.PI/180))*Math.sin(i/2)*Math.sin(i/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}(0,n.useEffect)((()=>{ft(0),vt(null),mt(0),jt(null),wt(null),kt(null)}),[Pe]),(0,n.useEffect)((()=>{mt(0),jt(null),kt(null)}),[gt]),(0,n.useEffect)((()=>{kt(null)}),[pt]);const Pt=async e=>{zt(!0);try{const t=(await i.A.get("".concat("https://jupiter.nearle.app/live/api/v3","/deliveries/getdeliverylogs/?deliveryid=").concat(e))).data.details;if(Array.isArray(t)&&0!==t.length){const e=t.map((e=>{var t,r,o;const n=null!==e&&void 0!==e&&e.logdate?q()(e.logdate):null;return{lat:parseFloat(null!==(t=null===e||void 0===e?void 0:e.latitude)&&void 0!==t?t:null===e||void 0===e?void 0:e.lat),lng:parseFloat(null!==(r=null!==(o=null===e||void 0===e?void 0:e.longitude)&&void 0!==o?o:null===e||void 0===e?void 0:e.lng)&&void 0!==r?r:null===e||void 0===e?void 0:e.lon),logdate:null===e||void 0===e?void 0:e.logdate,_ts:n&&n.isValid()?n.valueOf():Number.MAX_SAFE_INTEGER}})).filter((e=>Number.isFinite(e.lat)&&Number.isFinite(e.lng))).sort(((e,t)=>e._ts-t._ts));if(0!==e.length){Ke(e[0].logdate),_e(e[e.length-1].logdate);const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Array.isArray(e)||0===e.length)return[];const r=e.filter((e=>Number.isFinite(e.lat)&&Number.isFinite(e.lng)&&(Math.abs(e.lat)>.1||Math.abs(e.lng)>.1)));if(0===r.length)return[];if(1===r.length)return[{lat:r[0].lat,lng:r[0].lng,logdate:r[0].logdate,_ts:r[0]._ts}];const o=null!=t.processNoise?t.processNoise:1e-10,n=null!=t.measurementNoise?t.measurementNoise:2e-9,i=null!=t.outlierGate?t.outlierGate:9,a=null!=t.maxSpeedKmh?t.maxSpeedKmh:120,l=e=>e._ts||(e.logdate?new Date(e.logdate).getTime():0);let s=0;for(;s<r.length-1;){const e=r[s],t=r[s+1],o=l(e),n=l(t)||o+1e3,i=Math.max(.001,(n-o)/1e3);if(Me([e.lat,e.lng],[t.lat,t.lng])/i*3600<=a)break;if(s+2<r.length){const e=r[s+2],o=l(e)||n+1e3,i=Math.max(.001,(o-n)/1e3);if(Me([t.lat,t.lng],[e.lat,e.lng])/i*3600<=a){s+=1;continue}}s++}const c=[r[s]];let d=l(r[s]);for(let p=s+1;p<r.length;p++){const e=r[p],t=l(e)||d+1e3,o=Math.max(.001,(t-d)/1e3),n=c[c.length-1];Me([n.lat,n.lng],[e.lat,e.lng])/o*3600>a||(c.push(e),d=t)}if(c.length<2)return c.map((e=>({lat:e.lat,lng:e.lng,logdate:e.logdate,_ts:e._ts})));const x=e=>{const t=c.length,r=new Array(t),a=new Array(t),s=new Array(t),d=new Array(t),x=new Array(t),h=l(c[0]),u=l(c[1]),p=Math.max(.1,(u-h)/1e3),m=(c[1][e]-c[0][e])/p;r[0]=[c[0][e],m],a[0]=[n,0,0,1],s[0]=r[0].slice(),d[0]=a[0].slice(),x[0]=0;let g=h;for(let b=1;b<t;b++){const t=l(c[b])||g+1e3,h=Math.max(.1,(t-g)/1e3);g=t,x[b]=h;const[u,p]=r[b-1],m=u+p*h,f=p,[v,A,j,y]=a[b-1],w=h*h,S=w*h,k=v+h*(A+j)+w*y+S*h/4*o,D=A+h*y+S/2*o,M=j+h*y+S/2*o,C=y+w*o;s[b]=[m,f],d[b]=[k,D,M,C];const z=c[b][e]-m,I=k+n;if(z*z/I>i){r[b]=[m,f],a[b]=[k,D,M,C];continue}const W=k/I,P=M/I,R=m+W*z,Y=f+P*z;r[b]=[R,Y],a[b]=[(1-W)*k,(1-W)*D,M-P*k,C-P*D]}const f=new Array(t);f[t-1]=r[t-1].slice();for(let o=t-2;o>=0;o--){const e=x[o+1],[t,n,i,l]=a[o],c=t+e*n,h=n,u=i+e*l,p=l,[m,g,b,v]=d[o+1],A=m*v-g*b;if(!Number.isFinite(A)||Math.abs(A)<1e-30){f[o]=r[o].slice();continue}const j=v/A,y=-g/A,w=-b/A,S=m/A,k=c*j+h*w,D=c*y+h*S,M=u*j+p*w,C=u*y+p*S,z=f[o+1][0]-s[o+1][0],I=f[o+1][1]-s[o+1][1];f[o]=[r[o][0]+k*z+D*I,r[o][1]+M*z+C*I]}return f.map((e=>e[0]))},h=x("lat"),u=x("lng");return c.map(((e,t)=>({lat:h[t],lng:u[t],logdate:e.logdate,_ts:e._ts})))}(e),r=t.map((e=>({lat:e.lat,lng:e.lng})));Fe(r),function(e){let t=0;for(let r=0;r<e.length-1;r++){const{lat:o,lng:n}=e[r],{lat:i,lng:a}=e[r+1];t+=Wt(o,n,i,a)}}(r),ze(!0)}else xe("No Valid Logs Found","error",2e3)}else xe("No Logs Found ","error",2e3)}catch(t){console.log("getdeliverylogs",t)}finally{zt(!1)}},{data:Rt,isLoading:Yt,isError:Tt,error:Lt,fetchNextPage:Nt,hasNextPage:Ot,isFetchingNextPage:Ft}=(0,a.q)({queryKey:["fetchdeliveries",Pe,O,ht,J,V,K,Le,gt,pt,(null===yt||void 0===yt?void 0:yt.userid)||0],queryFn:Q.tL,getNextPageParam:e=>{var t;return null!==(t=e.nextPage)&&void 0!==t?t:void 0},refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!0}),Et=(null===Rt||void 0===Rt?void 0:Rt.pages.flatMap((e=>e.rows)))||[];(0,n.useEffect)((()=>{if(!Ot)return;const e=new IntersectionObserver((e=>{e[0].isIntersecting&&Nt()}),{root:document.querySelector(".MuiTableContainer-root"),rootMargin:"0px",threshold:1});return r.current&&e.observe(r.current),()=>{r.current&&e.unobserve(r.current)}}),[Ot,Nt]);const{data:Kt,isLoading:Ht,isError:_t,error:Bt}=(0,l.I)({queryKey:["tenantlist",Pe],queryFn:()=>(0,Q.Mn)(Pe),enabled:0!==Pe}),{data:qt,isLoading:Jt,isError:Zt,error:Gt}=(0,l.I)({queryKey:["fetchRidersList",Pe],queryFn:Q.Sd,enabled:0!==Pe}),{data:Ut,isLoading:Vt,isError:$t,error:Xt}=(0,l.I)({queryKey:["gettenantlocations",gt],queryFn:()=>(0,Q.DL)(gt),enabled:0!==gt});(0,n.useEffect)((()=>{(async()=>{Ze(!0);try{await i.A.get(0==Pe?"".concat("https://jupiter.nearle.app/live/api/v1","/deliveries/deliverysummary/?fromdate=").concat(J,"&todate=").concat(V):"".concat("https://jupiter.nearle.app/live/api/v1","/deliveries/deliverysummary/?applocationid=").concat(Pe,"&tenantid=").concat(gt,"&locationid=").concat(pt,"&fromdate=").concat(J,"&todate=").concat(V,"&userid=").concat((null===yt||void 0===yt?void 0:yt.userid)||0)).then((e=>{Ue(e.data.details.total),Qe(e.data.details.pending),ot(e.data.details.accepted),ct(e.data.details.arrived),it(e.data.details.picked),lt(e.data.details.active),$e(e.data.details.delivered),xt(e.data.details.skipped),tt(e.data.details.cancelled)})).catch((e=>{(0,re.M8)(e.message,{variant:"error",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3})}))}catch(e){console.log(e)}finally{Ze(!1)}})()}),[Pe,J,V,ht,gt,pt,yt]);const Qt=null===Et||void 0===Et?void 0:Et.map((e=>({tenantname:e.tenantname,tenantcity:e.tenantcity,tenantcontactno:e.tenantcontactno,rider:e.ridername,orderid:e.orderid,paymenttype:64==e.paymenttype?"Pay Later":42==e.paymenttype?"Pay on Delivery":"Digital",deliverydate:e.deliverydate,orderstatus:e.orderstatus,ordernotes:e.ordernotes,kms:e.kms,cumulativekms:e.cumulativekms,assigntime:e.assigntime,starttime:e.starttime,arrivaltime:e.arrivaltime,pickuptime:e.pickuptime,deliverytime:e.deliverytime,canceltime:e.canceltime,deliverycharge:e.deliverycharges,deliveryamt:e.deliveryamt,pickupcustomer:e.pickupcustomer,pickupcontactno:e.pickupcontactno,Pickupaddress:e.pickupaddress,pickupsuburb:e.pickupsuburb,pickupcity:e.applocation,pickuplat:e.pickuplat,pickuplong:e.pickuplon,deliverycustomer:e.deliverycustomer,deliverycontactno:e.deliverycontactno,deliveryaddress:e.deliveryaddress,deliverysuburb:e.locationsuburb,deliverylat:e.deliverylat,deliverylong:e.deliverylong,locationname:e.locationname,locationsuburb:e.pickuplocation,deliverylocation:e.deliverylocation,locationcontactno:e.locationcontactno})));function er(e){return q()(e).format("DD/MM/YYYY ")}function tr(e){return q()(e).format(" hh:mm A")}const rr=Tt?"An error has occurred: (fetchDeliveries) ".concat(Lt.message):_t?"An error has occurred: (getTenants) ".concat(Bt.message):$t?"An error has occurred: (gettenantlocations) ".concat(Xt.message):Zt?"An error has occurred: (getriderbydelivery) ".concat(Gt.message):null;(0,n.useEffect)((()=>{rr&&xe(rr,"warning",2e3)}),[rr]);const or=[{key:"total",label:"Total Orders",color:be,icon:T.F6S,value:Ge},{key:"delivered",label:"Delivered",color:"#10b981",icon:T.mU9,value:Ve},{key:"pending",label:"Pending",color:"#f59e0b",icon:T.tX0,value:Xe},{key:"cancelled",label:"Cancelled",color:"#ef4444",icon:T.uDv,value:et}];return(0,G.jsxs)(G.Fragment,{children:[(Je||Ht||Vt||Ct||Jt||Ft)&&(0,G.jsx)("div",{children:(0,G.jsx)(te.A,{})}),Yt&&(0,G.jsx)(g.A,{sx:{color:"#fff",zIndex:e=>e.zIndex.drawer+1},open:Yt}),(0,G.jsx)(s.A,{elevation:0,sx:{mb:{xs:1.5,md:2},p:{xs:1.5,sm:2,md:2.5},borderRadius:he.radiusCard/8,border:"1px solid",borderColor:he.borderSubtle,background:"linear-gradient(135deg, ".concat(pe(be)," 0%, ").concat(pe(ve)," 100%)"),boxShadow:he.shadowMd},children:(0,G.jsxs)(h.A,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:{xs:1.5,sm:2},children:[(0,G.jsxs)(h.A,{direction:"row",alignItems:"center",spacing:{xs:1.25,sm:1.75},children:[(0,G.jsx)(c.A,{sx:{width:{xs:40,sm:48},height:{xs:40,sm:48},bgcolor:be,color:"#fff",boxShadow:"0 6px 18px ".concat(ge(be))},children:(0,G.jsx)(T.Z2J,{size:22})}),(0,G.jsxs)(h.A,{children:[(0,G.jsx)(p.A,{variant:"h3",sx:{fontWeight:800,color:he.textPrimary,lineHeight:1.1,fontSize:{xs:"1.25rem",sm:"1.5rem",md:"1.75rem"}},children:"Orders Details"}),(0,G.jsxs)(h.A,{direction:"row",alignItems:"center",spacing:.75,sx:{mt:.5},children:[(0,G.jsx)(x.A,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:"#10b981",boxShadow:"0 0 0 4px rgba(16,185,129,0.18)"}}),(0,G.jsxs)(p.A,{variant:"caption",sx:{color:he.textSecondary,fontWeight:600},children:["Live \xb7 ",_||"All Zones"," \xb7 ",Ie]})]})]})]}),(0,G.jsx)(ae.A,{ref:L,locaName:_,setAppId:Re,setLocoName:B,setPage:E,pill:!0,accentColor:be,icon:(0,G.jsx)(T.HPi,{size:14}),placeholder:"Select Zone",paperComponent:Ae,sx:{width:{xs:"100%",sm:280},zIndex:100}})]})}),(0,G.jsx)(f.Ay,{container:!0,spacing:{xs:1.25,sm:1.5,md:2},sx:{mt:"1px"},children:or.map((e=>{const t=e.icon;return(0,G.jsx)(f.Ay,{item:!0,xs:6,sm:6,md:3,children:(0,G.jsxs)(s.A,{elevation:0,sx:{position:"relative",overflow:"hidden",p:{xs:1.25,sm:1.75,md:2.25},borderRadius:he.radiusCard/8,border:"1px solid",borderColor:he.borderSubtle,background:"#fff",transition:"transform 0.2s, box-shadow 0.2s, border-color 0.2s","&:hover":{transform:"translateY(-3px)",boxShadow:he.shadowMd,borderColor:fe(e.color)}},children:[(0,G.jsx)(x.A,{sx:{position:"absolute",top:0,left:0,right:0,height:3,background:"linear-gradient(90deg, ".concat(e.color," 0%, ").concat(me(e.color)," 100%)")}}),(0,G.jsxs)(h.A,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",spacing:1,children:[(0,G.jsxs)(h.A,{spacing:.5,sx:{minWidth:0,flex:1},children:[(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary,fontWeight:700,letterSpacing:.4,textTransform:"uppercase",fontSize:{xs:10,sm:11},whiteSpace:"nowrap"},children:e.label}),(0,G.jsx)(p.A,{sx:{fontWeight:800,color:he.textPrimary,lineHeight:1.1,fontSize:{xs:"1.25rem",sm:"1.5rem",md:"1.75rem"}},children:e.value})]}),(0,G.jsx)(c.A,{sx:{width:{xs:36,sm:42,md:48},height:{xs:36,sm:42,md:48},bgcolor:me(e.color),color:e.color,boxShadow:"inset 0 0 0 1px ".concat(fe(e.color)),flexShrink:0},children:(0,G.jsx)(t,{size:20})})]})]})},e.key)}))}),(0,G.jsx)(s.A,{elevation:0,sx:{mt:{xs:1.5,md:2},p:{xs:1.25,md:1.75},borderRadius:he.radiusCard/8,border:"1px solid",borderColor:he.borderSubtle,background:"#fff",boxShadow:he.shadowSoft},children:(0,G.jsxs)(f.Ay,{container:!0,spacing:1.25,alignItems:"center",children:[(0,G.jsx)(f.Ay,{item:!0,xs:12,sm:6,md:3,children:(0,G.jsx)(b.A,{options:Kt||[],value:bt,getOptionLabel:e=>(null===e||void 0===e?void 0:e.tenantname)||"",PaperComponent:Ae,onOpen:e=>{Pe||(e.preventDefault(),(0,le.k)("Please select a your app location first!","warning",3e3),setTimeout((()=>{var e;null===(e=L.current)||void 0===e||e.focus()}),0))},onChange:(e,t,r)=>{"clear"===r?(ft(0),vt(null),mt(0),jt(null)):(ft((null===t||void 0===t?void 0:t.tenantid)||0),vt(t),mt(t.locationid),jt(null))},renderInput:e=>(0,G.jsx)(v.A,(0,o.A)((0,o.A)({},e),{},{inputRef:N,placeholder:"Select Tenant",size:"small",sx:ye("#0ea5e9"),InputProps:(0,o.A)((0,o.A)({},e.InputProps),{},{startAdornment:(0,G.jsx)(h.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,G.jsx)(je,{color:"#0ea5e9",size:22,selected:!0,children:(0,G.jsx)(T.Itr,{size:13})})})})}))})}),(0,G.jsx)(f.Ay,{item:!0,xs:12,sm:6,md:3,children:(0,G.jsx)(b.A,{options:Ut||[],getOptionLabel:e=>e?"".concat(e.locationname," (").concat(e.suburb,")"):"",value:At,PaperComponent:Ae,onOpen:e=>{Pe||gt?gt||(e.preventDefault(),(0,le.k)("Please select a your Tenant first!","warning",3e3),setTimeout((()=>{var e;null===(e=N.current)||void 0===e||e.focus()}),0)):(e.preventDefault(),(0,le.k)("Please select a your Location and Tenant first!","warning",3e3),setTimeout((()=>{var e;null===(e=L.current)||void 0===e||e.focus()}),0))},onChange:(e,t,r)=>{"clear"===r?(mt(0),jt(null)):(mt(t.locationid||0),jt(t))},renderInput:e=>(0,G.jsx)(v.A,(0,o.A)((0,o.A)({},e),{},{placeholder:"Select Location",size:"small",sx:ye("#10b981"),InputProps:(0,o.A)((0,o.A)({},e.InputProps),{},{startAdornment:(0,G.jsx)(h.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,G.jsx)(je,{color:"#10b981",size:22,selected:!0,children:(0,G.jsx)(T.JFD,{size:13})})})})}))})}),(0,G.jsx)(f.Ay,{item:!0,xs:12,sm:6,md:3,children:(0,G.jsx)(b.A,{options:qt||[],value:St,getOptionLabel:e=>"".concat(e.firstname," ").concat(e.lastname),PaperComponent:Ae,onOpen:()=>{Pe||(0,le.k)("Select App Location First","warning",2e3)},onChange:(e,t,r)=>{"clear"===r?(wt(null),kt(null)):(wt(t),kt(t))},renderInput:e=>(0,G.jsx)(v.A,(0,o.A)((0,o.A)({},e),{},{placeholder:"Select Rider",size:"small",sx:ye("#8b5cf6"),InputProps:(0,o.A)((0,o.A)({},e.InputProps),{},{startAdornment:(0,G.jsx)(h.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,G.jsx)(je,{color:"#8b5cf6",size:22,selected:!0,children:(0,G.jsx)(T.bsz,{size:13})})})})}))})}),(0,G.jsx)(f.Ay,{item:!0,xs:12,sm:6,md:3,children:(0,G.jsxs)(h.A,{direction:"row",spacing:1,alignItems:"center",justifyContent:{xs:"flex-start",md:"flex-end"},children:[(0,G.jsx)(d.A,{title:"Date Filter",placement:"top",children:(0,G.jsxs)(x.A,{onClick:()=>ue(!0),sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.25,py:.75,borderRadius:999,cursor:"pointer",bgcolor:pe("#f59e0b"),border:"1.5px solid ".concat(fe("#f59e0b")),color:"#f59e0b",fontWeight:800,fontSize:12,transition:"all 0.18s","&:hover":{borderColor:"#f59e0b",boxShadow:"0 0 0 3px ".concat(ge("#f59e0b"))}},children:[(0,G.jsx)(T.Ki0,{size:14}),q()(J).format("DD/MM/YY")," \u2013 ",q()(V).format("DD/MM/YY")]})}),(0,G.jsx)(A.A,{variant:"contained",size:"small",startIcon:(0,G.jsx)(T.S3Y,{}),onClick:()=>{Mt(!0),setTimeout((()=>{H("")}),0)},sx:{borderRadius:999,px:1.5,py:.75,fontWeight:800,fontSize:12,textTransform:"none",background:"linear-gradient(135deg, ".concat(be," 0%, ").concat(ve," 100%)"),boxShadow:"0 6px 18px ".concat(ge(be)),"&:hover":{background:"linear-gradient(135deg, ".concat(be," 0%, ").concat(ve," 100%)"),boxShadow:"0 8px 22px ".concat(ge(be))}},children:"Export"})]})})]})}),(0,G.jsx)(s.A,{elevation:0,sx:{mt:{xs:1.5,md:2},p:{xs:1,md:1.5},borderTopLeftRadius:he.radiusCard/8,borderTopRightRadius:he.radiusCard/8,borderBottomLeftRadius:0,borderBottomRightRadius:0,border:"1px solid",borderColor:he.borderSubtle,borderBottom:0,background:"#fff"},children:(0,G.jsxs)(h.A,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:1.5,sx:{flexWrap:"wrap-reverse"},children:[(0,G.jsx)(h.A,{direction:"row",spacing:.75,sx:{flex:1,overflowX:"auto",py:.5,px:.25,"&::-webkit-scrollbar":{height:6},"&::-webkit-scrollbar-thumb":{backgroundColor:he.borderSubtle,borderRadius:4}},children:Se.map((e=>{var t;const r=we[e],o=r.icon,n=ht.toLowerCase()===e,i=null!==(t=It[e])&&void 0!==t?t:0;return(0,G.jsxs)(x.A,{onClick:()=>ut("all"===e?"All":e),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?r.color:fe(r.color)),bgcolor:n?r.color:pe(r.color),color:n?"#fff":r.color,fontWeight:700,boxShadow:n?"0 6px 18px ".concat(ge(r.color)):"none",transition:"all 0.18s","&:hover":{borderColor:r.color,boxShadow:n?"0 6px 18px ".concat(ge(r.color)):"0 0 0 3px ".concat(ge(r.color))}},children:[(0,G.jsx)(c.A,{sx:{width:{xs:22,md:26},height:{xs:22,md:26},bgcolor:n?"rgba(255,255,255,0.22)":me(r.color),color:n?"#fff":r.color},children:(0,G.jsx)(o,{size:13})}),(0,G.jsx)(p.A,{variant:"caption",sx:{fontWeight:800,fontSize:{xs:11.5,md:13},lineHeight:1},children:r.label}),(0,G.jsx)(x.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:n?"rgba(255,255,255,0.22)":"#fff",color:n?"#fff":r.color,border:n?"none":"1px solid ".concat(fe(r.color))},children:i})]},e)}))}),(0,G.jsx)(x.A,{sx:{width:{xs:"100%",sm:240,lg:280},flex:{xs:"1 1 100%",sm:"0 0 auto"}},children:(0,G.jsx)(ne.A,{value:Ye,onChange:Te,onDebouncedChange:Ne,placeholder:"Search orders (ctrl+k)",sx:{m:0,width:"100%",borderRadius:999,bgcolor:pe(be),"& fieldset":{borderColor:fe(be),borderWidth:1.5},"&:hover fieldset":{borderColor:be},"&.Mui-focused fieldset":{borderColor:be,borderWidth:2},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(ge(be))}}})})]})}),(0,G.jsx)(s.A,{elevation:0,sx:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomLeftRadius:he.radiusCard/8,borderBottomRightRadius:he.radiusCard/8,border:"1px solid",borderColor:he.borderSubtle,overflow:"hidden",background:"#fff"},children:(0,G.jsxs)(j.A,{ref:u,onScroll:e=>{const{scrollTop:t,scrollHeight:r,clientHeight:o}=e.currentTarget;t+o>=r-50&&Ot&&!Ft&&Nt()},sx:{maxHeight:{xs:"calc(100vh - 220px)",md:"calc(100vh - 190px)"},overflow:"auto","&::-webkit-scrollbar":{width:10,height:10},"&::-webkit-scrollbar-thumb":{backgroundColor:fe(be),borderRadius:8,"&:hover":{backgroundColor:be}},"&::-webkit-scrollbar-track":{backgroundColor:he.surfaceAlt}},children:[t?(0,G.jsx)(ce.nV,{sx:{p:1.25},children:Yt?(0,G.jsxs)(h.A,{alignItems:"center",sx:{py:6},children:[(0,G.jsx)(ie.A,{}),(0,G.jsx)(p.A,{variant:"caption",color:"text.secondary",sx:{mt:1},children:"Loading orders\u2026"})]}):0==(null===Et||void 0===Et?void 0:Et.length)?(0,G.jsxs)(h.A,{alignItems:"center",spacing:1.5,sx:{py:6},children:[(0,G.jsx)(c.A,{sx:{width:64,height:64,bgcolor:me("#94a3b8"),color:he.textMuted},children:(0,G.jsx)(T.Z2J,{size:28})}),(0,G.jsx)(p.A,{variant:"subtitle1",sx:{fontWeight:700,color:he.textPrimary},children:"No orders to show"}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary,textAlign:"center",px:2},children:Ye?"Try a different keyword.":"Adjust the filters above to load orders."})]}):null===Et||void 0===Et?void 0:Et.map(((e,t)=>{var r;const o=String(e.orderstatus||"").toLowerCase(),n=we[o]||{label:e.orderstatus||"\u2014",color:be,icon:T.Z2J},i=n.icon,a="cancelled"===o,l="delivered"===e.orderstatus;return(0,G.jsx)(ce.pg,{accent:n.color,header:(0,G.jsxs)(h.A,{spacing:1.25,children:[(0,G.jsxs)(h.A,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",spacing:1,children:[(0,G.jsxs)(h.A,{direction:"row",alignItems:"center",spacing:.75,sx:{minWidth:0},children:[(0,G.jsx)(p.A,{variant:"caption",sx:{fontWeight:700,color:he.textMuted},children:String(F*K+t+1).padStart(2,"0")}),(0,G.jsx)(je,{color:be,size:32,children:(0,G.jsx)(T.Itr,{size:16})}),(0,G.jsxs)(h.A,{spacing:.25,sx:{minWidth:0},children:[(0,G.jsx)(p.A,{variant:"subtitle2",sx:{fontWeight:700,color:he.textPrimary},noWrap:!0,children:e.tenantname}),(0,G.jsxs)(p.A,{variant:"caption",sx:{color:he.textSecondary,fontWeight:700},children:["#",e.orderid]})]})]}),(0,G.jsx)(d.A,{title:l?"View rider route":"Available for delivered orders",placement:"top",children:(0,G.jsx)("span",{children:(0,G.jsx)(y.A,{size:"small",disabled:!l,onClick:()=>{l&&(Pt(e.deliveryid),qe(e))},sx:{flexShrink:0,bgcolor:me(l?be:"#94a3b8"),color:l?be:he.textMuted,border:"1px solid ".concat(fe(l?be:"#94a3b8")),"&:hover":{bgcolor:l?be:me("#94a3b8"),color:l?"#fff":he.textMuted}},children:(0,G.jsx)(T.Cd7,{size:14})})})})]}),(0,G.jsxs)(h.A,{direction:"row",alignItems:"center",spacing:.75,sx:{flexWrap:"wrap",gap:.5},children:[(0,G.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1,py:.375,borderRadius:999,bgcolor:pe(n.color),border:"1px solid ".concat(fe(n.color)),color:n.color,fontSize:11,fontWeight:800},children:[(0,G.jsx)(i,{size:12})," ",n.label]}),e.ridername&&(0,G.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1,py:.375,borderRadius:999,bgcolor:pe("#8b5cf6"),border:"1px solid ".concat(fe("#8b5cf6")),color:"#8b5cf6",fontSize:11,fontWeight:800},children:[(0,G.jsx)(T.bsz,{size:12})," ",e.ridername]}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textMuted,fontWeight:600},children:q()(e.deliverydate).utc().format("DD/MM/YYYY \xb7 hh:mm A")})]})]}),children:(0,G.jsxs)(ce.FG,{children:[(0,G.jsx)(ce.pY,{label:"Pickup",children:(0,G.jsxs)(h.A,{spacing:.25,sx:{minWidth:0},children:[(0,G.jsx)(p.A,{sx:{fontSize:13,fontWeight:700,color:he.textPrimary},noWrap:!0,children:e.pickupcustomer||"\u2014"}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary},noWrap:!0,children:e.pickupcontactno}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary},noWrap:!0,children:e.pickupsuburb||(e.Pickupaddress?e.Pickupaddress.slice(0,22)+"\u2026":"")}),e.applocation&&(0,G.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:.75,py:.25,borderRadius:999,bgcolor:pe("#10b981"),border:"1px solid ".concat(fe("#10b981")),color:"#10b981",fontSize:10,fontWeight:800,width:"fit-content"},children:[(0,G.jsx)(T.JFD,{size:11})," ",e.applocation]})]})}),(0,G.jsx)(ce.pY,{label:"Drop",children:(0,G.jsxs)(h.A,{spacing:.25,sx:{minWidth:0},children:[(0,G.jsx)(p.A,{sx:{fontSize:13,fontWeight:700,color:he.textPrimary},noWrap:!0,children:e.deliverycustomer||"\u2014"}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary},noWrap:!0,children:e.deliverycontactno}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary},noWrap:!0,children:e.deliverysuburb||(e.deliveryaddress?e.deliveryaddress.slice(0,22)+"\u2026":"")})]})}),(0,G.jsx)(ce.pY,{label:"Assigned",children:(0,G.jsx)(De,{value:e.assigntime,formatDate:er,formatTime:tr})}),(0,G.jsx)(ce.pY,{label:"Accepted",children:(0,G.jsx)(De,{value:e.acceptedtime,formatDate:er,formatTime:tr})}),(0,G.jsx)(ce.pY,{label:"Arrived",children:(0,G.jsx)(De,{value:e.arrivaltime,formatDate:er,formatTime:tr})}),(0,G.jsx)(ce.pY,{label:"Picked",children:(0,G.jsx)(De,{value:e.pickuptime,formatDate:er,formatTime:tr,success:"active"===e.deliverystatus})}),(0,G.jsx)(ce.pY,{label:"Active",children:(0,G.jsx)(De,{value:e.starttime,formatDate:er,formatTime:tr})}),(0,G.jsx)(ce.pY,{label:"Delivered",children:(0,G.jsx)(De,{value:e.deliverytime,formatDate:er,formatTime:tr})}),(0,G.jsx)(ce.pY,{label:"Cancelled",children:(0,G.jsx)(De,{value:e.canceltime,formatDate:er,formatTime:tr})}),(0,G.jsx)(ce.pY,{label:"KMS \xb7 plan / act / rider",full:!0,children:(0,G.jsxs)(h.A,{direction:"row",spacing:.5,sx:{flexWrap:"wrap",gap:.5},children:[(0,G.jsx)(ke,{color:"#ef4444",icon:(0,G.jsx)(T.xI$,{size:11}),label:a||""==e.kms?"0 km":"".concat(e.kms," km"),tooltip:"KMS"}),(0,G.jsx)(ke,{color:"#10b981",icon:(0,G.jsx)(T.xI$,{size:11}),label:"".concat(null!==(r=e.cumulativekms)&&void 0!==r?r:0," km"),tooltip:"Actual KMS"}),(0,G.jsx)(ke,{color:"#0ea5e9",icon:(0,G.jsx)(T.xI$,{size:11}),label:"".concat(e.previouskms||(a?"0.00":e.kms)||0," km"),tooltip:"Rider KMS"})]})}),(0,G.jsx)(ce.pY,{label:"Charges \xb7 chg / amt",full:!0,children:(0,G.jsxs)(h.A,{direction:"row",spacing:.5,sx:{flexWrap:"wrap",gap:.5},children:[(0,G.jsx)(ke,{color:"#ef4444",icon:(0,G.jsx)(T.YHz,{size:11}),label:a||""==e.deliverycharges?"0.00":"".concat(e.deliverycharges,".00"),tooltip:"Delivery Charge"}),(0,G.jsx)(ke,{color:"#10b981",icon:(0,G.jsx)(T.YHz,{size:11}),label:""==e.deliveryamt?"0.00":"".concat(e.deliveryamt,".00"),tooltip:"Delivery Amount"})]})}),e.ordernotes&&(0,G.jsx)(ce.pY,{label:"Notes",full:!0,children:(0,G.jsxs)(h.A,{direction:"row",spacing:.5,alignItems:"flex-start",children:[(0,G.jsx)(T.NpB,{size:12,color:he.textMuted,style:{marginTop:2,flexShrink:0}}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary},children:e.ordernotes})]})})]})},e.deliveryid||"".concat(e.orderid,"-").concat(t))}))}):(0,G.jsxs)(w.A,{stickyHeader:!0,sx:{minWidth:1600},children:[(0,G.jsx)(S.A,{children:(0,G.jsxs)(k.A,{sx:{"& th":{backgroundColor:he.surfaceAlt,color:he.textSecondary,fontSize:{xs:10,md:11},fontWeight:800,letterSpacing:.6,textTransform:"uppercase",whiteSpace:"nowrap",borderBottom:"1px solid ".concat(he.borderSubtle),py:{xs:1,md:1.25},px:{xs:1,md:1.5}}},children:[(0,G.jsx)(D.A,{children:"#"}),(0,G.jsx)(D.A,{children:"Map"}),(0,G.jsx)(D.A,{children:"Client"}),(0,G.jsx)(D.A,{children:"Pickup"}),(0,G.jsx)(D.A,{children:"Drop"}),(0,G.jsx)(D.A,{children:"Status / Rider"}),(0,G.jsx)(D.A,{children:"Assigned"}),(0,G.jsx)(D.A,{children:"Accepted"}),(0,G.jsx)(D.A,{children:"Arrived"}),(0,G.jsx)(D.A,{children:"Picked"}),(0,G.jsx)(D.A,{children:"Active"}),(0,G.jsx)(D.A,{children:"Delivered"}),(0,G.jsx)(D.A,{children:"Cancelled"}),(0,G.jsx)(D.A,{children:"Notes"}),(0,G.jsx)(D.A,{align:"center",children:"KMS"}),(0,G.jsx)(D.A,{align:"center",children:"Charges"})]})}),(0,G.jsx)(M.A,{children:Yt?(0,G.jsx)(se,{rows:16,columns:16,height:15}):0==(null===Et||void 0===Et?void 0:Et.length)?(0,G.jsx)(k.A,{children:(0,G.jsx)(D.A,{colSpan:16,sx:{py:6},children:(0,G.jsxs)(h.A,{alignItems:"center",spacing:1.5,children:[(0,G.jsx)(c.A,{sx:{width:64,height:64,bgcolor:me("#94a3b8"),color:he.textMuted},children:(0,G.jsx)(T.Z2J,{size:28})}),(0,G.jsx)(p.A,{variant:"subtitle1",sx:{fontWeight:700,color:he.textPrimary},children:"No orders to show"}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary},children:Ye?"Try a different keyword.":"Adjust the filters above to load orders."})]})})}):null===Et||void 0===Et?void 0:Et.map(((e,t)=>{var r;const o=String(e.orderstatus||"").toLowerCase(),n=we[o]||{label:e.orderstatus||"\u2014",color:be,icon:T.Z2J},i=n.icon,a="cancelled"===o;return(0,G.jsxs)(k.A,{sx:{transition:"background-color 0.15s","& td":{borderBottom:"1px solid ".concat(he.divider),py:{xs:1,md:1.25},px:{xs:1,md:1.5},verticalAlign:"top"},"&:hover":{backgroundColor:he.surfaceAlt}},children:[(0,G.jsx)(D.A,{children:(0,G.jsx)(p.A,{variant:"caption",sx:{fontWeight:700,color:he.textMuted},children:String(F*K+t+1).padStart(2,"0")})}),(0,G.jsx)(D.A,{children:(0,G.jsx)(d.A,{title:"delivered"===e.orderstatus?"View rider route":"Available for delivered orders",placement:"top",children:(0,G.jsx)("span",{children:(0,G.jsx)(y.A,{size:"small",disabled:"delivered"!==e.orderstatus,onClick:()=>{"delivered"===e.orderstatus&&(Pt(e.deliveryid),qe(e))},sx:{bgcolor:"delivered"===e.orderstatus?me(be):me("#94a3b8"),color:"delivered"===e.orderstatus?be:he.textMuted,border:"1px solid ".concat("delivered"===e.orderstatus?fe(be):fe("#94a3b8")),"&:hover":{bgcolor:"delivered"===e.orderstatus?be:me("#94a3b8"),color:"delivered"===e.orderstatus?"#fff":he.textMuted}},children:(0,G.jsx)(T.Cd7,{size:14})})})})}),(0,G.jsx)(D.A,{children:(0,G.jsxs)(h.A,{direction:"row",alignItems:"flex-start",spacing:1,children:[(0,G.jsx)(je,{color:be,size:32,children:(0,G.jsx)(T.Itr,{size:16})}),(0,G.jsxs)(h.A,{spacing:.25,sx:{minWidth:0},children:[(0,G.jsx)(p.A,{variant:"subtitle2",sx:{fontWeight:700,color:he.textPrimary,whiteSpace:"nowrap"},children:e.tenantname}),(0,G.jsx)(d.A,{title:"Order ID",placement:"top",children:(0,G.jsxs)(p.A,{variant:"caption",sx:{color:he.textSecondary,fontWeight:700},children:["#",e.orderid]})}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textMuted},children:q()(e.deliverydate).utc().format("DD/MM/YYYY \xb7 hh:mm A")})]})]})}),(0,G.jsx)(D.A,{children:(0,G.jsxs)(h.A,{spacing:.25,children:[(0,G.jsx)(p.A,{variant:"subtitle2",sx:{fontWeight:700,color:he.textPrimary,whiteSpace:"nowrap"},children:e.pickupcustomer||"\u2014"}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary},children:e.pickupcontactno}),(0,G.jsx)(d.A,{title:e.Pickupaddress||e.pickupsuburb||"",children:(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary,cursor:"pointer",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.pickupsuburb||(e.Pickupaddress?e.Pickupaddress.slice(0,22)+"\u2026":"")})}),e.applocation&&(0,G.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:.75,py:.25,borderRadius:999,bgcolor:pe("#10b981"),border:"1px solid ".concat(fe("#10b981")),color:"#10b981",fontSize:10,fontWeight:800,width:"fit-content"},children:[(0,G.jsx)(T.JFD,{size:11})," ",e.applocation]})]})}),(0,G.jsx)(D.A,{children:(0,G.jsxs)(h.A,{spacing:.25,children:[(0,G.jsx)(p.A,{variant:"subtitle2",sx:{fontWeight:700,color:he.textPrimary,whiteSpace:"nowrap"},children:e.deliverycustomer||"\u2014"}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary},children:e.deliverycontactno}),(0,G.jsx)(d.A,{title:e.deliveryaddress||"",children:(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary,cursor:"pointer",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.deliverysuburb||(e.deliveryaddress?e.deliveryaddress.slice(0,22)+"\u2026":"")})})]})}),(0,G.jsx)(D.A,{children:(0,G.jsxs)(h.A,{spacing:.5,children:[(0,G.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1,py:.375,borderRadius:999,bgcolor:pe(n.color),border:"1px solid ".concat(fe(n.color)),color:n.color,fontSize:11,fontWeight:800,width:"fit-content"},children:[(0,G.jsx)(i,{size:12})," ",n.label]}),e.ridername&&(0,G.jsxs)(h.A,{direction:"row",alignItems:"center",spacing:.5,children:[(0,G.jsx)(T.bsz,{size:12,color:he.textMuted}),(0,G.jsx)(d.A,{title:"Rider ID: ".concat(e.userid),children:(0,G.jsx)(p.A,{variant:"caption",sx:{fontWeight:700,color:he.textPrimary,whiteSpace:"nowrap"},children:e.ridername})})]})]})}),(0,G.jsx)(D.A,{children:(0,G.jsx)(De,{value:e.assigntime,formatDate:er,formatTime:tr})}),(0,G.jsx)(D.A,{children:(0,G.jsx)(De,{value:e.acceptedtime,formatDate:er,formatTime:tr})}),(0,G.jsx)(D.A,{children:(0,G.jsx)(De,{value:e.arrivaltime,formatDate:er,formatTime:tr})}),(0,G.jsx)(D.A,{children:(0,G.jsx)(De,{value:e.pickuptime,formatDate:er,formatTime:tr,success:"active"===e.deliverystatus})}),(0,G.jsx)(D.A,{children:(0,G.jsx)(De,{value:e.starttime,formatDate:er,formatTime:tr})}),(0,G.jsx)(D.A,{children:(0,G.jsx)(De,{value:e.deliverytime,formatDate:er,formatTime:tr})}),(0,G.jsx)(D.A,{children:(0,G.jsx)(De,{value:e.canceltime,formatDate:er,formatTime:tr})}),(0,G.jsx)(D.A,{sx:{maxWidth:180},children:e.ordernotes?(0,G.jsxs)(h.A,{direction:"row",spacing:.5,alignItems:"flex-start",children:[(0,G.jsx)(T.NpB,{size:12,color:he.textMuted,style:{marginTop:2,flexShrink:0}}),(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textSecondary,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.ordernotes})]}):(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textMuted},children:"\u2014"})}),(0,G.jsx)(D.A,{align:"center",children:(0,G.jsxs)(h.A,{spacing:.5,alignItems:"center",children:[(0,G.jsx)(ke,{color:"#ef4444",icon:(0,G.jsx)(T.xI$,{size:11}),label:a||""==e.kms?"0 km":"".concat(e.kms," km"),tooltip:"KMS"}),(0,G.jsx)(ke,{color:"#10b981",icon:(0,G.jsx)(T.xI$,{size:11}),label:"".concat(null!==(r=e.cumulativekms)&&void 0!==r?r:0," km"),tooltip:"Actual KMS"}),(0,G.jsx)(ke,{color:"#0ea5e9",icon:(0,G.jsx)(T.xI$,{size:11}),label:"".concat(e.previouskms||(a?"0.00":e.kms)||0," km"),tooltip:"Rider KMS"})]})}),(0,G.jsx)(D.A,{align:"center",children:(0,G.jsxs)(h.A,{spacing:.5,alignItems:"center",children:[(0,G.jsx)(ke,{color:"#ef4444",icon:(0,G.jsx)(T.YHz,{size:11}),label:a||""==e.deliverycharges?"0.00":"".concat(e.deliverycharges,".00"),tooltip:"Delivery Charge"}),(0,G.jsx)(ke,{color:"#10b981",icon:(0,G.jsx)(T.YHz,{size:11}),label:""==e.deliveryamt?"0.00":"".concat(e.deliveryamt,".00"),tooltip:"Delivery Amount"})]})})]},e.deliveryid||"".concat(e.orderid,"-").concat(t))}))})]}),(0,G.jsx)(C.A,{}),0!==(null===Et||void 0===Et?void 0:Et.length)&&(0,G.jsx)(h.A,{justifyContent:"center",alignItems:"center",sx:{width:"100%",py:2},children:(0,G.jsx)(h.A,{ref:r,style:{textAlign:"center",width:"100%"},children:Ft||Ot?(0,G.jsx)(ie.A,{}):(0,G.jsx)(p.A,{variant:"caption",sx:{color:he.textMuted,fontWeight:600},children:"No more orders"})})})]})}),(0,G.jsxs)(z.A,{open:Dt,onClose:()=>Mt(!1),fullWidth:!0,maxWidth:"sm",fullScreen:t,PaperProps:{sx:{borderRadius:{xs:0,sm:3},overflow:"hidden"}},children:[(0,G.jsx)(I.A,{sx:{background:"linear-gradient(135deg, ".concat(be," 0%, ").concat(ve," 100%)"),color:"#fff",py:2},children:(0,G.jsxs)(h.A,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[(0,G.jsxs)(h.A,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,G.jsx)(c.A,{sx:{width:36,height:36,bgcolor:"rgba(255,255,255,0.22)",color:"#fff"},children:(0,G.jsx)(T.S3Y,{size:20})}),(0,G.jsxs)(h.A,{children:[(0,G.jsx)(p.A,{sx:{fontSize:11,fontWeight:700,opacity:.85,letterSpacing:.6,textTransform:"uppercase",lineHeight:1},children:"Report"}),(0,G.jsx)(p.A,{sx:{fontWeight:800,fontSize:{xs:"1.05rem",sm:"1.2rem"},lineHeight:1.2,mt:.25},children:"Export Orders"})]})]}),(0,G.jsx)(y.A,{size:"small",onClick:()=>Mt(!1),sx:{color:"#fff",bgcolor:"rgba(255,255,255,0.18)","&:hover":{bgcolor:"rgba(255,255,255,0.3)"}},children:(0,G.jsx)(T.m6K,{size:16})})]})}),(0,G.jsxs)(W.A,{sx:{p:2},children:[Yt&&(0,G.jsx)(Z.A,{}),[{label:"App Location",value:_,color:be},{label:"Tenant",value:null===bt||void 0===bt?void 0:bt.tenantname,color:"#0ea5e9"},{label:"Business Location",value:null===At||void 0===At?void 0:At.locationname,color:"#10b981"},{label:"Status",value:ht,color:"#f59e0b"},{label:"Rider",value:St?"".concat(St.firstname," ").concat(St.lastname):null,color:"#8b5cf6"},{label:"Keyword",value:Ye,color:"#06b6d4"},{label:"Start Date",value:J,color:"#14b8a6"},{label:"End Date",value:V,color:"#ef4444"}].map(((e,t)=>(0,G.jsxs)(h.A,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{px:1.5,py:1,borderRadius:2,bgcolor:pe(e.color),border:"1px solid ".concat(fe(e.color)),mb:1},children:[(0,G.jsx)(p.A,{variant:"body2",sx:{fontWeight:700,color:he.textPrimary},children:e.label}),(0,G.jsx)(P.A,{size:"small",label:e.value||"None",sx:{fontWeight:700,bgcolor:e.value?e.color:me("#94a3b8"),color:e.value?"#fff":he.textMuted,border:"none"}})]},t)))]}),(0,G.jsxs)(R.A,{sx:{p:2,bgcolor:he.surfaceAlt,gap:1},children:[(0,G.jsx)(A.A,{color:"inherit",variant:"outlined",onClick:()=>Mt(!1),sx:{borderRadius:999,px:2,textTransform:"none",fontWeight:700,borderColor:he.borderSubtle,color:he.textSecondary},children:"Cancel"}),(0,G.jsx)(ee.pK,{data:Qt,filename:"Orders_Detail_".concat(q()().format("YYYY-MM-DD_HHmmss"),".csv"),label:"Download CSV",btnLoading:Yt,onClick:()=>{setTimeout((()=>Mt(!1)),0)}})]})]}),(0,G.jsx)(oe.A,{open:de,onClose:()=>ue(!1),onSelect:e=>{U(e.startDate),$(e.endDate),We(e.label)}}),(0,G.jsx)(z.A,{open:Ce,onClose:()=>{ze(!1)},fullScreen:!0,fullWidth:!0,children:Oe&&(0,G.jsx)("div",{children:(0,G.jsx)(X,{coordinates:Oe,additionalProps:{riderStart:Ee,riderEnd:He},order:Be,setMapOpen:ze})})})]})}},23787:(e,t,r)=>{r.d(t,{FG:()=>u,nV:()=>x,pY:()=>p,pg:()=>h});var o=r(89379),n=r(80045),i=r(93230),a=r(2235),l=r(16491),s=r(82053),c=r(44414);const d=["children","scroll","onScroll","sx"],x=e=>{let{children:t,scroll:r=!1,onScroll:a,sx:l}=e,s=(0,n.A)(e,d);return(0,c.jsx)(i.A,(0,o.A)((0,o.A)({spacing:1.25,onScroll:a,sx:(0,o.A)((0,o.A)({p:1.5},r&&{maxHeight:"calc(100vh - 220px)",overflowY:"auto",overflowX:"hidden"}),l)},s),{},{children:t}))},h=e=>{let{accent:t="#662582",header:r,footer:n,selected:i=!1,onClick:s,children:d,sx:x}=e;return(0,c.jsxs)(a.A,{elevation:0,onClick:s,sx:(0,o.A)({position:"relative",overflow:"hidden",flexShrink:0,borderRadius:2.5,border:"1px solid",borderColor:i?t:"#e2e8f0",background:i?"".concat(t,"0a"):"#fff",boxShadow:"0 4px 14px rgba(15,23,42,0.05)",transition:"border-color 0.15s, box-shadow 0.15s"},x),children:[(0,c.jsx)(l.A,{sx:{position:"absolute",left:0,top:0,bottom:0,width:3,bgcolor:t}}),(0,c.jsxs)(l.A,{sx:{p:1.5,pl:2},children:[r,d,n]})]})},u=e=>{let{children:t,columns:r=2,sx:n}=e;return(0,c.jsx)(l.A,{sx:(0,o.A)({display:"grid",gridTemplateColumns:"repeat(".concat(r,", minmax(0, 1fr))"),gap:1,mt:1.25},n),children:t})},p=e=>{let{label:t,value:r,children:o,full:n=!1,align:i="left"}=e;return(0,c.jsxs)(l.A,{sx:{gridColumn:n?"1 / -1":"auto",minWidth:0,textAlign:i},children:[(0,c.jsx)(s.A,{sx:{fontSize:9.5,fontWeight:800,letterSpacing:.5,textTransform:"uppercase",color:"#94a3b8",lineHeight:1.4},children:t}),(0,c.jsx)(l.A,{sx:{mt:.25,minWidth:0},children:void 0!==o?o:(0,c.jsx)(s.A,{sx:{fontSize:13,fontWeight:600,color:"#0f172a"},noWrap:!0,children:null!==r&&void 0!==r?r:"\u2014"})})]})}},35678:(e,t,r)=>{r.d(t,{A:()=>j});var o=r(9950),n=r(96583),i=r(40033),a=r(82053),l=r(28170),s=r(93230),c=r(82223),d=r(55916),x=r(4159),h=r.n(x),u=r(56712),p=r(81417),m=r(96600),g=r(53132),f=r(94289),b=r(57326),v=r(50624),A=r(44414);const j=e=>{let{open:t,onClose:r,onSelect:x}=e;const[j,y]=(0,o.useState)(null);return(0,A.jsxs)(n.A,{open:t,onClose:r,children:[(0,A.jsx)(i.A,{align:"left",children:(0,A.jsx)(a.A,{variant:"h4",children:"Select Filter Options"})}),(0,A.jsx)(l.A,{sx:{width:"100%"},className:"datedialog",children:(0,A.jsx)(d.U,{open:t,toggle:r,id:"daterange1",onChange:e=>{y({startDate:h()(e.startDate).format("YYYY-MM-DD"),endDate:h()(e.endDate).format("YYYY-MM-DD"),label:e.label||"custom"})},definedRanges:[{label:"Today",startDate:new Date,endDate:new Date},{label:"Yesterday",startDate:(0,u.A)(new Date,-1),endDate:(0,u.A)(new Date,-1)},{label:"Tomorrow",startDate:(0,u.A)(new Date,1),endDate:(0,u.A)(new Date,1)},{label:"This Week",startDate:(0,p.A)(new Date),endDate:(0,m.A)(new Date)},{label:"Last Week",startDate:(0,p.A)((0,g.A)(new Date,-1)),endDate:(0,m.A)((0,g.A)(new Date,-1))},{label:"Last 7 Days",startDate:(0,g.A)(new Date,-1),endDate:new Date},{label:"This Month",startDate:(0,f.A)(new Date),endDate:(0,b.A)(new Date)},{label:"Last Month",startDate:(0,f.A)((0,v.A)(new Date,-1)),endDate:(0,b.A)((0,v.A)(new Date,-1))}]})}),(0,A.jsx)(s.A,{direction:"row",justifyContent:"flex-end",sx:{width:"100%",p:2},children:(0,A.jsx)(c.A,{variant:"contained",size:"small",onClick:()=>{j?(x(j),r()):r()},children:"OK"})})]})}},46639:(e,t,r)=>{r.d(t,{A:()=>P});var o=r(57528),n=r(98587),i=r(58168),a=r(9950),l=r(72004),s=r(3484),c=r(88283),d=r(89548),x=r(18463),h=r(59254),u=r(45558),p=r(1614);function m(e){return(0,p.Ay)("MuiCircularProgress",e)}(0,u.A)("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);var g,f,b,v,A=r(44414);const j=["className","color","disableShrink","size","style","thickness","value","variant"];let y,w,S,k;const D=44,M=(0,c.i7)(y||(y=g||(g=(0,o.A)(["\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n"])))),C=(0,c.i7)(w||(w=f||(f=(0,o.A)(["\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"])))),z=(0,h.Ay)("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,t[r.variant],t["color".concat((0,d.A)(r.color))]]}})((e=>{let{ownerState:t,theme:r}=e;return(0,i.A)({display:"inline-block"},"determinate"===t.variant&&{transition:r.transitions.create("transform")},"inherit"!==t.color&&{color:(r.vars||r).palette[t.color].main})}),(e=>{let{ownerState:t}=e;return"indeterminate"===t.variant&&(0,c.AH)(S||(S=b||(b=(0,o.A)(["\n animation: "," 1.4s linear infinite;\n "]))),M)})),I=(0,h.Ay)("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(e,t)=>t.svg})({display:"block"}),W=(0,h.Ay)("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.circle,t["circle".concat((0,d.A)(r.variant))],r.disableShrink&&t.circleDisableShrink]}})((e=>{let{ownerState:t,theme:r}=e;return(0,i.A)({stroke:"currentColor"},"determinate"===t.variant&&{transition:r.transitions.create("stroke-dashoffset")},"indeterminate"===t.variant&&{strokeDasharray:"80px, 200px",strokeDashoffset:0})}),(e=>{let{ownerState:t}=e;return"indeterminate"===t.variant&&!t.disableShrink&&(0,c.AH)(k||(k=v||(v=(0,o.A)(["\n animation: "," 1.4s ease-in-out infinite;\n "]))),C)})),P=a.forwardRef((function(e,t){const r=(0,x.b)({props:e,name:"MuiCircularProgress"}),{className:o,color:a="primary",disableShrink:c=!1,size:h=40,style:u,thickness:p=3.6,value:g=0,variant:f="indeterminate"}=r,b=(0,n.A)(r,j),v=(0,i.A)({},r,{color:a,disableShrink:c,size:h,thickness:p,value:g,variant:f}),y=(e=>{const{classes:t,variant:r,color:o,disableShrink:n}=e,i={root:["root",r,"color".concat((0,d.A)(o))],svg:["svg"],circle:["circle","circle".concat((0,d.A)(r)),n&&"circleDisableShrink"]};return(0,s.A)(i,m,t)})(v),w={},S={},k={};if("determinate"===f){const e=2*Math.PI*((D-p)/2);w.strokeDasharray=e.toFixed(3),k["aria-valuenow"]=Math.round(g),w.strokeDashoffset="".concat(((100-g)/100*e).toFixed(3),"px"),S.transform="rotate(-90deg)"}return(0,A.jsx)(z,(0,i.A)({className:(0,l.A)(y.root,o),style:(0,i.A)({width:h,height:h},S,u),ownerState:v,ref:t,role:"progressbar"},k,b,{children:(0,A.jsx)(I,{className:y.svg,ownerState:v,viewBox:"".concat(22," ").concat(22," ").concat(D," ").concat(D),children:(0,A.jsx)(W,{className:y.circle,style:w,ownerState:v,cx:D,cy:D,r:(D-p)/2,fill:"none",strokeWidth:p})})}))}))},56311:(e,t,r)=>{r.d(t,{A:()=>u});var o=r(89379),n=r(9950),i=r(2660),a=r(2046),l=r(83274),s=r(25333),c=r(97125),d=r(7762),x=r(52097),h=r(44414);const u=e=>{let{value:t,onChange:r,onDebouncedChange:u,debounceTime:p=500,placeholder:m="Search (ctrl+k)",sx:g}=e;const f=(0,n.useRef)(null),[b]=(0,x.d7)(t,p);return(0,n.useEffect)((()=>{u&&u(b)}),[b,u]),(0,n.useEffect)((()=>{const e=e=>{var t;"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),null===(t=f.current)||void 0===t||t.focus());"Escape"===e.key&&document.activeElement===f.current&&f.current.blur()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[]),(0,h.jsx)(i.A,{sx:(0,o.A)({},g),inputRef:f,placeholder:m,autoComplete:"off",value:t,fullWidth:!0,onChange:e=>r(e.target.value),startAdornment:(0,h.jsx)(a.A,{position:"start",sx:{mr:-.5},children:(0,h.jsx)(c.A,{})}),endAdornment:(0,h.jsx)(l.A,{title:"Clear",children:(0,h.jsx)(s.A,{sx:{visibility:t?"visible":"hidden"},onClick:()=>r(""),children:(0,h.jsx)(d.A,{})})})})}},58691:(e,t,r)=>{r.d(t,{A:()=>l});r(9950);var o=r(16491),n=r(46639),i=r(62217),a=r(44414);function l(e){let{size:t=70,imgSize:r=40,alt:l="loader"}=e;return(0,a.jsxs)(o.A,{position:"relative",display:"inline-flex",justifyContent:"center",alignItems:"center",children:[(0,a.jsx)(n.A,{size:t}),(0,a.jsx)(o.A,{position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",sx:{width:r,height:r},children:(0,a.jsx)("img",{src:i,alt:l,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"}})})]})}},59212:(e,t,r)=>{r.d(t,{A:()=>h});var o=r(89379),n=r(9950),i=r(93230),a=r(41413),l=r(77922),s=r(29925),c=r(26910),d=r(31222),x=r(44414);const h=(0,n.forwardRef)(((e,t)=>{let{setAppId:r,setLocoName:h,setPage:u,sx:p,textfeildSx:m,textfieldSx:g,pill:f=!1,accentColor:b="#6366f1",icon:v,placeholder:A="Select Zone",paperComponent:j}=e;const[y,w]=(0,n.useState)(JSON.parse(localStorage.getItem("applocations")||"[]"));(0,n.useEffect)((()=>{0===y.length&&(async()=>{try{const e=localStorage.getItem("userid");if(!e)return;const t=await c.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/partners/getlocations/?userid=").concat(e));if(t.data.status){const e=[...t.data.details,{locationname:"All",applocationid:0}];localStorage.setItem("applocations",JSON.stringify(e)),w(e)}}catch(e){console.error("Error fetching locations in LocationAutocomplete:",e)}})()}),[y.length]);const S=e=>"".concat(b).concat(e),k=S("08"),D=S("26"),M=S("55"),C=S("18"),z=f?{cursor:"pointer","& .MuiOutlinedInput-root":{borderRadius:"999px",bgcolor:k,fontWeight:600,color:"#0f172a",paddingRight:"8px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s, background-color 0.2s","& fieldset":{borderColor:M,borderWidth:1.5},"&:hover fieldset":{borderColor:b},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(D)},"&.Mui-focused fieldset":{borderColor:b,borderWidth:2}},"& .MuiAutocomplete-endAdornment .MuiSvgIcon-root":{color:b}}:{},I=f&&(0,x.jsx)(i.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5,mr:.25,flexShrink:0},children:(0,x.jsx)(a.A,{sx:{width:24,height:24,bgcolor:C,color:b,transition:"background-color 0.15s, color 0.15s"},children:v||(0,x.jsx)(d.HPi,{size:14})})});return(0,x.jsx)(l.A,{id:"location-autocomplete",options:y||[],getOptionLabel:e=>{var t;return null!==(t=null===e||void 0===e?void 0:e.locationname)&&void 0!==t?t:""},PaperComponent:j,sx:(0,o.A)({},p),onChange:(e,t,o)=>{"clear"===o?(null===r||void 0===r||r(0),null===h||void 0===h||h(""),null===u||void 0===u||u(0)):t&&(null===r||void 0===r||r(t.applocationid),null===h||void 0===h||h(t.locationname),null===u||void 0===u||u(0))},renderInput:e=>f?(0,x.jsx)(s.A,(0,o.A)((0,o.A)({},e),{},{inputRef:t,placeholder:A,InputProps:(0,o.A)((0,o.A)({},e.InputProps),{},{startAdornment:I}),sx:(0,o.A)((0,o.A)({},z),g||m||{})})):(0,x.jsx)(s.A,(0,o.A)((0,o.A)({},e),{},{inputRef:t,label:"Select Zones",sx:(0,o.A)({},g||m||{})}))})}))}}]);