1 line
48 KiB
JavaScript
1 line
48 KiB
JavaScript
"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[2912],{62912:function(e,t,n){n.r(t);var o=n(93433),a=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),g=n(16783),m=n(69099),h=n(47131),Z=n(16429),b=n(83929),v=n(44758),j=n(66212),y=n(70024),S=n(19536),k=n(85281),w=n(33604),C=n(49914),_=n(96467),P=n(11198),Y=n(36528),D=n(12058),I=n(88960),W=n(23195),z=n(58467),A=n(22539),M=n(66277),E=n(56573),L=n(19860),R=n(17530),H=n(11577),N=(n(46926),n(97316),n(29736)),T=n(23208),B=n(45904),F=n(94469),O=n(10658),K=n.n(O),q=n(90842),U=(n(83870),n(40765)),G=n(3745),$=n(70501),X=n(46417),Q=n(91635);K().extend(Q);var V=999,J=16,ee="0 14px 40px rgba(15, 23, 42, 0.10)",te="0 8px 24px rgba(15, 23, 42, 0.08)",ne="0 18px 50px rgba(15, 23, 42, 0.18)",oe="#0f172a",ae="#64748b",re="#94a3b8",ie="#e2e8f0",se="#f1f5f9",ce="#f8fafc",le=function(e,t){return"".concat(e).concat(t)},de=function(e){return le(e,"08")},ue=function(e){return le(e,"18")},xe=function(e){return le(e,"26")},pe=function(e){return le(e,"55")},fe="#662582",ge="#9255AB",me=function(e){var t=e.color,n=e.icon,o=e.title,a=e.subtitle,r=e.action;return(0,X.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(se),background:"linear-gradient(90deg, ".concat(de(t)," 0%, transparent 100%)")},children:[(0,X.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.25,children:[(0,X.jsx)(d.Z,{sx:{width:32,height:32,bgcolor:t,color:"#fff",boxShadow:"0 6px 18px ".concat(xe(t))},children:n}),(0,X.jsxs)(l.Z,{children:[(0,X.jsx)(u.Z,{sx:{fontWeight:800,color:oe,fontSize:14,lineHeight:1.1},children:o}),a&&(0,X.jsx)(u.Z,{variant:"caption",sx:{color:ae,fontWeight:600},children:a})]})]}),r]})},he=function(e){var t=e.children,n=e.sx,o=void 0===n?{}:n;return(0,X.jsx)($.Z,{elevation:0,sx:(0,s.Z)({borderRadius:J/8,border:"1px solid",borderColor:ie,background:"#fff",overflow:"hidden",boxShadow:ee,height:"100%"},o),children:t})},Ze=function(e){return(0,X.jsx)($.Z,(0,s.Z)((0,s.Z)({},e),{},{sx:{mt:.75,borderRadius:2,boxShadow:ne,border:"1px solid",borderColor:"divider",overflow:"hidden"}}))};t.default=function(){R.Z.setApiKey("AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8");var e=c.useState(null),t=(0,i.Z)(e,2),n=(t[0],t[1]),O=c.useState(null),Q=(0,i.Z)(O,2),ne=(Q[0],Q[1]),le=c.useState(""),be=(0,i.Z)(le,2),ve=(be[0],be[1],c.useState("")),je=(0,i.Z)(ve,2),ye=(je[0],je[1],c.useState("")),Se=(0,i.Z)(ye,2),ke=Se[0],we=Se[1],Ce=c.useState(""),_e=(0,i.Z)(Ce,2),Pe=_e[0],Ye=_e[1],De=c.useState([]),Ie=(0,i.Z)(De,2),We=(Ie[0],Ie[1],c.useState([])),ze=(0,i.Z)(We,2),Ae=(ze[0],ze[1],c.useRef(!1)),Me=(c.useRef(!1),(0,c.useState)("")),Ee=(0,i.Z)(Me,2),Le=(Ee[0],Ee[1],(0,c.useState)("")),Re=(0,i.Z)(Le,2),He=(Re[0],Re[1],(0,c.useState)("")),Ne=(0,i.Z)(He,2),Te=(Ne[0],Ne[1],(0,c.useState)("")),Be=(0,i.Z)(Te,2),Fe=(Be[0],Be[1],(0,c.useState)("")),Oe=(0,i.Z)(Fe,2),Ke=(Oe[0],Oe[1],(0,c.useState)("")),qe=(0,i.Z)(Ke,2),Ue=(qe[0],qe[1],(0,c.useState)("")),Ge=(0,i.Z)(Ue,2),$e=(Ge[0],Ge[1],(0,c.useState)("")),Xe=(0,i.Z)($e,2),Qe=(Xe[0],Xe[1],(0,c.useState)("")),Ve=(0,i.Z)(Qe,2),Je=(Ve[0],Ve[1],(0,c.useState)("")),et=(0,i.Z)(Je,2),tt=(et[0],et[1],(0,c.useState)("")),nt=(0,i.Z)(tt,2),ot=(nt[0],nt[1],(0,c.useState)("")),at=(0,i.Z)(ot,2),rt=(at[0],at[1],(0,c.useState)("")),it=(0,i.Z)(rt,2),st=(it[0],it[1],(0,c.useState)("")),ct=(0,i.Z)(st,2),lt=(ct[0],ct[1],(0,c.useState)("")),dt=(0,i.Z)(lt,2),ut=(dt[0],dt[1],(0,c.useState)("")),xt=(0,i.Z)(ut,2),pt=(xt[0],xt[1],(0,c.useState)("")),ft=(0,i.Z)(pt,2),gt=(ft[0],ft[1]),mt=(0,c.useState)(""),ht=(0,i.Z)(mt,2),Zt=(ht[0],ht[1]),bt=(0,c.useState)({}),vt=(0,i.Z)(bt,2),jt=(vt[0],vt[1],(0,c.useState)({})),yt=(0,i.Z)(jt,2),St=(yt[0],yt[1],(0,c.useRef)(null),(0,c.useState)(localStorage.getItem("locationid"))),kt=(0,i.Z)(St,2),wt=kt[0],Ct=kt[1],_t=(0,c.useState)(!1),Pt=(0,i.Z)(_t,2),Yt=Pt[0],Dt=Pt[1],It=(0,c.useRef)(null),Wt=(0,c.useRef)(null),zt=(0,c.useState)(0),At=(0,i.Z)(zt,2),Mt=At[0],Et=At[1],Lt=(0,c.useState)(1),Rt=(0,i.Z)(Lt,2),Ht=Rt[0],Nt=Rt[1];"undefined"===typeof window||Ae.current||(document.querySelector("#google-maps")||function(e,t,n){if(t){var o=document.createElement("script");o.setAttribute("async",""),o.setAttribute("id",n),o.src=e,t.appendChild(o)}}("https://maps.googleapis.com/maps/api/js?key=".concat("AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8","&libraries=places&location=10.3656,77.9690&radius=50000&components=country:IN&strictbounds=true"),document.querySelector("head"),"google-maps"),Ae.current=!0);var Tt=localStorage.getItem("applocationid"),Bt=(0,z.s0)(),Ft=(0,c.useState)({}),Ot=(0,i.Z)(Ft,2),Kt=(Ot[0],Ot[1],(0,c.useState)("")),qt=(0,i.Z)(Kt,2),Ut=(qt[0],qt[1],(0,c.useState)(!1)),Gt=(0,i.Z)(Ut,2),$t=(Gt[0],Gt[1],(0,c.useState)(!1)),Xt=(0,i.Z)($t,2),Qt=(Xt[0],Xt[1],(0,c.useState)(!1)),Vt=(0,i.Z)(Qt,2),Jt=Vt[0],en=Vt[1],tn=(0,c.useState)(1),nn=(0,i.Z)(tn,2),on=(nn[0],nn[1],(0,c.useState)([])),an=(0,i.Z)(on,2),rn=(an[0],an[1],(0,c.useState)([])),sn=(0,i.Z)(rn,2),cn=sn[0],ln=sn[1],dn=(0,c.useState)(""),un=(0,i.Z)(dn,2),xn=(un[0],un[1],(0,c.useState)(K()().format("MM-DD-YYYY"))),pn=(0,i.Z)(xn,2),fn=pn[0],gn=pn[1],mn=(0,c.useState)(K()().add(1,"day").format("MM-DD-YYYY")),hn=(0,i.Z)(mn,2),Zn=(hn[0],hn[1]),bn=(0,c.useState)(),vn=(0,i.Z)(bn,2),jn=vn[0],yn=vn[1],Sn=(0,c.useState)(),kn=(0,i.Z)(Sn,2),wn=kn[0],Cn=kn[1],_n=(0,c.useState)([]),Pn=(0,i.Z)(_n,2),Yn=Pn[0],Dn=Pn[1],In=(0,c.useState)(""),Wn=(0,i.Z)(In,2),zn=(Wn[0],Wn[1],(0,c.useState)([])),An=(0,i.Z)(zn,2),Mn=(An[0],An[1],(0,L.Z)()),En=(0,c.useState)(""),Ln=(0,i.Z)(En,2),Rn=Ln[0],Hn=Ln[1],Nn=(0,c.useState)([]),Tn=(0,i.Z)(Nn,2),Bn=(Tn[0],Tn[1],(0,c.useState)([])),Fn=(0,i.Z)(Bn,2),On=(Fn[0],Fn[1],(0,c.useState)([])),Kn=(0,i.Z)(On,2),qn=(Kn[0],Kn[1],(0,c.useState)([])),Un=(0,i.Z)(qn,2),Gn=(Un[0],Un[1],(0,c.useState)(!1)),$n=(0,i.Z)(Gn,2),Xn=($n[0],$n[1]),Qn=(0,c.useState)(!1),Vn=(0,i.Z)(Qn,2),Jn=Vn[0],eo=Vn[1],to=(0,c.useState)(!1),no=(0,i.Z)(to,2),oo=no[0],ao=no[1],ro=(0,c.useState)([]),io=(0,i.Z)(ro,2),so=io[0],co=(io[1],(0,c.useState)([])),lo=(0,i.Z)(co,2),uo=(lo[0],lo[1],(0,c.useState)([])),xo=(0,i.Z)(uo,2),po=(xo[0],xo[1]),fo=(0,c.useState)(""),go=(0,i.Z)(fo,2),mo=go[0],ho=go[1],Zo=(0,c.useState)(""),bo=(0,i.Z)(Zo,2),vo=(bo[0],bo[1],(0,c.useState)({})),jo=(0,i.Z)(vo,2),yo=(jo[0],jo[1],(0,c.useState)("")),So=(0,i.Z)(yo,2),ko=So[0],wo=(So[1],(0,c.useState)([])),Co=(0,i.Z)(wo,2),_o=(Co[0],Co[1]),Po=(0,c.useState)([]),Yo=(0,i.Z)(Po,2),Do=(Yo[0],Yo[1],(0,c.useState)()),Io=(0,i.Z)(Do,2),Wo=Io[0],zo=Io[1],Ao=(0,c.useState)([]),Mo=(0,i.Z)(Ao,2),Eo=(Mo[0],Mo[1],(0,c.useState)({})),Lo=(0,i.Z)(Eo,2),Ro=Lo[0],Ho=Lo[1],No=(0,c.useState)({}),To=(0,i.Z)(No,2),Bo=(To[0],To[1],(0,c.useState)("")),Fo=(0,i.Z)(Bo,2),Oo=Fo[0],Ko=Fo[1],qo=(0,c.useState)([]),Uo=(0,i.Z)(qo,2),Go=(Uo[0],Uo[1],(0,c.useState)()),$o=(0,i.Z)(Go,2),Xo=($o[0],$o[1]),Qo=(0,c.useState)(""),Vo=(0,i.Z)(Qo,2),Jo=(Vo[0],Vo[1],(0,c.useState)(!0)),ea=(0,i.Z)(Jo,2),ta=(ea[0],ea[1],(0,c.useState)("B")),na=(0,i.Z)(ta,2),oa=(na[0],na[1],(0,c.useState)(!1)),aa=(0,i.Z)(oa,2),ra=(aa[0],aa[1],(0,c.useState)({latitude:0,longitude:0})),ia=(0,i.Z)(ra,2),sa=ia[0],ca=ia[1],la=(0,c.useState)({latitude:0,longitude:0}),da=(0,i.Z)(la,2),ua=da[0],xa=da[1],pa=(0,c.useState)(!1),fa=(0,i.Z)(pa,2),ga=fa[0],ma=fa[1],ha=(0,c.useState)(0),Za=(0,i.Z)(ha,2),ba=Za[0],va=Za[1],ja=(0,c.useState)(0),ya=(0,i.Z)(ja,2),Sa=ya[0],ka=ya[1],wa=(0,c.useState)(0),Ca=(0,i.Z)(wa,2),_a=Ca[0],Pa=Ca[1],Ya=(0,c.useState)(0),Da=(0,i.Z)(Ya,2),Ia=Da[0],Wa=Da[1],za=(0,c.useState)(0),Aa=(0,i.Z)(za,2),Ma=Aa[0],Ea=Aa[1],La=(0,c.useState)([]),Ra=(0,i.Z)(La,2),Ha=Ra[0],Na=Ra[1],Ta=(0,c.useState)("Select "),Ba=(0,i.Z)(Ta,2),Fa=Ba[0],Oa=Ba[1],Ka=(0,c.useState)(),qa=(0,i.Z)(Ka,2),Ua=qa[0],Ga=qa[1],$a=(0,c.useState)(""),Xa=(0,i.Z)($a,2),Qa=(Xa[0],Xa[1]),Va=localStorage.getItem("tenantid"),Ja=(0,c.useState)(null),er=(0,i.Z)(Ja,2),tr=er[0],nr=er[1],or=(0,c.useState)(!1),ar=(0,i.Z)(or,2),rr=ar[0],ir=ar[1],sr=(0,c.useState)(""),cr=(0,i.Z)(sr,2),lr=cr[0],dr=cr[1],ur=(0,c.useState)([]),xr=(0,i.Z)(ur,2),pr=xr[0],fr=xr[1],gr=(0,c.useState)({}),mr=(0,i.Z)(gr,2),hr=mr[0],Zr=mr[1],br=(0,c.useState)({}),vr=(0,i.Z)(br,2),jr=vr[0],yr=vr[1],Sr=(0,c.useState)(0),kr=(0,i.Z)(Sr,2),wr=kr[0],Cr=kr[1],_r=(0,c.useState)(0),Pr=(0,i.Z)(_r,2),Yr=Pr[0],Dr=Pr[1],Ir=(0,c.useState)(0),Wr=(0,i.Z)(Ir,2),zr=Wr[0],Ar=Wr[1],Mr=(0,c.useState)([]),Er=(0,i.Z)(Mr,2),Lr=Er[0],Rr=Er[1],Hr=(0,c.useState)(),Nr=(0,i.Z)(Hr,2),Tr=Nr[0],Br=Nr[1],Fr=(0,c.useState)(),Or=(0,i.Z)(Fr,2),Kr=Or[0],qr=Or[1],Ur=(0,c.useState)(),Gr=(0,i.Z)(Ur,2),$r=Gr[0],Xr=Gr[1],Qr=(0,c.useState)(0),Vr=(0,i.Z)(Qr,2),Jr=Vr[0],ei=Vr[1],ti=(0,c.useState)(0),ni=(0,i.Z)(ti,2),oi=ni[0],ai=ni[1],ri=(0,c.useState)(0),ii=(0,i.Z)(ri,2),si=ii[0],ci=ii[1],li=(0,c.useState)(0),di=(0,i.Z)(li,2),ui=di[0],xi=di[1],pi=(0,c.useState)(),fi=(0,i.Z)(pi,2),gi=fi[0],mi=fi[1],hi=(0,c.useState)(),Zi=(0,i.Z)(hi,2),bi=Zi[0],vi=Zi[1],ji=(0,c.useState)(!1),yi=(0,i.Z)(ji,2),Si=yi[0],ki=yi[1],wi=(0,c.useState)(!1),Ci=(0,i.Z)(wi,2),_i=Ci[0],Pi=Ci[1],Yi=(0,c.useState)(0),Di=(0,i.Z)(Yi,2),Ii=Di[0],Wi=Di[1];(0,c.useEffect)((function(){console.log(Ii)}),[Ii]);var zi=function(e){nr(e)},Ai=function(e){return{cursor:"pointer",backgroundColor:tr===e?Mn.palette.primary.main:"default",color:tr===e?"#fff":"","&:hover":{backgroundColor:tr===e?Mn.palette.primary.main:Mn.palette.primary.light,color:"#fff"}}},Mi=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){var t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,E.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantpricing/?tenantid=").concat(Va));case 3:t=e.sent,console.log("pricingResponse",t.data.details),ka(t.data.details.baseprice),Pa(t.data.details.priceperkm),Wa(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(){Mi()}),[]),(0,c.useEffect)((function(){console.log("startPoint",sa),console.log("endPoint",ua),0!=sa.latitude&&0!=sa.longitude&&0!=ua.latitude&&0!=ua.longitude&&Ei(sa,ua)}),[sa,ua]);var Ei=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(t,n){var o,r,i,s,c,l,d,u,x,p,f,g;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new google.maps.DistanceMatrixService,r=function(e,t,n,a){return new Promise((function(r,i){o.getDistanceMatrix({origins:[new google.maps.LatLng(e.latitude,e.longitude)],destinations:[new google.maps.LatLng(t.latitude,t.longitude)],travelMode:n,unitSystem:a},(function(e,t){"OK"===t?r(e):i(new Error("Error calculating distance: ".concat(t)))}))}))},e.prev=2,e.next=5,r(t,n,"DRIVING",google.maps.UnitSystem.METRIC);case 5:for(i=e.sent,s=i.rows[0].elements,c=0;c<s.length;c++)l=s[c],d=l.distance.value,console.log("distance in m ",d),u=(d/1e3).toFixed(2),console.log("distance in km ",u),x=Math.round(u),console.log("roundedDistance",x),va(x),x<Ia?Ea(Sa):(console.log("minKm",Ia),console.log("pricePerKm",_a),console.log("basePrice",Sa),p=(x-Ia)*_a+Sa,console.log("total",p),Ea(p)),ma(!0),x>$r&&(ma(!0),en(!0)),f=l.duration.text.match(/([\d.]+)/),g=f?parseInt(f[0]):null,console.log("Distance: ".concat(x,", Duration: ").concat(g));e.next=13;break;case 10:e.prev=10,e.t0=e.catch(2),console.error("Error calculating distance:",e.t0);case 13:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(t,n){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){if(Yn[0]){var e=[];Yn.map((function(t){K()().diff(K()("".concat(K()(fn).format("MM-DD-YYYY")," ").concat(K()(t).format("HH:mm:ss"))),"m")<=0&&e.push(t)})),e[0]&&po([{sno:1,address:"",customerid:"",deliverytime:K()(e[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}])}}),[Yn]),(0,c.useEffect)((function(){if(ko){var e=cn.filter((function(e){return e.address.toLowerCase().includes(ko.toLowerCase())||e.firstname.toLowerCase().includes(ko.toLowerCase())||e.contactno.toLowerCase().includes(ko.toLowerCase())}));console.log(e),_o((0,o.Z)(e))}else _o((0,o.Z)(cn))}),[ko]);var Li=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eo(!0),console.log("tid",Va),e.next=4,E.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantinfo/?tenantid=").concat(Va)).then((function(e){console.log("fetchtenantinfo",e),e.data.status&&(Ho(e.data.details),Xo(e.data.details.tenantid),Ni(),Ga(e.data.details.subcategoryid)),eo(!1)})).catch((function(e){console.log(e),eo(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Li()}),[]);var Ri=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E.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?Na(e.data.details):Na([])})).catch((function(e){console.log(e),Na([])}));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Ri()}),[]);var Hi=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eo(!0),e.next=3,E.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocations/?applocationid=").concat(Tt)).then((function(e){console.log("fetchTiming",e);var t=e.data.details[0],n=t.opentime,o=t.closetime,a=t.latitude,r=t.longitude,i=t.radius;if(e.data.status){Br(a),qr(r),Xr(i),yn("".concat(K()().format("MM-DD-YYYY")," ").concat(n)),Cn("".concat(K()().format("MM-DD-YYYY")," ").concat(o)),console.log("starttime","".concat(K()().format("MM-DD-YYYY")," ").concat(n)),console.log("endtime","".concat(K()().format("MM-DD-YYYY")," ").concat(o," "));for(var s=[],c="".concat(K()().format("MM-DD-YYYY")," ").concat(n);K()("".concat(K()().format("MM-DD-YYYY")," ").concat(o," ")).diff(c,"m")>=0;c=K()(c).add(30,"m"))s.push(c);console.log("setTimeslotarr",s),Dn(s)}eo(!1)})).catch((function(e){console.log(e),eo(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Hi()}),[]);var Ni=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eo(!0),e.next=3,E.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocationconfig/?applocationid=").concat(Tt)).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&&zo(t),eo(!1)})).catch((function(e){console.log(e),eo(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){jn&&wn&&Ni()}),[jn,wn]);var Ti=function(e,t,n){(0,q.yv)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:n||2e3}),console.log(mo)};var Bi=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){var t,n;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},t={orders:{applocationid:Ro.applolcationid,cancellled:"",categoryid:+Ro.categoryid,configid:7,customerid:0==Jr&&+hr.customerid||0,deliveryaddress:jr.address||"",deliverycharge:+Ma.toFixed(2)||0,deliverycity:jr.city||"",deliverycontactno:jr.contactno||"",deliverycustomer:jr.firstname||"",deliveryid:0==oi&&+jr.customerid||0,deliverylandmark:jr.landmark||"",deliverylat:jr.latitude.toString(),deliverylocation:jr.suburb||"",deliverylocationid:jr.deliverylocationid||0,deliverylong:jr.longitude.toString(),deliverytime:"".concat(K()(fn).format("YYYY-MM-DD")," ").concat(K()(Oo.$d).format("HH:mm:ss")),deliverytype:0!==hr.customerid||0!==jr.customerid?"B":"C",delivered:"",itemcount:1,kms:ba.toString()||0,locationid:+wt,moduleid:+Ro.moduleid,orderamount:+Ma.toFixed(2)||0,ordercharges:0,orderdate:K()().format("YYYY-MM-DD HH:mm:ss"),orderheaderid:0,orderid:"",ordernotes:Rn,orderstatus:"created",ordervalue:+Ma.toFixed(2)||0,partnerid:Ro.partnerid,paymentstatus:1,paymenttype:42,pending:"",pickupaddress:hr.address||"",pickupcity:hr.city||"",pickupcontactno:hr.contactno||"",pickupcustomer:hr.firstname||"",pickuplandmark:hr.landmark||"",pickuplat:hr.latitude.toString(),pickuplocation:hr.suburb||"",pickuplocationid:hr.deliverylocationid||0,pickuplong:hr.longitude.toString(),processing:"",ready:"",remarks:"",smsdelivery:Ii,subcategoryid:+Ua,taxamount:0,tenantid:Ro.tenantid,tenantuserid:parseInt(localStorage.getItem("userid")),collectionamt:+Mt||0,quantity:+Ht||1},pickup:{address:hr.address||"",applocationid:Ro.applolcationid,city:hr.city||"",configid:7,contactno:hr.contactno||"",customertoken:"",customerid:0==Jr&&hr.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:hr.doorno||"",email:hr.email||"",firstname:hr.firstname||"",landmark:hr.landmark||"",latitude:hr.latitude.toString()||"",longitude:hr.longitude.toString()||"",locationid:hr.deliverylocationid||0,postcode:hr.postcode||"",primaryaddress:1,profileimage:"",state:hr.state||"",suburb:hr.suburb||"",tenantid:Ro.tenantid},drop:{address:jr.address||"",applocationid:Ro.applolcationid,city:jr.city||"",configid:7,contactno:jr.contactno||"",customertoken:"",customerid:0==oi&&jr.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:jr.doorno||"",email:jr.email||"",firstname:jr.firstname||"",landmark:jr.landmark||"",latitude:jr.latitude.toString(),longitude:jr.longitude.toString(),locationid:jr.deliverylocationid||0,postcode:jr.postcode||"",primaryaddress:1,profileimage:"",state:jr.state||"",suburb:jr.suburb||"",tenantid:Ro.tenantid}},console.log("createsubmitobj2",t),hr.firstname){e.next=7;break}Ti("Enter Pickup Contact Name ","warning",2e3),e.next=79;break;case 7:if(hr.contactno){e.next=11;break}Ti("Enter Pickup Contact Number ","warning",2e3),e.next=79;break;case 11:if(10==hr.contactno.length){e.next=15;break}Ti("Check Pickup Contact Number ","error",2e3),e.next=79;break;case 15:if(hr.suburb){e.next=19;break}Ti("Enter Pickup Location ","warning",2e3),e.next=79;break;case 19:if(hr.city){e.next=23;break}Ti("Enter Pickup City ","warning",2e3),e.next=79;break;case 23:if(hr.postcode){e.next=27;break}Ti("Enter Pickup Postcode ","warning",2e3),e.next=79;break;case 27:if(hr.landmark){e.next=31;break}Ti("Enter Pickup Landmark ","warning",2e3),e.next=79;break;case 31:if(jr.firstname){e.next=35;break}Ti("Enter Drop Contact Name ","warning",2e3),e.next=79;break;case 35:if(jr.contactno){e.next=39;break}Ti("Enter Drop Contact Number","warning",2e3),e.next=79;break;case 39:if(10===jr.contactno.length){e.next=43;break}Ti("Check Drop Contact Number ","error",2e3),e.next=79;break;case 43:if(jr.suburb){e.next=47;break}Ti("Enter Drop Suburb ","warning",2e3),e.next=79;break;case 47:if(jr.city){e.next=51;break}Ti("Enter Drop City ","warning",2e3),e.next=79;break;case 51:if(jr.postcode){e.next=55;break}Ti("Enter Drop postcode ","warning",2e3),e.next=79;break;case 55:if(jr.landmark){e.next=59;break}Ti("Enter Drop Landmark ","warning",2e3),e.next=79;break;case 59:if(Oo){e.next=63;break}Ti("Choose deliverytime ","warning",2e3),e.next=79;break;case 63:if(Ga){e.next=67;break}Ti("Choose SubCategory ","warning",2e3),e.next=79;break;case 67:return e.prev=67,e.next=70,E.Z.post("".concat("https://jupiter.nearle.app/live/api/v2","/orders/createorder"),t);case 70:(n=e.sent).data.status?(console.log("createRes",n),(0,q.yv)("Order Created Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:1e3}),Wo&¬ifyadmin(Wo),Bt("/nearle/orders")):Ti("Something went wrong, Cannot create order","warning"),eo(!1),console.log(n),e.next=79;break;case 76:e.prev=76,e.t0=e.catch(67),console.log("createResErr",e.t0);case 79:case"end":return e.stop()}}),e,null,[[67,76]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){console.log("shiftarr"),console.log(so)}),[so]);var Fi=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){var t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Xn(!0),e.prev=1,t=""==lr?"".concat("https://jupiter.nearle.app/live/api/v1","/customers/gettenantcustomers/?tenantid=").concat(Va,"&pageno=1&pagesize=20"):"".concat("https://jupiter.nearle.app/live/api/v1","/customers/search/?tenantid=").concat(Va,"&keyword=").concat(lr),e.next=5,E.Z.get(t).then((function(e){if(console.log("clientdetails",e.data.details),e.data.status&&e.data.details){ln(e.data.details||[]),fr(e.data.details||[]);var t=[];e.data.details.map((function(e){t.push((0,s.Z)({label:"".concat(e.firstname," | ").concat(e.contactno)},e))})),_o(t)}else ln([]),fr([]),_o([]);Xn(!1)})).catch((function(e){console.log(e),Xn(!1),Ti("server error","warning")}));case 5:e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.log(e.t0),Xn(!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"),Fi()}),[lr.length>3,""==lr]);(0,c.useEffect)((function(){if(ke){var e=document.getElementById("addressAuto1"),t=new window.google.maps.places.Autocomplete(e,{strictBounds:!0,bounds:new window.google.maps.Circle({center:new window.google.maps.LatLng(Tr,Kr),radius:1e3*$r}).getBounds()});t.addListener("place_changed",(function(){var e=t.getPlace();we("".concat(e.name,", ").concat(e.formatted_address)),console.log("new place",e),console.log(" pick (new place) lat lng",{lat:e.geometry.location.lat(),lng:e.geometry.location.lng()}),ca({latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}),n(e),gt("".concat(e.name," ").concat(e.formatted_address)),Zr((0,s.Z)((0,s.Z)({},hr),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var o={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":o.street_number=e.long_name;break;case"route":o.route=e.long_name;break;case"locality":o.locality=e.long_name;break;case"sublocality_level_1":o.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":o.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":o.administrative_area_level_1=e.long_name;break;case"country":o.country=e.long_name;break;case"postal_code":o.postal_code=e.long_name}}))})),Zr((0,s.Z)((0,s.Z)({},hr),{},{address:o.address,doorno:"".concat(o.street_number," ").concat(o.route),suburb:o.sublocality_level_1,city:o.locality,postcode:o.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()})),console.log("Pick Address:",o)}))}}),[ke]),(0,c.useEffect)((function(){if(Pe){var e=document.getElementById("addressAuto2"),t=new window.google.maps.places.Autocomplete(e,{strictBounds:!0,bounds:new window.google.maps.Circle({center:new window.google.maps.LatLng(Tr,Kr),radius:1e3*$r}).getBounds()});t.addListener("place_changed",(function(){var e=t.getPlace();Ye("".concat(e.name,", ").concat(e.formatted_address)),console.log("new place",e),console.log("drop (new place) lat lng",{lat:e.geometry.location.lat(),lng:e.geometry.location.lng()}),xa({latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}),ne(e),Zt("".concat(e.name," ").concat(e.formatted_address)),yr((0,s.Z)((0,s.Z)({},jr),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var n={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":n.street_number=e.long_name;break;case"route":n.route=e.long_name;break;case"locality":n.locality=e.long_name;break;case"sublocality_level_1":n.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":n.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":n.administrative_area_level_1=e.long_name;break;case"country":n.country=e.long_name;break;case"postal_code":n.postal_code=e.long_name}}))})),yr((0,s.Z)((0,s.Z)({},jr),{},{address:n.address,doorno:"".concat(n.street_number," ").concat(n.route),suburb:n.sublocality_level_1,city:n.locality,postcode:n.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()})),console.log("Drop Address:",n)}))}}),[Pe]);var Oi=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(){var t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,E.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantlocations/?tenantid=").concat(Va));case 3:t=e.sent,console.log("gettenantlocations",t.data.details),t.data&&t.data.details?(Rr(t.data.details),1==t.data.details.length&&(Dt(!0),Ct(t.data.details[0].locationid))):Rr([]),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),console.log("gettenantlocations",e.t0),Rr([]);case 12:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){Oi()}),[]),(0,X.jsxs)(X.Fragment,{children:[Jn&&(0,X.jsx)(H.Z,{}),(0,X.jsxs)(x.ZP,{container:!0,rowSpacing:2,columnSpacing:2.75,children:[(0,X.jsx)(x.ZP,{item:!0,xs:12,children:(0,X.jsx)($.Z,{elevation:0,sx:{position:"sticky",top:"60px",zIndex:1e3,mb:1.5,p:{xs:1.5,sm:2,md:2.5},borderRadius:J/8,border:"1px solid",borderColor:ie,background:"linear-gradient(135deg, ".concat(de(fe)," 0%, ").concat(de(ge)," 100%)"),boxShadow:te},children:(0,X.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,X.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:{xs:1.25,sm:1.75},children:[(0,X.jsx)(d.Z,{sx:{width:{xs:40,sm:48},height:{xs:40,sm:48},bgcolor:fe,color:"#fff",boxShadow:"0 6px 18px ".concat(xe(fe))},children:(0,X.jsx)(A.tX2,{size:22})}),(0,X.jsxs)(l.Z,{children:[(0,X.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,X.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:.75,sx:{mt:.5},children:[(0,X.jsx)(p.Z,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:"#10b981",boxShadow:"0 0 0 4px rgba(16,185,129,0.18)"}}),(0,X.jsx)(u.Z,{variant:"caption",sx:{color:ae,fontWeight:600},children:"Fill pickup, drop, schedule & pricing details"})]})]})]}),1===Lr.length?(0,X.jsxs)(p.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.5,py:.875,borderRadius:999,bgcolor:de(fe),border:"1.5px solid ".concat(pe(fe)),color:fe,fontWeight:800,fontSize:13},children:[(0,X.jsx)(A.x$F,{size:14})," ",Lr[0].locationname]}):(0,X.jsx)(f.Z,{options:Lr||[],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:Ze,sx:{width:{xs:"100%",sm:300}},size:"small",renderInput:function(e){return(0,X.jsx)(g.Z,(0,s.Z)((0,s.Z)({},e),{},{placeholder:"Select Business Location",InputProps:(0,s.Z)((0,s.Z)({},e.InputProps),{},{startAdornment:(0,X.jsx)(l.Z,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,X.jsx)(d.Z,{sx:{width:22,height:22,bgcolor:fe,color:"#fff"},children:(0,X.jsx)(A.x$F,{size:13})})})}),sx:{"& .MuiOutlinedInput-root":{borderRadius:V+"px",bgcolor:"#fff",fontWeight:600,"& fieldset":{borderColor:pe(fe),borderWidth:1.5},"&:hover fieldset":{borderColor:fe},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(xe(fe))},"&.Mui-focused fieldset":{borderColor:fe,borderWidth:2}}}}))},onChange:function(e,t,n){t&&(Ct(t.locationid),Dt(!0)),"clear"===n&&Dt(!1)}})]})})}),(0,X.jsx)(x.ZP,{item:!0,xs:12,children:(0,X.jsxs)(p.Z,{sx:{overflow:"visible"},children:[(0,X.jsx)(x.ZP,{container:!0,spacing:2,children:(0,X.jsx)(x.ZP,{item:!0,xs:12,children:(0,X.jsxs)(x.ZP,{container:!0,spacing:2,sx:{height:"100%"},children:[(0,X.jsx)(x.ZP,{item:!0,xs:12,sm:6,children:(0,X.jsxs)(he,{children:[(0,X.jsx)(me,{color:"#0ea5e9",icon:(0,X.jsx)(A.$0r,{size:16}),title:"Pickup Details",subtitle:"Where the order is picked up",action:(0,X.jsx)(m.Z,{size:"small",variant:"outlined",startIcon:(0,X.jsx)(A.Bjz,{size:14}),onClick:function(){Yt?(ir(!0),Cr(1),Zr({}),we(""),dr("")):Ti("Select Business Location","warning")},sx:{borderRadius:999,px:1.5,py:.375,fontSize:11.5,fontWeight:700,textTransform:"none",borderColor:pe("#0ea5e9"),color:"#0ea5e9","&:hover":{borderColor:"#0ea5e9",bgcolor:de("#0ea5e9"),boxShadow:"0 0 0 3px ".concat(xe("#0ea5e9"))}},children:"Saved Locations"})}),(0,X.jsx)(p.Z,{sx:{p:{xs:2,md:2.5}},children:(0,X.jsx)(x.ZP,{container:!0,spacing:2,children:(0,X.jsx)(x.ZP,{item:!0,xs:12,children:(0,X.jsxs)(x.ZP,{container:!0,spacing:4,children:[(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{inputRef:It,disabled:!Yt,fullWidth:!0,InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(I.Xws,{})})},variant:"outlined",label:"Contact Name",value:hr.firstname,onChange:function(e){Zr((0,s.Z)((0,s.Z)({},hr),{},{firstname:e.target.value}))}})}),(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{error:Si,disabled:!Yt,fullWidth:!0,type:"number",InputProps:{inputProps:{maxLength:10},startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(Y.DNl,{color:Si&&"red"})})},variant:"outlined",label:"Contact Number",value:hr.contactno,onChange:function(e){e.target.value.length<=10&&Zr((0,s.Z)((0,s.Z)({},hr),{},{contactno:e.target.value})),gi==e.target.value?ci(0):ci(1),e.target.value.length<10?ki(!0):ki(!1)}})}),(0,X.jsx)(x.ZP,{item:!0,xs:12,children:(0,X.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==Yr?(0,X.jsx)("div",{children:(0,X.jsx)(g.Z,{variant:"outlined",label:"Address",disabled:!Yt,id:"addressAuto1",fullWidth:!0,value:ke,onChange:function(e){return we(e.target.value)},InputProps:{endAdornment:(0,X.jsx)(h.Z,{onClick:function(){we(""),Zr((0,s.Z)((0,s.Z)({},hr),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),ma(!1),ca({latitude:0,longitude:0})},size:"small",children:(0,X.jsx)(P.Z,{})})}})}):(0,X.jsx)(g.Z,{InputProps:{endAdornment:(0,X.jsx)(h.Z,{onClick:function(){Dr(0),Zr((0,s.Z)((0,s.Z)({},hr),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),ma(!1),ca({latitude:0,longitude:0})},children:(0,X.jsx)(W.Z,{})})},variant:"outlined",placeholder:"Select",value:hr.address,onChange:function(e){Zr((0,s.Z)((0,s.Z)({},hr),{},{address:e.target.value})),""==e.target.value&&(Dr(0),ma(!1),ca({latitude:0,longitude:0}))}})})}),(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{disabled:!Yt,fullWidth:!0,InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(D.Lmk,{})})},variant:"outlined",label:"Door No / Street",value:hr.doorno,onChange:function(e){Zr((0,s.Z)((0,s.Z)({},hr),{},{doorno:e.target.value}))}})}),(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{disabled:!Yt,fullWidth:!0,InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(I.GUT,{})})},variant:"outlined",label:"Location",value:hr.suburb,onChange:function(e){Zr((0,s.Z)((0,s.Z)({},hr),{},{suburb:e.target.value}))}})}),(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{disabled:!Yt,fullWidth:!0,InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(A.Ys1,{})})},variant:"outlined",label:"City",value:hr.city,onChange:function(e){Zr((0,s.Z)((0,s.Z)({},hr),{},{city:e.target.value}))}})}),(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{disabled:!Yt,fullWidth:!0,InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(M.kk8,{})})},variant:"outlined",label:"Postcode",value:hr.postcode,onChange:function(e){Zr((0,s.Z)((0,s.Z)({},hr),{},{postcode:e.target.value}))}})}),(0,X.jsx)(x.ZP,{item:!0,xs:12,children:(0,X.jsx)(g.Z,{disabled:!Yt,fullWidth:!0,InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(I.I2o,{})})},variant:"outlined",label:"Landmark",value:hr.landmark,onChange:function(e){Zr((0,s.Z)((0,s.Z)({},hr),{},{landmark:e.target.value}))}})}),1==si&&(0,X.jsx)(x.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"end"},children:(0,X.jsx)(Z.Z,{children:(0,X.jsx)(b.Z,{control:(0,X.jsx)(v.Z,{checked:1===Jr,onChange:function(e){ei(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})})})]})}),(0,X.jsx)(x.ZP,{item:!0,xs:12,sm:6,children:(0,X.jsxs)(he,{children:[(0,X.jsx)(me,{color:fe,icon:(0,X.jsx)(A.ili,{size:16}),title:"Drop Details",subtitle:"Where the order is delivered",action:(0,X.jsx)(m.Z,{size:"small",variant:"outlined",startIcon:(0,X.jsx)(A.Bjz,{size:14}),onClick:function(){Yt?(ir(!0),Cr(2),Ye(""),dr("")):Ti("Select Business Location","warning")},sx:{borderRadius:999,px:1.5,py:.375,fontSize:11.5,fontWeight:700,textTransform:"none",borderColor:pe(fe),color:fe,"&:hover":{borderColor:fe,bgcolor:de(fe),boxShadow:"0 0 0 3px ".concat(xe(fe))}},children:"Saved Locations"})}),(0,X.jsx)(p.Z,{sx:{p:{xs:2,md:2.5}},children:(0,X.jsxs)(x.ZP,{container:!0,spacing:2,sx:{height:"100%"},children:[(0,X.jsx)(x.ZP,{item:!0,xs:12,sx:{height:"100%"},children:(0,X.jsxs)(l.Z,{direction:"row",justifyContent:"space-between",sx:{display:"none"},children:[(0,X.jsx)(u.Z,{variant:"h5",sx:{mb:2},children:"Drop Details"}),(0,X.jsx)(l.Z,{direction:"row",alignItems:"center",children:(0,X.jsx)(m.Z,{variant:"outlined",sx:{"&:hover":{bgcolor:Mn.palette.primary.main,color:"white"}},onClick:function(){Yt?(ir(!0),Cr(2),Ye(""),dr("")):Ti("Select Business Location","warning")},children:"Saved Locations"})})]})}),(0,X.jsx)(x.ZP,{item:!0,xs:12,children:(0,X.jsxs)(x.ZP,{container:!0,spacing:4,children:[(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{inputRef:Wt,disabled:!Yt,fullWidth:!0,variant:"outlined",label:"Contact Name",InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(I.Xws,{})})},value:jr.firstname,onChange:function(e){yr((0,s.Z)((0,s.Z)({},jr),{},{firstname:e.target.value}))}})}),(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{disabled:!Yt,error:_i,fullWidth:!0,type:"number",variant:"outlined",label:"Contact Number",InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(Y.DNl,{color:_i&&"red"})})},value:jr.contactno,onChange:function(e){e.target.value.length<=10&&yr((0,s.Z)((0,s.Z)({},jr),{},{contactno:e.target.value})),bi==e.target.value?xi(0):xi(1),e.target.value.length<10?Pi(!0):Pi(!1)}})}),(0,X.jsx)(x.ZP,{item:!0,xs:12,children:(0,X.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==zr?(0,X.jsx)("div",{children:(0,X.jsx)(g.Z,{id:"addressAuto2",disabled:!Yt,label:"Address",fullWidth:!0,value:Pe,onChange:function(e){return Ye(e.target.value)},InputProps:{endAdornment:(0,X.jsx)(h.Z,{onClick:function(){Ye(""),yr((0,s.Z)((0,s.Z)({},jr),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),ma(!1),xa({latitude:0,longitude:0})},size:"small",children:(0,X.jsx)(P.Z,{})})}})}):(0,X.jsx)(g.Z,{disabled:!Yt,InputProps:{endAdornment:(0,X.jsx)(h.Z,{onClick:function(){Ar(0),yr((0,s.Z)((0,s.Z)({},jr),{},{firstname:"",contactno:"",doorno:"",suburb:"",city:"",postcode:"",landmark:""})),ma(!1),xa({latitude:0,longitude:0})},children:(0,X.jsx)(W.Z,{})})},variant:"outlined",placeholder:"Select",value:jr.address,onChange:function(e){Zr((0,s.Z)((0,s.Z)({},jr),{},{address:e.target.value})),""==e.target.value&&(Ar(0),ma(!1),xa({latitude:0,longitude:0}))}})})}),(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{disabled:!Yt,fullWidth:!0,variant:"outlined",label:"Door No / Street",InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(D.Lmk,{})})},value:jr.doorno,onChange:function(e){yr((0,s.Z)((0,s.Z)({},jr),{},{doorno:e.target.value}))}})}),(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{disabled:!Yt,fullWidth:!0,variant:"outlined",label:"Location",InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(I.GUT,{})})},value:jr.suburb,onChange:function(e){yr((0,s.Z)((0,s.Z)({},jr),{},{suburb:e.target.value}))}})}),(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{disabled:!Yt,fullWidth:!0,variant:"outlined",label:"City",InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(A.Ys1,{})})},value:jr.city,onChange:function(e){yr((0,s.Z)((0,s.Z)({},jr),{},{city:e.target.value}))}})}),(0,X.jsx)(x.ZP,{item:!0,xs:6,children:(0,X.jsx)(g.Z,{disabled:!Yt,fullWidth:!0,variant:"outlined",label:"Postcode",InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(M.kk8,{})})},value:jr.postcode,onChange:function(e){yr((0,s.Z)((0,s.Z)({},jr),{},{postcode:e.target.value}))}})}),(0,X.jsx)(x.ZP,{item:!0,xs:12,children:(0,X.jsx)(g.Z,{disabled:!Yt,fullWidth:!0,variant:"outlined",label:"Landmark",InputProps:{startAdornment:(0,X.jsx)(h.Z,{children:(0,X.jsx)(I.I2o,{})})},value:jr.landmark,onChange:function(e){yr((0,s.Z)((0,s.Z)({},jr),{},{landmark:e.target.value}))}})}),1==ui&&(0,X.jsx)(x.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"end"},children:(0,X.jsx)(Z.Z,{children:(0,X.jsx)(b.Z,{control:(0,X.jsx)(v.Z,{checked:1===oi,onChange:function(e){ai(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})]})})]})}),(0,X.jsx)(x.ZP,{item:!0,xs:12,sm:6,children:(0,X.jsxs)(he,{sx:{mt:2,minHeight:390},children:[(0,X.jsx)(me,{color:"#f59e0b",icon:(0,X.jsx)(A.k71,{size:16}),title:"Schedule",subtitle:"Pickup date & time slot"}),(0,X.jsx)(p.Z,{sx:{p:{xs:2,md:2.5}},children:(0,X.jsx)(x.ZP,{container:!0,children:(0,X.jsxs)(x.ZP,{item:!0,xs:12,children:[(0,X.jsx)(u.Z,{variant:"subtitle2",sx:{fontWeight:700,color:ae,mb:1},children:"Date"}),(0,X.jsx)(T._,{dateAdapter:B.y,sx:{},children:(0,X.jsx)(N.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),Ko(""),t<=0){console.log("startdate",e),gn(e),Zn(e);var n=[];Yn.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]?po([{sno:1,address:"",customerid:"",deliverytime:K()(n[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}]):po([])}else ho("choose Upcoming Date"),Ti("choose Upcoming Date","warning"),gn(NaN)},value:K()(fn),sx:{width:"100%",mt:2},disablePast:!0})}),(0,X.jsx)(u.Z,{variant:"subtitle2",sx:{fontWeight:700,color:ae,mt:2,mb:1},children:"Time"}),(0,X.jsx)(p.Z,{sx:{mt:.5,p:1.25,borderRadius:2,border:"1px solid",borderColor:se,bgcolor:ce,maxHeight:150,overflowY:"auto",scrollbarWidth:"thin","&::-webkit-scrollbar":{width:6},"&::-webkit-scrollbar-thumb":{backgroundColor:pe(fe),borderRadius:6}},children:(0,X.jsx)(l.Z,{direction:"row",flexWrap:"wrap",gap:.75,useFlexGap:!0,children:Yn.map((function(e,t){if(K()().diff(K()("".concat(K()(fn).format("MM-DD-YYYY")," ").concat(K()(e).format("HH:mm:ss"))),"m")<=0){var n=K()(Oo).format("HH:mm")==K()(e).format("HH:mm");return(0,X.jsxs)(p.Z,{onClick:function(){ba>$r?en(!0):ga?Ko(e):Ti("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":pe("#f59e0b")),bgcolor:n?"#f59e0b":de("#f59e0b"),color:n?"#fff":"#f59e0b",fontSize:12,fontWeight:800,transition:"all 0.15s",boxShadow:n?"0 6px 18px ".concat(xe("#f59e0b")):"none","&:hover":{borderColor:"#f59e0b",boxShadow:n?"0 6px 18px ".concat(xe("#f59e0b")):"0 0 0 3px ".concat(xe("#f59e0b"))}},children:[(0,X.jsx)(A.Y8K,{size:11})," ",K()(e).format("hh:mm A")]},t)}}))})})]})})})]})}),(0,X.jsx)(x.ZP,{item:!0,xs:12,sm:6,sx:{},children:(0,X.jsxs)(he,{sx:{mt:2,minHeight:390},children:[(0,X.jsx)(me,{color:"#10b981",icon:(0,X.jsx)(A.sF1,{size:16}),title:"Distance & Pricing",subtitle:"Auto-calculated from pickup \u2192 drop"}),(0,X.jsxs)(p.Z,{sx:{p:{xs:2,md:2.5}},children:[ga&&(0,X.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",mb:3},children:[(0,X.jsx)(l.Z,{spacing:1.5,children:(0,X.jsx)(j.Z,{label:"Distance: ".concat(ba," km"),size:"medium",variant:"contained",color:"primary"})}),(0,X.jsx)(l.Z,{spacing:1.5,children:(0,X.jsx)(j.Z,{label:"Charge: \u20b9".concat(Ma.toFixed(2)),size:"medium",variant:"contained",color:"primary"})})]}),(0,X.jsxs)(l.Z,{direction:"column",justifyContent:"space-between",sx:{mb:2},children:[(0,X.jsx)(u.Z,{variant:"h5",children:"Category"}),(0,X.jsx)(f.Z,{disablePortal:!0,id:"combo-box-demo",options:Ha,getOptionLabel:function(e){return"".concat(e.subcategoryname)||""},sx:{my:2,zIndex:"100"},fullWidth:!0,renderInput:function(e){return(0,X.jsx)(g.Z,(0,s.Z)((0,s.Z)({},e),{},{label:""==Fa?Ro.subcategoryname:Fa}))},onChange:function(e,t,n){t&&(console.log(t),Oa(t.subcategoryname),Ga(t.subcategoryid))}})]}),(0,X.jsx)(u.Z,{variant:"h5",children:"Weight"}),(0,X.jsxs)(l.Z,{direction:"row",justifyContent:"space-evenly",sx:{border:"1px solid #eee",my:2,py:2},children:[(0,X.jsx)(j.Z,{variant:"contained",color:"default",label:"1-10kgs",sx:Ai("1-10kgs"),onClick:function(){zi("1-10kgs"),Qa("1-10kgs")}}),(0,X.jsx)(j.Z,{variant:"contained",color:"default",label:"11-20kgs",sx:Ai("11-20kgs"),onClick:function(){zi("11-20kgs"),Qa("11-20kgs")}}),(0,X.jsx)(j.Z,{variant:"contained",color:"default",label:"21-30kgs",sx:Ai("21-30kgs"),onClick:function(){zi("21-30kgs"),Qa("21-30kgs")}})]}),(0,X.jsxs)(l.Z,{direction:"row",justifyContent:"space-between",sx:{mt:4},children:[(0,X.jsx)(u.Z,{variant:"h5",children:"SMS Delivery"}),(0,X.jsx)(y.Z,{checked:1===Ii,onChange:function(e){Wi(e.target.checked?1:0)}})]})]})]})})]})})}),(0,X.jsxs)(he,{sx:{mt:2},children:[(0,X.jsx)(me,{color:"#6366f1",icon:(0,X.jsx)(A.ByW,{size:16}),title:"Collection & Quantity",subtitle:"Cash to collect on delivery, total items"}),(0,X.jsx)(p.Z,{sx:{p:{xs:2,md:2.5}},children:(0,X.jsxs)(x.ZP,{container:!0,spacing:2,children:[(0,X.jsx)(x.ZP,{item:!0,xs:12,sm:6,children:(0,X.jsx)(g.Z,{type:"number",value:Mt,fullWidth:!0,label:"Cash Collect",onChange:function(e){return Et(e.target.value)},inputProps:{min:0}})}),(0,X.jsx)(x.ZP,{item:!0,xs:12,sm:6,children:(0,X.jsx)(g.Z,{type:"number",value:Ht,fullWidth:!0,label:"Quantity",onChange:function(e){return Nt(e.target.value)},inputProps:{min:1}})})]})})]}),(0,X.jsxs)(he,{sx:{mt:2},children:[(0,X.jsx)(me,{color:ae,icon:(0,X.jsx)(A.hKf,{size:16}),title:"Notes",subtitle:"Add anything the rider should know"}),(0,X.jsxs)(p.Z,{sx:{p:{xs:2,md:2.5}},children:[(0,X.jsx)(g.Z,{focused:!0,variant:"outlined",sx:{width:"100%",mb:2},multiline:!0,rows:2,label:"Notes",placeholder:"Special instructions, gate code, etc.",value:Rn,onChange:function(e){return Hn(e.target.value)}}),(0,X.jsx)(S.Z,{sx:{my:1.5}}),(0,X.jsxs)(l.Z,{direction:"row",justifyContent:"flex-end",alignItems:"center",spacing:1.25,children:[!ga&&(0,X.jsx)(u.Z,{variant:"caption",sx:{color:re,fontWeight:700},children:"Set pickup & drop to enable"}),(0,X.jsx)(m.Z,{size:"medium",disabled:!ga,variant:"contained",startIcon:oo?null:(0,X.jsx)(A.ZSR,{size:16}),onClick:function(){eo(!0),ao(!0),Bi(),setTimeout((function(){eo(!1),ao(!1)}),1e3)},sx:{borderRadius:999,px:3,py:1,fontWeight:800,textTransform:"none",fontSize:13,background:"linear-gradient(135deg, ".concat(fe," 0%, ").concat(ge," 100%)"),color:"#fff",boxShadow:"0 8px 22px ".concat(xe(fe)),transition:"all 0.18s","&:hover":{background:"linear-gradient(135deg, #4D1C61 0%, ".concat(fe," 100%)"),transform:"translateY(-1px)",boxShadow:"0 10px 26px ".concat(xe(fe))},"&.Mui-disabled":{background:se,color:re,boxShadow:"none"}},children:oo?(0,X.jsx)(k.Z,{size:18,thickness:5,sx:{color:"#fff"}}):"Create Order"})]})]})]})]})}),(0,X.jsxs)(F.Z,{open:rr,onClose:function(){return ir(!1)},fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:3}},children:[(0,X.jsxs)(w.Z,{sx:{p:2.5,background:"linear-gradient(135deg, ".concat(de(fe)," 0%, ").concat(de(ge)," 100%)"),borderBottom:"1px solid ".concat(ie)},children:[(0,X.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.5,sx:{mb:1.5},children:[(0,X.jsx)(d.Z,{sx:{bgcolor:fe,color:"#fff",width:40,height:40,boxShadow:"0 6px 18px ".concat(xe(fe))},children:(0,X.jsx)(A.Bjz,{size:20})}),(0,X.jsxs)(l.Z,{children:[(0,X.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:oe},children:"Saved Locations"}),(0,X.jsxs)(u.Z,{variant:"caption",sx:{color:ae,fontWeight:600},children:["Pick a saved customer for ",1===wr?"Pickup":"Drop"]})]})]}),(0,X.jsxs)(p.Z,{sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.5,borderRadius:999,bgcolor:"#fff",border:"1.5px solid ".concat(pe(fe)),transition:"all 0.18s","&:focus-within":{borderColor:fe,boxShadow:"0 0 0 3px ".concat(xe(fe))}},children:[(0,X.jsx)(U.Z,{style:{color:fe,fontSize:14}}),(0,X.jsx)(C.Z,{fullWidth:!0,placeholder:"Search saved customer",value:lr,onChange:function(e){return dr(e.target.value)},sx:{flex:1,"& .MuiOutlinedInput-input":{p:"6px 4px",fontSize:13,fontWeight:600},"& fieldset":{border:"none"}},endAdornment:lr&&(0,X.jsx)(h.Z,{size:"small",onClick:function(){return dr("")},sx:{p:.25,color:fe},children:(0,X.jsx)(W.Z,{fontSize:"small"})}),autoComplete:"off"})]})]}),(0,X.jsx)(_.Z,{sx:{p:2,bgcolor:ce},children:0===pr.length?(0,X.jsxs)(l.Z,{alignItems:"center",justifyContent:"center",spacing:1.5,sx:{minHeight:480,maxHeight:480},children:[(0,X.jsx)(d.Z,{sx:{width:56,height:56,bgcolor:ue("#94a3b8"),color:re},children:(0,X.jsx)(A.Bjz,{size:26})}),(0,X.jsx)(u.Z,{variant:"subtitle1",sx:{fontWeight:700,color:oe},children:"No saved locations"}),(0,X.jsx)(u.Z,{variant:"caption",sx:{color:ae},children:lr?"Try a different keyword.":"Save a customer from the order form to reuse it later."})]}):(0,X.jsx)(l.Z,{spacing:1,sx:{minHeight:480,maxHeight:480,overflow:"auto",pr:.5},children:pr.map((function(e,t){var n=hr.customerid===e.customerid;return(0,X.jsxs)(p.Z,{onClick:function(){n||(ir(!1),1===wr?(Dr(1),ca({latitude:e.latitude,longitude:e.longitude}),Zr(e),mi(e.contactno)):(Ar(1),xa({latitude:e.latitude,longitude:e.longitude}),yr(e),vi(e.contactno)))},sx:{display:"flex",alignItems:"flex-start",gap:1.25,p:1.5,borderRadius:2,border:"1px solid",borderColor:n?pe("#94a3b8"):ie,bgcolor:n?ce:"#fff",cursor:n?"not-allowed":"pointer",opacity:n?.6:1,transition:"all 0.15s","&:hover":n?{}:{borderColor:pe(fe),bgcolor:de(fe),boxShadow:ee}},children:[(0,X.jsx)(d.Z,{sx:{width:36,height:36,bgcolor:ue(fe),color:fe,fontWeight:800},children:String(e.firstname||"?").charAt(0).toUpperCase()}),(0,X.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,X.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:.75,flexWrap:"wrap",useFlexGap:!0,children:[(0,X.jsx)(u.Z,{sx:{fontWeight:800,color:oe,fontSize:13.5},noWrap:!0,children:e.firstname}),(0,X.jsxs)(p.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.375,px:.75,py:.125,borderRadius:999,bgcolor:de("#0ea5e9"),border:"1px solid ".concat(pe("#0ea5e9")),color:"#0ea5e9",fontSize:10.5,fontWeight:800},children:[(0,X.jsx)(Y.DNl,{size:9})," ",e.contactno]}),n&&(0,X.jsx)(p.Z,{sx:{display:"inline-flex",alignItems:"center",px:.75,py:.125,borderRadius:999,bgcolor:de("#94a3b8"),border:"1px solid ".concat(pe("#94a3b8")),color:ae,fontSize:10.5,fontWeight:800},children:"Already used"})]}),(0,X.jsx)(u.Z,{variant:"caption",sx:{color:ae,mt:.25},noWrap:!0,children:e.address})]})]},t)}))})}),(0,X.jsx)(l.Z,{direction:"row",justifyContent:"flex-end",sx:{p:2,borderTop:"1px solid ".concat(se)},children:(0,X.jsx)(m.Z,{variant:"outlined",onClick:function(){return ir(!1)},sx:{borderRadius:999,px:2.5,borderColor:ie,color:ae,fontWeight:700,textTransform:"none","&:hover":{borderColor:ae,bgcolor:ce}},children:"Cancel"})})]}),(0,X.jsxs)(F.Z,{open:Jt,onClose:function(){return en(!1)},PaperProps:{sx:{borderRadius:3}},children:[(0,X.jsx)(p.Z,{sx:{p:2.5,background:"linear-gradient(135deg, ".concat(de("#ef4444")," 0%, ").concat(de("#f59e0b")," 100%)"),borderBottom:"1px solid ".concat(ie)},children:(0,X.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,X.jsx)(d.Z,{sx:{bgcolor:"#ef4444",color:"#fff",width:40,height:40,boxShadow:"0 6px 18px ".concat(xe("#ef4444"))},children:(0,X.jsx)(G.Z,{})}),(0,X.jsxs)(l.Z,{children:[(0,X.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:oe},children:"Out of Service Area"}),(0,X.jsx)(u.Z,{variant:"caption",sx:{color:ae,fontWeight:600},children:"This drop point is outside the supported radius"})]})]})}),(0,X.jsx)(_.Z,{sx:{pt:2.5},children:(0,X.jsx)(u.Z,{sx:{color:ae,fontWeight:600},children:"Service is not available at this location. Try a different drop point within the coverage zone."})}),(0,X.jsx)(l.Z,{direction:"row",justifyContent:"flex-end",sx:{p:2,borderTop:"1px solid ".concat(se)},children:(0,X.jsx)(m.Z,{variant:"contained",onClick:function(){return en(!1)},sx:{borderRadius:999,px:3,bgcolor:"#ef4444",fontWeight:700,textTransform:"none",boxShadow:"0 6px 18px ".concat(xe("#ef4444")),"&:hover":{bgcolor:"#dc2626"}},children:"Close"})})]})]})]})}}}]); |