Files
Express_console_build/build/static/js/1735.de935927.chunk.js

2 lines
45 KiB
JavaScript

/*! For license information please see 1735.de935927.chunk.js.LICENSE.txt */
"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[1735],{2046:(e,t,n)=>{n.d(t,{A:()=>y});var r=n(98587),a=n(58168),i=n(9950),o=n(72004),s=n(3484),l=n(89548),c=n(82053),d=n(15866),u=n(39766),h=n(59254),p=n(45558),x=n(1614);function m(e){return(0,x.Ay)("MuiInputAdornment",e)}const v=(0,p.A)("MuiInputAdornment",["root","filled","standard","outlined","positionStart","positionEnd","disablePointerEvents","hiddenLabel","sizeSmall"]);var A,g=n(18463),f=n(44414);const j=["children","className","component","disablePointerEvents","disableTypography","position","variant"],b=(0,h.Ay)("div",{name:"MuiInputAdornment",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t["position".concat((0,l.A)(n.position))],!0===n.disablePointerEvents&&t.disablePointerEvents,t[n.variant]]}})((e=>{let{theme:t,ownerState:n}=e;return(0,a.A)({display:"flex",height:"0.01em",maxHeight:"2em",alignItems:"center",whiteSpace:"nowrap",color:(t.vars||t).palette.action.active},"filled"===n.variant&&{["&.".concat(v.positionStart,"&:not(.").concat(v.hiddenLabel,")")]:{marginTop:16}},"start"===n.position&&{marginRight:8},"end"===n.position&&{marginLeft:8},!0===n.disablePointerEvents&&{pointerEvents:"none"})})),y=i.forwardRef((function(e,t){const n=(0,g.b)({props:e,name:"MuiInputAdornment"}),{children:h,className:p,component:x="div",disablePointerEvents:v=!1,disableTypography:y=!1,position:w,variant:S}=n,k=(0,r.A)(n,j),D=(0,u.A)()||{};let M=S;S&&D.variant,D&&!M&&(M=D.variant);const z=(0,a.A)({},n,{hiddenLabel:D.hiddenLabel,size:D.size,disablePointerEvents:v,position:w,variant:M}),C=(e=>{const{classes:t,disablePointerEvents:n,hiddenLabel:r,position:a,size:i,variant:o}=e,c={root:["root",n&&"disablePointerEvents",a&&"position".concat((0,l.A)(a)),o,r&&"hiddenLabel",i&&"size".concat((0,l.A)(i))]};return(0,s.A)(c,m,t)})(z);return(0,f.jsx)(d.A.Provider,{value:null,children:(0,f.jsx)(b,(0,a.A)({as:x,ownerState:z,className:(0,o.A)(C.root,p),ref:t},k,{children:"string"!==typeof h||y?(0,f.jsxs)(i.Fragment,{children:["start"===w?A||(A=(0,f.jsx)("span",{className:"notranslate",children:"\u200b"})):null,h]}):(0,f.jsx)(c.A,{color:"text.secondary",children:h})}))})}))},7762:(e,t,n)=>{var r=n(24994);t.A=void 0;var a=r(n(79526)),i=n(44414);t.A=(0,a.default)((0,i.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear")},17322:(e,t,n)=>{n.r(t),n.d(t,{default:()=>we});var r=n(89379),a=n(9950),i=n(27182),o=n(26910),s=n(60010),l=n(36150),c=n(13838),d=n(14857),u=n(99810),h=n(49029),p=n(47113),x=n(33516),m=n(82215),v=n(2527),A=n.n(v),g=(n(55392),n(4159)),f=n.n(g),j=n(93230),b=n(82053),y=n(25277),w=n(16491),S=n(57560),k=n(94826),D=n(44414),M=n(36220);f().extend(M);const z=new(A().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]}),C=new(A().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]}),W=e=>{let{coordinates:t,additionalProps:n,order:r,setMapOpen:i}=e;console.log("additionalProps",n);const o=(0,a.useRef)(null),s=(0,d.A)(),[l,c]=(0,a.useState)([]),[v,A]=(0,a.useState)(!1);if((0,a.useEffect)((()=>{if(o.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)))]];o.current.fitBounds(e)}}),[t]),(0,a.useEffect)((()=>{(async()=>{if(A(!0),t.length<2)return c([]),void A(!1);const e=t[0],n=t[t.length-1],r="https://router.project-osrm.org/route/v1/driving/".concat(e.lng,",").concat(e.lat,";").concat(n.lng,",").concat(n.lat,"?overview=full&geometries=geojson");try{var a;const e=await fetch(r),t=await e.json();if(null!==(a=t.routes)&&void 0!==a&&a.length){const e=t.routes[0].geometry.coordinates.map((e=>{let[t,n]=e;return{lat:n,lng:t}}));c(e)}}catch(i){console.error("OSRM Error:",i)}finally{A(!1)}})()}),[t]),!t||0===t.length)return null;const g=t[0],M=t[t.length-1],W=t[Math.floor(t.length/2)],P=e=>{let{label:t,value:n}=e;return(0,D.jsxs)(j.A,{direction:"row",spacing:1,alignItems:"center",children:[(0,D.jsxs)(b.A,{variant:"subtitle1",sx:{fontWeight:600},children:[t,":"]}),(0,D.jsx)(y.A,{label:n||"0.00",color:"primary",sx:{fontWeight:700}})]})};return(0,D.jsxs)(w.A,{sx:{width:"100%",height:"100vh",position:"relative",overflow:"hidden"},children:[v&&(0,D.jsx)(k.A,{}),(0,D.jsx)(y.A,{label:"Close",icon:(0,D.jsx)(S.A,{style:{fontSize:18}}),onClick:()=>i(!1),sx:{position:"absolute",top:12,right:12,zIndex:2e3,bgcolor:s.palette.error.main,color:"#fff",fontWeight:600,borderRadius:"12px",px:1.5,py:.5,boxShadow:s.shadows[4],cursor:"pointer","& .MuiChip-icon":{color:"#fff"}}}),(0,D.jsxs)(u.W,{center:W,zoom:14,scrollWheelZoom:!0,style:{height:"100%",width:"100%"},ref:o,children:[(0,D.jsx)(h.e,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,D.jsx)(p.p,{position:g,icon:z,children:(0,D.jsx)(x.m,{direction:"bottom",children:"Pickup: ".concat(f()(n.riderStart).format("DD-MM-YYYY hh:mm A"))})}),(0,D.jsx)(p.p,{position:M,icon:C,children:(0,D.jsx)(x.m,{direction:"bottom",children:"Drop: ".concat(f()(n.riderEnd).format("DD-MM-YYYY hh:mm A"))})}),l.length>0&&(0,D.jsx)(m.R,{positions:l,pathOptions:{color:"blue",weight:5}})]}),(0,D.jsx)(w.A,{sx:{position:"absolute",bottom:0,width:"100%",bgcolor:"rgba(255,255,255,0.96)",p:2,boxShadow:s.shadows[3],zIndex:1500},children:(0,D.jsxs)(j.A,{direction:"row",flexWrap:"wrap",rowGap:1.5,columnGap:3,alignItems:"center",children:[(0,D.jsx)(P,{label:"Tenant",value:null===r||void 0===r?void 0:r.tenantname}),(0,D.jsx)(P,{label:"Rider",value:null===r||void 0===r?void 0:r.ridername}),(0,D.jsx)(P,{label:"Pickup",value:null===r||void 0===r?void 0:r.pickupcustomer}),(0,D.jsx)(P,{label:"Drop",value:null===r||void 0===r?void 0:r.deliverycustomer}),(0,D.jsx)(P,{label:"Kms",value:null===r||void 0===r?void 0:r.kms}),(0,D.jsx)(P,{label:"Actual Kms",value:null===r||void 0===r?void 0:r.actualkms}),(0,D.jsx)(P,{label:"Rider Kms",value:null===r||void 0===r?void 0:r.riderkms})]})})]})};var P=n(43302),L=n(41557),R=n(55158),I=n(77922),Y=n(29925),E=n(28810),N=n(83274),O=n(82223),T=n(1320),F=n(15769),H=n(69780),K=n(9213),q=n(21671),B=n(34075),V=n(82917),_=n(74745),U=n(96583),G=n(40033),J=n(28170),Z=n(249),Q=n(26050),X=n(79739),$=n(58168);const ee={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 327c-29.9 0-58 11.6-79.2 32.8A111.6 111.6 0 00400 439c0 29.9 11.7 58 32.8 79.2A111.6 111.6 0 00512 551c29.9 0 58-11.7 79.2-32.8C612.4 497 624 468.9 624 439c0-29.9-11.6-58-32.8-79.2S541.9 327 512 327zm342.6-37.9a362.49 362.49 0 00-79.9-115.7 370.83 370.83 0 00-118.2-77.8C610.7 76.6 562.1 67 512 67c-50.1 0-98.7 9.6-144.5 28.5-44.3 18.3-84 44.5-118.2 77.8A363.6 363.6 0 00169.4 289c-19.5 45-29.4 92.8-29.4 142 0 70.6 16.9 140.9 50.1 208.7 26.7 54.5 64 107.6 111 158.1 80.3 86.2 164.5 138.9 188.4 153a43.9 43.9 0 0022.4 6.1c7.8 0 15.5-2 22.4-6.1 23.9-14.1 108.1-66.8 188.4-153 47-50.4 84.3-103.6 111-158.1C867.1 572 884 501.8 884 431.1c0-49.2-9.9-97-29.4-142zM512 615c-97.2 0-176-78.8-176-176s78.8-176 176-176 176 78.8 176 176-78.8 176-176 176z"}}]},name:"environment",theme:"filled"};var te=n(61187),ne=function(e,t){return a.createElement(te.A,(0,$.A)({},e,{ref:t,icon:ee}))};const re=a.forwardRef(ne);var ae=n(19474);const ie={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"}}]},name:"close-circle",theme:"filled"};var oe=function(e,t){return a.createElement(te.A,(0,$.A)({},e,{ref:t,icon:ie}))};const se=a.forwardRef(oe);var le=n(64367),ce=n(81425),de=n(50027),ue=n(90376),he=n(52351),pe=n(8881),xe=n(35678),me=n(56311),ve=n(58691),Ae=n(59212),ge=n(20466);function fe(e){let{rows:t=5,columns:n=6,height:r=40}=e;return(0,D.jsx)(D.Fragment,{children:[...Array(t)].map(((e,t)=>(0,D.jsx)(K.A,{children:[...Array(n)].map(((e,t)=>(0,D.jsx)(q.A,{children:(0,D.jsx)(V.A,{variant:"rectangular",height:r,width:70,animation:"wave"})},t)))},t)))})}var je=n(36220);f().extend(je);const be=(e,t,n)=>{(0,pe.M8)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:n||1500})},ye=[{id:"sno",disablePadding:!1,label:"#"},{id:"map",disablePadding:!1,label:"^"},{id:"tenantname",disablePadding:!1,label:"Client"},{id:"Pickup loco",disablePadding:!1,label:"Pickup"},{id:"Delivery loco",disablePadding:!1,label:"Drop"},{id:"order status",disablePadding:!1,label:"status"},{id:"assigned",disablePadding:!1,label:"assigned"},{id:"Accepted",disablePadding:!1,label:"Accepted"},{id:"arrived",disablePadding:!1,label:"arrived"},{id:"picked",disablePadding:!1,label:"picked"},{id:"active",disablePadding:!1,label:"active"},{id:"Delivered",disablePadding:!1,label:"Delivered"},{id:"cancelled",disablePadding:!1,label:"cancelled"},{id:" notes",disablePadding:!1,label:"NOTES"},{id:"kms",disablePadding:!1,label:"KMS",numeric:"center"},{id:"charges",numeric:"center",label:"Charges",disablePadding:!1}];function we(){const e=(0,d.A)(),t=(0,a.useRef)(),n=(0,a.useRef)(),u=(0,a.useRef)(null),h=(0,a.useRef)(null),p=localStorage.getItem("userid"),[x,m]=(0,a.useState)(0),[v,A]=(0,a.useState)(50),[g,w]=(0,a.useState)("All"),[S,M]=(0,a.useState)(f()().format("YYYY-MM-DD")),[z,C]=(0,a.useState)(f()().format("YYYY-MM-DD")),[$,ee]=(0,a.useState)(!1),[te,ne]=(0,a.useState)(!1),[ie,oe]=(0,a.useState)("Today"),[je,we]=(0,a.useState)(0),[Se,ke]=(0,a.useState)(""),[De,Me]=(0,a.useState)(""),[ze,Ce]=(0,a.useState)([]),[We,Pe]=(0,a.useState)(),[Le,Re]=(0,a.useState)(),[Ie,Ye]=(0,a.useState)({}),[Ee,Ne]=(0,a.useState)(!1);let[Oe,Te]=(0,a.useState)(0),[Fe,He]=(0,a.useState)(0),[Ke,qe]=(0,a.useState)(0),[Be,Ve]=(0,a.useState)(0),[_e,Ue]=(0,a.useState)(0),[Ge,Je]=(0,a.useState)(0),[Ze,Qe]=(0,a.useState)(0),[Xe,$e]=(0,a.useState)(0),[et,tt]=(0,a.useState)(0);const[nt,rt]=(0,a.useState)(0),[at,it]=(0,a.useState)("All"),[ot,st]=(0,a.useState)(0),[lt,ct]=(0,a.useState)(0),[dt,ut]=(0,a.useState)(null),[ht,pt]=(0,a.useState)(null),[xt,mt]=(0,a.useState)(),[vt,At]=(0,a.useState)(null),[gt,ft]=(0,a.useState)(!1),[jt,bt]=(0,a.useState)(!1),yt=[{id:0,status:"All",statusLow:"All",count:Oe},{id:1,status:"Pending",statusLow:"pending",count:Ke},{id:2,status:"Accepted",statusLow:"accepted",count:_e},{id:3,status:"Arrived",statusLow:"arrived",count:Xe},{id:4,status:"Picked",statusLow:"picked",count:Ge},{id:5,status:"Active",statusLow:"active",count:Ze},{id:6,status:"Delivered",statusLow:"delivered",count:Fe},{id:7,status:"Skipped",statusLow:"skipped",count:et},{id:8,status:"Cancelled",statusLow:"cancelled",count:Be}];function wt(e,t,n,r){const a=(n-e)*(Math.PI/180),i=(r-t)*(Math.PI/180),o=Math.sin(a/2)*Math.sin(a/2)+Math.cos(e*(Math.PI/180))*Math.cos(n*(Math.PI/180))*Math.sin(i/2)*Math.sin(i/2);return 6371*(2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)))}(0,a.useEffect)((()=>{ct(0),ut(null),st(0),pt(null),mt(null),At(null)}),[je]),(0,a.useEffect)((()=>{st(0),pt(null),At(null)}),[lt]),(0,a.useEffect)((()=>{At(null)}),[ot]);const St=async e=>{bt(!0),console.log("deliveryid",e);try{const t=await o.A.get("".concat("https://jupiter.nearle.app/live/api/v3","/deliveries/getdeliverylogs/?deliveryid=").concat(e));console.log("getdeliverylogs",t.data.details);const n=t.data.details;if(0!=n.length){Pe(n[0].logdate),Re(n[n.length-1].logdate);const e=n.map((e=>({lat:e.latitude,lng:e.longitude})));console.log("coData",e),Ce(e);const t=function(e){let t=0;for(let n=0;n<e.length-1;n++){const{lat:r,lng:a}=e[n],{lat:i,lng:o}=e[n+1],s=wt(r,a,i,o);console.log("distance",s),t+=s}return t}(e);console.log("Total distance traveled:",t,"km"),ne(!0)}else null!=n&&n||be("No Logs Found ","error",2e3)}catch(t){console.log("getdeliverylogs",t)}finally{bt(!1)}},{data:kt,isLoading:Dt,isError:Mt,error:zt,fetchNextPage:Ct,hasNextPage:Wt,isFetchingNextPage:Pt}=(0,s.q)({queryKey:["fetchdeliveries",je,p,at,S,z,v,De,lt,ot,(null===xt||void 0===xt?void 0:xt.userid)||0],queryFn:ce.tL,getNextPageParam:e=>{var t;return null!==(t=e.nextPage)&&void 0!==t?t:void 0},refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!0}),Lt=(null===kt||void 0===kt?void 0:kt.pages.flatMap((e=>e.rows)))||[];(0,a.useEffect)((()=>{if(!Wt)return;const e=new IntersectionObserver((e=>{e[0].isIntersecting&&Ct()}),{root:document.querySelector(".MuiTableContainer-root"),rootMargin:"0px",threshold:1});return t.current&&e.observe(t.current),()=>{t.current&&e.unobserve(t.current)}}),[Wt,Ct]);const{data:Rt,isLoading:It,isError:Yt,error:Et}=(0,l.I)({queryKey:["tenantlist",je],queryFn:()=>(0,ce.Mn)(je),enabled:0!==je}),{data:Nt,isLoading:Ot,isError:Tt,error:Ft}=(0,l.I)({queryKey:["getriderbydelivery",S,z,je,lt,ot],queryFn:()=>(0,ce.aY)(S,z,je,lt,ot),enabled:0!=je}),{data:Ht,isLoading:Kt,isError:qt,error:Bt}=(0,l.I)({queryKey:["gettenantlocations",lt],queryFn:()=>(0,ce.DL)(lt),enabled:0!==lt});(0,a.useEffect)((()=>{(async()=>{Ne(!0);try{await o.A.get(0==je?"".concat("https://jupiter.nearle.app/live/api/v1","/deliveries/deliverysummary/?fromdate=").concat(S,"&todate=").concat(z):"".concat("https://jupiter.nearle.app/live/api/v1","/deliveries/deliverysummary/?applocationid=").concat(je,"&tenantid=").concat(lt,"&locationid=").concat(ot,"&fromdate=").concat(S,"&todate=").concat(z,"&userid=").concat((null===xt||void 0===xt?void 0:xt.userid)||0)).then((e=>{console.log("fetchcountres",e.data.details),Te(e.data.details.total),"All"==at&&rt(e.data.details.total),qe(e.data.details.pending),Ue(e.data.details.accepted),$e(e.data.details.arrived),Je(e.data.details.picked),Qe(e.data.details.active),He(e.data.details.delivered),tt(e.data.details.skipped),Ve(e.data.details.cancelled)})).catch((e=>{console.log(e),(0,pe.M8)(e.message,{variant:"error",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3})}))}catch(e){console.log(e)}finally{Ne(!1)}})()}),[je,S,z,at,lt,ot,xt]);const Vt=null===Lt||void 0===Lt?void 0:Lt.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 _t(e){return f()(e).format("DD/MM/YYYY ")}function Ut(e){return f()(e).format(" hh:mm A")}console.log("csvData",Vt);const Gt=Mt?"An error has occurred: (fetchDeliveries) ".concat(zt.message):Yt?"An error has occurred: (getTenants) ".concat(Et.message):qt?"An error has occurred: (gettenantlocations) ".concat(Bt.message):Tt?"An error has occurred: (getriderbydelivery) ".concat(Ft.message):null;return(0,a.useEffect)((()=>{Gt&&(console.log("errormessage",Gt),be(Gt,"warning",2e3))}),[Gt]),(0,D.jsxs)(D.Fragment,{children:[(Ee||It||Kt||jt||Ot||Pt)&&(0,D.jsx)("div",{children:(0,D.jsx)(he.A,{})}),Dt&&(0,D.jsx)(R.A,{sx:{color:"#fff",zIndex:e=>e.zIndex.drawer+1},open:Dt}),(0,D.jsx)(i.A,{title:"Orders Details",secondary:(0,D.jsxs)(j.A,{display:"flex",flexDirection:"row",alignItems:"center ",gap:3,flexWrap:"wrap",children:[(0,D.jsx)(Ae.A,{ref:u,locaName:g,setAppId:we,setLocoName:w,setPage:m,sx:{minWidth:250,maxWidth:1e3,flex:1}}),(0,D.jsx)(I.A,{options:Rt||[],value:dt,sx:{minWidth:250,maxWidth:1e3,flex:1},onOpen:e=>{je||(e.preventDefault(),(0,ge.k)("Please select a your app location first!","warning",3e3),setTimeout((()=>{var e;null===(e=u.current)||void 0===e||e.focus()}),0))},onChange:(e,t,n)=>{"clear"===n?(ct(0),ut(null),st(0),pt(null)):(ct((null===t||void 0===t?void 0:t.tenantid)||0),ut(t),st(t.locationid),pt(null))},renderInput:e=>(0,D.jsx)(Y.A,(0,r.A)((0,r.A)({},e),{},{inputRef:h,label:"Select Tenant"}))}),(0,D.jsx)(I.A,{options:Ht||[],getOptionLabel:e=>"".concat(e.locationname," (").concat(e.suburb,")")||0,value:ht,sx:{minWidth:250,maxWidth:1e3,flex:1},onOpen:e=>{je||lt?lt||(e.preventDefault(),(0,ge.k)("Please select a your Tenant first!","warning",3e3),setTimeout((()=>{var e;null===(e=h.current)||void 0===e||e.focus()}),0)):(e.preventDefault(),(0,ge.k)("Please select a your Location and Tenant first!","warning",3e3),setTimeout((()=>{var e;null===(e=u.current)||void 0===e||e.focus()}),0))},onChange:(e,t,n)=>{"clear"===n?(st(0),pt(null)):(st(t.locationid||0),pt(t))},renderInput:e=>(0,D.jsx)(Y.A,(0,r.A)((0,r.A)({},e),{},{label:"Select Location"}))})]})}),(0,D.jsx)(de.A,{content:!1,title:(0,D.jsxs)(j.A,{sx:{m:2},gap:3,children:[(0,D.jsxs)(j.A,{direction:"row",alignItems:"center",gap:2,flexWrap:"wrap",sx:{},children:[S&&z&&(0,D.jsxs)(j.A,{direction:"row",alignItems:"center",gap:2,flexWrap:"wrap",children:[(0,D.jsx)(E.A,{badgeContent:Se?0:nt,max:"".concat(Oe),color:"primary",sx:{bgcolor:"#f3e5f5",p:.2,borderRadius:"3px",color:"#7b1fa2"},children:"Orders-".concat(ie)}),(0,D.jsx)(N.A,{title:"Date Filter",placement:"top",children:(0,D.jsx)(y.A,{label:(0,D.jsxs)(b.A,{noWrap:!0,color:"secondary",children:[f()(S).format("DD/MM/YYYY")," - ",f()(z).format("DD/MM/YYYY")]}),variant:"combined",color:"warning",size:"small",deleteIcon:(0,D.jsx)(le.A,{style:{fontSize:18}}),onDelete:()=>{ee(!0)},onClick:()=>ee(!0),sx:{cursor:"pointer"}})})]}),(0,D.jsx)(O.A,{variant:"outlined",size:"small",startIcon:(0,D.jsx)(L.A,{}),onClick:()=>{ft(!0),setTimeout((()=>{A("")}),0)},children:"Export Report"})]}),(0,D.jsxs)(j.A,{display:"flex",flexDirection:"row",gap:2,alignItems:"center",sx:{},flexWrap:"wrap",children:[(0,D.jsx)(I.A,{id:"combo-box-demo",label:at,options:yt,getOptionLabel:e=>"".concat(e.status),sx:{minWidth:250,maxWidth:1e3,flex:1},onChange:(e,t,n)=>{"clear"===n?(it("All"),rt(yt[0].count)):(console.log("status",t),it(t.statusLow),rt(t.count))},renderInput:e=>(0,D.jsx)(Y.A,(0,r.A)((0,r.A)({},e),{},{label:"Select Status"}))}),(0,D.jsx)(I.A,{id:"combo-box-demo",value:vt,options:Nt||[],getOptionLabel:e=>"".concat(e.firstname," ").concat(e.lastname),sx:{minWidth:250,maxWidth:1e3,flex:1},onOpen:()=>{je||(0,ge.k)("Select App Location First","warning",2e3)},onChange:(e,t,n)=>{"clear"===n?(mt(null),At(null)):(mt(t),At(t))},renderInput:e=>(0,D.jsx)(Y.A,(0,r.A)((0,r.A)({},e),{},{label:"Select Rider"}))}),(0,D.jsx)(me.A,{value:Se,onChange:ke,onDebouncedChange:Me,sx:{minWidth:250,maxWidth:1e3,flex:1}})]})]}),children:(0,D.jsxs)(T.A,{ref:n,onScroll:e=>{const{scrollTop:t,scrollHeight:n,clientHeight:r}=e.currentTarget;t+r>=n-50&&Wt&&!Pt&&Ct()},sx:{maxHeight:"calc(100vh - 200px)",overflow:"auto","&::-webkit-scrollbar":{width:"12px",cursor:"pointer"},"&::-webkit-scrollbar-thumb":{backgroundColor:e.palette.primary.main,borderRadius:"8px",cursor:"pointer"},"&::-webkit-scrollbar-thumb:hover":{backgroundColor:e.palette.primary.dark,cursor:"pointer"},"&::-webkit-scrollbar-track":{backgroundColor:e.palette.primary.lighter,cursor:"pointer"}},children:[(0,D.jsxs)(F.A,{stickyHeader:!0,"aria-label":"sticky table",children:[(0,D.jsx)(H.A,{sx:{"& th":{borderTop:"1px solid ".concat(e.palette.divider),borderBottom:"2px solid ".concat(e.palette.divider," !important")}},children:(0,D.jsx)(K.A,{sx:{width:"100%"},children:ye.map((e=>(0,D.jsx)(q.A,{sx:{position:"sticky !important",width:"100%"},children:e.label},e.id)))})}),(0,D.jsx)(B.A,{children:Dt?(0,D.jsx)(fe,{rows:16,columns:30,height:15}):0==(null===Lt||void 0===Lt?void 0:Lt.length)?(0,D.jsx)(K.A,{children:(0,D.jsx)(q.A,{colSpan:15,sx:{"&:hover":{bgcolor:"white"}},children:(0,D.jsx)(c.A,{description:"No Orders Found"})})}):null===Lt||void 0===Lt?void 0:Lt.map(((t,n)=>(0,D.jsxs)(K.A,{children:[(0,D.jsxs)(q.A,{sx:{width:"10px"},children:[" ",x*v+n+1]}),(0,D.jsx)(q.A,{sx:{width:"10px",cursor:"pointer"},onClick:()=>{if("delivered"!=t.orderstatus)return null;console.log("row",t),St(t.deliveryid),Ye(t),Ne(!0),setTimeout((()=>{Ne(!1)}),500)},children:"delivered"==t.orderstatus?(0,D.jsx)(re,{style:{color:e.palette.primary.main}}):(0,D.jsx)(ae.A,{style:{color:e.palette.secondary.main}})}),(0,D.jsxs)(q.A,{sx:{textAlign:"start",whiteSpace:"nowrap"},children:[t.tenantname,(0,D.jsx)(N.A,{title:"OrderId",children:(0,D.jsx)(b.A,{variant:"body2",noWrap:!0,sx:{cursor:"pointer"},children:t.orderid})}),(0,D.jsx)(b.A,{noWrap:!0,variant:"body2",children:f()(t.deliverydate).utc().format("DD/MM/YYYY")}),(0,D.jsx)(b.A,{noWrap:!0,variant:"body2",children:f()(t.deliverydate).utc().format("hh:mm A")})]}),(0,D.jsx)(q.A,{align:"left",children:(0,D.jsx)(j.A,{direction:"row",spacing:1,children:(0,D.jsxs)(j.A,{direction:"column",children:[(0,D.jsx)(b.A,{noWrap:!0,children:t.pickupcustomer}),(0,D.jsx)(b.A,{variant:"caption",color:"textSecondary",children:t.pickupcontactno}),(0,D.jsx)(N.A,{title:t.Pickupaddress||t.pickupsuburb,children:(0,D.jsx)(b.A,{noWrap:!0,variant:"caption",color:"textSecondary",sx:{cursor:"pointer",textOverflow:"ellipsis"},children:" ".concat(t.pickupsuburb||t.Pickupaddress.slice(0,20)+"...")})}),(0,D.jsx)(b.A,{noWrap:!0,variant:"caption",color:"textSecondary",children:t.applocation})]})})}),(0,D.jsx)(q.A,{align:"left",children:(0,D.jsx)(j.A,{direction:"row",spacing:1,children:(0,D.jsxs)(j.A,{direction:"column",children:[(0,D.jsx)(b.A,{sx:{whiteSpace:"nowrap"},children:t.deliverycustomer}),(0,D.jsx)(b.A,{variant:"caption",color:"textSecondary",children:t.deliverycontactno}),(0,D.jsx)(N.A,{title:t.deliveryaddress,children:(0,D.jsx)(b.A,{variant:"caption",color:"textSecondary",sx:{cursor:"pointer"},children:"".concat(t.deliverysuburb||t.deliveryaddress.slice(0,20)+"...")})})]})})}),(0,D.jsxs)(q.A,{align:"left",children:[(0,D.jsxs)(j.A,{direction:"row",sx:{mb:1},children:["created"===t.orderstatus&&(0,D.jsx)(y.A,{label:"Created",color:"primary",size:"small",sx:{minWidth:80}}),"pending"===t.orderstatus&&(0,D.jsx)(y.A,{label:"Pending",color:"warning",size:"small",sx:{minWidth:80}}),"accepted"===t.orderstatus&&(0,D.jsx)(y.A,{label:"Accepted",size:"small",sx:{bgcolor:e.palette.chip.accept,color:"white",minWidth:80}}),"arrived"===t.orderstatus&&(0,D.jsx)(y.A,{label:"Arrived",size:"small",sx:{bgcolor:e.palette.chip.arrive,color:"white",minWidth:80}}),"picked"===t.orderstatus&&(0,D.jsx)(y.A,{label:"Picked",color:"info",size:"small",sx:{minWidth:80}}),"active"===t.orderstatus&&(0,D.jsx)(y.A,{label:"Active",color:"info",size:"small",sx:{minWidth:80}}),"delivered"===t.orderstatus&&(0,D.jsx)(y.A,{label:"Delivered",color:"success",size:"small",sx:{minWidth:80}}),"skipped"===t.orderstatus&&(0,D.jsx)(y.A,{label:"Skipped",color:"secondary",size:"small",sx:{minWidth:80}}),"cancelled"===t.orderstatus&&(0,D.jsx)(y.A,{label:"Cancelled",color:"error",size:"small",sx:{minWidth:80}})]}),(0,D.jsxs)(N.A,{title:t.ridername,children:[(0,D.jsx)(b.A,{variant:"subtitle2",display:"block",sx:{cursor:"pointer",whiteSpace:"nowrap"},children:t.ridername}),(0,D.jsxs)(b.A,{variant:"subtitle2",display:"block",sx:{cursor:"pointer",whiteSpace:"nowrap"},children:["ID : ",t.userid]})]})]}),(0,D.jsxs)(q.A,{align:"left",children:[(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"12px"},children:""===t.assigntime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:80,height:14}):_t(t.assigntime)}),(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"13px"},variant:"h5",children:""===t.assigntime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:60,height:18}):Ut(t.assigntime)})]}),(0,D.jsxs)(q.A,{align:"left",children:[(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"12px"},children:""===t.acceptedtime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:80,height:14}):_t(t.acceptedtime)}),(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"13px"},variant:"h5",children:""===t.acceptedtime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:60,height:18}):Ut(t.acceptedtime)})]}),(0,D.jsxs)(q.A,{align:"left",children:[(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"12px"},children:""===t.arrivaltime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:80,height:14}):_t(t.arrivaltime)}),(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"13px"},variant:"h5",children:""===t.arrivaltime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:60,height:18}):Ut(t.arrivaltime)})]}),(0,D.jsxs)(q.A,{align:"left",children:[(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"12px"},children:""===t.pickuptime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:80,height:14}):_t(t.pickuptime)}),(0,D.jsxs)(j.A,{direction:"row",children:[(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"13px"},variant:"h5",children:""===t.pickuptime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:60,height:18}):Ut(t.pickuptime)}),"active"===t.deliverystatus&&(0,D.jsx)(P.cxC,{fontSize:"large",style:{color:"green",marginLeft:"8px"}})]})]}),(0,D.jsxs)(q.A,{align:"left",children:[(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"12px"},children:""===t.starttime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:80,height:14}):_t(t.starttime)}),(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"13px"},variant:"h5",children:""===t.starttime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:60,height:18}):Ut(t.starttime)})]}),(0,D.jsxs)(q.A,{align:"left",children:[(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"12px"},children:""===t.deliverytime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:80,height:14}):_t(t.deliverytime)}),(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"13px"},variant:"h5",children:""===t.deliverytime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:60,height:18}):Ut(t.deliverytime)})]}),(0,D.jsxs)(q.A,{align:"left",children:[(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"12px"},children:""===t.canceltime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:80,height:14}):_t(t.canceltime)}),(0,D.jsx)(b.A,{noWrap:!0,sx:{fontSize:"13px"},variant:"h5",children:""===t.canceltime?(0,D.jsx)(V.A,{animation:!1,variant:"text",width:60,height:18}):Ut(t.canceltime)})]}),(0,D.jsx)(q.A,{align:"left",children:(0,D.jsx)(b.A,{variant:"caption",children:t.ordernotes||(0,D.jsx)(V.A,{animation:!1,variant:"text",width:40,height:18})})}),(0,D.jsx)(q.A,{align:"center",children:(0,D.jsxs)(j.A,{direction:"column",spacing:1,children:[(0,D.jsx)(N.A,{title:" KMS",placement:"top",children:(0,D.jsx)(y.A,{label:"cancelled"===t.deliverystatus||""==t.kms?0:t.kms,size:"small",variant:"light",color:"error",sx:{minWidth:80,border:"1px solid #e96969",cursor:"pointer"}})}),(0,D.jsx)(N.A,{title:"Actual KMS",placement:"left",children:(0,D.jsx)(y.A,{label:t.cumulativekms,size:"small",color:"success",variant:"light",onClick:()=>{},sx:{minWidth:80,border:"1px solid #76ff03 ",cursor:"pointer"}})}),(0,D.jsx)(N.A,{title:"Rider KMS",children:(0,D.jsx)(y.A,{label:t.previouskms||("cancelled"==t.deliverystatus?"0.00":t.kms),size:"small",color:"info",variant:"light",onClick:()=>{},sx:{minWidth:80,border:"1px solid #03a9f4 ",cursor:"pointer"}})})]})}),(0,D.jsx)(q.A,{align:"center",children:(0,D.jsxs)(j.A,{direction:"column",spacing:1,children:[(0,D.jsx)(N.A,{title:" Delivery Charge",placement:"top",children:(0,D.jsx)(y.A,{label:"cancelled"===t.orderstatus||""==t.deliverycharges?"\u20b9 ".concat(0,".00"):"\u20b9 ".concat(t.deliverycharges,".00"),size:"small",variant:"light",color:"error",sx:{minWidth:80,border:"1px solid #e96969",cursor:"pointer"}})}),(0,D.jsx)(N.A,{title:"Delivery Amount",children:(0,D.jsx)(y.A,{label:""==t.deliveryamt?"\u20b9 ".concat(0,".00"):"\u20b9 ".concat(t.deliveryamt,".00"),size:"small",color:"success",variant:"light",sx:{minWidth:80,border:"1px solid #76ff03 ",cursor:"pointer"}})})]})})]},t.name)))})]}),(0,D.jsx)(_.A,{}),0!==(null===Lt||void 0===Lt?void 0:Lt.length)&&(0,D.jsx)(j.A,{justifyContent:"center",alignItems:"center",sx:{width:"100%",py:2},children:(0,D.jsx)(j.A,{ref:t,style:{textAlign:"center",width:"100%"},children:Pt||Wt?(0,D.jsx)(ve.A,{}):"No More Orders Details"})})]})}),(0,D.jsxs)(U.A,{open:gt,onClose:()=>ft(!1),fullWidth:!0,maxWidth:"sm",children:[(0,D.jsx)(G.A,{sx:{bgcolor:"primary.main",color:"white"},children:(0,D.jsx)(b.A,{variant:"h3",children:"Export Report"})}),(0,D.jsxs)(J.A,{children:[Dt&&(0,D.jsx)(k.A,{}),(0,D.jsxs)(Z.A,{gap:2,sx:{width:"100%"},children:[(0,D.jsx)(Q.Ay,{sx:{bgcolor:"primary.lighter"},secondaryAction:(0,D.jsx)(y.A,{size:"small",label:g||"None",color:g?"primary":"secondary"}),children:(0,D.jsx)(b.A,{variant:"h5",fontWeight:500,children:"App Location"})}),(0,D.jsx)(Q.Ay,{sx:{bgcolor:"secondary.lighter"},secondaryAction:(0,D.jsx)(y.A,{size:"small",label:(null===dt||void 0===dt?void 0:dt.tenantname)||"None",color:null!==dt&&void 0!==dt&&dt.tenantname?"primary":"secondary"}),children:(0,D.jsx)(b.A,{variant:"h5",fontWeight:500,children:"Tenant"})}),(0,D.jsx)(Q.Ay,{sx:{bgcolor:"primary.lighter"},secondaryAction:(0,D.jsx)(y.A,{size:"small",label:(null===ht||void 0===ht?void 0:ht.locationname)||"None",color:null!==ht&&void 0!==ht&&ht.locationname?"primary":"secondary"}),children:(0,D.jsx)(b.A,{variant:"h5",fontWeight:500,children:"Business Location"})}),(0,D.jsx)(Q.Ay,{sx:{bgcolor:"secondary.lighter"},secondaryAction:(0,D.jsx)(y.A,{size:"small",label:at||"None",color:at?"primary":"secondary"}),children:(0,D.jsx)(b.A,{variant:"h5",fontWeight:500,children:"Status"})}),(0,D.jsx)(Q.Ay,{sx:{bgcolor:"primary.lighter"},secondaryAction:(0,D.jsx)(y.A,{size:"small",label:vt?"".concat(vt.firstname," ").concat(vt.lastname):"None",color:vt?"primary":"secondary"}),children:(0,D.jsx)(b.A,{variant:"h5",fontWeight:500,children:"Rider"})}),(0,D.jsx)(Q.Ay,{sx:{bgcolor:"secondary.lighter"},secondaryAction:(0,D.jsx)(y.A,{size:"small",label:Se||"None",color:Se?"primary":"secondary"}),children:(0,D.jsx)(b.A,{variant:"h5",fontWeight:500,children:"Keyword"})}),(0,D.jsx)(Q.Ay,{sx:{bgcolor:"primary.lighter"},secondaryAction:(0,D.jsx)(y.A,{size:"small",label:S||"None",color:S?"primary":"secondary"}),children:(0,D.jsx)(b.A,{variant:"h5",fontWeight:500,children:"Start Date"})}),(0,D.jsx)(Q.Ay,{sx:{bgcolor:"secondary.lighter"},secondaryAction:(0,D.jsx)(y.A,{size:"small",label:z||"None",color:z?"primary":"secondary"}),children:(0,D.jsx)(b.A,{variant:"h5",fontWeight:500,children:"End Date"})})]})]}),(0,D.jsxs)(X.A,{sx:{width:"100%",bgcolor:"secondary.lighter"},children:[(0,D.jsx)(O.A,{color:"error",variant:"contained",startIcon:(0,D.jsx)(se,{}),onClick:()=>{ft(!1)},sx:{},children:"Close"}),(0,D.jsx)(ue.pK,{data:Vt,filename:"Orders_Detail_".concat(f()().format("YYYY-MM-DD_HHmmss"),".csv"),label:"Download CSV",style:{m:1},btnLoading:Dt,onClick:()=>{setTimeout((()=>ft(!1)),0)}})]})]}),(0,D.jsx)(xe.A,{open:$,onClose:()=>ee(!1),onSelect:e=>{M(e.startDate),C(e.endDate),oe(e.label),console.log("Selected Date Range:",e)}}),(0,D.jsx)(U.A,{open:te,onClose:()=>{ne(!1)},fullScreen:!0,fullWidth:!0,children:ze&&(0,D.jsx)("div",{children:(0,D.jsx)(W,{coordinates:ze,additionalProps:{riderStart:We,riderEnd:Le},order:Ie,setMapOpen:ne})})})]})}},19474:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(58168),a=n(9950);const i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 289.1a362.49 362.49 0 00-79.9-115.7 370.83 370.83 0 00-118.2-77.8C610.7 76.6 562.1 67 512 67c-50.1 0-98.7 9.6-144.5 28.5-44.3 18.3-84 44.5-118.2 77.8A363.6 363.6 0 00169.4 289c-19.5 45-29.4 92.8-29.4 142 0 70.6 16.9 140.9 50.1 208.7 26.7 54.5 64 107.6 111 158.1 80.3 86.2 164.5 138.9 188.4 153a43.9 43.9 0 0022.4 6.1c7.8 0 15.5-2 22.4-6.1 23.9-14.1 108.1-66.8 188.4-153 47-50.4 84.3-103.6 111-158.1C867.1 572 884 501.8 884 431.1c0-49.2-9.9-97-29.4-142zM512 880.2c-65.9-41.9-300-207.8-300-449.1 0-77.9 31.1-151.1 87.6-206.3C356.3 169.5 431.7 139 512 139s155.7 30.5 212.4 85.9C780.9 280 812 353.2 812 431.1c0 241.3-234.1 407.2-300 449.1zm0-617.2c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 551c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 439c0-29.9 11.7-58 32.8-79.2C454 338.6 482.1 327 512 327c29.9 0 58 11.6 79.2 32.8C612.4 381 624 409.1 624 439c0 29.9-11.6 58-32.8 79.2z"}}]},name:"environment",theme:"outlined"};var o=n(61187),s=function(e,t){return a.createElement(o.A,(0,r.A)({},e,{ref:t,icon:i}))};const l=a.forwardRef(s)},25713:(e,t,n)=>{n.d(t,{A:()=>v});var r=n(98587),a=n(58168),i=n(9950),o=n(72004),s=n(3484),l=n(59254),c=n(18463),d=n(45558),u=n(1614);function h(e){return(0,u.Ay)("MuiCardActions",e)}(0,d.A)("MuiCardActions",["root","spacing"]);var p=n(44414);const x=["disableSpacing","className"],m=(0,l.Ay)("div",{name:"MuiCardActions",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableSpacing&&t.spacing]}})((e=>{let{ownerState:t}=e;return(0,a.A)({display:"flex",alignItems:"center",padding:8},!t.disableSpacing&&{"& > :not(style) ~ :not(style)":{marginLeft:8}})})),v=i.forwardRef((function(e,t){const n=(0,c.b)({props:e,name:"MuiCardActions"}),{disableSpacing:i=!1,className:l}=n,d=(0,r.A)(n,x),u=(0,a.A)({},n,{disableSpacing:i}),v=(e=>{const{classes:t,disableSpacing:n}=e,r={root:["root",!n&&"spacing"]};return(0,s.A)(r,h,t)})(u);return(0,p.jsx)(m,(0,a.A)({className:(0,o.A)(v.root,l),ownerState:u,ref:t},d))}))},27182:(e,t,n)=>{n.d(t,{A:()=>d});var r=n(89379),a=(n(9950),n(14857)),i=n(25713),o=n(60899),s=n(93230),l=n(82053),c=n(44414);const d=e=>{let{title:t,secondary:n,sx:d}=e;const u=(0,a.A)();return(0,c.jsx)(i.A,{sx:(0,r.A)({position:"sticky",top:"30px",bgcolor:u.palette.background.default,zIndex:10,width:"100%"},d),children:(0,c.jsx)(o.Ay,{container:!0,children:(0,c.jsx)(o.Ay,{item:!0,xs:12,children:(0,c.jsxs)(s.A,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:2,sx:{flexWrap:"wrap"},children:[(0,c.jsx)(l.A,{variant:"h3",children:t}),n]})})})})}},35678:(e,t,n)=>{n.d(t,{A:()=>b});var r=n(9950),a=n(96583),i=n(40033),o=n(82053),s=n(28170),l=n(93230),c=n(82223),d=n(55916),u=n(4159),h=n.n(u),p=n(56712),x=n(81417),m=n(96600),v=n(53132),A=n(94289),g=n(57326),f=n(50624),j=n(44414);const b=e=>{let{open:t,onClose:n,onSelect:u}=e;const[b,y]=(0,r.useState)(null);return(0,j.jsxs)(a.A,{open:t,onClose:n,children:[(0,j.jsx)(i.A,{align:"left",children:(0,j.jsx)(o.A,{variant:"h4",children:"Select Filter Options"})}),(0,j.jsx)(s.A,{sx:{width:"100%"},className:"datedialog",children:(0,j.jsx)(d.U,{open:t,toggle:n,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,p.A)(new Date,-1),endDate:(0,p.A)(new Date,-1)},{label:"Tomorrow",startDate:(0,p.A)(new Date,1),endDate:(0,p.A)(new Date,1)},{label:"This Week",startDate:(0,x.A)(new Date),endDate:(0,m.A)(new Date)},{label:"Last Week",startDate:(0,x.A)((0,v.A)(new Date,-1)),endDate:(0,m.A)((0,v.A)(new Date,-1))},{label:"Last 7 Days",startDate:(0,v.A)(new Date,-1),endDate:new Date},{label:"This Month",startDate:(0,A.A)(new Date),endDate:(0,g.A)(new Date)},{label:"Last Month",startDate:(0,A.A)((0,f.A)(new Date,-1)),endDate:(0,g.A)((0,f.A)(new Date,-1))}]})}),(0,j.jsx)(l.A,{direction:"row",justifyContent:"flex-end",sx:{width:"100%",p:2},children:(0,j.jsx)(c.A,{variant:"contained",size:"small",onClick:()=>{b?(u(b),n()):n()},children:"OK"})})]})}},41557:(e,t,n)=>{var r=n(24994);t.A=void 0;var a=r(n(79526)),i=n(44414);t.A=(0,a.default)((0,i.jsx)("path",{d:"M19 9h-4V3H9v6H5l7 7zm-8 2V5h2v6h1.17L12 13.17 9.83 11zm-6 7h14v2H5z"}),"DownloadOutlined")},46639:(e,t,n)=>{n.d(t,{A:()=>L});var r=n(57528),a=n(98587),i=n(58168),o=n(9950),s=n(72004),l=n(3484),c=n(88283),d=n(89548),u=n(18463),h=n(59254),p=n(45558),x=n(1614);function m(e){return(0,x.Ay)("MuiCircularProgress",e)}(0,p.A)("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);var v,A,g,f,j=n(44414);const b=["className","color","disableShrink","size","style","thickness","value","variant"];let y,w,S,k;const D=44,M=(0,c.i7)(y||(y=v||(v=(0,r.A)(["\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n"])))),z=(0,c.i7)(w||(w=A||(A=(0,r.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"])))),C=(0,h.Ay)("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t["color".concat((0,d.A)(n.color))]]}})((e=>{let{ownerState:t,theme:n}=e;return(0,i.A)({display:"inline-block"},"determinate"===t.variant&&{transition:n.transitions.create("transform")},"inherit"!==t.color&&{color:(n.vars||n).palette[t.color].main})}),(e=>{let{ownerState:t}=e;return"indeterminate"===t.variant&&(0,c.AH)(S||(S=g||(g=(0,r.A)(["\n animation: "," 1.4s linear infinite;\n "]))),M)})),W=(0,h.Ay)("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(e,t)=>t.svg})({display:"block"}),P=(0,h.Ay)("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.circle,t["circle".concat((0,d.A)(n.variant))],n.disableShrink&&t.circleDisableShrink]}})((e=>{let{ownerState:t,theme:n}=e;return(0,i.A)({stroke:"currentColor"},"determinate"===t.variant&&{transition:n.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=f||(f=(0,r.A)(["\n animation: "," 1.4s ease-in-out infinite;\n "]))),z)})),L=o.forwardRef((function(e,t){const n=(0,u.b)({props:e,name:"MuiCircularProgress"}),{className:r,color:o="primary",disableShrink:c=!1,size:h=40,style:p,thickness:x=3.6,value:v=0,variant:A="indeterminate"}=n,g=(0,a.A)(n,b),f=(0,i.A)({},n,{color:o,disableShrink:c,size:h,thickness:x,value:v,variant:A}),y=(e=>{const{classes:t,variant:n,color:r,disableShrink:a}=e,i={root:["root",n,"color".concat((0,d.A)(r))],svg:["svg"],circle:["circle","circle".concat((0,d.A)(n)),a&&"circleDisableShrink"]};return(0,l.A)(i,m,t)})(f),w={},S={},k={};if("determinate"===A){const e=2*Math.PI*((D-x)/2);w.strokeDasharray=e.toFixed(3),k["aria-valuenow"]=Math.round(v),w.strokeDashoffset="".concat(((100-v)/100*e).toFixed(3),"px"),S.transform="rotate(-90deg)"}return(0,j.jsx)(C,(0,i.A)({className:(0,s.A)(y.root,r),style:(0,i.A)({width:h,height:h},S,p),ownerState:f,ref:t,role:"progressbar"},k,g,{children:(0,j.jsx)(W,{className:y.svg,ownerState:f,viewBox:"".concat(22," ").concat(22," ").concat(D," ").concat(D),children:(0,j.jsx)(P,{className:y.circle,style:w,ownerState:f,cx:D,cy:D,r:(D-x)/2,fill:"none",strokeWidth:x})})}))}))},52097:(e,t,n)=>{n.d(t,{d7:()=>o});var r=n(9950);function a(e,t,n,a){var i=this,o=(0,r.useRef)(null),s=(0,r.useRef)(0),l=(0,r.useRef)(0),c=(0,r.useRef)(null),d=(0,r.useRef)([]),u=(0,r.useRef)(),h=(0,r.useRef)(),p=(0,r.useRef)(e),x=(0,r.useRef)(!0);p.current=e;var m="undefined"!=typeof window,v=!t&&0!==t&&m;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var A=!!(n=n||{}).leading,g=!("trailing"in n)||!!n.trailing,f="maxWait"in n,j="debounceOnServer"in n&&!!n.debounceOnServer,b=f?Math.max(+n.maxWait||0,t):null;(0,r.useEffect)((function(){return x.current=!0,function(){x.current=!1}}),[]);var y=(0,r.useMemo)((function(){var e=function(e){var t=d.current,n=u.current;return d.current=u.current=null,s.current=e,l.current=l.current||e,h.current=p.current.apply(n,t)},n=function(e,t){v&&cancelAnimationFrame(c.current),c.current=v?requestAnimationFrame(e):setTimeout(e,t)},r=function(e){if(!x.current)return!1;var n=e-o.current;return!o.current||n>=t||n<0||f&&e-s.current>=b},y=function(t){return c.current=null,g&&d.current?e(t):(d.current=u.current=null,h.current)},w=function e(){var a=Date.now();if(A&&l.current===s.current&&S(),r(a))return y(a);if(x.current){var i=t-(a-o.current),c=f?Math.min(i,b-(a-s.current)):i;n(e,c)}},S=function(){a&&a({})},k=function(){if(m||j){var a=Date.now(),l=r(a);if(d.current=[].slice.call(arguments),u.current=i,o.current=a,l){if(!c.current&&x.current)return s.current=o.current,n(w,t),A?e(o.current):h.current;if(f)return n(w,t),e(o.current)}return c.current||n(w,t),h.current}};return k.cancel=function(){c.current&&(v?cancelAnimationFrame(c.current):clearTimeout(c.current)),s.current=0,d.current=o.current=u.current=c.current=null},k.isPending=function(){return!!c.current},k.flush=function(){return c.current?y(Date.now()):h.current},k}),[A,f,t,b,g,v,m,j,a]);return y}function i(e,t){return e===t}function o(e,t,n){var o=n&&n.equalityFn||i,s=(0,r.useRef)(e),l=(0,r.useState)({})[1],c=a((0,r.useCallback)((function(e){s.current=e,l({})}),[l]),t,n,l),d=(0,r.useRef)(e);return o(d.current,e)||(c(e),d.current=e),[s.current,c]}},56311:(e,t,n)=>{n.d(t,{A:()=>p});var r=n(89379),a=n(9950),i=n(2660),o=n(2046),s=n(83274),l=n(25333),c=n(97125),d=n(7762),u=n(52097),h=n(44414);const p=e=>{let{value:t,onChange:n,onDebouncedChange:p,debounceTime:x=500,placeholder:m="Search (ctrl+k)",sx:v}=e;const A=(0,a.useRef)(null),[g]=(0,u.d7)(t,x);return(0,a.useEffect)((()=>{p&&p(g)}),[g,p]),(0,a.useEffect)((()=>{const e=e=>{var t;"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),null===(t=A.current)||void 0===t||t.focus());"Escape"===e.key&&document.activeElement===A.current&&A.current.blur()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[]),(0,h.jsx)(i.A,{sx:(0,r.A)({},v),inputRef:A,placeholder:m,autoComplete:"off",value:t,fullWidth:!0,onChange:e=>n(e.target.value),startAdornment:(0,h.jsx)(o.A,{position:"start",sx:{mr:-.5},children:(0,h.jsx)(c.A,{})}),endAdornment:(0,h.jsx)(s.A,{title:"Clear",children:(0,h.jsx)(l.A,{sx:{visibility:t?"visible":"hidden"},onClick:()=>n(""),children:(0,h.jsx)(d.A,{})})})})}},58691:(e,t,n)=>{n.d(t,{A:()=>s});n(9950);var r=n(16491),a=n(46639),i=n(62217),o=n(44414);function s(e){let{size:t=70,imgSize:n=40,alt:s="loader"}=e;return(0,o.jsxs)(r.A,{position:"relative",display:"inline-flex",justifyContent:"center",alignItems:"center",children:[(0,o.jsx)(a.A,{size:t}),(0,o.jsx)(r.A,{position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",sx:{width:n,height:n},children:(0,o.jsx)("img",{src:i,alt:s,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"}})})]})}},59212:(e,t,n)=>{n.d(t,{A:()=>c});var r=n(89379),a=n(9950),i=n(77922),o=n(29925),s=n(26910),l=n(44414);const c=(0,a.forwardRef)(((e,t)=>{let{setAppId:n,setLocoName:c,setPage:d,sx:u,textfeildSx:h}=e;const[p,x]=(0,a.useState)(JSON.parse(localStorage.getItem("applocations")||"[]"));return(0,a.useEffect)((()=>{0===p.length&&(async()=>{try{const e=localStorage.getItem("userid");if(!e)return;const t=await s.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)),x(e)}}catch(e){console.error("Error fetching locations in LocationAutocomplete:",e)}})()}),[p.length]),(0,l.jsx)(i.A,{id:"location-autocomplete",options:p||[],getOptionLabel:e=>{var t;return null!==(t=null===e||void 0===e?void 0:e.locationname)&&void 0!==t?t:""},sx:(0,r.A)({},u),onChange:(e,t,r)=>{"clear"===r?(null===n||void 0===n||n(0),null===c||void 0===c||c(""),null===d||void 0===d||d(0)):t&&(null===n||void 0===n||n(t.applocationid),null===c||void 0===c||c(t.locationname),null===d||void 0===d||d(0))},renderInput:e=>(0,l.jsx)(o.A,(0,r.A)((0,r.A)({},e),{},{inputRef:t,label:"Select Zones",sx:(0,r.A)({},h)}))})}))},64367:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(23235),a=n(44414);const i=(0,r.A)((0,a.jsx)("path",{d:"M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 16H5V10h14zM9 14H7v-2h2zm4 0h-2v-2h2zm4 0h-2v-2h2zm-8 4H7v-2h2zm4 0h-2v-2h2zm4 0h-2v-2h2z"}),"CalendarMonth")},97125:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(23235),a=n(44414);const i=(0,r.A)((0,a.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"SearchOutlined")}}]);