Files
Express_console_build/build/static/js/5235.534e4ff6.chunk.js

1 line
50 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[5235],{11041:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Ie});var o=r(22555),i=r(85672),n=r(66157),l=r(41033),a=r(68320),s=r(55235),c=r(97043),d=r(23440),x=r(48738),u=r(71392),h=r(91834),p=r(2866),m=r(76264),g=r(15227),f=r(1939),b=r(17488),v=r(86270),A=r(80911),j=r(83209),y=r(11969),w=r(72486),S=r(54016),k=r(50755),D=r(1596),M=r(81802),C=r(58571),z=r(58689),I=r(19619),W=r(5670),P=r(81062),R=r(17450),Y=r(69039),T=r(48952),L=r(15172),O=r(43e3),N=r(69191),E=r(87),F=r(69810),K=r(91001),H=r(73413),_=r.n(H),B=(r(98443),r(46077)),q=r.n(B),J=r(15059),G=r(94826),Z=r(65908),U=r(22686);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:n}=e;console.log("additionalProps",r);const l=(0,i.useRef)(null),a=(0,Y.A)(),[s,c]=(0,i.useState)([]),[d,h]=(0,i.useState)(!1);if((0,i.useEffect)((()=>{if(l.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)))]];l.current.fitBounds(e)}}),[t]),(0,i.useEffect)((()=>{(async()=>{if(h(!0),t.length<2)return c([]),void h(!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)),i=e[e.length-1];return o[o.length-1]!==i&&o.push(i),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"),i=await fetch(o),n=await i.json();if(n.matchings&&n.matchings.length>0){const e=n.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 h(!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"),i=await fetch(o),n=await i.json();if(n.routes&&n.routes[0]){const e=n.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{h(!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,Z.jsxs)(u.A,{direction:"row",spacing:1,alignItems:"center",children:[(0,Z.jsxs)(p.A,{variant:"subtitle1",sx:{fontWeight:600},children:[t,":"]}),(0,Z.jsx)(P.A,{label:r||"0.00",color:"primary",sx:{fontWeight:700}})]})};return(0,Z.jsxs)(x.A,{sx:{width:"100%",height:"100vh",position:"relative",overflow:"hidden"},children:[d&&(0,Z.jsx)(G.A,{}),(0,Z.jsx)(P.A,{label:"Close",icon:(0,Z.jsx)(J.A,{style:{fontSize:18}}),onClick:()=>n(!1),sx:{position:"absolute",top:12,right:12,zIndex:2e3,bgcolor:a.palette.error.main,color:"#fff",fontWeight:600,borderRadius:"12px",px:1.5,py:.5,boxShadow:a.shadows[4],cursor:"pointer","& .MuiChip-icon":{color:"#fff"}}}),(0,Z.jsxs)(O.W,{center:f,zoom:14,scrollWheelZoom:!0,style:{height:"100%",width:"100%"},ref:l,children:[(0,Z.jsx)(N.e,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,Z.jsx)(E.p,{position:m,icon:V,children:(0,Z.jsx)(F.m,{direction:"bottom",children:"Pickup: ".concat(q()(r.riderStart).format("DD-MM-YYYY hh:mm A"))})}),(0,Z.jsx)(E.p,{position:g,icon:$,children:(0,Z.jsx)(F.m,{direction:"bottom",children:"Drop: ".concat(q()(r.riderEnd).format("DD-MM-YYYY hh:mm A"))})}),s.length>0&&(0,Z.jsx)(K.R,{positions:s,pathOptions:{color:"blue",weight:5}})]}),(0,Z.jsx)(x.A,{sx:{position:"absolute",bottom:0,width:"100%",bgcolor:"rgba(255,255,255,0.96)",p:2,boxShadow:a.shadows[3],zIndex:1500},children:(0,Z.jsxs)(u.A,{direction:"row",flexWrap:"wrap",rowGap:1.5,columnGap:3,alignItems:"center",children:[(0,Z.jsx)(b,{label:"Tenant",value:null===o||void 0===o?void 0:o.tenantname}),(0,Z.jsx)(b,{label:"Rider",value:null===o||void 0===o?void 0:o.ridername}),(0,Z.jsx)(b,{label:"Pickup",value:null===o||void 0===o?void 0:o.pickupcustomer}),(0,Z.jsx)(b,{label:"Drop",value:null===o||void 0===o?void 0:o.deliverycustomer}),(0,Z.jsx)(b,{label:"Kms",value:null===o||void 0===o?void 0:o.kms}),(0,Z.jsx)(b,{label:"Actual Kms",value:null===o||void 0===o?void 0:o.actualkms}),(0,Z.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(13659),oe=r(35678),ie=r(56311),ne=r(58691),le=r(59212),ae=r(27001),se=r(36803),ce=r(20466);function de(e){let{rows:t=5,columns:r=6,height:o=40}=e;return(0,Z.jsx)(Z.Fragment,{children:[...Array(t)].map(((e,t)=>(0,Z.jsx)(k.A,{children:[...Array(r)].map(((e,t)=>(0,Z.jsx)(D.A,{children:(0,Z.jsx)(h.A,{variant:"rectangular",height:o,width:70,animation:"wave"})},t)))},t)))})}var xe=r(23787),ue=r(22686);q().extend(ue);const he=(e,t,r)=>{(0,re.M8)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:r||1500})},pe={radiusPill:999,radiusCard:14,shadowSoft:"0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05)",shadowMd:"0 1px 3px rgba(15, 23, 42, 0.06)",shadowPop:"0 12px 32px rgba(15, 23, 42, 0.12)",textPrimary:"#0f172a",textSecondary:"#64748b",textMuted:"#94a3b8",borderSubtle:"#e2e8f0",divider:"#f1f5f9",surface:"#ffffff",surfaceAlt:"#f8fafc"},me=(e,t)=>"".concat(e).concat(t),ge=e=>me(e,"08"),fe=e=>me(e,"18"),be=e=>me(e,"26"),ve=e=>me(e,"55"),Ae="#662582",je="#9255AB",ye=e=>(0,Z.jsx)(s.A,(0,o.A)((0,o.A)({},e),{},{sx:{mt:.75,borderRadius:2,boxShadow:pe.shadowPop,border:"1px solid",borderColor:"divider",overflow:"hidden"}})),we=e=>{let{color:t,selected:r,size:o=24,children:i}=e;return(0,Z.jsx)(c.A,{sx:{width:o,height:o,bgcolor:r?t:fe(t),color:r?"#fff":t,transition:"background-color 0.15s, color 0.15s"},children:i})},Se=e=>({"& .MuiOutlinedInput-root":{borderRadius:"10px",bgcolor:"#ffffff",fontWeight:600,"& fieldset":{borderColor:"#e2e8f0",borderWidth:1},"&:hover fieldset":{borderColor:"#cbd5e1"},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(be(e))},"&.Mui-focused fieldset":{borderColor:"#662582",borderWidth:1.5}}}),ke={all:{label:"All",color:Ae,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}},De=["all","pending","accepted","arrived","picked","active","delivered","skipped","cancelled"],Me=e=>{let{color:t,icon:r,label:o,tooltip:i}=e;return(0,Z.jsx)(d.A,{title:i||"",placement:"top",children:(0,Z.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1,py:.375,borderRadius:999,bgcolor:"#ffffff",border:"1px solid ".concat(ve(t)),color:t,fontSize:11,fontWeight:800,minWidth:80,justifyContent:"center",whiteSpace:"nowrap"},children:[r,o]})})},Ce=e=>{let{value:t,formatDate:r,formatTime:o,success:i}=e;return t?(0,Z.jsxs)(u.A,{spacing:.25,children:[(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary,fontWeight:600,whiteSpace:"nowrap"},children:r(t)}),(0,Z.jsxs)(u.A,{direction:"row",alignItems:"center",spacing:.5,children:[(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textPrimary,fontWeight:800,whiteSpace:"nowrap"},children:o(t)}),i&&(0,Z.jsx)(L.cxC,{style:{color:"#10b981",fontSize:12}})]})]}):(0,Z.jsxs)(u.A,{spacing:.5,children:[(0,Z.jsx)(h.A,{animation:!1,variant:"text",width:70,height:12}),(0,Z.jsx)(h.A,{animation:!1,variant:"text",width:55,height:14})]})};function ze(e,t){const r=e=>e*Math.PI/180,o=r(e[0]),i=r(t[0]),n=r(t[0]-e[0]),l=r(t[1]-e[1]),a=Math.sin(n/2)**2+Math.cos(o)*Math.cos(i)*Math.sin(l/2)**2;return 12742*Math.asin(Math.min(1,Math.sqrt(a)))}function Ie(){const e=(0,Y.A)(),t=(0,m.A)(e.breakpoints.down("md")),r=(0,i.useRef)(),h=(0,i.useRef)(),L=(0,i.useRef)(null),O=(0,i.useRef)(null),N=localStorage.getItem("userid"),[E,F]=(0,i.useState)(0),[K,H]=(0,i.useState)(50),[_,B]=(0,i.useState)("All"),[J,U]=(0,i.useState)(q()().format("YYYY-MM-DD")),[V,$]=(0,i.useState)(q()().format("YYYY-MM-DD")),[ue,me]=(0,i.useState)(!1),[Ie,We]=(0,i.useState)(!1),[Pe,Re]=(0,i.useState)("Today"),[Ye,Te]=(0,i.useState)(0),[Le,Oe]=(0,i.useState)(""),[Ne,Ee]=(0,i.useState)(""),[Fe,Ke]=(0,i.useState)([]),[He,_e]=(0,i.useState)(),[Be,qe]=(0,i.useState)(),[Je,Ge]=(0,i.useState)({}),[Ze,Ue]=(0,i.useState)(!1);let[Ve,$e]=(0,i.useState)(0),[Xe,Qe]=(0,i.useState)(0),[et,tt]=(0,i.useState)(0),[rt,ot]=(0,i.useState)(0),[it,nt]=(0,i.useState)(0),[lt,at]=(0,i.useState)(0),[st,ct]=(0,i.useState)(0),[dt,xt]=(0,i.useState)(0),[ut,ht]=(0,i.useState)(0);const[pt,mt]=(0,i.useState)("All"),[gt,ft]=(0,i.useState)(0),[bt,vt]=(0,i.useState)(0),[At,jt]=(0,i.useState)(null),[yt,wt]=(0,i.useState)(null),[St,kt]=(0,i.useState)(),[Dt,Mt]=(0,i.useState)(null),[Ct,zt]=(0,i.useState)(!1),[It,Wt]=(0,i.useState)(!1),Pt={all:Ve,pending:et,accepted:it,arrived:dt,picked:lt,active:st,delivered:Xe,skipped:ut,cancelled:rt};function Rt(e,t,r,o){const i=(r-e)*(Math.PI/180),n=(o-t)*(Math.PI/180),l=Math.sin(i/2)*Math.sin(i/2)+Math.cos(e*(Math.PI/180))*Math.cos(r*(Math.PI/180))*Math.sin(n/2)*Math.sin(n/2);return 6371*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))}(0,i.useEffect)((()=>{vt(0),jt(null),ft(0),wt(null),kt(null),Mt(null)}),[Ye]),(0,i.useEffect)((()=>{ft(0),wt(null),Mt(null)}),[bt]),(0,i.useEffect)((()=>{Mt(null)}),[gt]);const Yt=async e=>{Wt(!0);try{const t=(await n.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 i=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:i&&i.isValid()?i.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){_e(e[0].logdate),qe(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,i=null!=t.measurementNoise?t.measurementNoise:2e-9,n=null!=t.outlierGate?t.outlierGate:9,l=null!=t.maxSpeedKmh?t.maxSpeedKmh:120,a=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=a(e),i=a(t)||o+1e3,n=Math.max(.001,(i-o)/1e3);if(ze([e.lat,e.lng],[t.lat,t.lng])/n*3600<=l)break;if(s+2<r.length){const e=r[s+2],o=a(e)||i+1e3,n=Math.max(.001,(o-i)/1e3);if(ze([t.lat,t.lng],[e.lat,e.lng])/n*3600<=l){s+=1;continue}}s++}const c=[r[s]];let d=a(r[s]);for(let p=s+1;p<r.length;p++){const e=r[p],t=a(e)||d+1e3,o=Math.max(.001,(t-d)/1e3),i=c[c.length-1];ze([i.lat,i.lng],[e.lat,e.lng])/o*3600>l||(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),l=new Array(t),s=new Array(t),d=new Array(t),x=new Array(t),u=a(c[0]),h=a(c[1]),p=Math.max(.1,(h-u)/1e3),m=(c[1][e]-c[0][e])/p;r[0]=[c[0][e],m],l[0]=[i,0,0,1],s[0]=r[0].slice(),d[0]=l[0].slice(),x[0]=0;let g=u;for(let b=1;b<t;b++){const t=a(c[b])||g+1e3,u=Math.max(.1,(t-g)/1e3);g=t,x[b]=u;const[h,p]=r[b-1],m=h+p*u,f=p,[v,A,j,y]=l[b-1],w=u*u,S=w*u,k=v+u*(A+j)+w*y+S*u/4*o,D=A+u*y+S/2*o,M=j+u*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+i;if(z*z/I>n){r[b]=[m,f],l[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],l[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,i,n,a]=l[o],c=t+e*i,u=i,h=n+e*a,p=a,[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+u*w,D=c*y+u*S,M=h*j+p*w,C=h*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]))},u=x("lat"),h=x("lng");return c.map(((e,t)=>({lat:u[t],lng:h[t],logdate:e.logdate,_ts:e._ts})))}(e),r=t.map((e=>({lat:e.lat,lng:e.lng})));Ke(r),function(e){let t=0;for(let r=0;r<e.length-1;r++){const{lat:o,lng:i}=e[r],{lat:n,lng:l}=e[r+1];t+=Rt(o,i,n,l)}}(r),We(!0)}else he("No Valid Logs Found","error",2e3)}else he("No Logs Found ","error",2e3)}catch(t){console.log("getdeliverylogs",t)}finally{Wt(!1)}},{data:Tt,isLoading:Lt,isError:Ot,error:Nt,fetchNextPage:Et,hasNextPage:Ft,isFetchingNextPage:Kt}=(0,l.q)({queryKey:["fetchdeliveries",Ye,N,pt,J,V,K,Ne,bt,gt,(null===St||void 0===St?void 0:St.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}),Ht=(null===Tt||void 0===Tt?void 0:Tt.pages.flatMap((e=>e.rows)))||[];(0,i.useEffect)((()=>{if(!Ft)return;const e=new IntersectionObserver((e=>{e[0].isIntersecting&&Et()}),{root:document.querySelector(".MuiTableContainer-root"),rootMargin:"0px",threshold:1});return r.current&&e.observe(r.current),()=>{r.current&&e.unobserve(r.current)}}),[Ft,Et]);const{data:_t,isLoading:Bt,isError:qt,error:Jt}=(0,a.I)({queryKey:["tenantlist",Ye],queryFn:()=>(0,Q.Mn)(Ye),enabled:0!==Ye}),{data:Gt,isLoading:Zt,isError:Ut,error:Vt}=(0,a.I)({queryKey:["fetchRidersList",Ye],queryFn:Q.Sd,enabled:0!==Ye}),{data:$t,isLoading:Xt,isError:Qt,error:er}=(0,a.I)({queryKey:["gettenantlocations",bt],queryFn:()=>(0,Q.DL)(bt),enabled:0!==bt});(0,i.useEffect)((()=>{(async()=>{Ue(!0);try{await n.A.get(0==Ye?"".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(Ye,"&tenantid=").concat(bt,"&locationid=").concat(gt,"&fromdate=").concat(J,"&todate=").concat(V,"&userid=").concat((null===St||void 0===St?void 0:St.userid)||0)).then((e=>{$e(e.data.details.total),tt(e.data.details.pending),nt(e.data.details.accepted),xt(e.data.details.arrived),at(e.data.details.picked),ct(e.data.details.active),Qe(e.data.details.delivered),ht(e.data.details.skipped),ot(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{Ue(!1)}})()}),[Ye,J,V,pt,bt,gt,St]);const tr=null===Ht||void 0===Ht?void 0:Ht.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 rr(e){return q()(e).format("DD/MM/YYYY ")}function or(e){return q()(e).format(" hh:mm A")}const ir=Ot?"An error has occurred: (fetchDeliveries) ".concat(Nt.message):qt?"An error has occurred: (getTenants) ".concat(Jt.message):Qt?"An error has occurred: (gettenantlocations) ".concat(er.message):Ut?"An error has occurred: (getriderbydelivery) ".concat(Vt.message):null;(0,i.useEffect)((()=>{ir&&he(ir,"warning",2e3)}),[ir]);const nr=[{key:"total",label:"Total Orders",color:Ae,icon:T.HU2,value:Ve},{key:"delivered",label:"Delivered",color:"#10b981",icon:T.cAP,value:Xe},{key:"pending",label:"Pending",color:"#f59e0b",icon:T.G6c,value:et},{key:"cancelled",label:"Cancelled",color:"#ef4444",icon:T.qiG,value:rt}];return(0,Z.jsxs)(Z.Fragment,{children:[(Ze||Bt||Xt||It||Zt||Kt)&&(0,Z.jsx)("div",{children:(0,Z.jsx)(te.A,{})}),Lt&&(0,Z.jsx)(g.A,{sx:{color:"#fff",zIndex:e=>e.zIndex.drawer+1},open:Lt}),(0,Z.jsx)(ae.A,{title:"Orders Details",subtitle:"Live \xb7 ".concat(_||"All Zones"," \xb7 ").concat(Pe),live:!0,action:(0,Z.jsx)(le.A,{ref:L,locaName:_,setAppId:Te,setLocoName:B,setPage:F,pill:!0,accentColor:Ae,icon:(0,Z.jsx)(T.HPi,{size:14}),placeholder:"Select Zone",paperComponent:ye,sx:{width:{xs:"100%",sm:280},zIndex:100}})}),(0,Z.jsx)(f.Ay,{container:!0,spacing:{xs:2,md:2.5},sx:{mb:{xs:1.5,md:2}},children:nr.map((e=>{var t;const r=e.icon;return(0,Z.jsx)(f.Ay,{item:!0,xs:6,sm:6,md:3,children:(0,Z.jsx)(se.A,{title:e.label,value:null!==(t=e.value)&&void 0!==t?t:0,icon:(0,Z.jsx)(r,{size:20}),color:e.color,loading:Ze})},e.key)}))}),(0,Z.jsx)(s.A,{elevation:0,sx:{mt:{xs:1.5,md:2},p:{xs:1.25,md:1.75},borderRadius:pe.radiusCard/8,border:"1px solid",borderColor:pe.borderSubtle,background:"#fff",boxShadow:pe.shadowSoft},children:(0,Z.jsxs)(f.Ay,{container:!0,spacing:1.25,alignItems:"center",children:[(0,Z.jsx)(f.Ay,{item:!0,xs:12,sm:6,md:3,children:(0,Z.jsx)(b.A,{options:_t||[],value:At,getOptionLabel:e=>(null===e||void 0===e?void 0:e.tenantname)||"",PaperComponent:ye,onOpen:e=>{Ye||(e.preventDefault(),(0,ce.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?(vt(0),jt(null),ft(0),wt(null)):(vt((null===t||void 0===t?void 0:t.tenantid)||0),jt(t),ft(t.locationid),wt(null))},renderInput:e=>(0,Z.jsx)(v.A,(0,o.A)((0,o.A)({},e),{},{inputRef:O,placeholder:"Select Tenant",size:"small",sx:Se("#0ea5e9"),InputProps:(0,o.A)((0,o.A)({},e.InputProps),{},{startAdornment:(0,Z.jsx)(u.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,Z.jsx)(we,{color:"#0ea5e9",size:22,selected:!0,children:(0,Z.jsx)(T.Itr,{size:13})})})})}))})}),(0,Z.jsx)(f.Ay,{item:!0,xs:12,sm:6,md:3,children:(0,Z.jsx)(b.A,{options:$t||[],getOptionLabel:e=>e?"".concat(e.locationname," (").concat(e.suburb,")"):"",value:yt,PaperComponent:ye,onOpen:e=>{Ye||bt?bt||(e.preventDefault(),(0,ce.k)("Please select a your Tenant first!","warning",3e3),setTimeout((()=>{var e;null===(e=O.current)||void 0===e||e.focus()}),0)):(e.preventDefault(),(0,ce.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?(ft(0),wt(null)):(ft(t.locationid||0),wt(t))},renderInput:e=>(0,Z.jsx)(v.A,(0,o.A)((0,o.A)({},e),{},{placeholder:"Select Location",size:"small",sx:Se("#10b981"),InputProps:(0,o.A)((0,o.A)({},e.InputProps),{},{startAdornment:(0,Z.jsx)(u.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,Z.jsx)(we,{color:"#10b981",size:22,selected:!0,children:(0,Z.jsx)(T.JFD,{size:13})})})})}))})}),(0,Z.jsx)(f.Ay,{item:!0,xs:12,sm:6,md:3,children:(0,Z.jsx)(b.A,{options:Gt||[],value:Dt,getOptionLabel:e=>"".concat(e.firstname," ").concat(e.lastname),PaperComponent:ye,onOpen:()=>{Ye||(0,ce.k)("Select App Location First","warning",2e3)},onChange:(e,t,r)=>{"clear"===r?(kt(null),Mt(null)):(kt(t),Mt(t))},renderInput:e=>(0,Z.jsx)(v.A,(0,o.A)((0,o.A)({},e),{},{placeholder:"Select Rider",size:"small",sx:Se("#8b5cf6"),InputProps:(0,o.A)((0,o.A)({},e.InputProps),{},{startAdornment:(0,Z.jsx)(u.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,Z.jsx)(we,{color:"#8b5cf6",size:22,selected:!0,children:(0,Z.jsx)(T.bsz,{size:13})})})})}))})}),(0,Z.jsx)(f.Ay,{item:!0,xs:12,sm:6,md:3,children:(0,Z.jsxs)(u.A,{direction:"row",spacing:1,alignItems:"center",justifyContent:{xs:"flex-start",md:"flex-end"},children:[(0,Z.jsx)(d.A,{title:"Date Filter",placement:"top",children:(0,Z.jsxs)(x.A,{onClick:()=>me(!0),sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.25,py:.75,borderRadius:999,cursor:"pointer",bgcolor:ge("#f59e0b"),border:"1.5px solid ".concat(ve("#f59e0b")),color:"#f59e0b",fontWeight:800,fontSize:12,transition:"all 0.18s","&:hover":{borderColor:"#f59e0b",boxShadow:"0 0 0 3px ".concat(be("#f59e0b"))}},children:[(0,Z.jsx)(T.Ki0,{size:14}),q()(J).format("DD/MM/YY")," \u2013 ",q()(V).format("DD/MM/YY")]})}),(0,Z.jsx)(A.A,{variant:"contained",size:"small",startIcon:(0,Z.jsx)(T.S3Y,{}),onClick:()=>{zt(!0),setTimeout((()=>{H("")}),0)},sx:{borderRadius:999,px:1.5,py:.75,fontWeight:800,fontSize:12,textTransform:"none",background:"linear-gradient(135deg, ".concat(Ae," 0%, ").concat(je," 100%)"),"&:hover":{background:"linear-gradient(135deg, ".concat(Ae," 0%, ").concat(je," 100%)"),boxShadow:"0 8px 22px ".concat(be(Ae))}},children:"Export"})]})})]})}),(0,Z.jsx)(s.A,{elevation:0,sx:{mt:{xs:1.5,md:2},p:{xs:1,md:1.5},borderTopLeftRadius:pe.radiusCard/8,borderTopRightRadius:pe.radiusCard/8,borderBottomLeftRadius:0,borderBottomRightRadius:0,border:"1px solid",borderColor:pe.borderSubtle,borderBottom:0,background:"#fff"},children:(0,Z.jsxs)(u.A,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:1.5,sx:{flexWrap:"wrap-reverse"},children:[(0,Z.jsx)(u.A,{direction:"row",spacing:.75,sx:{flex:1,overflowX:"auto",py:.5,px:.25,"&::-webkit-scrollbar":{height:6},"&::-webkit-scrollbar-thumb":{backgroundColor:pe.borderSubtle,borderRadius:4}},children:De.map((e=>{var t;const r=ke[e],o=r.icon,i=pt.toLowerCase()===e,n=null!==(t=Pt[e])&&void 0!==t?t:0;return(0,Z.jsxs)(x.A,{onClick:()=>mt("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:"1px solid ".concat(i?r.color:pe.borderSubtle),bgcolor:i?r.color:pe.surface,color:i?"#fff":pe.textSecondary,fontWeight:600,boxShadow:"none",transition:"background-color 0.15s, border-color 0.15s, color 0.15s","&:hover":{borderColor:i?r.color:"#cbd5e1",bgcolor:i?r.color:pe.surfaceAlt}},children:[(0,Z.jsx)(c.A,{sx:{width:{xs:22,md:26},height:{xs:22,md:26},bgcolor:i?"rgba(255,255,255,0.22)":fe(r.color),color:i?"#fff":r.color},children:(0,Z.jsx)(o,{size:13})}),(0,Z.jsx)(p.A,{variant:"caption",sx:{fontWeight:600,fontSize:{xs:11.5,md:13},lineHeight:1},children:r.label}),(0,Z.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:700,bgcolor:i?"rgba(255,255,255,0.22)":pe.surfaceAlt,color:i?"#fff":pe.textSecondary,border:"none"},children:n})]},e)}))}),(0,Z.jsx)(x.A,{sx:{width:{xs:"100%",sm:240,lg:280},flex:{xs:"1 1 100%",sm:"0 0 auto"}},children:(0,Z.jsx)(ie.A,{value:Le,onChange:Oe,onDebouncedChange:Ee,placeholder:"Search orders (ctrl+k)",sx:{m:0,width:"100%",borderRadius:999,bgcolor:"#ffffff","& fieldset":{borderColor:"#e2e8f0",borderWidth:1},"&:hover fieldset":{borderColor:"#cbd5e1"},"&.Mui-focused fieldset":{borderColor:"#662582",borderWidth:1.5},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(be(Ae))}}})})]})}),(0,Z.jsx)(s.A,{elevation:0,sx:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomLeftRadius:pe.radiusCard/8,borderBottomRightRadius:pe.radiusCard/8,border:"1px solid",borderColor:pe.borderSubtle,overflow:"hidden",background:"#fff"},children:(0,Z.jsxs)(j.A,{ref:h,onScroll:e=>{const{scrollTop:t,scrollHeight:r,clientHeight:o}=e.currentTarget;t+o>=r-50&&Ft&&!Kt&&Et()},sx:{maxHeight:{xs:"calc(100vh - 220px)",md:"calc(100vh - 190px)"},overflow:"auto","&::-webkit-scrollbar":{width:10,height:10},"&::-webkit-scrollbar-thumb":{backgroundColor:ve(Ae),borderRadius:8,"&:hover":{backgroundColor:Ae}},"&::-webkit-scrollbar-track":{backgroundColor:pe.surfaceAlt}},children:[t?(0,Z.jsx)(xe.nV,{sx:{p:1.25},children:Lt?(0,Z.jsxs)(u.A,{alignItems:"center",sx:{py:6},children:[(0,Z.jsx)(ne.A,{}),(0,Z.jsx)(p.A,{variant:"caption",color:"text.secondary",sx:{mt:1},children:"Loading orders\u2026"})]}):0==(null===Ht||void 0===Ht?void 0:Ht.length)?(0,Z.jsxs)(u.A,{alignItems:"center",spacing:1.5,sx:{py:6},children:[(0,Z.jsx)(c.A,{sx:{width:64,height:64,bgcolor:fe("#94a3b8"),color:pe.textMuted},children:(0,Z.jsx)(T.Z2J,{size:28})}),(0,Z.jsx)(p.A,{variant:"subtitle1",sx:{fontWeight:700,color:pe.textPrimary},children:"No orders to show"}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary,textAlign:"center",px:2},children:Le?"Try a different keyword.":"Adjust the filters above to load orders."})]}):null===Ht||void 0===Ht?void 0:Ht.map(((e,t)=>{var r;const o=String(e.orderstatus||"").toLowerCase(),i=ke[o]||{label:e.orderstatus||"\u2014",color:Ae,icon:T.Z2J},n=i.icon,l="cancelled"===o,a="delivered"===e.orderstatus;return(0,Z.jsx)(xe.pg,{accent:i.color,header:(0,Z.jsxs)(u.A,{spacing:1.25,children:[(0,Z.jsxs)(u.A,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",spacing:1,children:[(0,Z.jsxs)(u.A,{direction:"row",alignItems:"center",spacing:.75,sx:{minWidth:0},children:[(0,Z.jsx)(p.A,{variant:"caption",sx:{fontWeight:700,color:pe.textMuted},children:String(E*K+t+1).padStart(2,"0")}),(0,Z.jsx)(we,{color:Ae,size:32,children:(0,Z.jsx)(T.Itr,{size:16})}),(0,Z.jsxs)(u.A,{spacing:.25,sx:{minWidth:0},children:[(0,Z.jsx)(p.A,{variant:"subtitle2",sx:{fontWeight:700,color:pe.textPrimary},noWrap:!0,children:e.tenantname}),(0,Z.jsxs)(p.A,{variant:"caption",sx:{color:pe.textSecondary,fontWeight:700},children:["#",e.orderid]})]})]}),(0,Z.jsx)(d.A,{title:a?"View rider route":"Available for delivered orders",placement:"top",children:(0,Z.jsx)("span",{children:(0,Z.jsx)(y.A,{size:"small",disabled:!a,onClick:()=>{a&&(Yt(e.deliveryid),Ge(e))},sx:{flexShrink:0,bgcolor:fe(a?Ae:"#94a3b8"),color:a?Ae:pe.textMuted,border:"1px solid ".concat(ve(a?Ae:"#94a3b8")),"&:hover":{bgcolor:a?Ae:fe("#94a3b8"),color:a?"#fff":pe.textMuted}},children:(0,Z.jsx)(T.Cd7,{size:14})})})})]}),(0,Z.jsxs)(u.A,{direction:"row",alignItems:"center",spacing:.75,sx:{flexWrap:"wrap",gap:.5},children:[(0,Z.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1,py:.375,borderRadius:999,bgcolor:ge(i.color),border:"1px solid ".concat(ve(i.color)),color:i.color,fontSize:11,fontWeight:800},children:[(0,Z.jsx)(n,{size:12})," ",i.label]}),e.ridername&&(0,Z.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1,py:.375,borderRadius:999,bgcolor:ge("#8b5cf6"),border:"1px solid ".concat(ve("#8b5cf6")),color:"#8b5cf6",fontSize:11,fontWeight:800},children:[(0,Z.jsx)(T.bsz,{size:12})," ",e.ridername]}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textMuted,fontWeight:600},children:q()(e.deliverydate).utc().format("DD/MM/YYYY \xb7 hh:mm A")})]})]}),children:(0,Z.jsxs)(xe.FG,{children:[(0,Z.jsx)(xe.pY,{label:"Pickup",children:(0,Z.jsxs)(u.A,{spacing:.25,sx:{minWidth:0},children:[(0,Z.jsx)(p.A,{sx:{fontSize:13,fontWeight:700,color:pe.textPrimary},noWrap:!0,children:e.pickupcustomer||"\u2014"}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary},noWrap:!0,children:e.pickupcontactno}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary},noWrap:!0,children:e.pickupsuburb||(e.Pickupaddress?e.Pickupaddress.slice(0,22)+"\u2026":"")}),e.applocation&&(0,Z.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:.75,py:.25,borderRadius:999,bgcolor:ge("#10b981"),border:"1px solid ".concat(ve("#10b981")),color:"#10b981",fontSize:10,fontWeight:800,width:"fit-content"},children:[(0,Z.jsx)(T.JFD,{size:11})," ",e.applocation]})]})}),(0,Z.jsx)(xe.pY,{label:"Drop",children:(0,Z.jsxs)(u.A,{spacing:.25,sx:{minWidth:0},children:[(0,Z.jsx)(p.A,{sx:{fontSize:13,fontWeight:700,color:pe.textPrimary},noWrap:!0,children:e.deliverycustomer||"\u2014"}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary},noWrap:!0,children:e.deliverycontactno}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary},noWrap:!0,children:e.deliverysuburb||(e.deliveryaddress?e.deliveryaddress.slice(0,22)+"\u2026":"")})]})}),(0,Z.jsx)(xe.pY,{label:"Assigned",children:(0,Z.jsx)(Ce,{value:e.assigntime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(xe.pY,{label:"Accepted",children:(0,Z.jsx)(Ce,{value:e.acceptedtime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(xe.pY,{label:"Arrived",children:(0,Z.jsx)(Ce,{value:e.arrivaltime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(xe.pY,{label:"Picked",children:(0,Z.jsx)(Ce,{value:e.pickuptime,formatDate:rr,formatTime:or,success:"active"===e.deliverystatus})}),(0,Z.jsx)(xe.pY,{label:"Active",children:(0,Z.jsx)(Ce,{value:e.starttime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(xe.pY,{label:"Delivered",children:(0,Z.jsx)(Ce,{value:e.deliverytime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(xe.pY,{label:"Cancelled",children:(0,Z.jsx)(Ce,{value:e.canceltime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(xe.pY,{label:"KMS \xb7 plan / act / rider",full:!0,children:(0,Z.jsxs)(u.A,{direction:"row",spacing:.5,sx:{flexWrap:"wrap",gap:.5},children:[(0,Z.jsx)(Me,{color:"#ef4444",icon:(0,Z.jsx)(T.xI$,{size:11}),label:l||""==e.kms?"0 km":"".concat(e.kms," km"),tooltip:"KMS"}),(0,Z.jsx)(Me,{color:"#10b981",icon:(0,Z.jsx)(T.xI$,{size:11}),label:"".concat(null!==(r=e.cumulativekms)&&void 0!==r?r:0," km"),tooltip:"Actual KMS"}),(0,Z.jsx)(Me,{color:"#0ea5e9",icon:(0,Z.jsx)(T.xI$,{size:11}),label:"".concat(e.previouskms||(l?"0.00":e.kms)||0," km"),tooltip:"Rider KMS"})]})}),(0,Z.jsx)(xe.pY,{label:"Charges \xb7 chg / amt",full:!0,children:(0,Z.jsxs)(u.A,{direction:"row",spacing:.5,sx:{flexWrap:"wrap",gap:.5},children:[(0,Z.jsx)(Me,{color:"#ef4444",icon:(0,Z.jsx)(T.YHz,{size:11}),label:l||""==e.deliverycharges?"0.00":"".concat(e.deliverycharges,".00"),tooltip:"Delivery Charge"}),(0,Z.jsx)(Me,{color:"#10b981",icon:(0,Z.jsx)(T.YHz,{size:11}),label:""==e.deliveryamt?"0.00":"".concat(e.deliveryamt,".00"),tooltip:"Delivery Amount"})]})}),e.ordernotes&&(0,Z.jsx)(xe.pY,{label:"Notes",full:!0,children:(0,Z.jsxs)(u.A,{direction:"row",spacing:.5,alignItems:"flex-start",children:[(0,Z.jsx)(T.NpB,{size:12,color:pe.textMuted,style:{marginTop:2,flexShrink:0}}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary},children:e.ordernotes})]})})]})},e.deliveryid||"".concat(e.orderid,"-").concat(t))}))}):(0,Z.jsxs)(w.A,{stickyHeader:!0,sx:{minWidth:1600},children:[(0,Z.jsx)(S.A,{children:(0,Z.jsxs)(k.A,{sx:{"& th":{backgroundColor:pe.surfaceAlt,color:pe.textSecondary,fontSize:{xs:10,md:11},fontWeight:800,letterSpacing:.6,textTransform:"uppercase",whiteSpace:"nowrap",borderBottom:"1px solid ".concat(pe.borderSubtle),py:{xs:1,md:1.25},px:{xs:1,md:1.5}}},children:[(0,Z.jsx)(D.A,{children:"#"}),(0,Z.jsx)(D.A,{children:"Map"}),(0,Z.jsx)(D.A,{children:"Client"}),(0,Z.jsx)(D.A,{children:"Pickup"}),(0,Z.jsx)(D.A,{children:"Drop"}),(0,Z.jsx)(D.A,{children:"Status / Rider"}),(0,Z.jsx)(D.A,{children:"Assigned"}),(0,Z.jsx)(D.A,{children:"Accepted"}),(0,Z.jsx)(D.A,{children:"Arrived"}),(0,Z.jsx)(D.A,{children:"Picked"}),(0,Z.jsx)(D.A,{children:"Active"}),(0,Z.jsx)(D.A,{children:"Delivered"}),(0,Z.jsx)(D.A,{children:"Cancelled"}),(0,Z.jsx)(D.A,{children:"Notes"}),(0,Z.jsx)(D.A,{align:"center",children:"KMS"}),(0,Z.jsx)(D.A,{align:"center",children:"Charges"})]})}),(0,Z.jsx)(M.A,{children:Lt?(0,Z.jsx)(de,{rows:16,columns:16,height:15}):0==(null===Ht||void 0===Ht?void 0:Ht.length)?(0,Z.jsx)(k.A,{children:(0,Z.jsx)(D.A,{colSpan:16,sx:{py:6},children:(0,Z.jsxs)(u.A,{alignItems:"center",spacing:1.5,children:[(0,Z.jsx)(c.A,{sx:{width:64,height:64,bgcolor:fe("#94a3b8"),color:pe.textMuted},children:(0,Z.jsx)(T.Z2J,{size:28})}),(0,Z.jsx)(p.A,{variant:"subtitle1",sx:{fontWeight:700,color:pe.textPrimary},children:"No orders to show"}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary},children:Le?"Try a different keyword.":"Adjust the filters above to load orders."})]})})}):null===Ht||void 0===Ht?void 0:Ht.map(((e,t)=>{var r;const o=String(e.orderstatus||"").toLowerCase(),i=ke[o]||{label:e.orderstatus||"\u2014",color:Ae,icon:T.Z2J},n=i.icon,l="cancelled"===o;return(0,Z.jsxs)(k.A,{sx:{transition:"background-color 0.15s","& td":{borderBottom:"1px solid ".concat(pe.divider),py:{xs:1,md:1.25},px:{xs:1,md:1.5},verticalAlign:"top"},"&:hover":{backgroundColor:pe.surfaceAlt}},children:[(0,Z.jsx)(D.A,{children:(0,Z.jsx)(p.A,{variant:"caption",sx:{fontWeight:700,color:pe.textMuted},children:String(E*K+t+1).padStart(2,"0")})}),(0,Z.jsx)(D.A,{children:(0,Z.jsx)(d.A,{title:"delivered"===e.orderstatus?"View rider route":"Available for delivered orders",placement:"top",children:(0,Z.jsx)("span",{children:(0,Z.jsx)(y.A,{size:"small",disabled:"delivered"!==e.orderstatus,onClick:()=>{"delivered"===e.orderstatus&&(Yt(e.deliveryid),Ge(e))},sx:{bgcolor:"delivered"===e.orderstatus?fe(Ae):fe("#94a3b8"),color:"delivered"===e.orderstatus?Ae:pe.textMuted,border:"1px solid ".concat("delivered"===e.orderstatus?ve(Ae):ve("#94a3b8")),"&:hover":{bgcolor:"delivered"===e.orderstatus?Ae:fe("#94a3b8"),color:"delivered"===e.orderstatus?"#fff":pe.textMuted}},children:(0,Z.jsx)(T.Cd7,{size:14})})})})}),(0,Z.jsx)(D.A,{children:(0,Z.jsxs)(u.A,{direction:"row",alignItems:"flex-start",spacing:1,children:[(0,Z.jsx)(we,{color:Ae,size:32,children:(0,Z.jsx)(T.Itr,{size:16})}),(0,Z.jsxs)(u.A,{spacing:.25,sx:{minWidth:0},children:[(0,Z.jsx)(p.A,{variant:"subtitle2",sx:{fontWeight:700,color:pe.textPrimary,whiteSpace:"nowrap"},children:e.tenantname}),(0,Z.jsx)(d.A,{title:"Order ID",placement:"top",children:(0,Z.jsxs)(p.A,{variant:"caption",sx:{color:pe.textSecondary,fontWeight:700},children:["#",e.orderid]})}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textMuted},children:q()(e.deliverydate).utc().format("DD/MM/YYYY \xb7 hh:mm A")})]})]})}),(0,Z.jsx)(D.A,{children:(0,Z.jsxs)(u.A,{spacing:.25,children:[(0,Z.jsx)(p.A,{variant:"subtitle2",sx:{fontWeight:700,color:pe.textPrimary,whiteSpace:"nowrap"},children:e.pickupcustomer||"\u2014"}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary},children:e.pickupcontactno}),(0,Z.jsx)(d.A,{title:e.Pickupaddress||e.pickupsuburb||"",children:(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.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,Z.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:.75,py:.25,borderRadius:999,bgcolor:ge("#10b981"),border:"1px solid ".concat(ve("#10b981")),color:"#10b981",fontSize:10,fontWeight:800,width:"fit-content"},children:[(0,Z.jsx)(T.JFD,{size:11})," ",e.applocation]})]})}),(0,Z.jsx)(D.A,{children:(0,Z.jsxs)(u.A,{spacing:.25,children:[(0,Z.jsx)(p.A,{variant:"subtitle2",sx:{fontWeight:700,color:pe.textPrimary,whiteSpace:"nowrap"},children:e.deliverycustomer||"\u2014"}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary},children:e.deliverycontactno}),(0,Z.jsx)(d.A,{title:e.deliveryaddress||"",children:(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary,cursor:"pointer",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.deliverysuburb||(e.deliveryaddress?e.deliveryaddress.slice(0,22)+"\u2026":"")})})]})}),(0,Z.jsx)(D.A,{children:(0,Z.jsxs)(u.A,{spacing:.5,children:[(0,Z.jsxs)(x.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1,py:.375,borderRadius:999,bgcolor:ge(i.color),border:"1px solid ".concat(ve(i.color)),color:i.color,fontSize:11,fontWeight:800,width:"fit-content"},children:[(0,Z.jsx)(n,{size:12})," ",i.label]}),e.ridername&&(0,Z.jsxs)(u.A,{direction:"row",alignItems:"center",spacing:.5,children:[(0,Z.jsx)(T.bsz,{size:12,color:pe.textMuted}),(0,Z.jsx)(d.A,{title:"Rider ID: ".concat(e.userid),children:(0,Z.jsx)(p.A,{variant:"caption",sx:{fontWeight:700,color:pe.textPrimary,whiteSpace:"nowrap"},children:e.ridername})})]})]})}),(0,Z.jsx)(D.A,{children:(0,Z.jsx)(Ce,{value:e.assigntime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(D.A,{children:(0,Z.jsx)(Ce,{value:e.acceptedtime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(D.A,{children:(0,Z.jsx)(Ce,{value:e.arrivaltime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(D.A,{children:(0,Z.jsx)(Ce,{value:e.pickuptime,formatDate:rr,formatTime:or,success:"active"===e.deliverystatus})}),(0,Z.jsx)(D.A,{children:(0,Z.jsx)(Ce,{value:e.starttime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(D.A,{children:(0,Z.jsx)(Ce,{value:e.deliverytime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(D.A,{children:(0,Z.jsx)(Ce,{value:e.canceltime,formatDate:rr,formatTime:or})}),(0,Z.jsx)(D.A,{sx:{maxWidth:180},children:e.ordernotes?(0,Z.jsxs)(u.A,{direction:"row",spacing:.5,alignItems:"flex-start",children:[(0,Z.jsx)(T.NpB,{size:12,color:pe.textMuted,style:{marginTop:2,flexShrink:0}}),(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textSecondary,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.ordernotes})]}):(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textMuted},children:"\u2014"})}),(0,Z.jsx)(D.A,{align:"center",children:(0,Z.jsxs)(u.A,{spacing:.5,alignItems:"center",children:[(0,Z.jsx)(Me,{color:"#ef4444",icon:(0,Z.jsx)(T.xI$,{size:11}),label:l||""==e.kms?"0 km":"".concat(e.kms," km"),tooltip:"KMS"}),(0,Z.jsx)(Me,{color:"#10b981",icon:(0,Z.jsx)(T.xI$,{size:11}),label:"".concat(null!==(r=e.cumulativekms)&&void 0!==r?r:0," km"),tooltip:"Actual KMS"}),(0,Z.jsx)(Me,{color:"#0ea5e9",icon:(0,Z.jsx)(T.xI$,{size:11}),label:"".concat(e.previouskms||(l?"0.00":e.kms)||0," km"),tooltip:"Rider KMS"})]})}),(0,Z.jsx)(D.A,{align:"center",children:(0,Z.jsxs)(u.A,{spacing:.5,alignItems:"center",children:[(0,Z.jsx)(Me,{color:"#ef4444",icon:(0,Z.jsx)(T.YHz,{size:11}),label:l||""==e.deliverycharges?"0.00":"".concat(e.deliverycharges,".00"),tooltip:"Delivery Charge"}),(0,Z.jsx)(Me,{color:"#10b981",icon:(0,Z.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,Z.jsx)(C.A,{}),0!==(null===Ht||void 0===Ht?void 0:Ht.length)&&(0,Z.jsx)(u.A,{justifyContent:"center",alignItems:"center",sx:{width:"100%",py:2},children:(0,Z.jsx)(u.A,{ref:r,style:{textAlign:"center",width:"100%"},children:Kt||Ft?(0,Z.jsx)(ne.A,{}):(0,Z.jsx)(p.A,{variant:"caption",sx:{color:pe.textMuted,fontWeight:600},children:"No more orders"})})})]})}),(0,Z.jsxs)(z.A,{open:Ct,onClose:()=>zt(!1),fullWidth:!0,maxWidth:"sm",fullScreen:t,PaperProps:{sx:{borderRadius:{xs:0,sm:3},overflow:"hidden"}},children:[(0,Z.jsx)(I.A,{sx:{background:"linear-gradient(135deg, ".concat(Ae," 0%, ").concat(je," 100%)"),color:"#fff",py:2},children:(0,Z.jsxs)(u.A,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[(0,Z.jsxs)(u.A,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,Z.jsx)(c.A,{sx:{width:36,height:36,bgcolor:"rgba(255,255,255,0.22)",color:"#fff"},children:(0,Z.jsx)(T.S3Y,{size:20})}),(0,Z.jsxs)(u.A,{children:[(0,Z.jsx)(p.A,{sx:{fontSize:11,fontWeight:700,opacity:.85,letterSpacing:.6,textTransform:"uppercase",lineHeight:1},children:"Report"}),(0,Z.jsx)(p.A,{sx:{fontWeight:800,fontSize:{xs:"1.05rem",sm:"1.2rem"},lineHeight:1.2,mt:.25},children:"Export Orders"})]})]}),(0,Z.jsx)(y.A,{size:"small",onClick:()=>zt(!1),sx:{color:"#fff",bgcolor:"rgba(255,255,255,0.18)","&:hover":{bgcolor:"rgba(255,255,255,0.3)"}},children:(0,Z.jsx)(T.m6K,{size:16})})]})}),(0,Z.jsxs)(W.A,{sx:{p:2},children:[Lt&&(0,Z.jsx)(G.A,{}),[{label:"App Location",value:_,color:Ae},{label:"Tenant",value:null===At||void 0===At?void 0:At.tenantname,color:"#0ea5e9"},{label:"Business Location",value:null===yt||void 0===yt?void 0:yt.locationname,color:"#10b981"},{label:"Status",value:pt,color:"#f59e0b"},{label:"Rider",value:Dt?"".concat(Dt.firstname," ").concat(Dt.lastname):null,color:"#8b5cf6"},{label:"Keyword",value:Le,color:"#06b6d4"},{label:"Start Date",value:J,color:"#14b8a6"},{label:"End Date",value:V,color:"#ef4444"}].map(((e,t)=>(0,Z.jsxs)(u.A,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{px:1.5,py:1,borderRadius:2,bgcolor:ge(e.color),border:"1px solid ".concat(ve(e.color)),mb:1},children:[(0,Z.jsx)(p.A,{variant:"body2",sx:{fontWeight:700,color:pe.textPrimary},children:e.label}),(0,Z.jsx)(P.A,{size:"small",label:e.value||"None",sx:{fontWeight:700,bgcolor:e.value?e.color:fe("#94a3b8"),color:e.value?"#fff":pe.textMuted,border:"none"}})]},t)))]}),(0,Z.jsxs)(R.A,{sx:{p:2,bgcolor:pe.surfaceAlt,gap:1},children:[(0,Z.jsx)(A.A,{color:"inherit",variant:"outlined",onClick:()=>zt(!1),sx:{borderRadius:999,px:2,textTransform:"none",fontWeight:700,borderColor:pe.borderSubtle,color:pe.textSecondary},children:"Cancel"}),(0,Z.jsx)(ee.pK,{data:tr,filename:"Orders_Detail_".concat(q()().format("YYYY-MM-DD_HHmmss"),".csv"),label:"Download CSV",btnLoading:Lt,onClick:()=>{setTimeout((()=>zt(!1)),0)}})]})]}),(0,Z.jsx)(oe.A,{open:ue,onClose:()=>me(!1),onSelect:e=>{U(e.startDate),$(e.endDate),Re(e.label)}}),(0,Z.jsx)(z.A,{open:Ie,onClose:()=>{We(!1)},fullScreen:!0,fullWidth:!0,children:Fe&&(0,Z.jsx)("div",{children:(0,Z.jsx)(X,{coordinates:Fe,additionalProps:{riderStart:He,riderEnd:Be},order:Je,setMapOpen:We})})})]})}},23787:(e,t,r)=>{r.d(t,{FG:()=>h,nV:()=>x,pY:()=>p,pg:()=>u});var o=r(22555),i=r(53986),n=r(71392),l=r(55235),a=r(48738),s=r(2866),c=r(65908);const d=["children","scroll","onScroll","sx"],x=e=>{let{children:t,scroll:r=!1,onScroll:l,sx:a}=e,s=(0,i.A)(e,d);return(0,c.jsx)(n.A,(0,o.A)((0,o.A)({spacing:1.25,onScroll:l,sx:(0,o.A)((0,o.A)({p:1.5},r&&{maxHeight:"calc(100vh - 220px)",overflowY:"auto",overflowX:"hidden"}),a)},s),{},{children:t}))},u=e=>{let{accent:t="#662582",header:r,footer:i,selected:n=!1,onClick:s,children:d,sx:x}=e;return(0,c.jsxs)(l.A,{elevation:0,onClick:s,sx:(0,o.A)({position:"relative",overflow:"hidden",flexShrink:0,borderRadius:2.5,border:"1px solid",borderColor:n?t:"#e2e8f0",background:n?"".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)(a.A,{sx:{position:"absolute",left:0,top:0,bottom:0,width:3,bgcolor:t}}),(0,c.jsxs)(a.A,{sx:{p:1.5,pl:2},children:[r,d,i]})]})},h=e=>{let{children:t,columns:r=2,sx:i}=e;return(0,c.jsx)(a.A,{sx:(0,o.A)({display:"grid",gridTemplateColumns:"repeat(".concat(r,", minmax(0, 1fr))"),gap:1,mt:1.25},i),children:t})},p=e=>{let{label:t,value:r,children:o,full:i=!1,align:n="left"}=e;return(0,c.jsxs)(a.A,{sx:{gridColumn:i?"1 / -1":"auto",minWidth:0,textAlign:n},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)(a.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"})})]})}},27001:(e,t,r)=>{r.d(t,{A:()=>a});var o=r(71392),i=r(48738),n=r(2866),l=r(65908);function a(e){let{title:t,subtitle:r,live:a=!1,action:s}=e;return(0,l.jsxs)(o.A,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:{xs:"flex-start",sm:"center"},spacing:1.5,sx:{mb:{xs:2,md:2.5}},children:[(0,l.jsxs)(i.A,{sx:{minWidth:0},children:[(0,l.jsx)(n.A,{variant:"h3",sx:{fontWeight:700,letterSpacing:"-0.02em",color:"grey.800"},children:t}),r&&(0,l.jsxs)(o.A,{direction:"row",alignItems:"center",spacing:.75,sx:{mt:.5},children:[a&&(0,l.jsx)(i.A,{sx:{width:7,height:7,borderRadius:"50%",bgcolor:"success.main",boxShadow:"0 0 0 3px rgba(16,185,129,0.18)"}}),(0,l.jsx)(n.A,{variant:"caption",sx:{color:"text.secondary",fontWeight:500},children:r})]})]}),s&&(0,l.jsx)(i.A,{sx:{flexShrink:0,width:{xs:"100%",sm:"auto"}},children:s})]})}},35678:(e,t,r)=>{r.d(t,{A:()=>j});var o=r(85672),i=r(58689),n=r(19619),l=r(2866),a=r(5670),s=r(71392),c=r(80911),d=r(36117),x=r(46077),u=r.n(x),h=r(36738),p=r(80959),m=r(33090),g=r(52994),f=r(33323),b=r(75732),v=r(43962),A=r(65908);const j=e=>{let{open:t,onClose:r,onSelect:x}=e;const[j,y]=(0,o.useState)(null);return(0,A.jsxs)(i.A,{open:t,onClose:r,children:[(0,A.jsx)(n.A,{align:"left",children:(0,A.jsx)(l.A,{variant:"h4",children:"Select Filter Options"})}),(0,A.jsx)(a.A,{sx:{width:"100%"},className:"datedialog",children:(0,A.jsx)(d.U,{open:t,toggle:r,id:"daterange1",onChange:e=>{y({startDate:u()(e.startDate).format("YYYY-MM-DD"),endDate:u()(e.endDate).format("YYYY-MM-DD"),label:e.label||"custom"})},definedRanges:[{label:"Today",startDate:new Date,endDate:new Date},{label:"Yesterday",startDate:(0,h.A)(new Date,-1),endDate:(0,h.A)(new Date,-1)},{label:"Tomorrow",startDate:(0,h.A)(new Date,1),endDate:(0,h.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"})})]})}},36803:(e,t,r)=>{r.d(t,{A:()=>x});var o=r(84007),i=r(75953),n=r(71392),l=r(48738),a=r(2866),s=r(91834),c=r(97043),d=r(65908);function x(e){let{title:t,value:r,icon:x,color:u="#662582",caption:h,loading:p=!1}=e;return(0,d.jsx)(o.A,{sx:{height:"100%"},children:(0,d.jsx)(i.A,{sx:{p:{xs:1.75,md:2},"&:last-child":{pb:{xs:1.75,md:2}}},children:(0,d.jsxs)(n.A,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,children:[(0,d.jsxs)(l.A,{sx:{minWidth:0,flex:1},children:[(0,d.jsx)(a.A,{variant:"body2",sx:{fontWeight:500,color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t}),p?(0,d.jsx)(s.A,{variant:"rounded",sx:{width:72,height:30,mt:.5},animation:"wave"}):(0,d.jsx)(a.A,{sx:{mt:.25,fontWeight:700,letterSpacing:"-0.015em",color:"grey.800",lineHeight:1.15,fontSize:{xs:"1.375rem",md:"1.5rem"},whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r}),h&&(0,d.jsx)(a.A,{variant:"caption",sx:{display:"block",mt:.5,color:"text.secondary"},children:h})]}),x&&(0,d.jsx)(c.A,{variant:"rounded",sx:{width:42,height:42,borderRadius:2,bgcolor:"".concat(u,"14"),color:u,flexShrink:0},children:x})]})})})}},56311:(e,t,r)=>{r.d(t,{A:()=>h});var o=r(22555),i=r(85672),n=r(29776),l=r(43318),a=r(23440),s=r(11969),c=r(80795),d=r(51808),x=r(93811),u=r(65908);const h=e=>{let{value:t,onChange:r,onDebouncedChange:h,debounceTime:p=500,placeholder:m="Search (ctrl+k)",sx:g}=e;const f=(0,i.useRef)(null),[b]=(0,x.d7)(t,p);return(0,i.useEffect)((()=>{h&&h(b)}),[b,h]),(0,i.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,u.jsx)(n.A,{sx:(0,o.A)({},g),inputRef:f,placeholder:m,autoComplete:"off",value:t,fullWidth:!0,onChange:e=>r(e.target.value),startAdornment:(0,u.jsx)(l.A,{position:"start",sx:{mr:-.5},children:(0,u.jsx)(c.A,{})}),endAdornment:(0,u.jsx)(a.A,{title:"Clear",children:(0,u.jsx)(s.A,{sx:{visibility:t?"visible":"hidden"},onClick:()=>r(""),children:(0,u.jsx)(d.A,{})})})})}},58691:(e,t,r)=>{r.d(t,{A:()=>a});r(85672);var o=r(48738),i=r(12010),n=r(62217),l=r(65908);function a(e){let{size:t=70,imgSize:r=40,alt:a="loader"}=e;return(0,l.jsxs)(o.A,{position:"relative",display:"inline-flex",justifyContent:"center",alignItems:"center",children:[(0,l.jsx)(i.A,{size:t}),(0,l.jsx)(o.A,{position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",sx:{width:r,height:r},children:(0,l.jsx)("img",{src:n,alt:a,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"}})})]})}},59212:(e,t,r)=>{r.d(t,{A:()=>u});var o=r(22555),i=r(85672),n=r(71392),l=r(97043),a=r(17488),s=r(86270),c=r(66157),d=r(48952),x=r(65908);const u=(0,i.forwardRef)(((e,t)=>{let{setAppId:r,setLocoName:u,setPage:h,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,i.useState)(JSON.parse(localStorage.getItem("applocations")||"[]"));(0,i.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("26"),D=S("18"),M=f?{cursor:"pointer","& .MuiOutlinedInput-root":{borderRadius:"10px",bgcolor:"#ffffff",fontWeight:600,color:"#0f172a",paddingRight:"8px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s","& fieldset":{borderColor:"#e2e8f0",borderWidth:1},"&:hover fieldset":{borderColor:"#cbd5e1"},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(k)},"&.Mui-focused fieldset":{borderColor:b,borderWidth:1.5}},"& .MuiAutocomplete-endAdornment .MuiSvgIcon-root":{color:"#94a3b8"}}:{},C=f&&(0,x.jsx)(n.A,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5,mr:.25,flexShrink:0},children:(0,x.jsx)(l.A,{sx:{width:24,height:24,bgcolor:D,color:b,transition:"background-color 0.15s, color 0.15s"},children:v||(0,x.jsx)(d.HPi,{size:14})})});return(0,x.jsx)(a.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===u||void 0===u||u(""),null===h||void 0===h||h(0)):t&&(null===r||void 0===r||r(t.applocationid),null===u||void 0===u||u(t.locationname),null===h||void 0===h||h(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:C}),sx:(0,o.A)((0,o.A)({},M),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||{})}))})}))},68320:(e,t,r)=>{r.d(t,{I:()=>n});var o=r(48149),i=r(59363);function n(e,t){return(0,i.t)(e,o.$,t)}}}]);