1 line
51 KiB
JavaScript
1 line
51 KiB
JavaScript
"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[2912],{91547:function(e,t,n){var o=n(1413),a=n(29439),r=n(47313),i=n(76088),s=n(16783),c=n(85281),l=n(88706),d=n(46417),u="https://nominatim.openstreetmap.org/search",p=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[],n=function(e,n){e&&t.push({long_name:e,short_name:e,types:n})};return n(e.house_number,["street_number"]),n(e.road||e.pedestrian,["route"]),n(e.suburb||e.neighbourhood||e.quarter,["sublocality_level_1","sublocality"]),n(e.city_district||e.county,["administrative_area_level_3"]),n(e.city||e.town||e.village,["locality"]),n(e.state,["administrative_area_level_1"]),n(e.country,["country"]),n(e.postcode,["postal_code"]),t},x=function(e){var t;return{formatted_address:e.display_name,name:(null===(t=e.display_name)||void 0===t?void 0:t.split(",")[0])||"",geometry:{location:{lat:function(){return parseFloat(e.lat)},lng:function(){return parseFloat(e.lon)}}},address_components:p(e.address)}},f=function(e,t){var n=new URLSearchParams({q:e,format:"json",addressdetails:"1",limit:"5"});if(null!==t&&void 0!==t&&t.lat&&null!==t&&void 0!==t&&t.lng){var o=.5;n.set("viewbox","".concat(t.lng-o,",").concat(t.lat+o,",").concat(t.lng+o,",").concat(t.lat-o))}return n};t.ZP=function(e){var t=e.id,n=e.label,p=e.placeholder,h=void 0===p?"Search address":p,m=e.value,g=e.onChange,Z=e.onPlaceSelected,b=e.bias,v=e.sx,j=e.textFieldSx,S=e.fullWidth,y=void 0===S||S,_=e.disabled,k=e.inputRef,C=e.TextFieldProps,P=void 0===C?{}:C,w=(0,r.useState)(m||""),A=(0,a.Z)(w,2),I=A[0],E=A[1],D=(0,r.useState)([]),R=(0,a.Z)(D,2),Y=R[0],W=R[1],M=(0,r.useState)(!1),T=(0,a.Z)(M,2),z=T[0],L=T[1];(0,r.useEffect)((function(){void 0!==m&&m!==I&&E(m||"")}),[m]);var H=(0,r.useMemo)((function(){return(0,l.Z)((function(e,t,n){if(e){var o=f(e,t);fetch("".concat(u,"?").concat(o.toString()),{headers:{Accept:"application/json"}}).then((function(e){return e.ok?e.json():[]})).then((function(e){return n(e||[])})).catch((function(){return n([])}))}else n([])}),500)}),[]);return(0,r.useEffect)((function(){var e=!0;return I?(L(!0),H(I,b,(function(t){e&&(L(!1),W(t))})),function(){e=!1}):(W([]),void L(!1))}),[I,null===b||void 0===b?void 0:b.lat,null===b||void 0===b?void 0:b.lng,H]),(0,d.jsx)(i.Z,{id:t,freeSolo:!0,fullWidth:y,disabled:_,sx:v,options:Y,filterOptions:function(e){return e},getOptionLabel:function(e){return"string"===typeof e?e:e.display_name||""},isOptionEqualToValue:function(e,t){return e.place_id===(null===t||void 0===t?void 0:t.place_id)},inputValue:I,onInputChange:function(e,t){E(t),null===g||void 0===g||g(t)},onChange:function(e,t){t&&"string"!==typeof t&&(E(t.display_name||""),null===Z||void 0===Z||Z(x(t)))},renderInput:function(e){var t,a,r,i;return(0,d.jsx)(s.Z,(0,o.Z)((0,o.Z)((0,o.Z)({},e),P),{},{inputRef:k,label:n,placeholder:h,sx:j,autoComplete:"off",InputProps:(0,o.Z)((0,o.Z)((0,o.Z)({},e.InputProps),P.InputProps),{},{startAdornment:null!==(t=null===(a=P.InputProps)||void 0===a?void 0:a.startAdornment)&&void 0!==t?t:e.InputProps.startAdornment,endAdornment:(0,d.jsxs)(d.Fragment,{children:[z?(0,d.jsx)(c.Z,{color:"inherit",size:16}):null,null!==(r=null===(i=P.InputProps)||void 0===i?void 0:i.endAdornment)&&void 0!==r?r:e.InputProps.endAdornment]})})}))}})}},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),p=n(9019),x=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),y=n(19536),_=n(85281),k=n(33604),C=n(49914),P=n(96467),w=n(11198),A=n(37159),I=n(36528),E=n(12058),D=n(88960),R=n(23195),Y=n(58467),W=n(22539),M=n(66277),T=n(56573),z=n(19860),L=n(91547),H=n(11577),F=(n(46926),n(97316),n(29736)),N=n(23208),O=n(45904),B=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)",oe="0 18px 50px rgba(15, 23, 42, 0.18)",ae="#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")},pe=function(e){return de(e,"18")},xe=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,o=e.title,a=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(xe(t))},children:n}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{sx:{fontWeight:800,color:ae,fontSize:14,lineHeight:1.1},children:o}),a&&(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:a})]})]}),r]})},Ze=function(e){var t=e.children,n=e.sx,o=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%"},o),children:t})},be=function(e){return(0,Q.jsx)(X.Z,(0,s.Z)((0,s.Z)({},e),{},{sx:{mt:.75,borderRadius:2,boxShadow:oe,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(""),oe=(0,i.Z)($,2),de=oe[0],ve=oe[1],je=(0,c.useState)(""),Se=(0,i.Z)(je,2),ye=(Se[0],Se[1],(0,c.useState)("")),_e=(0,i.Z)(ye,2),ke=(_e[0],_e[1],(0,c.useState)("")),Ce=(0,i.Z)(ke,2),Pe=(Ce[0],Ce[1],(0,c.useState)("")),we=(0,i.Z)(Pe,2),Ae=(we[0],we[1],(0,c.useState)("")),Ie=(0,i.Z)(Ae,2),Ee=(Ie[0],Ie[1],(0,c.useState)("")),De=(0,i.Z)(Ee,2),Re=(De[0],De[1],(0,c.useState)("")),Ye=(0,i.Z)(Re,2),We=(Ye[0],Ye[1],(0,c.useState)("")),Me=(0,i.Z)(We,2),Te=(Me[0],Me[1],(0,c.useState)("")),ze=(0,i.Z)(Te,2),Le=(ze[0],ze[1],(0,c.useState)("")),He=(0,i.Z)(Le,2),Fe=(He[0],He[1],(0,c.useState)("")),Ne=(0,i.Z)(Fe,2),Oe=(Ne[0],Ne[1],(0,c.useState)("")),Be=(0,i.Z)(Oe,2),Ue=(Be[0],Be[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],nt=et[1],ot=(0,c.useState)(!1),at=(0,i.Z)(ot,2),rt=at[0],it=at[1],st=(0,c.useRef)(null),ct=(0,c.useRef)(null),lt=(0,c.useState)(0),dt=(0,i.Z)(lt,2),ut=dt[0],pt=dt[1],xt=(0,c.useState)(1),ft=(0,i.Z)(xt,2),ht=ft[0],mt=ft[1],gt=localStorage.getItem("applocationid"),Zt=(0,Y.s0)(),bt=(0,c.useState)({}),vt=(0,i.Z)(bt,2),jt=(vt[0],vt[1],(0,c.useState)("")),St=(0,i.Z)(jt,2),yt=(St[0],St[1],(0,c.useState)(!1)),_t=(0,i.Z)(yt,2),kt=(_t[0],_t[1],(0,c.useState)(!1)),Ct=(0,i.Z)(kt,2),Pt=(Ct[0],Ct[1],(0,c.useState)(!1)),wt=(0,i.Z)(Pt,2),At=wt[0],It=wt[1],Et=(0,c.useState)(1),Dt=(0,i.Z)(Et,2),Rt=(Dt[0],Dt[1],(0,c.useState)([])),Yt=(0,i.Z)(Rt,2),Wt=(Yt[0],Yt[1],(0,c.useState)([])),Mt=(0,i.Z)(Wt,2),Tt=Mt[0],zt=Mt[1],Lt=(0,c.useState)(""),Ht=(0,i.Z)(Lt,2),Ft=(Ht[0],Ht[1],(0,c.useState)(K()().format("MM-DD-YYYY"))),Nt=(0,i.Z)(Ft,2),Ot=Nt[0],Bt=Nt[1],Ut=(0,c.useState)(K()().add(1,"day").format("MM-DD-YYYY")),Kt=(0,i.Z)(Ut,2),qt=(Kt[0],Kt[1]),Gt=(0,c.useState)(),Vt=(0,i.Z)(Gt,2),Xt=Vt[0],Qt=Vt[1],$t=(0,c.useState)(),Jt=(0,i.Z)($t,2),en=Jt[0],tn=Jt[1],nn=(0,c.useState)([]),on=(0,i.Z)(nn,2),an=on[0],rn=on[1],sn=(0,c.useState)(""),cn=(0,i.Z)(sn,2),ln=(cn[0],cn[1],(0,c.useState)([])),dn=(0,i.Z)(ln,2),un=(dn[0],dn[1],(0,z.Z)()),pn=(0,c.useState)(""),xn=(0,i.Z)(pn,2),fn=xn[0],hn=xn[1],mn=(0,c.useState)([]),gn=(0,i.Z)(mn,2),Zn=(gn[0],gn[1],(0,c.useState)([])),bn=(0,i.Z)(Zn,2),vn=(bn[0],bn[1],(0,c.useState)([])),jn=(0,i.Z)(vn,2),Sn=(jn[0],jn[1],(0,c.useState)([])),yn=(0,i.Z)(Sn,2),_n=(yn[0],yn[1],(0,c.useState)(!1)),kn=(0,i.Z)(_n,2),Cn=(kn[0],kn[1]),Pn=(0,c.useState)(!1),wn=(0,i.Z)(Pn,2),An=wn[0],In=wn[1],En=(0,c.useState)(!1),Dn=(0,i.Z)(En,2),Rn=Dn[0],Yn=Dn[1],Wn=(0,c.useState)([]),Mn=(0,i.Z)(Wn,2),Tn=Mn[0],zn=(Mn[1],(0,c.useState)([])),Ln=(0,i.Z)(zn,2),Hn=(Ln[0],Ln[1],(0,c.useState)([])),Fn=(0,i.Z)(Hn,2),Nn=(Fn[0],Fn[1]),On=(0,c.useState)(""),Bn=(0,i.Z)(On,2),Un=Bn[0],Kn=Bn[1],qn=(0,c.useState)(""),Gn=(0,i.Z)(qn,2),Vn=(Gn[0],Gn[1],(0,c.useState)({})),Xn=(0,i.Z)(Vn,2),Qn=(Xn[0],Xn[1],(0,c.useState)("")),$n=(0,i.Z)(Qn,2),Jn=$n[0],eo=($n[1],(0,c.useState)([])),to=(0,i.Z)(eo,2),no=(to[0],to[1]),oo=(0,c.useState)([]),ao=(0,i.Z)(oo,2),ro=(ao[0],ao[1],(0,c.useState)()),io=(0,i.Z)(ro,2),so=io[0],co=io[1],lo=(0,c.useState)([]),uo=(0,i.Z)(lo,2),po=(uo[0],uo[1],(0,c.useState)({})),xo=(0,i.Z)(po,2),fo=xo[0],ho=xo[1],mo=(0,c.useState)({}),go=(0,i.Z)(mo,2),Zo=(go[0],go[1],(0,c.useState)("")),bo=(0,i.Z)(Zo,2),vo=bo[0],jo=bo[1],So=(0,c.useState)([]),yo=(0,i.Z)(So,2),_o=(yo[0],yo[1],(0,c.useState)()),ko=(0,i.Z)(_o,2),Co=(ko[0],ko[1]),Po=(0,c.useState)(""),wo=(0,i.Z)(Po,2),Ao=(wo[0],wo[1],(0,c.useState)(!0)),Io=(0,i.Z)(Ao,2),Eo=(Io[0],Io[1],(0,c.useState)("B")),Do=(0,i.Z)(Eo,2),Ro=(Do[0],Do[1],(0,c.useState)(!1)),Yo=(0,i.Z)(Ro,2),Wo=(Yo[0],Yo[1],(0,c.useState)({latitude:0,longitude:0})),Mo=(0,i.Z)(Wo,2),To=Mo[0],zo=Mo[1],Lo=(0,c.useState)({latitude:0,longitude:0}),Ho=(0,i.Z)(Lo,2),Fo=Ho[0],No=Ho[1],Oo=(0,c.useState)(!1),Bo=(0,i.Z)(Oo,2),Uo=Bo[0],Ko=Bo[1],qo=(0,c.useState)(0),Go=(0,i.Z)(qo,2),Vo=Go[0],Xo=Go[1],Qo=(0,c.useState)(0),$o=(0,i.Z)(Qo,2),Jo=$o[0],ea=$o[1],ta=(0,c.useState)(0),na=(0,i.Z)(ta,2),oa=na[0],aa=na[1],ra=(0,c.useState)(0),ia=(0,i.Z)(ra,2),sa=ia[0],ca=ia[1],la=(0,c.useState)(0),da=(0,i.Z)(la,2),ua=da[0],pa=da[1],xa=(0,c.useState)([]),fa=(0,i.Z)(xa,2),ha=fa[0],ma=fa[1],ga=(0,c.useState)("Select "),Za=(0,i.Z)(ga,2),ba=Za[0],va=Za[1],ja=(0,c.useState)(),Sa=(0,i.Z)(ja,2),ya=Sa[0],_a=Sa[1],ka=(0,c.useState)(""),Ca=(0,i.Z)(ka,2),Pa=(Ca[0],Ca[1]),wa=localStorage.getItem("tenantid"),Aa=(0,c.useState)(null),Ia=(0,i.Z)(Aa,2),Ea=Ia[0],Da=Ia[1],Ra=(0,c.useState)(!1),Ya=(0,i.Z)(Ra,2),Wa=Ya[0],Ma=Ya[1],Ta=(0,c.useState)(""),za=(0,i.Z)(Ta,2),La=za[0],Ha=za[1],Fa=(0,c.useState)([]),Na=(0,i.Z)(Fa,2),Oa=Na[0],Ba=Na[1],Ua=(0,c.useState)({}),Ka=(0,i.Z)(Ua,2),qa=Ka[0],Ga=Ka[1],Va=(0,c.useState)({}),Xa=(0,i.Z)(Va,2),Qa=Xa[0],$a=Xa[1],Ja=(0,c.useState)(0),er=(0,i.Z)(Ja,2),tr=er[0],nr=er[1],or=(0,c.useState)(0),ar=(0,i.Z)(or,2),rr=ar[0],ir=ar[1],sr=(0,c.useState)(0),cr=(0,i.Z)(sr,2),lr=cr[0],dr=cr[1],ur=(0,c.useState)([]),pr=(0,i.Z)(ur,2),xr=pr[0],fr=pr[1],hr=(0,c.useState)(),mr=(0,i.Z)(hr,2),gr=mr[0],Zr=mr[1],br=(0,c.useState)(),vr=(0,i.Z)(br,2),jr=vr[0],Sr=vr[1],yr=(0,c.useState)(),_r=(0,i.Z)(yr,2),kr=_r[0],Cr=_r[1],Pr=(0,c.useState)(0),wr=(0,i.Z)(Pr,2),Ar=wr[0],Ir=wr[1],Er=(0,c.useState)(0),Dr=(0,i.Z)(Er,2),Rr=Dr[0],Yr=Dr[1],Wr=(0,c.useState)(0),Mr=(0,i.Z)(Wr,2),Tr=Mr[0],zr=Mr[1],Lr=(0,c.useState)(0),Hr=(0,i.Z)(Lr,2),Fr=Hr[0],Nr=Hr[1],Or=(0,c.useState)(),Br=(0,i.Z)(Or,2),Ur=Br[0],Kr=Br[1],qr=(0,c.useState)(),Gr=(0,i.Z)(qr,2),Vr=Gr[0],Xr=Gr[1],Qr=(0,c.useState)(!1),$r=(0,i.Z)(Qr,2),Jr=$r[0],ei=$r[1],ti=(0,c.useState)(!1),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];(0,c.useEffect)((function(){console.log(si)}),[si]);var li=function(e){Da(e)},di=function(e){return{cursor:"pointer",backgroundColor:Ea===e?un.palette.primary.main:"default",color:Ea===e?"#fff":"","&:hover":{backgroundColor:Ea===e?un.palette.primary.main:un.palette.primary.light,color:"#fff"}}},ui=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,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantpricing/?tenantid=").concat(wa));case 3:t=e.sent,console.log("pricingResponse",t.data.details),ea(t.data.details.baseprice),aa(t.data.details.priceperkm),ca(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(){ui()}),[]),(0,c.useEffect)((function(){console.log("startPoint",To),console.log("endPoint",Fo),0!=To.latitude&&0!=To.longitude&&0!=Fo.latitude&&0!=Fo.longitude&&pi(To,Fo)}),[To,Fo]);var pi=function(){var e=(0,r.Z)((0,a.Z)().mark((function e(t,n){var o,r,i;return(0,a.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:o=e.sent,console.log("calculated distance in km:",o),Xo(o),r=(0,A.j)(o,Jo,oa,sa),console.log("total charge:",r),pa(r),Ko(!0),o>kr&&(Ko(!0),It(!0)),40,i=Math.round(o/40*60),console.log("Distance: ".concat(o,", 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()(Ot).format("MM-DD-YYYY")," ").concat(K()(t).format("HH:mm:ss"))),"m")<=0&&e.push(t)})),e[0]&&Nn([{sno:1,address:"",customerid:"",deliverytime:K()(e[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}])}}),[an]),(0,c.useEffect)((function(){if(Jn){var e=Tt.filter((function(e){return e.address.toLowerCase().includes(Jn.toLowerCase())||e.firstname.toLowerCase().includes(Jn.toLowerCase())||e.contactno.toLowerCase().includes(Jn.toLowerCase())}));console.log(e),no((0,o.Z)(e))}else no((0,o.Z)(Tt))}),[Jn]);var xi=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 In(!0),console.log("tid",wa),e.next=4,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantinfo/?tenantid=").concat(wa)).then((function(e){console.log("fetchtenantinfo",e),e.data.status&&(ho(e.data.details),Co(e.data.details.tenantid),mi(),_a(e.data.details.subcategoryid)),In(!1)})).catch((function(e){console.log(e),In(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){xi()}),[]);var fi=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,T.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?ma(e.data.details):ma([])})).catch((function(e){console.log(e),ma([])}));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){fi()}),[]);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 In(!0),e.next=3,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocations/?applocationid=").concat(gt)).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){Zr(a),Sr(r),Cr(i),Qt("".concat(K()().format("MM-DD-YYYY")," ").concat(n)),tn("".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),rn(s)}In(!1)})).catch((function(e){console.log(e),In(!1)}));case 3: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,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return In(!0),e.next=3,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocationconfig/?applocationid=").concat(gt)).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&&co(t),In(!1)})).catch((function(e){console.log(e),In(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Xt&&en&&mi()}),[Xt,en]);var gi=function(e,t,n){(0,q.yv)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:n||2e3}),console.log(Un)};var Zi=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:fo.applolcationid,cancellled:"",categoryid:+fo.categoryid,configid:7,customerid:0==Ar&&+qa.customerid||0,deliveryaddress:Qa.address||"",deliverycharge:+ua.toFixed(2)||0,deliverycity:Qa.city||"",deliverycontactno:Qa.contactno||"",deliverycustomer:Qa.firstname||"",deliveryid:0==Rr&&+Qa.customerid||0,deliverylandmark:Qa.landmark||"",deliverylat:Qa.latitude.toString(),deliverylocation:Qa.suburb||"",deliverylocationid:Qa.deliverylocationid||0,deliverylong:Qa.longitude.toString(),deliverytime:"".concat(K()(Ot).format("YYYY-MM-DD")," ").concat(K()(vo.$d).format("HH:mm:ss")),deliverytype:0!==qa.customerid||0!==Qa.customerid?"B":"C",delivered:"",itemcount:1,kms:Vo.toString()||0,locationid:+tt,moduleid:+fo.moduleid,orderamount:+ua.toFixed(2)||0,ordercharges:0,orderdate:K()().format("YYYY-MM-DD HH:mm:ss"),orderheaderid:0,orderid:"",ordernotes:fn,orderstatus:"created",ordervalue:+ua.toFixed(2)||0,partnerid:fo.partnerid,paymentstatus:1,paymenttype:42,pending:"",pickupaddress:qa.address||"",pickupcity:qa.city||"",pickupcontactno:qa.contactno||"",pickupcustomer:qa.firstname||"",pickuplandmark:qa.landmark||"",pickuplat:qa.latitude.toString(),pickuplocation:qa.suburb||"",pickuplocationid:qa.deliverylocationid||0,pickuplong:qa.longitude.toString(),processing:"",ready:"",remarks:"",smsdelivery:si,subcategoryid:+ya,taxamount:0,tenantid:fo.tenantid,tenantuserid:parseInt(localStorage.getItem("userid")),collectionamt:+ut||0,quantity:+ht||1},pickup:{address:qa.address||"",applocationid:fo.applolcationid,city:qa.city||"",configid:7,contactno:qa.contactno||"",customertoken:"",customerid:0==Ar&&qa.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:qa.doorno||"",email:qa.email||"",firstname:qa.firstname||"",landmark:qa.landmark||"",latitude:qa.latitude.toString()||"",longitude:qa.longitude.toString()||"",locationid:qa.deliverylocationid||0,postcode:qa.postcode||"",primaryaddress:1,profileimage:"",state:qa.state||"",suburb:qa.suburb||"",tenantid:fo.tenantid},drop:{address:Qa.address||"",applocationid:fo.applolcationid,city:Qa.city||"",configid:7,contactno:Qa.contactno||"",customertoken:"",customerid:0==Rr&&Qa.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:Qa.doorno||"",email:Qa.email||"",firstname:Qa.firstname||"",landmark:Qa.landmark||"",latitude:Qa.latitude.toString(),longitude:Qa.longitude.toString(),locationid:Qa.deliverylocationid||0,postcode:Qa.postcode||"",primaryaddress:1,profileimage:"",state:Qa.state||"",suburb:Qa.suburb||"",tenantid:fo.tenantid}},console.log("createsubmitobj2",t),qa.firstname){e.next=7;break}gi("Enter Pickup Contact Name ","warning",2e3),e.next=79;break;case 7:if(qa.contactno){e.next=11;break}gi("Enter Pickup Contact Number ","warning",2e3),e.next=79;break;case 11:if(10==qa.contactno.length){e.next=15;break}gi("Check Pickup Contact Number ","error",2e3),e.next=79;break;case 15:if(qa.suburb){e.next=19;break}gi("Enter Pickup Location ","warning",2e3),e.next=79;break;case 19:if(qa.city){e.next=23;break}gi("Enter Pickup City ","warning",2e3),e.next=79;break;case 23:if(qa.postcode){e.next=27;break}gi("Enter Pickup Postcode ","warning",2e3),e.next=79;break;case 27:if(qa.landmark){e.next=31;break}gi("Enter Pickup Landmark ","warning",2e3),e.next=79;break;case 31:if(Qa.firstname){e.next=35;break}gi("Enter Drop Contact Name ","warning",2e3),e.next=79;break;case 35:if(Qa.contactno){e.next=39;break}gi("Enter Drop Contact Number","warning",2e3),e.next=79;break;case 39:if(10===Qa.contactno.length){e.next=43;break}gi("Check Drop Contact Number ","error",2e3),e.next=79;break;case 43:if(Qa.suburb){e.next=47;break}gi("Enter Drop Suburb ","warning",2e3),e.next=79;break;case 47:if(Qa.city){e.next=51;break}gi("Enter Drop City ","warning",2e3),e.next=79;break;case 51:if(Qa.postcode){e.next=55;break}gi("Enter Drop postcode ","warning",2e3),e.next=79;break;case 55:if(Qa.landmark){e.next=59;break}gi("Enter Drop Landmark ","warning",2e3),e.next=79;break;case 59:if(vo){e.next=63;break}gi("Choose deliverytime ","warning",2e3),e.next=79;break;case 63:if(_a){e.next=67;break}gi("Choose SubCategory ","warning",2e3),e.next=79;break;case 67:return e.prev=67,e.next=70,T.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}),so&¬ifyadmin(so),Zt("/nearle/orders")):gi("Something went wrong, Cannot create order","warning"),In(!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(Tn)}),[Tn]);var bi=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 Cn(!0),e.prev=1,t=""==La?"".concat("https://jupiter.nearle.app/live/api/v1","/customers/gettenantcustomers/?tenantid=").concat(wa,"&pageno=1&pagesize=20"):"".concat("https://jupiter.nearle.app/live/api/v1","/customers/search/?tenantid=").concat(wa,"&keyword=").concat(La),e.next=5,T.Z.get(t).then((function(e){if(console.log("clientdetails",e.data.details),e.data.status&&e.data.details){zt(e.data.details||[]),Ba(e.data.details||[]);var t=[];e.data.details.map((function(e){t.push((0,s.Z)({label:"".concat(e.firstname," | ").concat(e.contactno)},e))})),no(t)}else zt([]),Ba([]),no([]);Cn(!1)})).catch((function(e){console.log(e),Cn(!1),gi("server error","warning")}));case 5:e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.log(e.t0),Cn(!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"),bi()}),[La.length>3,""==La]);var vi=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,T.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantlocations/?tenantid=").concat(wa));case 3:t=e.sent,console.log("gettenantlocations",t.data.details),t.data&&t.data.details?(fr(t.data.details),1==t.data.details.length&&(it(!0),nt(t.data.details[0].locationid))):fr([]),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),console.log("gettenantlocations",e.t0),fr([]);case 12:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){vi()}),[]),(0,Q.jsxs)(Q.Fragment,{children:[An&&(0,Q.jsx)(H.Z,{}),(0,Q.jsxs)(p.ZP,{container:!0,rowSpacing:2,columnSpacing:2.75,children:[(0,Q.jsx)(p.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(xe(he))},children:(0,Q.jsx)(W.tX2,{size:22})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h3",sx:{fontWeight:800,color:ae,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)(x.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===xr.length?(0,Q.jsxs)(x.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)(W.x$F,{size:14})," ",xr[0].locationname]}):(0,Q.jsx)(f.Z,{options:xr||[],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)(W.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(xe(he))},"&.Mui-focused fieldset":{borderColor:he,borderWidth:2}}}}))},onChange:function(e,t,n){t&&(nt(t.locationid),it(!0)),"clear"===n&&it(!1)}})]})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(x.Z,{sx:{overflow:"visible"},children:[(0,Q.jsx)(p.ZP,{container:!0,spacing:2,children:(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:2,sx:{height:"100%"},children:[(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(Ze,{children:[(0,Q.jsx)(ge,{color:"#0ea5e9",icon:(0,Q.jsx)(W.$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)(W.Bjz,{size:14}),onClick:function(){rt?(Ma(!0),nr(1),Ga({}),U(""),Ha("")):gi("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(xe("#0ea5e9"))}},children:"Saved Locations"})}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsx)(p.ZP,{container:!0,spacing:2,children:(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:4,children:[(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{inputRef:st,disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.Xws,{})})},variant:"outlined",label:"Contact Name",value:qa.firstname,onChange:function(e){Ga((0,s.Z)((0,s.Z)({},qa),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{error:Jr,disabled:!rt,fullWidth:!0,type:"number",InputProps:{inputProps:{maxLength:10},startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(I.DNl,{color:Jr&&"red"})})},variant:"outlined",label:"Contact Number",value:qa.contactno,onChange:function(e){e.target.value.length<=10&&Ga((0,s.Z)((0,s.Z)({},qa),{},{contactno:e.target.value})),Ur==e.target.value?zr(0):zr(1),e.target.value.length<10?ei(!0):ei(!1)}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==rr?(0,Q.jsx)("div",{children:(0,Q.jsx)(L.ZP,{label:"Address",disabled:!rt,id:"addressAuto1",fullWidth:!0,value:n,onChange:U,onPlaceSelected:function(e){U("".concat(e.name,", ").concat(e.formatted_address)),zo({latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}),Ga((0,s.Z)((0,s.Z)({},qa),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var t={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(n){switch(n){case"street_number":t.street_number=e.long_name;break;case"route":t.route=e.long_name;break;case"locality":t.locality=e.long_name;break;case"sublocality_level_1":t.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":t.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":t.administrative_area_level_1=e.long_name;break;case"country":t.country=e.long_name;break;case"postal_code":t.postal_code=e.long_name}}))})),Ga((0,s.Z)((0,s.Z)({},qa),{},{address:t.address,doorno:"".concat(t.street_number," ").concat(t.route),suburb:t.sublocality_level_1,city:t.locality,postcode:t.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}))},bias:{lat:gr,lng:jr},TextFieldProps:{variant:"outlined",InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){U(""),Ga((0,s.Z)((0,s.Z)({},qa),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ko(!1),zo({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(){ir(0),Ga((0,s.Z)((0,s.Z)({},qa),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ko(!1),zo({latitude:0,longitude:0})},children:(0,Q.jsx)(R.Z,{})})},variant:"outlined",placeholder:"Select",value:qa.address,onChange:function(e){Ga((0,s.Z)((0,s.Z)({},qa),{},{address:e.target.value})),""==e.target.value&&(ir(0),Ko(!1),zo({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(E.Lmk,{})})},variant:"outlined",label:"Door No / Street",value:qa.doorno,onChange:function(e){Ga((0,s.Z)((0,s.Z)({},qa),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.GUT,{})})},variant:"outlined",label:"Location",value:qa.suburb,onChange:function(e){Ga((0,s.Z)((0,s.Z)({},qa),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(W.Ys1,{})})},variant:"outlined",label:"City",value:qa.city,onChange:function(e){Ga((0,s.Z)((0,s.Z)({},qa),{},{city:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(M.kk8,{})})},variant:"outlined",label:"Postcode",value:qa.postcode,onChange:function(e){Ga((0,s.Z)((0,s.Z)({},qa),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.I2o,{})})},variant:"outlined",label:"Landmark",value:qa.landmark,onChange:function(e){Ga((0,s.Z)((0,s.Z)({},qa),{},{landmark:e.target.value}))}})}),1==Tr&&(0,Q.jsx)(p.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===Ar,onChange:function(e){Ir(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(Ze,{children:[(0,Q.jsx)(ge,{color:he,icon:(0,Q.jsx)(W.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)(W.Bjz,{size:14}),onClick:function(){rt?(Ma(!0),nr(2),ve(""),Ha("")):gi("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(xe(he))}},children:"Saved Locations"})}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:2,sx:{height:"100%"},children:[(0,Q.jsx)(p.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:un.palette.primary.main,color:"white"}},onClick:function(){rt?(Ma(!0),nr(2),ve(""),Ha("")):gi("Select Business Location","warning")},children:"Saved Locations"})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:4,children:[(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{inputRef:ct,disabled:!rt,fullWidth:!0,variant:"outlined",label:"Contact Name",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.Xws,{})})},value:Qa.firstname,onChange:function(e){$a((0,s.Z)((0,s.Z)({},Qa),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,error:oi,fullWidth:!0,type:"number",variant:"outlined",label:"Contact Number",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(I.DNl,{color:oi&&"red"})})},value:Qa.contactno,onChange:function(e){e.target.value.length<=10&&$a((0,s.Z)((0,s.Z)({},Qa),{},{contactno:e.target.value})),Vr==e.target.value?Nr(0):Nr(1),e.target.value.length<10?ai(!0):ai(!1)}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==lr?(0,Q.jsx)("div",{children:(0,Q.jsx)(L.ZP,{id:"addressAuto2",disabled:!rt,label:"Address",fullWidth:!0,value:de,onChange:ve,onPlaceSelected:function(e){ve("".concat(e.name,", ").concat(e.formatted_address)),No({latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}),$a((0,s.Z)((0,s.Z)({},Qa),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var t={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(n){switch(n){case"street_number":t.street_number=e.long_name;break;case"route":t.route=e.long_name;break;case"locality":t.locality=e.long_name;break;case"sublocality_level_1":t.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":t.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":t.administrative_area_level_1=e.long_name;break;case"country":t.country=e.long_name;break;case"postal_code":t.postal_code=e.long_name}}))})),$a((0,s.Z)((0,s.Z)({},Qa),{},{address:t.address,doorno:"".concat(t.street_number," ").concat(t.route),suburb:t.sublocality_level_1,city:t.locality,postcode:t.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}))},bias:{lat:gr,lng:jr},TextFieldProps:{InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){ve(""),$a((0,s.Z)((0,s.Z)({},Qa),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ko(!1),No({latitude:0,longitude:0})},size:"small",children:(0,Q.jsx)(w.Z,{})})}}})}):(0,Q.jsx)(h.Z,{disabled:!rt,InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){dr(0),$a((0,s.Z)((0,s.Z)({},Qa),{},{firstname:"",contactno:"",doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ko(!1),No({latitude:0,longitude:0})},children:(0,Q.jsx)(R.Z,{})})},variant:"outlined",placeholder:"Select",value:Qa.address,onChange:function(e){Ga((0,s.Z)((0,s.Z)({},Qa),{},{address:e.target.value})),""==e.target.value&&(dr(0),Ko(!1),No({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,variant:"outlined",label:"Door No / Street",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(E.Lmk,{})})},value:Qa.doorno,onChange:function(e){$a((0,s.Z)((0,s.Z)({},Qa),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,variant:"outlined",label:"Location",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.GUT,{})})},value:Qa.suburb,onChange:function(e){$a((0,s.Z)((0,s.Z)({},Qa),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,variant:"outlined",label:"City",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(W.Ys1,{})})},value:Qa.city,onChange:function(e){$a((0,s.Z)((0,s.Z)({},Qa),{},{city:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,variant:"outlined",label:"Postcode",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(M.kk8,{})})},value:Qa.postcode,onChange:function(e){$a((0,s.Z)((0,s.Z)({},Qa),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!rt,fullWidth:!0,variant:"outlined",label:"Landmark",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(D.I2o,{})})},value:Qa.landmark,onChange:function(e){$a((0,s.Z)((0,s.Z)({},Qa),{},{landmark:e.target.value}))}})}),1==Fr&&(0,Q.jsx)(p.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===Rr,onChange:function(e){Yr(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})]})})]})}),(0,Q.jsx)(p.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)(W.k71,{size:16}),title:"Schedule",subtitle:"Pickup date & time slot"}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsx)(p.ZP,{container:!0,children:(0,Q.jsxs)(p.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)(N._,{dateAdapter:O.y,sx:{},children:(0,Q.jsx)(F.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),jo(""),t<=0){console.log("startdate",e),Bt(e),qt(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]?Nn([{sno:1,address:"",customerid:"",deliverytime:K()(n[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}]):Nn([])}else Kn("choose Upcoming Date"),gi("choose Upcoming Date","warning"),Bt(NaN)},value:K()(Ot),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)(x.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()(Ot).format("MM-DD-YYYY")," ").concat(K()(e).format("HH:mm:ss"))),"m")<=0){var n=K()(vo).format("HH:mm")==K()(e).format("HH:mm");return(0,Q.jsxs)(x.Z,{onClick:function(){Vo>kr?It(!0):Uo?jo(e):gi("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(xe("#f59e0b")):"none","&:hover":{borderColor:"#f59e0b",boxShadow:n?"0 6px 18px ".concat(xe("#f59e0b")):"0 0 0 3px ".concat(xe("#f59e0b"))}},children:[(0,Q.jsx)(W.Y8K,{size:11})," ",K()(e).format("hh:mm A")]},t)}}))})})]})})})]})}),(0,Q.jsx)(p.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)(W.sF1,{size:16}),title:"Distance & Pricing",subtitle:"Auto-calculated from pickup \u2192 drop"}),(0,Q.jsxs)(x.Z,{sx:{p:{xs:2,md:2.5}},children:[Uo&&(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(Vo," 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(ua.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:ha,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:""==ba?fo.subcategoryname:ba}))},onChange:function(e,t,n){t&&(console.log(t),va(t.subcategoryname),_a(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:di("1-10kgs"),onClick:function(){li("1-10kgs"),Pa("1-10kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"11-20kgs",sx:di("11-20kgs"),onClick:function(){li("11-20kgs"),Pa("11-20kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"21-30kgs",sx:di("21-30kgs"),onClick:function(){li("21-30kgs"),Pa("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===si,onChange:function(e){ci(e.target.checked?1:0)}})]})]})]})})]})})}),(0,Q.jsxs)(Ze,{sx:{mt:2},children:[(0,Q.jsx)(ge,{color:"#6366f1",icon:(0,Q.jsx)(W.ByW,{size:16}),title:"Collection & Quantity",subtitle:"Cash to collect on delivery, total items"}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:2,children:[(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsx)(h.Z,{type:"number",value:ut,fullWidth:!0,label:"Cash Collect",onChange:function(e){return pt(e.target.value)},inputProps:{min:0}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsx)(h.Z,{type:"number",value:ht,fullWidth:!0,label:"Quantity",onChange:function(e){return mt(e.target.value)},inputProps:{min:1}})})]})})]}),(0,Q.jsxs)(Ze,{sx:{mt:2},children:[(0,Q.jsx)(ge,{color:re,icon:(0,Q.jsx)(W.hKf,{size:16}),title:"Notes",subtitle:"Add anything the rider should know"}),(0,Q.jsxs)(x.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:fn,onChange:function(e){return hn(e.target.value)}}),(0,Q.jsx)(y.Z,{sx:{my:1.5}}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"flex-end",alignItems:"center",spacing:1.25,children:[!Uo&&(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:!Uo,variant:"contained",startIcon:Rn?null:(0,Q.jsx)(W.ZSR,{size:16}),onClick:function(){In(!0),Yn(!0),Zi(),setTimeout((function(){In(!1),Yn(!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(xe(he)),transition:"all 0.18s","&:hover":{background:"linear-gradient(135deg, #4D1C61 0%, ".concat(he," 100%)"),transform:"translateY(-1px)",boxShadow:"0 10px 26px ".concat(xe(he))},"&.Mui-disabled":{background:ce,color:ie,boxShadow:"none"}},children:Rn?(0,Q.jsx)(_.Z,{size:18,thickness:5,sx:{color:"#fff"}}):"Create Order"})]})]})]})]})}),(0,Q.jsxs)(B.Z,{open:Wa,onClose:function(){return Ma(!1)},fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:3}},children:[(0,Q.jsxs)(k.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(xe(he))},children:(0,Q.jsx)(W.Bjz,{size:20})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:ae},children:"Saved Locations"}),(0,Q.jsxs)(u.Z,{variant:"caption",sx:{color:re,fontWeight:600},children:["Pick a saved customer for ",1===tr?"Pickup":"Drop"]})]})]}),(0,Q.jsxs)(x.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(xe(he))}},children:[(0,Q.jsx)(G.Z,{style:{color:he,fontSize:14}}),(0,Q.jsx)(C.Z,{fullWidth:!0,placeholder:"Search saved customer",value:La,onChange:function(e){return Ha(e.target.value)},sx:{flex:1,"& .MuiOutlinedInput-input":{p:"6px 4px",fontSize:13,fontWeight:600},"& fieldset":{border:"none"}},endAdornment:La&&(0,Q.jsx)(g.Z,{size:"small",onClick:function(){return Ha("")},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===Oa.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:pe("#94a3b8"),color:ie},children:(0,Q.jsx)(W.Bjz,{size:26})}),(0,Q.jsx)(u.Z,{variant:"subtitle1",sx:{fontWeight:700,color:ae},children:"No saved locations"}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:re},children:La?"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:Oa.map((function(e,t){var n=qa.customerid===e.customerid;return(0,Q.jsxs)(x.Z,{onClick:function(){n||(Ma(!1),1===tr?(ir(1),zo({latitude:e.latitude,longitude:e.longitude}),Ga(e),Kr(e.contactno)):(dr(1),No({latitude:e.latitude,longitude:e.longitude}),$a(e),Xr(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:pe(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:ae,fontSize:13.5},noWrap:!0,children:e.firstname}),(0,Q.jsxs)(x.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)(I.DNl,{size:9})," ",e.contactno]}),n&&(0,Q.jsx)(x.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 Ma(!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)(B.Z,{open:At,onClose:function(){return It(!1)},PaperProps:{sx:{borderRadius:3}},children:[(0,Q.jsx)(x.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(xe("#ef4444"))},children:(0,Q.jsx)(V.Z,{})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:ae},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 It(!1)},sx:{borderRadius:999,px:3,bgcolor:"#ef4444",fontWeight:700,textTransform:"none",boxShadow:"0 6px 18px ".concat(xe("#ef4444")),"&:hover":{bgcolor:"#dc2626"}},children:"Close"})})]})]})]})}},37159:function(e,t,n){n.d(t,{j:function(){return i},v:function(){return r}});var o=n(74165),a=n(15861),r=function(){var e=(0,a.Z)((0,o.Z)().mark((function e(t,n){var a,r,i,s,c,l,d,u,p,x,f,h,m,g,Z,b;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=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!=a&&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_GOOGLE_MAPS_API_KEY:"AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8",REACT_APP_RIDER_ACCESS_ID:"AAAAILMpCEU:APA91bEavuOllBI6sFgYtxXAgNmAVwNA-MnCMHLGlR4_t7UqpLajAkdn3T0CZr_zaLBknLyim9ytFLMZgbeXmKqTad_PKCbqlYjHpaizVrLXtecxqyEy4UktIacK2UvHVUATHL-7VQQk",REACT_APP_STAFF_TOKEN:"",REACT_APP_URL:"https://jupiter.nearle.app/live/api/v1",REACT_APP_URL2:"https://jupiter.nearle.app/live/api/v2",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(a,";").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 p=u.routes[0].distance,x=p/1e3,e.abrupt("return",Math.round(x));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-a),m=f(s-r),g=Math.sin(h/2)*Math.sin(h/2)+Math.cos(f(a))*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,o){return e<o?t:(e-o)*n+t}}}]); |