Files
dailygrubs_console_build/build/static/js/2912.4616aa85.chunk.js
2026-09-11 12:11:00 +05:30

1 line
49 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[2912],{62912:function(e,t,n){n.r(t);var a=n(93433),o=n(74165),r=n(15861),i=n(29439),s=n(1413),c=n(47313),l=n(42832),d=n(48119),u=n(61113),x=n(9019),p=n(57829),f=n(76088),h=n(16783),m=n(69099),g=n(47131),Z=n(16429),b=n(83929),v=n(44758),j=n(66212),S=n(70024),k=n(19536),_=n(85281),y=n(33604),C=n(49914),P=n(96467),w=n(11198),A=n(37159),E=n(36528),I=n(12058),D=n(88960),R=n(23195),W=n(58467),T=n(22539),Y=n(66277),M=n(56573),z=n(19860),L=n(91547),N=n(11577),H=(n(46926),n(97316),n(29736)),F=n(23208),B=n(45904),O=n(94469),U=n(10658),K=n.n(U),q=n(90842),G=n(40765),V=n(3745),X=n(70501),Q=n(46417),$=n(91635);K().extend($);var J=999,ee=16,te="0 14px 40px rgba(15, 23, 42, 0.10)",ne="0 8px 24px rgba(15, 23, 42, 0.08)",ae="0 18px 50px rgba(15, 23, 42, 0.18)",oe="#0f172a",re="#64748b",ie="#94a3b8",se="#e2e8f0",ce="#f1f5f9",le="#f8fafc",de=function(e,t){return"".concat(e).concat(t)},ue=function(e){return de(e,"08")},xe=function(e){return de(e,"18")},pe=function(e){return de(e,"26")},fe=function(e){return de(e,"55")},he="#662582",me="#9255AB",ge=function(e){var t=e.color,n=e.icon,a=e.title,o=e.subtitle,r=e.action;return(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,sx:{px:{xs:1.5,md:2},py:1.25,borderBottom:"1px solid ".concat(ce),background:"linear-gradient(90deg, ".concat(ue(t)," 0%, transparent 100%)")},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.25,children:[(0,Q.jsx)(d.Z,{sx:{width:32,height:32,bgcolor:t,color:"#fff",boxShadow:"0 6px 18px ".concat(pe(t))},children:n}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{sx:{fontWeight:800,color:oe,fontSize:14,lineHeight:1.1},children:a}),o&&(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:o})]})]}),r]})},Ze=function(e){var t=e.children,n=e.sx,a=void 0===n?{}:n;return(0,Q.jsx)(X.Z,{elevation:0,sx:(0,s.Z)({borderRadius:ee/8,border:"1px solid",borderColor:se,background:"#fff",overflow:"hidden",boxShadow:te,height:"100%"},a),children:t})},be=function(e){return(0,Q.jsx)(X.Z,(0,s.Z)((0,s.Z)({},e),{},{sx:{mt:.75,borderRadius:2,boxShadow:ae,border:"1px solid",borderColor:"divider",overflow:"hidden"}}))};t.default=function(){var e=c.useState(""),t=(0,i.Z)(e,2),n=t[0],U=t[1],$=c.useState(""),ae=(0,i.Z)($,2),de=ae[0],ve=ae[1],je=(0,c.useState)(""),Se=(0,i.Z)(je,2),ke=(Se[0],Se[1],(0,c.useState)("")),_e=(0,i.Z)(ke,2),ye=(_e[0],_e[1],(0,c.useState)("")),Ce=(0,i.Z)(ye,2),Pe=(Ce[0],Ce[1],(0,c.useState)("")),we=(0,i.Z)(Pe,2),Ae=(we[0],we[1],(0,c.useState)("")),Ee=(0,i.Z)(Ae,2),Ie=(Ee[0],Ee[1],(0,c.useState)("")),De=(0,i.Z)(Ie,2),Re=(De[0],De[1],(0,c.useState)("")),We=(0,i.Z)(Re,2),Te=(We[0],We[1],(0,c.useState)("")),Ye=(0,i.Z)(Te,2),Me=(Ye[0],Ye[1],(0,c.useState)("")),ze=(0,i.Z)(Me,2),Le=(ze[0],ze[1],(0,c.useState)("")),Ne=(0,i.Z)(Le,2),He=(Ne[0],Ne[1],(0,c.useState)("")),Fe=(0,i.Z)(He,2),Be=(Fe[0],Fe[1],(0,c.useState)("")),Oe=(0,i.Z)(Be,2),Ue=(Oe[0],Oe[1],(0,c.useState)("")),Ke=(0,i.Z)(Ue,2),qe=(Ke[0],Ke[1],(0,c.useState)("")),Ge=(0,i.Z)(qe,2),Ve=(Ge[0],Ge[1],(0,c.useState)("")),Xe=(0,i.Z)(Ve,2),Qe=(Xe[0],Xe[1],(0,c.useState)("")),$e=(0,i.Z)(Qe,2),Je=($e[0],$e[1],(0,c.useState)(localStorage.getItem("locationid"))),et=(0,i.Z)(Je,2),tt=(et[0],et[1]),nt=(0,c.useState)(!1),at=(0,i.Z)(nt,2),ot=at[0],rt=at[1],it=(0,c.useRef)(null),st=(0,c.useRef)(null),ct=(0,c.useState)(0),lt=(0,i.Z)(ct,2),dt=lt[0],ut=lt[1],xt=(0,c.useState)(1),pt=(0,i.Z)(xt,2),ft=pt[0],ht=pt[1],mt=localStorage.getItem("applocationid"),gt=(0,W.s0)(),Zt=(0,c.useState)({}),bt=(0,i.Z)(Zt,2),vt=(bt[0],bt[1],(0,c.useState)("")),jt=(0,i.Z)(vt,2),St=(jt[0],jt[1],(0,c.useState)(!1)),kt=(0,i.Z)(St,2),_t=(kt[0],kt[1],(0,c.useState)(!1)),yt=(0,i.Z)(_t,2),Ct=(yt[0],yt[1],(0,c.useState)(!1)),Pt=(0,i.Z)(Ct,2),wt=Pt[0],At=Pt[1],Et=(0,c.useState)(1),It=(0,i.Z)(Et,2),Dt=(It[0],It[1],(0,c.useState)([])),Rt=(0,i.Z)(Dt,2),Wt=(Rt[0],Rt[1],(0,c.useState)([])),Tt=(0,i.Z)(Wt,2),Yt=Tt[0],Mt=Tt[1],zt=(0,c.useState)(""),Lt=(0,i.Z)(zt,2),Nt=(Lt[0],Lt[1],(0,c.useState)(K()().format("MM-DD-YYYY"))),Ht=(0,i.Z)(Nt,2),Ft=Ht[0],Bt=Ht[1],Ot=(0,c.useState)(K()().add(1,"day").format("MM-DD-YYYY")),Ut=(0,i.Z)(Ot,2),Kt=(Ut[0],Ut[1]),qt=(0,c.useState)(),Gt=(0,i.Z)(qt,2),Vt=Gt[0],Xt=Gt[1],Qt=(0,c.useState)(),$t=(0,i.Z)(Qt,2),Jt=$t[0],en=$t[1],tn=(0,c.useState)([]),nn=(0,i.Z)(tn,2),an=nn[0],on=nn[1],rn=(0,c.useState)(""),sn=(0,i.Z)(rn,2),cn=(sn[0],sn[1],(0,c.useState)([])),ln=(0,i.Z)(cn,2),dn=(ln[0],ln[1],(0,z.Z)()),un=(0,c.useState)(""),xn=(0,i.Z)(un,2),pn=xn[0],fn=xn[1],hn=(0,c.useState)([]),mn=(0,i.Z)(hn,2),gn=(mn[0],mn[1],(0,c.useState)([])),Zn=(0,i.Z)(gn,2),bn=(Zn[0],Zn[1],(0,c.useState)([])),vn=(0,i.Z)(bn,2),jn=(vn[0],vn[1],(0,c.useState)([])),Sn=(0,i.Z)(jn,2),kn=(Sn[0],Sn[1],(0,c.useState)(!1)),_n=(0,i.Z)(kn,2),yn=(_n[0],_n[1]),Cn=(0,c.useState)(!1),Pn=(0,i.Z)(Cn,2),wn=Pn[0],An=Pn[1],En=(0,c.useState)(!1),In=(0,i.Z)(En,2),Dn=In[0],Rn=In[1],Wn=(0,c.useState)([]),Tn=(0,i.Z)(Wn,2),Yn=Tn[0],Mn=(Tn[1],(0,c.useState)([])),zn=(0,i.Z)(Mn,2),Ln=(zn[0],zn[1],(0,c.useState)([])),Nn=(0,i.Z)(Ln,2),Hn=(Nn[0],Nn[1]),Fn=(0,c.useState)(""),Bn=(0,i.Z)(Fn,2),On=Bn[0],Un=Bn[1],Kn=(0,c.useState)(""),qn=(0,i.Z)(Kn,2),Gn=(qn[0],qn[1],(0,c.useState)({})),Vn=(0,i.Z)(Gn,2),Xn=(Vn[0],Vn[1],(0,c.useState)("")),Qn=(0,i.Z)(Xn,2),$n=Qn[0],Jn=(Qn[1],(0,c.useState)([])),ea=(0,i.Z)(Jn,2),ta=(ea[0],ea[1]),na=(0,c.useState)([]),aa=(0,i.Z)(na,2),oa=(aa[0],aa[1],(0,c.useState)()),ra=(0,i.Z)(oa,2),ia=ra[0],sa=ra[1],ca=(0,c.useState)([]),la=(0,i.Z)(ca,2),da=(la[0],la[1],(0,c.useState)({})),ua=(0,i.Z)(da,2),xa=ua[0],pa=ua[1],fa=(0,c.useState)({}),ha=(0,i.Z)(fa,2),ma=(ha[0],ha[1],(0,c.useState)("")),ga=(0,i.Z)(ma,2),Za=ga[0],ba=ga[1],va=(0,c.useState)([]),ja=(0,i.Z)(va,2),Sa=(ja[0],ja[1],(0,c.useState)()),ka=(0,i.Z)(Sa,2),_a=(ka[0],ka[1]),ya=(0,c.useState)(""),Ca=(0,i.Z)(ya,2),Pa=(Ca[0],Ca[1],(0,c.useState)(!0)),wa=(0,i.Z)(Pa,2),Aa=(wa[0],wa[1],(0,c.useState)("B")),Ea=(0,i.Z)(Aa,2),Ia=Ea[0],Da=(Ea[1],(0,c.useState)(!1)),Ra=(0,i.Z)(Da,2),Wa=(Ra[0],Ra[1],(0,c.useState)({latitude:0,longitude:0})),Ta=(0,i.Z)(Wa,2),Ya=Ta[0],Ma=Ta[1],za=(0,c.useState)({latitude:0,longitude:0}),La=(0,i.Z)(za,2),Na=La[0],Ha=La[1],Fa=(0,c.useState)(!1),Ba=(0,i.Z)(Fa,2),Oa=Ba[0],Ua=Ba[1],Ka=(0,c.useState)(0),qa=(0,i.Z)(Ka,2),Ga=qa[0],Va=qa[1],Xa=(0,c.useState)(0),Qa=(0,i.Z)(Xa,2),$a=Qa[0],Ja=Qa[1],eo=(0,c.useState)(0),to=(0,i.Z)(eo,2),no=to[0],ao=to[1],oo=(0,c.useState)(0),ro=(0,i.Z)(oo,2),io=ro[0],so=ro[1],co=(0,c.useState)(0),lo=(0,i.Z)(co,2),uo=lo[0],xo=lo[1],po=(0,c.useState)([]),fo=(0,i.Z)(po,2),ho=fo[0],mo=fo[1],go=(0,c.useState)("Select "),Zo=(0,i.Z)(go,2),bo=Zo[0],vo=Zo[1],jo=(0,c.useState)(),So=(0,i.Z)(jo,2),ko=So[0],_o=So[1],yo=(0,c.useState)(""),Co=(0,i.Z)(yo,2),Po=Co[0],wo=Co[1],Ao=localStorage.getItem("tenantid"),Eo=(0,c.useState)(null),Io=(0,i.Z)(Eo,2),Do=Io[0],Ro=Io[1],Wo=(0,c.useState)(!1),To=(0,i.Z)(Wo,2),Yo=To[0],Mo=To[1],zo=(0,c.useState)(""),Lo=(0,i.Z)(zo,2),No=Lo[0],Ho=Lo[1],Fo=(0,c.useState)([]),Bo=(0,i.Z)(Fo,2),Oo=Bo[0],Uo=Bo[1],Ko=(0,c.useState)({}),qo=(0,i.Z)(Ko,2),Go=qo[0],Vo=qo[1],Xo=(0,c.useState)({}),Qo=(0,i.Z)(Xo,2),$o=Qo[0],Jo=Qo[1],er=(0,c.useState)(0),tr=(0,i.Z)(er,2),nr=tr[0],ar=tr[1],or=(0,c.useState)(0),rr=(0,i.Z)(or,2),ir=rr[0],sr=rr[1],cr=(0,c.useState)(0),lr=(0,i.Z)(cr,2),dr=lr[0],ur=lr[1],xr=(0,c.useState)([]),pr=(0,i.Z)(xr,2),fr=pr[0],hr=pr[1],mr=(0,c.useState)(),gr=(0,i.Z)(mr,2),Zr=gr[0],br=gr[1],vr=(0,c.useState)(),jr=(0,i.Z)(vr,2),Sr=jr[0],kr=jr[1],_r=(0,c.useState)(),yr=(0,i.Z)(_r,2),Cr=yr[0],Pr=yr[1],wr=Number.isFinite(Number(Zr))&&Number.isFinite(Number(Sr))&&!(0===Number(Zr)&&0===Number(Sr)),Ar=(0,c.useState)(0),Er=(0,i.Z)(Ar,2),Ir=Er[0],Dr=Er[1],Rr=(0,c.useState)(0),Wr=(0,i.Z)(Rr,2),Tr=Wr[0],Yr=Wr[1],Mr=(0,c.useState)(0),zr=(0,i.Z)(Mr,2),Lr=zr[0],Nr=zr[1],Hr=(0,c.useState)(0),Fr=(0,i.Z)(Hr,2),Br=Fr[0],Or=Fr[1],Ur=(0,c.useState)(),Kr=(0,i.Z)(Ur,2),qr=Kr[0],Gr=Kr[1],Vr=(0,c.useState)(),Xr=(0,i.Z)(Vr,2),Qr=Xr[0],$r=Xr[1],Jr=(0,c.useState)(!1),ei=(0,i.Z)(Jr,2),ti=ei[0],ni=ei[1],ai=(0,c.useState)(!1),oi=(0,i.Z)(ai,2),ri=oi[0],ii=oi[1],si=(0,c.useState)(0),ci=(0,i.Z)(si,2),li=ci[0],di=ci[1];(0,c.useEffect)((function(){console.log(li)}),[li]);var ui=function(e){Ro(e)},xi=function(e){return{cursor:"pointer",backgroundColor:Do===e?dn.palette.primary.main:"default",color:Do===e?"#fff":"","&:hover":{backgroundColor:Do===e?dn.palette.primary.main:dn.palette.primary.light,color:"#fff"}}},pi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantpricing/?tenantid=").concat(Ao));case 3:t=e.sent,console.log("pricingResponse",t.data.details),Ja(t.data.details.baseprice),ao(t.data.details.priceperkm),so(t.data.details.minkm),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),console.log("fetchTenantPricing error",e.t0);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){pi()}),[]),(0,c.useEffect)((function(){console.log("startPoint",Ya),console.log("endPoint",Na),0!=Ya.latitude&&0!=Ya.longitude&&0!=Na.latitude&&0!=Na.longitude&&fi(Ya,Na)}),[Ya,Na]);var fi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(t,n){var a,r,i;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,A.v)(t,n);case 3:a=e.sent,console.log("calculated distance in km:",a),Va(a),r=(0,A.j)(a,$a,no,io),console.log("total charge:",r),xo(r),Ua(!0),a>Cr&&(Ua(!0),At(!0)),40,i=Math.round(a/40*60),console.log("Distance: ".concat(a,", Duration: ").concat(i)),e.next=19;break;case 16:e.prev=16,e.t0=e.catch(0),console.error("Error calculating distance:",e.t0);case 19:case"end":return e.stop()}}),e,null,[[0,16]])})));return function(t,n){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){if(an[0]){var e=[];an.map((function(t){K()().diff(K()("".concat(K()(Ft).format("MM-DD-YYYY")," ").concat(K()(t).format("HH:mm:ss"))),"m")<=0&&e.push(t)})),e[0]&&Hn([{sno:1,address:"",customerid:"",deliverytime:K()(e[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}])}}),[an]),(0,c.useEffect)((function(){if($n){var e=Yt.filter((function(e){return e.address.toLowerCase().includes($n.toLowerCase())||e.firstname.toLowerCase().includes($n.toLowerCase())||e.contactno.toLowerCase().includes($n.toLowerCase())}));console.log(e),ta((0,a.Z)(e))}else ta((0,a.Z)(Yt))}),[$n]);var hi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return An(!0),console.log("tid",Ao),e.next=4,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantinfo/?tenantid=").concat(Ao)).then((function(e){console.log("fetchtenantinfo",e),e.data.status&&(pa(e.data.details),_a(e.data.details.tenantid),Zi(),_o(e.data.details.subcategoryid)),An(!1)})).catch((function(e){console.log(e),An(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){hi()}),[]);var mi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getsubcategories/?moduleid=6")).then((function(e){console.log("subcateRes",e.data.details),e.data.status&&e.data.details?mo(e.data.details):mo([])})).catch((function(e){console.log(e),mo([])}));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){mi()}),[]);var gi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return An(!0),e.next=3,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocations/?applocationid=").concat(mt)).then((function(e){var t,n;console.log("fetchTiming",e);var a=null===(t=e.data)||void 0===t||null===(n=t.details)||void 0===n?void 0:n[0];if(e.data.status&&a){var o=a.opentime,r=a.closetime,i=a.latitude,s=a.longitude,c=a.radius;br(i),kr(s),Pr(c),Xt("".concat(K()().format("MM-DD-YYYY")," ").concat(o)),en("".concat(K()().format("MM-DD-YYYY")," ").concat(r)),console.log("starttime","".concat(K()().format("MM-DD-YYYY")," ").concat(o)),console.log("endtime","".concat(K()().format("MM-DD-YYYY")," ").concat(r," "));for(var l=[],d="".concat(K()().format("MM-DD-YYYY")," ").concat(o);K()("".concat(K()().format("MM-DD-YYYY")," ").concat(r," ")).diff(d,"m")>=0;d=K()(d).add(30,"m"))l.push(d);console.log("setTimeslotarr",l),on(l)}An(!1)})).catch((function(e){console.log(e),An(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){gi()}),[]);var Zi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return An(!0),e.next=3,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocationconfig/?applocationid=").concat(mt)).then((function(e){var t=e.data.details.applocationadmins.map((function(e){return e.userfcmtokem}));console.log("fetchAppAdminTokens",e),console.log("userfcmtokemArray",t),e.data.status&&sa(t),An(!1)})).catch((function(e){console.log(e),An(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Vt&&Jt&&Zi()}),[Vt,Jt]);var bi=function(e,t,n){(0,q.yv)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:n||2e3}),console.log(On)};var vi=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t,n,a,r,i,s;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Go.latitude||Ya.latitude||0,n=Go.longitude||Ya.longitude||0,a=$o.latitude||Na.latitude||0,r=$o.longitude||Na.longitude||0,i={order:{amount:Math.round(uo)||0,applocationid:xa.applolcationid,categoryid:Do,collectionamount:+dt||0,distance:Ga||0,driverbatchcharge:0,drivercommissiontype:"F",drivercommissionvalue:0,enddate:Ft,estimatedtime:0,eventsno:0,fromtime:Za.split("-")[0],initialdistance:io,initialfare:$a,locationid:0,minimumfare:$a,ordernotes:pn,orderstatus:"created",ordertype:Ia,ordervalue:Math.round(uo)||0,paymentmode:"C",perkmdistance:0,priceperkm:no,promocode:"",promodiscount:0,serviceid:0,shiftsno:0,startdate:Ft,status:1,subcategoryid:ko,tax:0,tenantid:xa.tenantid,totaltax:0,totime:Za.split("-")[1],weight:Po,quantity:+ft||1},pickup:{address:Go.address||"",applocationid:xa.applolcationid,city:Go.city||"",configid:7,contactno:Go.contactno||"",customertoken:"",customerid:0==Ir&&Go.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:Go.doorno||"",email:Go.email||"",firstname:Go.firstname||"",landmark:Go.landmark||"",latitude:String(t),longitude:String(n),locationid:Go.deliverylocationid||0,postcode:Go.postcode||"",primaryaddress:1,profileimage:"",state:Go.state||"",suburb:Go.suburb||"",tenantid:xa.tenantid},drop:{address:$o.address||"",applocationid:xa.applolcationid,city:$o.city||"",configid:7,contactno:$o.contactno||"",customertoken:"",customerid:0==Tr&&$o.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:$o.doorno||"",email:$o.email||"",firstname:$o.firstname||"",landmark:$o.landmark||"",latitude:String(a),longitude:String(r),locationid:$o.deliverylocationid||0,postcode:$o.postcode||"",primaryaddress:1,profileimage:"",state:$o.state||"",suburb:$o.suburb||"",tenantid:xa.tenantid}},console.log("createsubmitobj2",i),Go.firstname){e.next=10;break}bi("Enter Pickup Contact Name ","warning",2e3),e.next=90;break;case 10:if(Go.contactno){e.next=14;break}bi("Enter Pickup Contact Number ","warning",2e3),e.next=90;break;case 14:if(10==Go.contactno.length){e.next=18;break}bi("Check Pickup Contact Number ","error",2e3),e.next=90;break;case 18:if(Go.suburb){e.next=22;break}bi("Enter Pickup Location ","warning",2e3),e.next=90;break;case 22:if(Go.city){e.next=26;break}bi("Enter Pickup City ","warning",2e3),e.next=90;break;case 26:if(Go.postcode){e.next=30;break}bi("Enter Pickup Postcode ","warning",2e3),e.next=90;break;case 30:if(Go.landmark){e.next=34;break}bi("Enter Pickup Landmark ","warning",2e3),e.next=90;break;case 34:if(Number(t)&&Number(n)){e.next=38;break}bi("Could not locate Pickup address on map, please recheck the address","error",3e3),e.next=90;break;case 38:if($o.firstname){e.next=42;break}bi("Enter Drop Contact Name ","warning",2e3),e.next=90;break;case 42:if($o.contactno){e.next=46;break}bi("Enter Drop Contact Number","warning",2e3),e.next=90;break;case 46:if(10===$o.contactno.length){e.next=50;break}bi("Check Drop Contact Number ","error",2e3),e.next=90;break;case 50:if($o.suburb){e.next=54;break}bi("Enter Drop Suburb ","warning",2e3),e.next=90;break;case 54:if($o.city){e.next=58;break}bi("Enter Drop City ","warning",2e3),e.next=90;break;case 58:if($o.postcode){e.next=62;break}bi("Enter Drop postcode ","warning",2e3),e.next=90;break;case 62:if($o.landmark){e.next=66;break}bi("Enter Drop Landmark ","warning",2e3),e.next=90;break;case 66:if(Number(a)&&Number(r)){e.next=70;break}bi("Could not locate Drop address on map, please recheck the address","error",3e3),e.next=90;break;case 70:if(Za){e.next=74;break}bi("Choose deliverytime ","warning",2e3),e.next=90;break;case 74:if(_o){e.next=78;break}bi("Choose SubCategory ","warning",2e3),e.next=90;break;case 78:return e.prev=78,e.next=81,M.Z.post("".concat("https://jupiter.nearle.app/live/api/v2","/orders/createorder"),i);case 81:(s=e.sent).data.status?(console.log("createRes",s),(0,q.yv)("Order Created Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:1e3}),ia&&notifyadmin(ia),gt("/nearle/orders")):bi("Something went wrong, Cannot create order","warning"),An(!1),console.log(s),e.next=90;break;case 87:e.prev=87,e.t0=e.catch(78),console.log("createResErr",e.t0);case 90:case"end":return e.stop()}}),e,null,[[78,87]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){console.log("shiftarr"),console.log(Yn)}),[Yn]);var ji=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return yn(!0),e.prev=1,t=""==No?"".concat("https://jupiter.nearle.app/live/api/v1","/customers/gettenantcustomers/?tenantid=").concat(Ao,"&pageno=1&pagesize=20"):"".concat("https://jupiter.nearle.app/live/api/v1","/customers/search/?tenantid=").concat(Ao,"&keyword=").concat(No),e.next=5,M.Z.get(t).then((function(e){if(console.log("clientdetails",e.data.details),e.data.status&&e.data.details){Mt(e.data.details||[]),Uo(e.data.details||[]);var t=[];e.data.details.map((function(e){t.push((0,s.Z)({label:"".concat(e.firstname," | ").concat(e.contactno)},e))})),ta(t)}else Mt([]),Uo([]),ta([]);yn(!1)})).catch((function(e){console.log(e),yn(!1),bi("server error","warning")}));case 5:e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.log(e.t0),yn(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){console.log("clientdetails, by search"),ji()}),[No.length>3,""==No]);var Si=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.overwriteFields,a=void 0===n||n,o=e.geometry.location.lat(),r=e.geometry.location.lng();if(Ma({latitude:o,longitude:r}),a){U("".concat(e.name,", ").concat(e.formatted_address)),Vo((0,s.Z)((0,s.Z)({},Go),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var i={address:"".concat(e.name," ").concat(e.formatted_address),street_number:"",route:"",locality:"",sublocality_level_1:"",administrative_area_level_3:"",administrative_area_level_1:"",country:"",postal_code:""};e.address_components.forEach((function(e){e.types.forEach((function(t){switch(t){case"street_number":i.street_number=e.long_name;break;case"route":i.route=e.long_name;break;case"locality":i.locality=e.long_name;break;case"sublocality_level_1":i.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":i.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":i.administrative_area_level_1=e.long_name;break;case"country":i.country=e.long_name;break;case"postal_code":i.postal_code=e.long_name}}))})),Vo((0,s.Z)((0,s.Z)({},Go),{},{address:i.address,doorno:"".concat(i.street_number," ").concat(i.route),suburb:i.sublocality_level_1,city:i.locality,postcode:i.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}))}else Vo((function(e){return(0,s.Z)((0,s.Z)({},e),{},{latitude:o,longitude:r})}))},ki=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.overwriteFields,a=void 0===n||n,o=e.geometry.location.lat(),r=e.geometry.location.lng();if(Ha({latitude:o,longitude:r}),a){ve("".concat(e.name,", ").concat(e.formatted_address)),Jo((0,s.Z)((0,s.Z)({},$o),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var i={address:"".concat(e.name," ").concat(e.formatted_address),street_number:"",route:"",locality:"",sublocality_level_1:"",administrative_area_level_3:"",administrative_area_level_1:"",country:"",postal_code:""};e.address_components.forEach((function(e){e.types.forEach((function(t){switch(t){case"street_number":i.street_number=e.long_name;break;case"route":i.route=e.long_name;break;case"locality":i.locality=e.long_name;break;case"sublocality_level_1":i.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":i.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":i.administrative_area_level_1=e.long_name;break;case"country":i.country=e.long_name;break;case"postal_code":i.postal_code=e.long_name}}))})),Jo((0,s.Z)((0,s.Z)({},$o),{},{address:i.address,doorno:"".concat(i.street_number," ").concat(i.route),suburb:i.sublocality_level_1,city:i.locality,postcode:i.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}))}else Jo((function(e){return(0,s.Z)((0,s.Z)({},e),{},{latitude:o,longitude:r})}))};(0,c.useEffect)((function(){if(0===Ya.latitude&&0===Ya.longitude){var e=n&&n.trim().length>=6&&n||Go.suburb&&Go.city&&[Go.doorno,Go.suburb,Go.city,Go.postcode].filter(Boolean).join(", ");if(e){var t=setTimeout((0,r.Z)((0,o.Z)().mark((function t(){var n;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,L.gA)(e,{bias:{lat:Zr,lng:Sr}});case 2:(n=t.sent)&&Si(n,{overwriteFields:!1});case 4:case"end":return t.stop()}}),t)}))),800);return function(){return clearTimeout(t)}}}}),[n,Go.doorno,Go.suburb,Go.city,Go.postcode,Zr,Sr]),(0,c.useEffect)((function(){if(0===Na.latitude&&0===Na.longitude){var e=de&&de.trim().length>=6&&de||$o.suburb&&$o.city&&[$o.doorno,$o.suburb,$o.city,$o.postcode].filter(Boolean).join(", ");if(e){var t=setTimeout((0,r.Z)((0,o.Z)().mark((function t(){var n;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,L.gA)(e,{bias:{lat:Zr,lng:Sr}});case 2:(n=t.sent)&&ki(n,{overwriteFields:!1});case 4:case"end":return t.stop()}}),t)}))),800);return function(){return clearTimeout(t)}}}}),[de,$o.doorno,$o.suburb,$o.city,$o.postcode,Zr,Sr]);var _i=function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantlocations/?tenantid=").concat(Ao));case 3:t=e.sent,console.log("gettenantlocations",t.data.details),t.data&&t.data.details?(hr(t.data.details),1==t.data.details.length&&(rt(!0),tt(t.data.details[0].locationid))):hr([]),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),console.log("gettenantlocations",e.t0),hr([]);case 12:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){_i()}),[]),(0,Q.jsxs)(Q.Fragment,{children:[wn&&(0,Q.jsx)(N.Z,{}),(0,Q.jsxs)(x.ZP,{container:!0,rowSpacing:2,columnSpacing:2.75,children:[(0,Q.jsx)(x.ZP,{item:!0,xs:12,children:(0,Q.jsx)(X.Z,{elevation:0,sx:{position:"sticky",top:"60px",zIndex:1e3,mb:1.5,p:{xs:1.5,sm:2,md:2.5},borderRadius:ee/8,border:"1px solid",borderColor:se,background:"linear-gradient(135deg, ".concat(ue(he)," 0%, ").concat(ue(me)," 100%)"),boxShadow:ne},children:(0,Q.jsxs)(l.Z,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:{xs:1.5,sm:2},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:{xs:1.25,sm:1.75},children:[(0,Q.jsx)(d.Z,{sx:{width:{xs:40,sm:48},height:{xs:40,sm:48},bgcolor:he,color:"#fff",boxShadow:"0 6px 18px ".concat(pe(he))},children:(0,Q.jsx)(T.tX2,{size:22})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h3",sx:{fontWeight:800,color:oe,lineHeight:1.1,fontSize:{xs:"1.25rem",sm:"1.5rem",md:"1.75rem"}},children:"Create Order"}),(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:.75,sx:{mt:.5},children:[(0,Q.jsx)(p.Z,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:"#10b981",boxShadow:"0 0 0 4px rgba(16,185,129,0.18)"}}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:"Fill pickup, drop, schedule & pricing details"})]})]})]}),1===fr.length?(0,Q.jsxs)(p.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.5,py:.875,borderRadius:999,bgcolor:ue(he),border:"1.5px solid ".concat(fe(he)),color:he,fontWeight:800,fontSize:13},children:[(0,Q.jsx)(T.x$F,{size:14})," ",fr[0].locationname]}):(0,Q.jsx)(f.Z,{options:fr||[],getOptionLabel:function(e){return e&&e.locationname?"".concat(e.locationname," (").concat(e.suburb||"",")"):""},isOptionEqualToValue:function(e,t){return(null===e||void 0===e?void 0:e.locationid)===(null===t||void 0===t?void 0:t.locationid)},PaperComponent:be,sx:{width:{xs:"100%",sm:300}},size:"small",renderInput:function(e){return(0,Q.jsx)(h.Z,(0,s.Z)((0,s.Z)({},e),{},{placeholder:"Select Business Location",InputProps:(0,s.Z)((0,s.Z)({},e.InputProps),{},{startAdornment:(0,Q.jsx)(l.Z,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,Q.jsx)(d.Z,{sx:{width:22,height:22,bgcolor:he,color:"#fff"},children:(0,Q.jsx)(T.x$F,{size:13})})})}),sx:{"& .MuiOutlinedInput-root":{borderRadius:J+"px",bgcolor:"#fff",fontWeight:600,"& fieldset":{borderColor:fe(he),borderWidth:1.5},"&:hover fieldset":{borderColor:he},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(pe(he))},"&.Mui-focused fieldset":{borderColor:he,borderWidth:2}}}}))},onChange:function(e,t,n){t&&(tt(t.locationid),rt(!0)),"clear"===n&&rt(!1)}})]})})}),(0,Q.jsx)(x.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(p.Z,{sx:{overflow:"visible"},children:[(0,Q.jsx)(x.ZP,{container:!0,spacing:2,children:(0,Q.jsx)(x.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(x.ZP,{container:!0,spacing:2,sx:{height:"100%"},children:[(0,Q.jsx)(x.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(Ze,{children:[(0,Q.jsx)(ge,{color:"#0ea5e9",icon:(0,Q.jsx)(T.$0r,{size:16}),title:"Pickup Details",subtitle:"Where the order is picked up",action:(0,Q.jsx)(m.Z,{size:"small",variant:"outlined",startIcon:(0,Q.jsx)(T.Bjz,{size:14}),onClick:function(){ot?(Mo(!0),ar(1),Vo({}),U(""),Ho("")):bi("Select Business Location","warning")},sx:{borderRadius:999,px:1.5,py:.375,fontSize:11.5,fontWeight:700,textTransform:"none",borderColor:fe("#0ea5e9"),color:"#0ea5e9","&:hover":{borderColor:"#0ea5e9",bgcolor:ue("#0ea5e9"),boxShadow:"0 0 0 3px ".concat(pe("#0ea5e9"))}},children:"Saved Locations"})}),(0,Q.jsx)(p.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsx)(x.ZP,{container:!0,spacing:2,children:(0,Q.jsx)(x.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(x.ZP,{container:!0,spacing:4,children:[(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{inputRef:it,disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.Xws,{})})},variant:"outlined",label:"Contact Name",value:Go.firstname,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},Go),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{error:ti,disabled:!ot,fullWidth:!0,type:"number",InputProps:{inputProps:{maxLength:10},startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(E.DNl,{color:ti&&"red"})})},variant:"outlined",label:"Contact Number",value:Go.contactno,onChange:function(e){e.target.value.length<=10&&Vo((0,s.Z)((0,s.Z)({},Go),{},{contactno:e.target.value})),qr==e.target.value?Nr(0):Nr(1),e.target.value.length<10?ni(!0):ni(!1)}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:12,children:(0,Q.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==ir?(0,Q.jsx)("div",{children:(0,Q.jsx)(L.ZP,{label:"Address",disabled:!ot||!wr,placeholder:wr?"Search address":"Loading location\u2026",id:"addressAuto1",fullWidth:!0,value:n,onChange:U,onPlaceSelected:Si,bias:{lat:Zr,lng:Sr},TextFieldProps:{variant:"outlined",InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){U(""),Vo((0,s.Z)((0,s.Z)({},Go),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Ma({latitude:0,longitude:0})},size:"small",children:(0,Q.jsx)(w.Z,{})})}}})}):(0,Q.jsx)(h.Z,{InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){sr(0),Vo((0,s.Z)((0,s.Z)({},Go),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Ma({latitude:0,longitude:0})},children:(0,Q.jsx)(R.Z,{})})},variant:"outlined",placeholder:"Select",value:Go.address,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},Go),{},{address:e.target.value})),""==e.target.value&&(sr(0),Ua(!1),Ma({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(I.Lmk,{})})},variant:"outlined",label:"Door No / Street",value:Go.doorno,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},Go),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.GUT,{})})},variant:"outlined",label:"Location",value:Go.suburb,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},Go),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(T.Ys1,{})})},variant:"outlined",label:"City",value:Go.city,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},Go),{},{city:e.target.value}))}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(Y.kk8,{})})},variant:"outlined",label:"Postcode",value:Go.postcode,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},Go),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.I2o,{})})},variant:"outlined",label:"Landmark",value:Go.landmark,onChange:function(e){Vo((0,s.Z)((0,s.Z)({},Go),{},{landmark:e.target.value}))}})}),1==Lr&&(0,Q.jsx)(x.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"end"},children:(0,Q.jsx)(Z.Z,{children:(0,Q.jsx)(b.Z,{control:(0,Q.jsx)(v.Z,{checked:1===Ir,onChange:function(e){Dr(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})})})]})}),(0,Q.jsx)(x.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(Ze,{children:[(0,Q.jsx)(ge,{color:he,icon:(0,Q.jsx)(T.ili,{size:16}),title:"Drop Details",subtitle:"Where the order is delivered",action:(0,Q.jsx)(m.Z,{size:"small",variant:"outlined",startIcon:(0,Q.jsx)(T.Bjz,{size:14}),onClick:function(){ot?(Mo(!0),ar(2),ve(""),Ho("")):bi("Select Business Location","warning")},sx:{borderRadius:999,px:1.5,py:.375,fontSize:11.5,fontWeight:700,textTransform:"none",borderColor:fe(he),color:he,"&:hover":{borderColor:he,bgcolor:ue(he),boxShadow:"0 0 0 3px ".concat(pe(he))}},children:"Saved Locations"})}),(0,Q.jsx)(p.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsxs)(x.ZP,{container:!0,spacing:2,sx:{height:"100%"},children:[(0,Q.jsx)(x.ZP,{item:!0,xs:12,sx:{height:"100%"},children:(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"space-between",sx:{display:"none"},children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{mb:2},children:"Drop Details"}),(0,Q.jsx)(l.Z,{direction:"row",alignItems:"center",children:(0,Q.jsx)(m.Z,{variant:"outlined",sx:{"&:hover":{bgcolor:dn.palette.primary.main,color:"white"}},onClick:function(){ot?(Mo(!0),ar(2),ve(""),Ho("")):bi("Select Business Location","warning")},children:"Saved Locations"})})]})}),(0,Q.jsx)(x.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(x.ZP,{container:!0,spacing:4,children:[(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{inputRef:st,disabled:!ot,fullWidth:!0,variant:"outlined",label:"Contact Name",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.Xws,{})})},value:$o.firstname,onChange:function(e){Jo((0,s.Z)((0,s.Z)({},$o),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,error:ri,fullWidth:!0,type:"number",variant:"outlined",label:"Contact Number",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(E.DNl,{color:ri&&"red"})})},value:$o.contactno,onChange:function(e){e.target.value.length<=10&&Jo((0,s.Z)((0,s.Z)({},$o),{},{contactno:e.target.value})),Qr==e.target.value?Or(0):Or(1),e.target.value.length<10?ii(!0):ii(!1)}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:12,children:(0,Q.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==dr?(0,Q.jsx)("div",{children:(0,Q.jsx)(L.ZP,{id:"addressAuto2",disabled:!ot||!wr,placeholder:wr?"Search address":"Loading location\u2026",label:"Address",fullWidth:!0,value:de,onChange:ve,onPlaceSelected:ki,bias:{lat:Zr,lng:Sr},TextFieldProps:{InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){ve(""),Jo((0,s.Z)((0,s.Z)({},$o),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Ha({latitude:0,longitude:0})},size:"small",children:(0,Q.jsx)(w.Z,{})})}}})}):(0,Q.jsx)(h.Z,{disabled:!ot,InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){ur(0),Jo((0,s.Z)((0,s.Z)({},$o),{},{firstname:"",contactno:"",doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ua(!1),Ha({latitude:0,longitude:0})},children:(0,Q.jsx)(R.Z,{})})},variant:"outlined",placeholder:"Select",value:$o.address,onChange:function(e){Jo((0,s.Z)((0,s.Z)({},$o),{},{address:e.target.value})),""==e.target.value&&(ur(0),Ua(!1),Ha({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Door No / Street",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(I.Lmk,{})})},value:$o.doorno,onChange:function(e){Jo((0,s.Z)((0,s.Z)({},$o),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Location",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.GUT,{})})},value:$o.suburb,onChange:function(e){Jo((0,s.Z)((0,s.Z)({},$o),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"City",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(T.Ys1,{})})},value:$o.city,onChange:function(e){Jo((0,s.Z)((0,s.Z)({},$o),{},{city:e.target.value}))}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Postcode",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(Y.kk8,{})})},value:$o.postcode,onChange:function(e){Jo((0,s.Z)((0,s.Z)({},$o),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Landmark",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.I2o,{})})},value:$o.landmark,onChange:function(e){Jo((0,s.Z)((0,s.Z)({},$o),{},{landmark:e.target.value}))}})}),1==Br&&(0,Q.jsx)(x.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"end"},children:(0,Q.jsx)(Z.Z,{children:(0,Q.jsx)(b.Z,{control:(0,Q.jsx)(v.Z,{checked:1===Tr,onChange:function(e){Yr(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})]})})]})}),(0,Q.jsx)(x.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(Ze,{sx:{mt:2,minHeight:390},children:[(0,Q.jsx)(ge,{color:"#f59e0b",icon:(0,Q.jsx)(T.k71,{size:16}),title:"Schedule",subtitle:"Pickup date & time slot"}),(0,Q.jsx)(p.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsx)(x.ZP,{container:!0,children:(0,Q.jsxs)(x.ZP,{item:!0,xs:12,children:[(0,Q.jsx)(u.Z,{variant:"subtitle2",sx:{fontWeight:700,color:re,mb:1},children:"Date"}),(0,Q.jsx)(F._,{dateAdapter:B.y,sx:{},children:(0,Q.jsx)(H.M,{format:"DD-MM-YYYY",onChange:function(e){var t=K()().diff(K()("".concat(K()(e).format("YYYY-MM-DD"))),"d");if(console.log("dateres11"),console.log(t),ba(""),t<=0){console.log("startdate",e),Bt(e),Kt(e);var n=[];an.map((function(t){K()().diff(K()("".concat(K()(e).format("MM-DD-YYYY")," ").concat(K()(t).format("HH:mm:ss"))),"m")<=0&&n.push(t)})),n[0]?Hn([{sno:1,address:"",customerid:"",deliverytime:K()(n[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}]):Hn([])}else Un("choose Upcoming Date"),bi("choose Upcoming Date","warning"),Bt(NaN)},value:K()(Ft),sx:{width:"100%",mt:2},disablePast:!0})}),(0,Q.jsx)(u.Z,{variant:"subtitle2",sx:{fontWeight:700,color:re,mt:2,mb:1},children:"Time"}),(0,Q.jsx)(p.Z,{sx:{mt:.5,p:1.25,borderRadius:2,border:"1px solid",borderColor:ce,bgcolor:le,maxHeight:150,overflowY:"auto",scrollbarWidth:"thin","&::-webkit-scrollbar":{width:6},"&::-webkit-scrollbar-thumb":{backgroundColor:fe(he),borderRadius:6}},children:(0,Q.jsx)(l.Z,{direction:"row",flexWrap:"wrap",gap:.75,useFlexGap:!0,children:an.map((function(e,t){if(K()().diff(K()("".concat(K()(Ft).format("MM-DD-YYYY")," ").concat(K()(e).format("HH:mm:ss"))),"m")<=0){var n=K()(Za).format("HH:mm")==K()(e).format("HH:mm");return(0,Q.jsxs)(p.Z,{onClick:function(){Ga>Cr?At(!0):Oa?ba(e):bi("Select Pickup and Drop","error")},sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1.25,py:.5,cursor:"pointer",borderRadius:999,border:"1.5px solid ".concat(n?"#f59e0b":fe("#f59e0b")),bgcolor:n?"#f59e0b":ue("#f59e0b"),color:n?"#fff":"#f59e0b",fontSize:12,fontWeight:800,transition:"all 0.15s",boxShadow:n?"0 6px 18px ".concat(pe("#f59e0b")):"none","&:hover":{borderColor:"#f59e0b",boxShadow:n?"0 6px 18px ".concat(pe("#f59e0b")):"0 0 0 3px ".concat(pe("#f59e0b"))}},children:[(0,Q.jsx)(T.Y8K,{size:11})," ",K()(e).format("hh:mm A")]},t)}}))})})]})})})]})}),(0,Q.jsx)(x.ZP,{item:!0,xs:12,sm:6,sx:{},children:(0,Q.jsxs)(Ze,{sx:{mt:2,minHeight:390},children:[(0,Q.jsx)(ge,{color:"#10b981",icon:(0,Q.jsx)(T.sF1,{size:16}),title:"Distance & Pricing",subtitle:"Auto-calculated from pickup \u2192 drop"}),(0,Q.jsxs)(p.Z,{sx:{p:{xs:2,md:2.5}},children:[Oa&&(0,Q.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",mb:3},children:[(0,Q.jsx)(l.Z,{spacing:1.5,children:(0,Q.jsx)(j.Z,{label:"Distance: ".concat(Ga," km"),size:"medium",variant:"contained",color:"primary"})}),(0,Q.jsx)(l.Z,{spacing:1.5,children:(0,Q.jsx)(j.Z,{label:"Charge: \u20b9".concat(uo.toFixed(2)),size:"medium",variant:"contained",color:"primary"})})]}),(0,Q.jsxs)(l.Z,{direction:"column",justifyContent:"space-between",sx:{mb:2},children:[(0,Q.jsx)(u.Z,{variant:"h5",children:"Category"}),(0,Q.jsx)(f.Z,{disablePortal:!0,id:"combo-box-demo",options:ho,getOptionLabel:function(e){return"".concat(e.subcategoryname)||""},sx:{my:2,zIndex:"100"},fullWidth:!0,renderInput:function(e){return(0,Q.jsx)(h.Z,(0,s.Z)((0,s.Z)({},e),{},{label:""==bo?xa.subcategoryname:bo}))},onChange:function(e,t,n){t&&(console.log(t),vo(t.subcategoryname),_o(t.subcategoryid))}})]}),(0,Q.jsx)(u.Z,{variant:"h5",children:"Weight"}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"space-evenly",sx:{border:"1px solid #eee",my:2,py:2},children:[(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"1-10kgs",sx:xi("1-10kgs"),onClick:function(){ui("1-10kgs"),wo("1-10kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"11-20kgs",sx:xi("11-20kgs"),onClick:function(){ui("11-20kgs"),wo("11-20kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"21-30kgs",sx:xi("21-30kgs"),onClick:function(){ui("21-30kgs"),wo("21-30kgs")}})]}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"space-between",sx:{mt:4},children:[(0,Q.jsx)(u.Z,{variant:"h5",children:"SMS Delivery"}),(0,Q.jsx)(S.Z,{checked:1===li,onChange:function(e){di(e.target.checked?1:0)}})]})]})]})})]})})}),(0,Q.jsxs)(Ze,{sx:{mt:2},children:[(0,Q.jsx)(ge,{color:"#6366f1",icon:(0,Q.jsx)(T.ByW,{size:16}),title:"Collection & Quantity",subtitle:"Cash to collect on delivery, total items"}),(0,Q.jsx)(p.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsxs)(x.ZP,{container:!0,spacing:2,children:[(0,Q.jsx)(x.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsx)(h.Z,{type:"number",value:dt,fullWidth:!0,label:"Cash Collect",onChange:function(e){return ut(e.target.value)},inputProps:{min:0}})}),(0,Q.jsx)(x.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsx)(h.Z,{type:"number",value:ft,fullWidth:!0,label:"Quantity",onChange:function(e){return ht(e.target.value)},inputProps:{min:1}})})]})})]}),(0,Q.jsxs)(Ze,{sx:{mt:2},children:[(0,Q.jsx)(ge,{color:re,icon:(0,Q.jsx)(T.hKf,{size:16}),title:"Notes",subtitle:"Add anything the rider should know"}),(0,Q.jsxs)(p.Z,{sx:{p:{xs:2,md:2.5}},children:[(0,Q.jsx)(h.Z,{focused:!0,variant:"outlined",sx:{width:"100%",mb:2},multiline:!0,rows:2,label:"Notes",placeholder:"Special instructions, gate code, etc.",value:pn,onChange:function(e){return fn(e.target.value)}}),(0,Q.jsx)(k.Z,{sx:{my:1.5}}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"flex-end",alignItems:"center",spacing:1.25,children:[!Oa&&(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:ie,fontWeight:700},children:"Set pickup & drop to enable"}),(0,Q.jsx)(m.Z,{size:"medium",disabled:!Oa,variant:"contained",startIcon:Dn?null:(0,Q.jsx)(T.ZSR,{size:16}),onClick:function(){An(!0),Rn(!0),vi(),setTimeout((function(){An(!1),Rn(!1)}),1e3)},sx:{borderRadius:999,px:3,py:1,fontWeight:800,textTransform:"none",fontSize:13,background:"linear-gradient(135deg, ".concat(he," 0%, ").concat(me," 100%)"),color:"#fff",boxShadow:"0 8px 22px ".concat(pe(he)),transition:"all 0.18s","&:hover":{background:"linear-gradient(135deg, #4D1C61 0%, ".concat(he," 100%)"),transform:"translateY(-1px)",boxShadow:"0 10px 26px ".concat(pe(he))},"&.Mui-disabled":{background:ce,color:ie,boxShadow:"none"}},children:Dn?(0,Q.jsx)(_.Z,{size:18,thickness:5,sx:{color:"#fff"}}):"Create Order"})]})]})]})]})}),(0,Q.jsxs)(O.Z,{open:Yo,onClose:function(){return Mo(!1)},fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:3}},children:[(0,Q.jsxs)(y.Z,{sx:{p:2.5,background:"linear-gradient(135deg, ".concat(ue(he)," 0%, ").concat(ue(me)," 100%)"),borderBottom:"1px solid ".concat(se)},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.5,sx:{mb:1.5},children:[(0,Q.jsx)(d.Z,{sx:{bgcolor:he,color:"#fff",width:40,height:40,boxShadow:"0 6px 18px ".concat(pe(he))},children:(0,Q.jsx)(T.Bjz,{size:20})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:oe},children:"Saved Locations"}),(0,Q.jsxs)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:["Pick a saved customer for ",1===nr?"Pickup":"Drop"]})]})]}),(0,Q.jsxs)(p.Z,{sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.5,borderRadius:999,bgcolor:"#fff",border:"1.5px solid ".concat(fe(he)),transition:"all 0.18s","&:focus-within":{borderColor:he,boxShadow:"0 0 0 3px ".concat(pe(he))}},children:[(0,Q.jsx)(G.Z,{style:{color:he,fontSize:14}}),(0,Q.jsx)(C.Z,{fullWidth:!0,placeholder:"Search saved customer",value:No,onChange:function(e){return Ho(e.target.value)},sx:{flex:1,"& .MuiOutlinedInput-input":{p:"6px 4px",fontSize:13,fontWeight:600},"& fieldset":{border:"none"}},endAdornment:No&&(0,Q.jsx)(g.Z,{size:"small",onClick:function(){return Ho("")},sx:{p:.25,color:he},children:(0,Q.jsx)(R.Z,{fontSize:"small"})}),autoComplete:"off"})]})]}),(0,Q.jsx)(P.Z,{sx:{p:2,bgcolor:le},children:0===Oo.length?(0,Q.jsxs)(l.Z,{alignItems:"center",justifyContent:"center",spacing:1.5,sx:{minHeight:480,maxHeight:480},children:[(0,Q.jsx)(d.Z,{sx:{width:56,height:56,bgcolor:xe("#94a3b8"),color:ie},children:(0,Q.jsx)(T.Bjz,{size:26})}),(0,Q.jsx)(u.Z,{variant:"subtitle1",sx:{fontWeight:700,color:oe},children:"No saved locations"}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re},children:No?"Try a different keyword.":"Save a customer from the order form to reuse it later."})]}):(0,Q.jsx)(l.Z,{spacing:1,sx:{minHeight:480,maxHeight:480,overflow:"auto",pr:.5},children:Oo.map((function(e,t){var n=Go.customerid===e.customerid;return(0,Q.jsxs)(p.Z,{onClick:function(){n||(Mo(!1),1===nr?(sr(1),Ma({latitude:e.latitude,longitude:e.longitude}),Vo(e),Gr(e.contactno)):(ur(1),Ha({latitude:e.latitude,longitude:e.longitude}),Jo(e),$r(e.contactno)))},sx:{display:"flex",alignItems:"flex-start",gap:1.25,p:1.5,borderRadius:2,border:"1px solid",borderColor:n?fe("#94a3b8"):se,bgcolor:n?le:"#fff",cursor:n?"not-allowed":"pointer",opacity:n?.6:1,transition:"all 0.15s","&:hover":n?{}:{borderColor:fe(he),bgcolor:ue(he),boxShadow:te}},children:[(0,Q.jsx)(d.Z,{sx:{width:36,height:36,bgcolor:xe(he),color:he,fontWeight:800},children:String(e.firstname||"?").charAt(0).toUpperCase()}),(0,Q.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:.75,flexWrap:"wrap",useFlexGap:!0,children:[(0,Q.jsx)(u.Z,{sx:{fontWeight:800,color:oe,fontSize:13.5},noWrap:!0,children:e.firstname}),(0,Q.jsxs)(p.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.375,px:.75,py:.125,borderRadius:999,bgcolor:ue("#0ea5e9"),border:"1px solid ".concat(fe("#0ea5e9")),color:"#0ea5e9",fontSize:10.5,fontWeight:800},children:[(0,Q.jsx)(E.DNl,{size:9})," ",e.contactno]}),n&&(0,Q.jsx)(p.Z,{sx:{display:"inline-flex",alignItems:"center",px:.75,py:.125,borderRadius:999,bgcolor:ue("#94a3b8"),border:"1px solid ".concat(fe("#94a3b8")),color:re,fontSize:10.5,fontWeight:800},children:"Already used"})]}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re,mt:.25},noWrap:!0,children:e.address})]})]},t)}))})}),(0,Q.jsx)(l.Z,{direction:"row",justifyContent:"flex-end",sx:{p:2,borderTop:"1px solid ".concat(ce)},children:(0,Q.jsx)(m.Z,{variant:"outlined",onClick:function(){return Mo(!1)},sx:{borderRadius:999,px:2.5,borderColor:se,color:re,fontWeight:700,textTransform:"none","&:hover":{borderColor:re,bgcolor:le}},children:"Cancel"})})]}),(0,Q.jsxs)(O.Z,{open:wt,onClose:function(){return At(!1)},PaperProps:{sx:{borderRadius:3}},children:[(0,Q.jsx)(p.Z,{sx:{p:2.5,background:"linear-gradient(135deg, ".concat(ue("#ef4444")," 0%, ").concat(ue("#f59e0b")," 100%)"),borderBottom:"1px solid ".concat(se)},children:(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,Q.jsx)(d.Z,{sx:{bgcolor:"#ef4444",color:"#fff",width:40,height:40,boxShadow:"0 6px 18px ".concat(pe("#ef4444"))},children:(0,Q.jsx)(V.Z,{})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:oe},children:"Out of Service Area"}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:"This drop point is outside the supported radius"})]})]})}),(0,Q.jsx)(P.Z,{sx:{pt:2.5},children:(0,Q.jsx)(u.Z,{sx:{color:re,fontWeight:600},children:"Service is not available at this location. Try a different drop point within the coverage zone."})}),(0,Q.jsx)(l.Z,{direction:"row",justifyContent:"flex-end",sx:{p:2,borderTop:"1px solid ".concat(ce)},children:(0,Q.jsx)(m.Z,{variant:"contained",onClick:function(){return At(!1)},sx:{borderRadius:999,px:3,bgcolor:"#ef4444",fontWeight:700,textTransform:"none",boxShadow:"0 6px 18px ".concat(pe("#ef4444")),"&:hover":{bgcolor:"#dc2626"}},children:"Close"})})]})]})]})}},37159:function(e,t,n){n.d(t,{j:function(){return i},v:function(){return r}});var a=n(74165),o=n(15861),r=function(){var e=(0,o.Z)((0,a.Z)().mark((function e(t,n){var o,r,i,s,c,l,d,u,x,p,f,h,m,g,Z,b;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null===t||void 0===t?void 0:t.latitude,r=null===t||void 0===t?void 0:t.longitude,i=null===n||void 0===n?void 0:n.latitude,s=null===n||void 0===n?void 0:n.longitude,null!=o&&null!=r&&null!=i&&null!=s){e.next=6;break}throw new Error("Invalid coordinates");case 6:return c={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_API_URL:"https://mock-data-api-nextjs.vercel.app/",REACT_APP_AUTH0_CLIENT_ID:"",REACT_APP_AUTH0_DOMAIN:"",REACT_APP_AWS_APP_CLIENT_ID:"",REACT_APP_AWS_POOL_ID:"",REACT_APP_FIREBASE_API_KEY:"",REACT_APP_FIREBASE_APP_ID:"",REACT_APP_FIREBASE_AUTH_DOMAIN:"",REACT_APP_FIREBASE_MEASUREMENT_ID:"",REACT_APP_FIREBASE_MESSAGING_SENDER_ID:"",REACT_APP_FIREBASE_PROJECT_ID:"",REACT_APP_FIREBASE_STORAGE_BUCKET:"",REACT_APP_RIDER_ACCESS_ID:"AAAAILMpCEU:APA91bEavuOllBI6sFgYtxXAgNmAVwNA-MnCMHLGlR4_t7UqpLajAkdn3T0CZr_zaLBknLyim9ytFLMZgbeXmKqTad_PKCbqlYjHpaizVrLXtecxqyEy4UktIacK2UvHVUATHL-7VQQk",REACT_APP_URL:"https://jupiter.nearle.app/live/api/v1",REACT_APP_URL2:"https://jupiter.nearle.app/live/api/v2",REACT_APP_URL3:"https://jupiter.nearle.app/live/api/v3",REACT_APP_VERSION:"v2.1.0"}.REACT_APP_OSRM_URL||"https://router.project-osrm.org",e.prev=7,l="".concat(c,"/route/v1/driving/").concat(r,",").concat(o,";").concat(s,",").concat(i,"?overview=false"),e.next=11,fetch(l);case 11:if(!(d=e.sent).ok){e.next=20;break}return e.next=15,d.json();case 15:if(!((u=e.sent).routes&&u.routes.length>0)){e.next=20;break}return x=u.routes[0].distance,p=x/1e3,e.abrupt("return",Math.round(p));case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(7),console.warn("OSRM API failed, falling back to Haversine math:",e.t0);case 25:return 6371,h=(f=function(e){return e*Math.PI/180})(i-o),m=f(s-r),g=Math.sin(h/2)*Math.sin(h/2)+Math.cos(f(o))*Math.cos(f(i))*Math.sin(m/2)*Math.sin(m/2),Z=2*Math.atan2(Math.sqrt(g),Math.sqrt(1-g)),b=6371*Z,e.abrupt("return",Math.round(1.3*b));case 33:case"end":return e.stop()}}),e,null,[[7,22]])})));return function(t,n){return e.apply(this,arguments)}}(),i=function(e,t,n,a){return e<a?t:(e-a)*n+t}}}]);