Files
Express_console_build/build/static/js/6015.c054d1f6.chunk.js

1 line
49 KiB
JavaScript

(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[6015],{855:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var i=n(68106),s=n(82522),r=n(65908);function o(e){var t,n;let o,l,{children:a,type:c="scale",direction:d="right",offset:h=10,scale:p={hover:1.05,tap:.95}}=e;switch(d){case"up":case"left":o=h,l=0;break;default:o=0,l=h}const[x,u]=(0,i.Y)(o,l),[m,f]=(0,i.Y)(o,l);switch(c){case"rotate":return(0,r.jsx)(s.P.div,{animate:{rotate:360},transition:{repeat:1/0,repeatType:"loop",duration:2,repeatDelay:0},children:a});case"slide":return"up"===d||"down"===d?(0,r.jsx)(s.P.div,{animate:{y:void 0!==m?m:""},onHoverEnd:()=>f(),onHoverStart:()=>f(),children:a}):(0,r.jsx)(s.P.div,{animate:{x:void 0!==x?x:""},onHoverEnd:()=>u(),onHoverStart:()=>u(),children:a});default:return"number"===typeof p&&(p={hover:p,tap:p}),(0,r.jsx)(s.P.div,{whileHover:{scale:null===(t=p)||void 0===t?void 0:t.hover},whileTap:{scale:null===(n=p)||void 0===n?void 0:n.tap},children:a})}}},23787:(e,t,n)=>{"use strict";n.d(t,{FG:()=>x,nV:()=>h,pY:()=>u,pg:()=>p});var i=n(22555),s=n(53986),r=n(71392),o=n(55235),l=n(48738),a=n(2866),c=n(65908);const d=["children","scroll","onScroll","sx"],h=e=>{let{children:t,scroll:n=!1,onScroll:o,sx:l}=e,a=(0,s.A)(e,d);return(0,c.jsx)(r.A,(0,i.A)((0,i.A)({spacing:1.25,onScroll:o,sx:(0,i.A)((0,i.A)({p:1.5},n&&{maxHeight:"calc(100vh - 220px)",overflowY:"auto",overflowX:"hidden"}),l)},a),{},{children:t}))},p=e=>{let{accent:t="#662582",header:n,footer:s,selected:r=!1,onClick:a,children:d,sx:h}=e;return(0,c.jsxs)(o.A,{elevation:0,onClick:a,sx:(0,i.A)({position:"relative",overflow:"hidden",flexShrink:0,borderRadius:2.5,border:"1px solid",borderColor:r?t:"#e2e8f0",background:r?"".concat(t,"0a"):"#fff",boxShadow:"0 4px 14px rgba(15,23,42,0.05)",transition:"border-color 0.15s, box-shadow 0.15s"},h),children:[(0,c.jsx)(l.A,{sx:{position:"absolute",left:0,top:0,bottom:0,width:3,bgcolor:t}}),(0,c.jsxs)(l.A,{sx:{p:1.5,pl:2},children:[n,d,s]})]})},x=e=>{let{children:t,columns:n=2,sx:s}=e;return(0,c.jsx)(l.A,{sx:(0,i.A)({display:"grid",gridTemplateColumns:"repeat(".concat(n,", minmax(0, 1fr))"),gap:1,mt:1.25},s),children:t})},u=e=>{let{label:t,value:n,children:i,full:s=!1,align:r="left"}=e;return(0,c.jsxs)(l.A,{sx:{gridColumn:s?"1 / -1":"auto",minWidth:0,textAlign:r},children:[(0,c.jsx)(a.A,{sx:{fontSize:9.5,fontWeight:800,letterSpacing:.5,textTransform:"uppercase",color:"#94a3b8",lineHeight:1.4},children:t}),(0,c.jsx)(l.A,{sx:{mt:.25,minWidth:0},children:void 0!==i?i:(0,c.jsx)(a.A,{sx:{fontSize:13,fontWeight:600,color:"#0f172a"},noWrap:!0,children:null!==n&&void 0!==n?n:"\u2014"})})]})}},39009:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>ge});var i=n(22555),s=n(85672),r=n(66157),o=n(60549),l=n.n(o),a=n(79829),c=n(46077),d=n.n(c),h=n(96515),p=n(69039),x=n(76264),u=n(13659),m=n(79520),f=n(15227),g=n(48738),A=n(71392),v=n(2866),j=n(81062),b=n(1939),S=n(84007),y=n(17488),C=n(86270),w=n(43318),k=n(80911),Y=n(12010),P=n(23440),R=n(11969),W=n(83209),z=n(55235),I=n(72486),T=n(54016),E=n(50755),M=n(1596),N=n(81802),D=n(58689),H=n(19619),L=n(29398),F=n(29776),O=n(58571),B=n(5670),q=n(76495),V=n(83900),K=n(28579),U=n(17450),J=n(91939),G=n(65293),Z=n(12557),_=n(51808),Q=n(88664),X=n(96048),$=n(3273),ee=n(13763),te=n(50728),ne=n(36444),ie=n(36563),se=n(35267),re=n(26777),oe=n(38464),le=n(81600),ae=n(15172),ce=n(48952),de=n(52351),he=n(94826),pe=(n(855),n(23787)),xe=(n(42041),n(65908)),ue=n(22686);d().extend(ue);const me={fontSize:11.5,fontWeight:700,color:"#475569",py:.75,px:1},fe={fontSize:12,py:.6,px:1},ge=()=>{const e=(0,h.Zp)(),t=(0,p.A)(),n=(0,x.A)(t.breakpoints.down("md")),o=(0,s.useRef)(null),c=(0,s.useRef)(null),ue=localStorage.getItem("userid"),[ge,Ae]=(0,s.useState)([]),[ve,je]=(0,s.useState)([]),[be,Se]=(0,s.useState)([]),[ye,Ce]=(0,s.useState)(!1),[we,ke]=(0,s.useState)(!1),[Ye,Pe]=(0,s.useState)(0),[Re,We]=(0,s.useState)(0),[ze,Ie]=(0,s.useState)(0),[Te,Ee]=(0,s.useState)(null),[Me,Ne]=(0,s.useState)(null),[De,He]=(0,s.useState)(0),[Le,Fe]=(0,s.useState)(0),[Oe,Be]=(0,s.useState)(0),[qe,Ve]=(0,s.useState)(null),[Ke,Ue]=(0,s.useState)([]),[Je,Ge]=(0,s.useState)([]),[Ze,_e]=(0,s.useState)(!1),[Qe,Xe]=(0,s.useState)(""),[$e,et]=(0,s.useState)(d()().format("MM-DD-YYYY")),[tt,nt]=(0,s.useState)(""),[it,st]=(0,s.useState)(null),[rt,ot]=(0,s.useState)(null),[lt,at]=(0,s.useState)(""),[ct,dt]=(0,s.useState)(),[ht,pt]=(0,s.useState)(0),[xt,ut]=(0,s.useState)(0),[mt,ft]=(0,s.useState)(0),[gt,At]=(0,s.useState)(0),[vt,jt]=(0,s.useState)(null),[bt,St]=(0,s.useState)([]),[yt,Ct]=(0,s.useState)(""),wt=(0,s.useRef)({}),kt=(e,t,n)=>{(0,u.M8)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:n||1500})},Yt=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3;const i="".concat(t,"-").concat(e);wt.current[i]||(kt(e,t,n),wt.current[i]=!0,setTimeout((()=>delete wt.current[i]),3e3))};(0,s.useEffect)((()=>{We(0),Ee(null),Ie(0),Ne(null),Se([]),Ve(null),Ue([]),St([]),jt(null),Ct(""),st(null),ot(null),nt("")}),[Ye]),(0,s.useEffect)((()=>{Ie(0),Ne(null),Ue([]),St([]),jt(null),Ct("")}),[Re]);(0,s.useEffect)((()=>{(async()=>{Ce(!0);try{const e=await r.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/partners/getlocations/?userid=").concat(ue));Ae(e.data.details||[])}catch(e){Yt(e.message,"error",5e3)}finally{Ce(!1)}})()}),[]);(0,s.useEffect)((()=>{Ye&&(async()=>{Ce(!0);try{const e=await r.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenants/?applocationid=").concat(Ye,"&status=active"));if(e.data.status){const t=(e.data.details||[]).map((e=>(0,i.A)((0,i.A)({},e),{},{label:"".concat(e.tenantname)})));je(t)}}catch(e){Yt("Failed to load clients","warning",3e3)}finally{Ce(!1)}})()}),[Ye]);(0,s.useEffect)((()=>{if(!Re)return;const e=setTimeout((()=>{(""===Qe||Qe.length>2)&&(async()=>{try{const e=""===Qe?"".concat("https://jupiter.nearle.app/live/api/v1","/customers/gettenantcustomers/?tenantid=").concat(Re,"&pageno=1&pagesize=30"):"".concat("https://jupiter.nearle.app/live/api/v1","/customers/search/?tenantid=").concat(Re,"&keyword=").concat(Qe),t=await r.A.get(e);t.data.status&&Ge(t.data.details||[])}catch(e){console.log(e),kt("server error","warning")}})()}),250);return()=>clearTimeout(e)}),[Qe,Re]),(0,s.useEffect)((()=>{let e=0,t=0,n=0,i=0;Ke.forEach((s=>{e+=Number(s.distance)||0,t+=Number(s.totalcharge)||0,n+=Number(s.quantity)||0,i+=Number(s.collectionamt)||0})),pt(e),ut(t),ft(n),At(i)}),[Ke]);const Pt=async e=>{try{if(!e||"object"!==typeof e)throw new Error("Invalid customer data.");if(!qe||"object"!==typeof qe)throw new Error("Origin (pickCust) data missing or invalid.");const t=await(0,m.F)(qe,e);return{roundedDistance:t,totalcharge:(0,m.D)(t,De,Le,Oe)}}catch(t){throw t.message.includes("Origin")||t.message.includes("customer")||t.message.includes("coordinates")?Yt("Missing or invalid input data for distance calculation.","warning",3e3):Yt("Unexpected error during distance calculation.","error",3e3),t}},Rt=async e=>{let t=!1;if(Ue((n=>(t=n.some((t=>t.firstname===e.firstname)),t?n.filter((t=>t.firstname!==e.firstname)):n))),!t){Ce(!0);try{const{roundedDistance:t,totalcharge:n}=await Pt(e);Ue((s=>s.some((t=>t.firstname===e.firstname))?s:[...s,(0,i.A)((0,i.A)({},e),{},{distance:t,totalcharge:n})]))}catch(n){console.error("Failed to calculate distance:",n)}finally{Ce(!1)}}};(0,s.useEffect)((()=>{Ye&&(async()=>{try{const e=await r.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocationconfig/?applocationid=").concat(Ye));if(e.data.status){const t=e.data.details.applocationadmins.map((e=>e.userfcmtokem));dt(t)}}catch(e){console.log(e)}})()}),[Ye]);const Wt=e=>null===e||void 0===e?void 0:e.toString().trim().toLowerCase().replace(/\s+/g,""),zt={"pickupdate(yyyy-mmm-dd)":"date","sendername*":"locationname","senderphone*":"locationcontact","senderaddress*":"locationaddress","receivername*":"firstname",receiverphone:"contactno","receiveralternatephone*":"altcontactno",receiverfulladdress:"address",receiverlatitude:"latitude",receiverlongitude:"longitude","itemdescription*":"description",Quantity:"quantity"," Collect Cash":"collectionamt",customerDeliveryTime:"customerdeliverytime",kitchenPickupTime:"kitchenpickuptime"},It=(e,t)=>{Ue((n=>n.map((n=>n.customerid===e?(0,i.A)((0,i.A)({},n),{},{quantity:Number(t)||0}):n))))},Tt=(e,t)=>{Ue((n=>n.map((n=>n.customerid===e?(0,i.A)((0,i.A)({},n),{},{collectionamt:Number(t)||0}):n))))},Et={location:!!Ye,client:!!Re,business:!!ze,schedule:!!rt,drops:Ke.length>0},Mt=Et.location&&Et.client&&Et.business&&Et.schedule&&Et.drops,Nt=Ke.length>0?"drops":bt.length>0?"preview":"empty";return(0,xe.jsxs)(xe.Fragment,{children:[ye&&(0,xe.jsx)(de.A,{}),(0,xe.jsx)(f.A,{sx:{color:"#fff",zIndex:e=>e.zIndex.drawer+1},open:we,children:(0,xe.jsx)(he.A,{color:"inherit"})}),(0,xe.jsxs)(g.A,{className:"orders-workspace-bg",sx:{height:{xs:"auto",md:"calc(100vh - 64px)"},minHeight:{xs:"calc(100vh - 64px)",md:0},display:"flex",flexDirection:"column",overflow:{xs:"visible",md:"hidden"},p:{xs:.75,sm:1.25},gap:1},children:[(0,xe.jsxs)(A.A,{direction:"row",alignItems:"center",gap:1,flexWrap:"wrap",sx:{flexShrink:0,px:.5},children:[(0,xe.jsx)(v.A,{sx:{fontWeight:700,fontSize:{xs:16,sm:17},color:"#1e293b",lineHeight:1.2},children:"Create Multiple Orders"}),(0,xe.jsx)(j.A,{size:"small",label:"".concat(Ke.length," drop").concat(1===Ke.length?"":"s"),sx:{height:20,fontSize:10.5,fontWeight:700,bgcolor:Ke.length?"rgba(24,144,255,0.10)":"#f1f5f9",color:Ke.length?"#1890ff":"#94a3b8",border:"1px solid ".concat(Ke.length?"rgba(24,144,255,0.25)":"#e2e8f0")}}),(0,xe.jsx)(g.A,{sx:{flex:1}}),(0,xe.jsx)(v.A,{sx:{fontSize:11,color:"#94a3b8",display:{xs:"none",md:"block"}},children:"Bulk-create deliveries from CSV/Excel or saved customers."})]}),(0,xe.jsxs)(b.Ay,{container:!0,spacing:1.25,sx:{flex:1,minHeight:0,overflow:{xs:"visible",md:"hidden"}},children:[(0,xe.jsxs)(b.Ay,{item:!0,xs:12,md:6,sx:{height:{xs:"auto",md:"100%"},minHeight:0,display:"flex",flexDirection:"column",gap:{xs:1.25,md:2.25},overflowY:{xs:"visible",md:"auto"},pr:{xs:0,md:.75}},children:[(0,xe.jsxs)(S.A,{className:"orders-card",sx:{p:2,flexShrink:0},children:[(0,xe.jsx)(g.A,{className:"section-title-bar",sx:{mb:1.5},children:(0,xe.jsx)(v.A,{sx:{fontWeight:700,color:"#1e293b",fontSize:13.5,letterSpacing:"-0.01em"},children:"Setup"})}),(0,xe.jsxs)(b.Ay,{container:!0,spacing:1.75,children:[(0,xe.jsx)(b.Ay,{item:!0,xs:12,sm:4,children:(0,xe.jsx)(y.A,{fullWidth:!0,size:"small",ref:o,className:"header-compact-input",options:ge||[],getOptionLabel:e=>"".concat(e.locationname),onChange:(e,t,n)=>{"clear"===n?Pe(0):t&&Pe(t.applocationid)},renderInput:e=>(0,xe.jsx)(C.A,(0,i.A)((0,i.A)({},e),{},{size:"small",placeholder:"Choose Location",label:"Location",InputLabelProps:{shrink:!0},className:"header-compact-tf",InputProps:(0,i.A)((0,i.A)({},e.InputProps),{},{startAdornment:(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(ae.sIY,{style:{color:"#94a3b8",fontSize:12,marginRight:6,flexShrink:0}}),e.InputProps.startAdornment]})})}))})}),(0,xe.jsx)(b.Ay,{item:!0,xs:12,sm:4,children:(0,xe.jsx)(y.A,{fullWidth:!0,size:"small",className:"header-compact-input",options:ve||[],value:Te,getOptionLabel:e=>(null===e||void 0===e?void 0:e.tenantname)||"",isOptionEqualToValue:(e,t)=>e.tenantid===t.tenantid,onOpen:e=>{Ye||(e.preventDefault(),Yt("Please select Location first!","warning",3e3),setTimeout((()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.focus()}),0))},onChange:(e,t,n)=>{"clear"===n?(We(0),Ee(null)):t&&(We(t.tenantid),Ee(t),(async e=>{try{const t=(await r.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantpricing/?tenantid=").concat(e))).data.details||{};He(t.baseprice||0),Fe(t.priceperkm||0),Be(t.minkm||0)}catch(t){console.log("fetchTenantPricing error",t)}})(t.tenantid),(async e=>{try{const t=(await r.A.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantlocations/?tenantid=").concat(e))).data.details||[];1===t.length?(Se(t),Ve(t[0]),Ie(t[0].locationid),Ne(t[0]),st(t[0].slots)):Se(t)}catch(t){console.log("gettenantlocations",t)}})(t.tenantid))},renderInput:e=>(0,xe.jsx)(C.A,(0,i.A)((0,i.A)({},e),{},{size:"small",placeholder:"Choose Client",label:"Client",inputRef:c,InputLabelProps:{shrink:!0},className:"header-compact-tf",InputProps:(0,i.A)((0,i.A)({},e.InputProps),{},{startAdornment:(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(le.x$1,{style:{color:"#94a3b8",fontSize:11,marginRight:6,flexShrink:0}}),e.InputProps.startAdornment]})})}))})}),(0,xe.jsx)(b.Ay,{item:!0,xs:12,sm:4,children:1===be.length?(0,xe.jsx)(C.A,{variant:"outlined",fullWidth:!0,size:"small",label:"Business Location",value:be[0].locationname,InputLabelProps:{shrink:!0},className:"header-compact-tf",InputProps:{style:{color:t.palette.primary.main},startAdornment:(0,xe.jsx)(Q.A,{style:{color:"#94a3b8",fontSize:14,marginRight:6,flexShrink:0}})}}):(0,xe.jsx)(y.A,{fullWidth:!0,size:"small",className:"header-compact-input",value:Me,options:be||[],getOptionLabel:e=>null!==e&&void 0!==e&&e.locationname?"".concat(e.locationname," (").concat(e.suburb||"",")"):"",onOpen:e=>{Ye||Re?Re||(e.preventDefault(),Yt("Please select Client first!","warning",3e3),setTimeout((()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.focus()}),0)):(e.preventDefault(),Yt("Please select Location and Client first!","warning",3e3),setTimeout((()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.focus()}),0))},onChange:(e,t,n)=>{"clear"!==n&&t?(Ie(t.locationid||0),Ne(t),Ve(t),st(null===t||void 0===t?void 0:t.slots)):(Ie(0),Ne(null),Ve(null),st(null))},renderInput:e=>(0,xe.jsx)(C.A,(0,i.A)((0,i.A)({},e),{},{size:"small",placeholder:"Business Location",label:"Business Location",InputLabelProps:{shrink:!0},className:"header-compact-tf",InputProps:(0,i.A)((0,i.A)({},e.InputProps),{},{startAdornment:(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(Q.A,{style:{color:"#94a3b8",fontSize:14,marginRight:6,flexShrink:0}}),e.InputProps.startAdornment]})})}))})})]})]}),(0,xe.jsxs)(S.A,{className:"orders-card",sx:{p:2,flexShrink:0},children:[(0,xe.jsx)(g.A,{className:"section-title-bar section-title-bar--accent",sx:{mb:1.5},children:(0,xe.jsx)(v.A,{sx:{fontWeight:700,color:"#1e293b",fontSize:13.5,letterSpacing:"-0.01em"},children:"Schedule & Pickup"})}),(0,xe.jsxs)(b.Ay,{container:!0,spacing:1.75,children:[(0,xe.jsx)(b.Ay,{item:!0,xs:12,sm:6,children:(0,xe.jsx)(G.$,{dateAdapter:Z.R,children:(0,xe.jsx)(J.l,{label:"Pickup Date",format:"DD-MM-YYYY",value:$e?d()($e):null,onChange:e=>{if(!e||!d()(e).isValid())return void et(d()().format("MM-DD-YYYY"));d()().diff(d()("".concat(d()(e).format("YYYY-MM-DD"))),"d")<=0?(et(d()(e).format("MM-DD-YYYY")),nt(""),ot(null)):(kt("Choose an upcoming date","warning"),et(d()().format("MM-DD-YYYY")))},disablePast:!0,slotProps:{textField:{size:"small",fullWidth:!0,InputLabelProps:{shrink:!0},InputProps:{startAdornment:(0,xe.jsx)(w.A,{position:"start",children:(0,xe.jsx)(X.A,{style:{color:"#94a3b8",fontSize:"13px"}})})},sx:{"& .MuiOutlinedInput-root":{borderRadius:"10px",height:"36px",paddingLeft:"10px"}}}}})})}),(0,xe.jsx)(b.Ay,{item:!0,xs:12,sm:6,children:(0,xe.jsx)(y.A,{size:"small",fullWidth:!0,options:it||[],sx:{"& .MuiOutlinedInput-root":{borderRadius:"10px",height:"36px"}},onChange:(e,t,n)=>{if("clear"===n||!t)return nt(null),void ot(null);if(!t.time)return void Yt("This slot has no time configured.","warning",3e3);const i=d()(t.time,"HH:mm").format("hh:mm A");nt(i);const s=d()("".concat($e," ").concat(i),"MM-DD-YYYY hh:mm A").format("YYYY-MM-DD hh:mm A");ot(s)},getOptionLabel:e=>e?"".concat(e.name," (").concat(d()(e.time,"HH:mm").format("hh:mm A"),")"):"",renderInput:e=>(0,xe.jsx)(C.A,(0,i.A)((0,i.A)({},e),{},{label:"Pickup Slot",placeholder:"Select Pickup Slot",fullWidth:!0,InputLabelProps:{shrink:!0},sx:{"& .MuiOutlinedInput-root":{borderRadius:"10px",height:"36px"}},InputProps:(0,i.A)((0,i.A)({},e.InputProps),{},{startAdornment:(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)($.A,{style:{color:"#94a3b8",fontSize:"13px",marginRight:"6px",marginLeft:"2px",flexShrink:0}}),e.InputProps.startAdornment]})})}))})}),(0,xe.jsx)(b.Ay,{item:!0,xs:12,children:qe?(0,xe.jsxs)(A.A,{direction:"row",spacing:1.25,alignItems:"center",sx:{border:"1px solid #eef2f6",borderLeft:"3px solid #1890ff",borderRadius:"10px",px:1.25,py:.75,bgcolor:"#fbfcff"},children:[(0,xe.jsx)(g.A,{sx:{width:28,height:28,borderRadius:"8px",background:"linear-gradient(135deg,#1890ff,#096dd9)",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,fontSize:12,boxShadow:"0 4px 10px rgba(24,144,255,0.30)"},children:(0,xe.jsx)(ae.sIY,{})}),(0,xe.jsxs)(g.A,{sx:{minWidth:0,flex:1},children:[(0,xe.jsx)(v.A,{sx:{fontSize:12.5,fontWeight:700,color:"#1e293b",lineHeight:1.2},noWrap:!0,children:qe.locationname||"\u2014"}),(0,xe.jsx)(v.A,{sx:{fontSize:11,color:"#64748b",lineHeight:1.3},noWrap:!0,children:qe.address||"\u2014"})]})]}):(0,xe.jsx)(v.A,{sx:{color:"#94a3b8",fontSize:12},children:"Pickup auto-fills once a Business Location is selected."})})]})]}),(0,xe.jsxs)(S.A,{className:"orders-card delivery-prefs-card",sx:{p:2,flexShrink:0},children:[(0,xe.jsxs)(g.A,{className:"delivery-prefs-header",sx:{mb:1},children:[(0,xe.jsx)(v.A,{className:"delivery-prefs-title",children:"Order Notes"}),(0,xe.jsx)(v.A,{className:"delivery-prefs-sub",children:"Applied to every order"})]}),(0,xe.jsx)(g.A,{className:"delivery-prefs-row",children:(0,xe.jsxs)(g.A,{className:"delivery-prefs-field",sx:{width:"100%"},children:[(0,xe.jsxs)("label",{className:"delivery-prefs-label",htmlFor:"bulk-dispatch-notes-input",children:[(0,xe.jsx)(ee.A,{style:{fontSize:11,color:"#65387a"}}),"Special Dispatch Notes"]}),(0,xe.jsx)(C.A,{id:"bulk-dispatch-notes-input",size:"small",fullWidth:!0,placeholder:"Gate codes, call instructions, special cargo care\u2026",value:lt,onChange:e=>at(e.target.value),sx:{"& .MuiOutlinedInput-root":{borderRadius:"10px",padding:"0 10px",alignItems:"center",fontSize:"12px",background:"#ffffff",height:"32px"},"& .MuiOutlinedInput-input":{padding:"0 !important",fontSize:"12px !important",lineHeight:"32px"}}})]})})]}),(0,xe.jsxs)(S.A,{className:"orders-card pricing-summary-card",sx:{flexShrink:0,p:"16px 18px !important"},children:[(0,xe.jsxs)(g.A,{className:"pricing-header",sx:{mb:1.5,pb:1},children:[(0,xe.jsx)(v.A,{className:"pricing-title",sx:{fontSize:"13px !important"},children:"Bulk Summary"}),(0,xe.jsx)(v.A,{className:"pricing-subtitle",sx:{fontSize:"10px !important"},children:"Live totals"})]}),(()=>{const e=e=>{let{icon:t,label:n,value:s,accent:r,active:o}=e;return(0,xe.jsxs)(g.A,{sx:(0,i.A)({bgcolor:"#fff",border:"1px solid #eef2f6",borderRadius:"10px",px:1,py:.75,display:"flex",alignItems:"center",gap:.85,minWidth:0,transition:"border-color 0.2s, box-shadow 0.2s"},o&&{borderColor:"".concat(r,"55"),boxShadow:"0 2px 6px -2px ".concat(r,"33")}),children:[(0,xe.jsx)(g.A,{sx:{width:26,height:26,borderRadius:"8px",bgcolor:"".concat(r,"18"),color:r,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,flexShrink:0},children:(0,xe.jsx)(t,{})}),(0,xe.jsxs)(g.A,{sx:{minWidth:0,flex:1},children:[(0,xe.jsx)(v.A,{sx:{fontSize:9.5,fontWeight:600,color:"#94a3b8",letterSpacing:.4,textTransform:"uppercase",lineHeight:1},children:n}),(0,xe.jsx)(v.A,{sx:{fontSize:13.5,fontWeight:800,color:o?"#1e293b":"#94a3b8",lineHeight:1.2,mt:.25},noWrap:!0,children:s})]})]})};return(0,xe.jsxs)(b.Ay,{container:!0,spacing:1.25,children:[(0,xe.jsx)(b.Ay,{item:!0,xs:6,children:e({icon:le.$Fg,label:"Distance",value:ht?"".concat(ht," km"):"\u2014",accent:"#1890ff",active:!!ht})}),(0,xe.jsx)(b.Ay,{item:!0,xs:6,children:e({icon:le.H5e,label:"Quantity",value:mt||0,accent:"#16a34a",active:!!mt})}),(0,xe.jsx)(b.Ay,{item:!0,xs:6,children:e({icon:le.MxO,label:"Cash Collect",value:"\u20b9".concat(Number(gt).toFixed(2)),accent:"#d97706",active:!!gt})}),(0,xe.jsx)(b.Ay,{item:!0,xs:6,children:e({icon:le.dv1,label:"Deliveries",value:Ke.length,accent:"#65387a",active:Ke.length>0})})]})})(),Ke.length>0&&(0,xe.jsxs)("div",{className:"total-charge-badge",style:{marginTop:14,padding:"10px 14px"},children:[(0,xe.jsxs)("div",{className:"total-charge-left",children:[(0,xe.jsx)(le.wTh,{className:"total-charge-icon"}),(0,xe.jsx)("div",{className:"total-charge-label",children:"Total Charge"})]}),(0,xe.jsxs)("div",{className:"total-charge-val",style:{fontSize:17},children:["\u20b9",Number(xt).toFixed(2)]})]}),(0,xe.jsx)(g.A,{sx:{mt:1.75},children:(0,xe.jsx)(k.A,{fullWidth:!0,className:"gradient-btn-create",disabled:!Mt||we,startIcon:!we&&(0,xe.jsx)(le.Cer,{style:{fontSize:11}}),onClick:async()=>{if(!Re)return void kt("Choose Client","warning");if(!qe)return void kt("Pickup location required","warning");if(!rt)return void kt("Select a pickup slot","warning");if(!Ke.length)return void kt("Add at least one drop customer","warning");const t=(()=>{if(rt){const e=d()(rt,["YYYY-MM-DD hh:mm A","YYYY-MM-DD HH:mm:ss"]);if(e.isValid())return e.format("YYYY-MM-DD HH:mm:ss")}if($e&&tt){const e=d()("".concat(d()($e).format("YYYY-MM-DD")," ").concat(tt),["YYYY-MM-DD hh:mm A","YYYY-MM-DD HH:mm:ss"]);if(e.isValid())return e.format("YYYY-MM-DD HH:mm:ss")}return d()().format("YYYY-MM-DD HH:mm:ss")})(),n=Ke.map((e=>{var n,i,s,r;return{applocationid:qe.applocationid,configid:9,partnerid:qe.partnerid,partneruserid:+ue,paymentstatus:1,paymenttype:42,pickupaddress:qe.address||"",pickupcity:qe.city||"",pickupcontactno:qe.contactno||"",pickupcustomer:qe.locationname||"",pickuplandmark:qe.landmark||"",pickuplat:qe.latitude,pickuplocation:qe.suburb||"",pickuplocationid:qe.locationid||0,pickuplong:qe.longitude,tenantid:qe.tenantid,customerid:+(null===e||void 0===e?void 0:e.customerid),deliveryaddress:e.address||"",deliverycharge:+e.totalcharge||0,deliverycity:e.city||"",deliverycontactno:(null===(n=e.contactno)||void 0===n?void 0:n.toString())||"",deliverycustomer:e.firstname||"",deliveryid:+e.customerid,deliverylandmark:e.landmark||"",deliverylat:(null===(i=e.latitude)||void 0===i?void 0:i.toString())||"",deliverylocation:e.suburb||"",deliverylocationid:e.deliverylocationid||0,deliverylong:(null===(s=e.longitude)||void 0===s?void 0:s.toString())||"",deliverytime:t,deliverytype:"B",itemcount:1,quantity:e.quantity,collectionamt:e.collectionamt,kms:(null===(r=e.distance)||void 0===r?void 0:r.toString())||"0",locationid:+qe.locationid,moduleid:+qe.moduleid,orderamount:+e.totalcharge||0,ordercharges:0,orderdate:d()().format("YYYY-MM-DD HH:mm:ss"),ordernotes:lt,orderstatus:"created",ordervalue:+e.totalcharge||0,pickupSlot:rt}}));Ce(!0),ke(!0);try{const t=await r.A.post("".concat("https://jupiter.nearle.app/live/api/v1","/orders/createorders"),n);var i;if(t.data.status)kt("Orders Created Successfully","success",2e3),ct&&(async()=>{try{"Success"===(await r.A.post("".concat("https://jupiter.nearle.app/live/api/v1","/utils/sendnotifications"),{priority:"high",registration_ids:ct,data:{accessid:"AAAAILMpCEU:APA91bEavuOllBI6sFgYtxXAgNmAVwNA-MnCMHLGlR4_t7UqpLajAkdn3T0CZr_zaLBknLyim9ytFLMZgbeXmKqTad_PKCbqlYjHpaizVrLXtecxqyEy4UktIacK2UvHVUATHL-7VQQk"},notification:{title:"Nearle Merchant",body:"An Order has been placed successfully, kindly process the same",sound:"ring"}})).data.message&&kt("Notification sent Successfully","success",1e3)}catch(e){kt(e.message,"error",1e3)}})(),e("/nearle/orders");else kt((null===t||void 0===t||null===(i=t.data)||void 0===i?void 0:i.message)||"Order creation failed. Please try again.","warning",3e3)}catch(o){let e="Something went wrong. Please try again.";var s;if(o.response)e=(null===(s=o.response.data)||void 0===s?void 0:s.message)||"Server error (".concat(o.response.status,")");else o.request&&(e="Network error. Check your internet connection.");kt(e,"error",3e3)}finally{Ce(!1),ke(!1)}},sx:{minHeight:"36px !important"},children:we?(0,xe.jsx)(Y.A,{color:"inherit",size:16,thickness:5}):"Dispatch ".concat(Ke.length||""," ").concat(1===Ke.length?"Order":"Orders").trim()})})]})]}),(0,xe.jsx)(b.Ay,{item:!0,xs:12,md:6,sx:{height:{xs:"auto",md:"100%"},minHeight:0,display:"flex",flexDirection:"column"},children:(0,xe.jsxs)(S.A,{className:"orders-card",sx:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",p:1.25,maxHeight:{xs:"none",md:685}},children:[(0,xe.jsxs)(A.A,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,sx:{mb:.75,flexShrink:0},children:[(0,xe.jsxs)(g.A,{className:"section-title-bar",sx:{mb:0},children:[(0,xe.jsx)(v.A,{sx:{fontWeight:700,color:"#1e293b",fontSize:13.5,letterSpacing:"-0.01em"},children:"drops"===Nt?"Drop List":"preview"===Nt?"File Preview":"Preview"}),(0,xe.jsx)(j.A,{size:"small",label:"drops"===Nt?Ke.length:"preview"===Nt?bt.length:0,sx:{height:20,fontSize:10.5,fontWeight:700,ml:1,bgcolor:"rgba(168,85,247,0.10)",color:"#65387a",border:"1px solid rgba(168,85,247,0.25)"}})]}),"drops"===Nt&&(0,xe.jsx)(j.A,{size:"small",label:"\u20b9".concat(Number(xt).toFixed(2)," total"),sx:{height:22,fontWeight:700,fontSize:11,bgcolor:"rgba(101,56,122,0.10)",color:"#65387a",border:"1px solid rgba(101,56,122,0.25)"}}),"preview"===Nt&&(0,xe.jsx)(j.A,{size:"small",label:"Awaiting Continue",icon:(0,xe.jsx)(te.A,{style:{fontSize:11}}),sx:{height:22,fontWeight:700,fontSize:11,bgcolor:"rgba(245,158,11,0.12)",color:"#b45309",border:"1px solid rgba(245,158,11,0.30)","& .MuiChip-icon":{color:"#b45309"}}}),"empty"!==Nt&&(()=>{const e=Ye&&Re&&ze,t=t=>{var n;e?(jt(t),0===t?null===(n=document.getElementById("upload-file"))||void 0===n||n.click():1===t&&(_e(!0),Xe(""))):Yt("Please select Location, Client, and Business Location first.","warning",3e3)};return(0,xe.jsxs)(A.A,{direction:"row",gap:.75,alignItems:"center",children:[(0,xe.jsx)(k.A,{size:"small",variant:"outlined",onClick:()=>t(0),startIcon:(0,xe.jsx)(ce.CtR,{}),sx:{height:24,py:0,textTransform:"none",borderRadius:"6px",fontSize:10.5,fontWeight:600,borderColor:"#cbd5e1",color:"#475569","&:hover":{borderColor:"#1890ff",color:"#1890ff"}},children:"Excel / CSV"}),(0,xe.jsx)(k.A,{size:"small",variant:"outlined",onClick:()=>t(1),startIcon:(0,xe.jsx)(le.YXz,{}),sx:{height:24,py:0,textTransform:"none",borderRadius:"6px",fontSize:10.5,fontWeight:600,borderColor:"#cbd5e1",color:"#475569","&:hover":{borderColor:"#65387a",color:"#65387a"}},children:"Selection"})]})})()]}),yt&&(0,xe.jsxs)(A.A,{direction:"row",gap:.75,alignItems:"center",sx:{mb:.75,color:"#64748b",flexShrink:0},children:[(0,xe.jsx)(ne.A,{style:{fontSize:12}}),(0,xe.jsx)(v.A,{sx:{fontSize:11.5},noWrap:!0,children:yt})]}),"preview"===Nt&&bt.length>=1&&(0,xe.jsxs)(g.A,{sx:{mb:1,p:1.25,bgcolor:"rgba(245,158,11,0.06)",border:"1.5px solid rgba(245,158,11,0.25)",borderRadius:"10px",display:"flex",alignItems:"center",justifyContent:"space-between",gap:1.5,flexShrink:0,animation:"blink 1.5s infinite","@keyframes blink":{"0%":{borderColor:"rgba(245,158,11,0.25)"},"50%":{borderColor:"rgba(245,158,11,0.6)"},"100%":{borderColor:"rgba(245,158,11,0.25)"}}},children:[(0,xe.jsxs)(g.A,{sx:{textAlign:"left"},children:[(0,xe.jsx)(v.A,{sx:{fontWeight:700,fontSize:12,color:"#b45309",lineHeight:1.2},children:"Process & Calculate Distances"}),(0,xe.jsx)(v.A,{sx:{color:"#b45309",opacity:.8,fontSize:10.5,lineHeight:1.25},children:"Click continue to import spreadsheet rows and calculate drop charges."})]}),(0,xe.jsx)(k.A,{variant:"contained",size:"small",color:"warning",onClick:()=>bt.forEach((e=>Rt(e))),sx:{textTransform:"none",borderRadius:"8px",fontWeight:700,fontSize:11,height:28,px:1.5,bgcolor:"#d97706",boxShadow:"none","&:hover":{bgcolor:"#b45309",boxShadow:"none"}},children:"Continue"})]}),(0,xe.jsxs)(g.A,{sx:{flex:1,minHeight:0,overflow:"auto"},children:["drops"===Nt&&n&&(0,xe.jsxs)(pe.nV,{sx:{p:0},children:[Ke.map(((e,t)=>{var n;return(0,xe.jsx)(pe.pg,{accent:"#65387a",header:(0,xe.jsxs)(A.A,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",spacing:1,children:[(0,xe.jsxs)(g.A,{sx:{minWidth:0,flex:1},children:[(0,xe.jsxs)(v.A,{sx:{fontSize:14,fontWeight:700,color:"#1e293b",lineHeight:1.2},children:[t+1,". ",e.firstname]}),(0,xe.jsx)(v.A,{sx:{fontSize:12,color:"#64748b",mt:.25},children:e.address})]}),(0,xe.jsx)(P.A,{title:"Remove",children:(0,xe.jsx)(R.A,{size:"small",onClick:()=>Rt(e),sx:{color:"#ef4444",p:.5,flexShrink:0},children:(0,xe.jsx)(ie.A,{style:{fontSize:14}})})})]}),children:(0,xe.jsxs)(pe.FG,{columns:2,children:[(0,xe.jsx)(pe.pY,{label:"Qty",children:0===vt?(0,xe.jsx)(v.A,{sx:{fontSize:13,fontWeight:600,color:"#0f172a"},children:null!==(n=e.quantity)&&void 0!==n?n:"\u2014"}):(0,xe.jsx)(C.A,{size:"small",type:"number",value:e.quantity||"",onChange:t=>It(e.customerid,t.target.value),inputProps:{min:0},fullWidth:!0,sx:{"& .MuiOutlinedInput-root":{borderRadius:"8px",height:34}}})}),(0,xe.jsx)(pe.pY,{label:"Cash",children:0===vt?(0,xe.jsx)(v.A,{sx:{fontSize:13,fontWeight:600,color:"#0f172a"},children:"\u20b9".concat(Number(e.collectionamt||0).toFixed(2))}):(0,xe.jsx)(C.A,{size:"small",type:"number",value:e.collectionamt?e.collectionamt:"",placeholder:"0",onChange:t=>{const n=Number(t.target.value);Tt(e.customerid,n>0?n:0)},inputProps:{min:0},InputProps:{startAdornment:(0,xe.jsx)(w.A,{position:"start",children:"\u20b9"})},fullWidth:!0,sx:{"& .MuiOutlinedInput-root":{borderRadius:"8px",height:34}}})}),(0,xe.jsx)(pe.pY,{label:"Km",value:e.distance}),(0,xe.jsx)(pe.pY,{label:"Charge",align:"right",children:(0,xe.jsxs)(v.A,{sx:{fontSize:13,fontWeight:700,color:"#1e293b"},children:["\u20b9",Number((null===e||void 0===e?void 0:e.totalcharge)||0).toFixed(2)]})})]})},e.customerid||e.firstname||t)})),(0,xe.jsx)(pe.pg,{accent:"#65387a",sx:{bgcolor:"#fafbfc"},children:(0,xe.jsxs)(pe.FG,{columns:2,children:[(0,xe.jsx)(pe.pY,{label:"Total Qty",value:mt}),(0,xe.jsx)(pe.pY,{label:"Total Cash",value:"\u20b9".concat(Number(gt).toFixed(2))}),(0,xe.jsx)(pe.pY,{label:"Total Km",value:ht}),(0,xe.jsx)(pe.pY,{label:"Total Charge",align:"right",children:(0,xe.jsxs)(v.A,{sx:{fontSize:14,fontWeight:800,color:"#65387a"},children:["\u20b9",Number(xt).toFixed(2)]})})]})})]}),"drops"===Nt&&!n&&(0,xe.jsx)(W.A,{component:z.A,sx:{borderRadius:"10px",border:"1px solid #eef2f6",boxShadow:"none"},children:(0,xe.jsxs)(I.A,{size:"small",stickyHeader:!0,children:[(0,xe.jsx)(T.A,{sx:{bgcolor:"#f8fafc"},children:(0,xe.jsxs)(E.A,{children:[(0,xe.jsx)(M.A,{sx:me,children:"#"}),(0,xe.jsx)(M.A,{sx:me,children:"Customer"}),(0,xe.jsx)(M.A,{sx:me,children:"Address"}),(0,xe.jsx)(M.A,{sx:me,align:"center",children:"Qty"}),(0,xe.jsx)(M.A,{sx:me,align:"center",children:"Cash"}),(0,xe.jsx)(M.A,{sx:me,children:"Km"}),(0,xe.jsx)(M.A,{sx:me,align:"right",children:"Charge"}),(0,xe.jsx)(M.A,{sx:me,align:"center",children:" "})]})}),(0,xe.jsxs)(N.A,{children:[Ke.map(((e,t)=>(0,xe.jsxs)(E.A,{hover:!0,children:[(0,xe.jsx)(M.A,{sx:fe,children:t+1}),(0,xe.jsx)(M.A,{sx:(0,i.A)((0,i.A)({},fe),{},{whiteSpace:"nowrap",color:"#1e293b",fontWeight:600}),children:e.firstname}),(0,xe.jsx)(M.A,{sx:(0,i.A)((0,i.A)({},fe),{},{color:"#64748b",maxWidth:220}),children:(0,xe.jsx)(P.A,{title:e.address||"",children:(0,xe.jsx)("span",{style:{display:"inline-block",maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",verticalAlign:"middle"},children:e.address})})}),(0,xe.jsx)(M.A,{align:"center",sx:fe,children:0===vt?e.quantity:(0,xe.jsx)(C.A,{size:"small",type:"number",value:e.quantity||"",onChange:t=>It(e.customerid,t.target.value),inputProps:{min:0},sx:{width:64,"& .MuiOutlinedInput-root":{borderRadius:"8px",height:30}}})}),(0,xe.jsx)(M.A,{align:"center",sx:fe,children:0===vt?"\u20b9".concat(Number(e.collectionamt||0).toFixed(2)):(0,xe.jsx)(C.A,{size:"small",type:"number",value:e.collectionamt?e.collectionamt:"",placeholder:"0",onChange:t=>{const n=Number(t.target.value);Tt(e.customerid,n>0?n:0)},inputProps:{min:0},InputProps:{startAdornment:(0,xe.jsx)(w.A,{position:"start",children:"\u20b9"})},sx:{width:90,"& .MuiOutlinedInput-root":{borderRadius:"8px",height:30}}})}),(0,xe.jsx)(M.A,{sx:fe,children:e.distance}),(0,xe.jsxs)(M.A,{align:"right",sx:(0,i.A)((0,i.A)({},fe),{},{fontWeight:700,color:"#1e293b"}),children:["\u20b9",Number((null===e||void 0===e?void 0:e.totalcharge)||0).toFixed(2)]}),(0,xe.jsx)(M.A,{align:"center",sx:fe,children:(0,xe.jsx)(P.A,{title:"Remove",children:(0,xe.jsx)(R.A,{size:"small",onClick:()=>Rt(e),sx:{color:"#ef4444",p:.5},children:(0,xe.jsx)(ie.A,{style:{fontSize:13}})})})})]},e.customerid||e.firstname||t))),(0,xe.jsxs)(E.A,{sx:{bgcolor:"#fafbfc"},children:[(0,xe.jsx)(M.A,{sx:(0,i.A)((0,i.A)({},fe),{},{fontWeight:800}),children:"Total"}),(0,xe.jsx)(M.A,{colSpan:2,sx:fe}),(0,xe.jsx)(M.A,{align:"center",sx:(0,i.A)((0,i.A)({},fe),{},{fontWeight:800}),children:mt}),(0,xe.jsxs)(M.A,{align:"center",sx:(0,i.A)((0,i.A)({},fe),{},{fontWeight:800}),children:["\u20b9",Number(gt).toFixed(2)]}),(0,xe.jsx)(M.A,{sx:(0,i.A)((0,i.A)({},fe),{},{fontWeight:800}),children:ht}),(0,xe.jsxs)(M.A,{align:"right",sx:(0,i.A)((0,i.A)({},fe),{},{fontWeight:800,color:"#65387a"}),children:["\u20b9",Number(xt).toFixed(2)]}),(0,xe.jsx)(M.A,{sx:fe})]})]})]})}),"preview"===Nt&&n&&(0,xe.jsx)(pe.nV,{sx:{p:0},children:bt.map(((e,t)=>{var n;return(0,xe.jsx)(pe.pg,{accent:"#d97706",header:(0,xe.jsxs)(g.A,{sx:{minWidth:0},children:[(0,xe.jsxs)(v.A,{sx:{fontSize:14,fontWeight:700,color:"#1e293b",lineHeight:1.2},children:[t+1,". ",e.firstname||"\u2014"]}),(0,xe.jsx)(v.A,{sx:{fontSize:12,color:"#64748b",mt:.25},children:e.address||"\u2014"})]}),children:(0,xe.jsxs)(pe.FG,{columns:2,children:[(0,xe.jsx)(pe.pY,{label:"Contact",value:e.contactno||"\u2014"}),(0,xe.jsx)(pe.pY,{label:"Qty",value:null!==(n=e.quantity)&&void 0!==n?n:"\u2014"}),(0,xe.jsx)(pe.pY,{label:"Cash",value:null!=e.collectionamt?"\u20b9".concat(Number(e.collectionamt).toFixed(2)):"\u2014"})]})},t)}))}),"preview"===Nt&&!n&&(0,xe.jsx)(W.A,{component:z.A,sx:{borderRadius:"10px",border:"1px solid #eef2f6",boxShadow:"none"},children:(0,xe.jsxs)(I.A,{size:"small",stickyHeader:!0,children:[(0,xe.jsx)(T.A,{sx:{bgcolor:"#f8fafc"},children:(0,xe.jsxs)(E.A,{children:[(0,xe.jsx)(M.A,{sx:me,children:"#"}),(0,xe.jsx)(M.A,{sx:me,children:"Name"}),(0,xe.jsx)(M.A,{sx:me,children:"Contact"}),(0,xe.jsx)(M.A,{sx:me,children:"Address"}),(0,xe.jsx)(M.A,{sx:me,align:"center",children:"Qty"}),(0,xe.jsx)(M.A,{sx:me,align:"center",children:"Cash"})]})}),(0,xe.jsx)(N.A,{children:bt.map(((e,t)=>{var n;return(0,xe.jsxs)(E.A,{hover:!0,children:[(0,xe.jsx)(M.A,{sx:fe,children:t+1}),(0,xe.jsx)(M.A,{sx:(0,i.A)((0,i.A)({},fe),{},{whiteSpace:"nowrap",color:"#1e293b",fontWeight:600}),children:e.firstname||"\u2014"}),(0,xe.jsx)(M.A,{sx:fe,children:e.contactno||"\u2014"}),(0,xe.jsx)(M.A,{sx:(0,i.A)((0,i.A)({},fe),{},{color:"#64748b",maxWidth:240}),children:(0,xe.jsx)(P.A,{title:e.address||"",children:(0,xe.jsx)("span",{style:{display:"inline-block",maxWidth:240,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",verticalAlign:"middle"},children:e.address||"\u2014"})})}),(0,xe.jsx)(M.A,{align:"center",sx:fe,children:null!==(n=e.quantity)&&void 0!==n?n:"\u2014"}),(0,xe.jsx)(M.A,{align:"center",sx:fe,children:null!=e.collectionamt?"\u20b9".concat(Number(e.collectionamt).toFixed(2)):"\u2014"})]},t)}))})]})}),"empty"===Nt&&(()=>{const e=Ye&&Re&&ze,t=t=>{var n;e?(jt(t),Ue([]),St([]),Ct(""),0===t?null===(n=document.getElementById("upload-file"))||void 0===n||n.click():1===t&&(_e(!0),Xe(""))):Yt("Please select Location, Client, and Business Location first.","warning",3e3)},n=n=>{let{value:i,icon:s,title:r,sub:o,accent:l}=n;return(0,xe.jsxs)(g.A,{role:"button",tabIndex:0,onClick:()=>t(i),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t(i))},sx:{flex:1,minWidth:0,display:"flex",alignItems:"center",textAlign:"left",gap:1.25,px:1.5,py:1.25,borderRadius:"10px",border:"1.5px solid #eef2f6",bgcolor:"#fff",opacity:e?1:.6,cursor:e?"pointer":"not-allowed",transition:"all 0.18s ease","&:hover":e?{borderColor:l,boxShadow:"0 4px 12px -4px ".concat(l,"40"),transform:"translateY(-1px)"}:void 0},children:[(0,xe.jsx)(g.A,{sx:{width:32,height:32,borderRadius:"8px",background:"".concat(l,"15"),color:l,display:"flex",alignItems:"center",justifyContent:"center",fontSize:15,flexShrink:0},children:(0,xe.jsx)(s,{})}),(0,xe.jsxs)(g.A,{sx:{minWidth:0,flex:1},children:[(0,xe.jsx)(v.A,{sx:{fontWeight:700,fontSize:13,color:"#1e293b",lineHeight:1.15},children:r}),(0,xe.jsx)(v.A,{sx:{fontSize:11,color:"#94a3b8",lineHeight:1.25},noWrap:!0,children:o})]})]})};return(0,xe.jsxs)(A.A,{alignItems:"center",justifyContent:"center",spacing:1.5,sx:{height:"100%",minHeight:240,bgcolor:"rgba(24,144,255,0.03)",border:"1px dashed rgba(24,144,255,0.25)",borderRadius:"12px",p:3,textAlign:"center"},children:[(0,xe.jsx)(g.A,{sx:{width:56,height:56,borderRadius:"14px",bgcolor:"rgba(24,144,255,0.08)",color:"#1890ff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:28},children:(0,xe.jsx)(se.A,{})}),(0,xe.jsx)(v.A,{sx:{fontWeight:700,color:"#1e293b",fontSize:14},children:"Choose a Drop Source to begin"}),(0,xe.jsx)(v.A,{sx:{color:"#64748b",fontSize:12,maxWidth:360,mb:1},children:"Select a source from below or the left panel to import or pick your delivery customers."}),(0,xe.jsxs)(A.A,{direction:{xs:"column",sm:"row"},gap:1.5,sx:{width:"100%",maxWidth:480,mt:1},children:[n({value:0,icon:ce.CtR,title:"Excel / CSV",sub:"Bulk upload a sheet",accent:"#1890ff"}),n({value:1,icon:le.YXz,title:"Selection",sub:"Pick saved customers",accent:"#65387a"})]})]})})()]})]})})]})]}),(0,xe.jsx)("input",{accept:".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",id:"upload-file",type:"file",hidden:!0,onChange:e=>{const t=e.target.files[0];if(!t)return;const n=t.name.replace(/\.[^/.]+$/,"");Ct((e=>e?"".concat(e,", ").concat(n):n)),(e=>{try{var t;const n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!n)return void kt("No file selected.","warning");const i=n.name.toLowerCase(),s=i.endsWith(".csv"),r=i.endsWith(".xls")||i.endsWith(".xlsx");if(!s&&!r)return void kt("Invalid file type. Please upload a CSV or Excel file.","warning");const o=(e,t)=>{const n={};for(const r in zt)n[Wt(r)]=zt[r];const i=e.map((e=>{const t={};for(const s in e){const r=Wt(s),o=n[r]||r;let l=e[s];"firstname"===o&&(l="string"===typeof(i=l)?i.replace(/^[\d.\s]+/,"").trim():i),t[o]=l}var i;return t})),s=Object.keys(zt).filter((e=>e.trim().endsWith("*"))).filter((e=>!t.includes(Wt(e))));if(s.length>0)return kt("Missing required columns: ".concat(s.join(", ")),"warning",3e3),void St([]);St(i),kt("File uploaded successfully","success",2e3),kt("Press Continue to add as drop customers","info",2500)};if(s&&l().parse(n,{header:!0,dynamicTyping:!0,skipEmptyLines:!0,complete:e=>{var t;if(null===(t=e.data)||void 0===t||!t.length)return kt("CSV file is empty or has no valid rows.","warning"),void St([]);const n=e.meta.fields.map(Wt);o(e.data,n)},error:e=>kt("CSV parsing failed: ".concat(e.message),"warning")}),r){const e=new FileReader;e.onload=e=>{try{const t=e.target.result,n=a.LF(t,{type:"binary"}),i=n.SheetNames[0],s=n.Sheets[i],r=a.Wp.sheet_to_json(s,{defval:""});if(null===r||void 0===r||!r.length)return kt("Excel file is empty or invalid.","warning"),void St([]);const l=Object.keys(r[0]).map(Wt);o(r,l)}catch(t){kt("Error reading Excel: ".concat(t.message),"warning")}},e.readAsBinaryString(n)}}catch(n){kt("Unexpected error: ".concat(n.message),"warning")}})(e)}}),(0,xe.jsxs)(D.A,{open:Ze,onClose:()=>_e(!1),fullWidth:!0,fullScreen:n,sx:{"& .MuiDialog-paper":{borderRadius:{xs:0,sm:"16px"},overflow:"hidden"}},children:[(0,xe.jsx)(H.A,{sx:{bgcolor:t.palette.primary.main,color:"white",py:2.5},children:(0,xe.jsxs)(A.A,{spacing:1.5,children:[(0,xe.jsx)(v.A,{variant:"h4",sx:{fontWeight:600,color:"white"},children:"Select Drop Customers (".concat(Ke.length||0,")")}),(0,xe.jsx)(L.A,{sx:{width:"100%"},children:(0,xe.jsx)(F.A,{autoFocus:!0,fullWidth:!0,id:"input-search-header",placeholder:"Search by name, contact, or address\u2026",value:Qe,onChange:e=>Xe(e.target.value),sx:{bgcolor:"white",borderRadius:"10px","& .MuiOutlinedInput-input":{p:"10px 14px"}},startAdornment:(0,xe.jsx)(w.A,{position:"start",children:(0,xe.jsx)(re.A,{style:{fontSize:"small",color:"#64748b"}})}),endAdornment:(0,xe.jsx)(R.A,{sx:{visibility:Qe?"visible":"hidden",p:.5},onClick:()=>Xe(""),children:(0,xe.jsx)(_.A,{style:{fontSize:"18px"}})}),autoComplete:"off"})})]})}),(0,xe.jsx)(O.A,{}),(0,xe.jsx)(B.A,{sx:{p:2.5,bgcolor:"#fafbfc",minHeight:400,maxHeight:{xs:"none",sm:600}},children:0===(null===Je||void 0===Je?void 0:Je.length)?(0,xe.jsx)(A.A,{alignItems:"center",justifyContent:"center",sx:{minHeight:300},children:(0,xe.jsx)(oe.A,{description:"No saved customers found for this client"})}):(0,xe.jsx)(A.A,{spacing:0,children:null===Je||void 0===Je?void 0:Je.map(((e,t)=>{const n=Ke.some((t=>t.customerid===e.customerid));return(0,xe.jsx)(q.A,{children:(0,xe.jsx)(V.A,{sx:{m:0,py:1,px:1.25,borderRadius:"10px","&:hover":{bgcolor:"rgba(24,144,255,0.04)"}},control:(0,xe.jsx)(K.A,{checked:n,onChange:t=>(async(e,t)=>{Ce(!0);try{if(e.target.checked){const{roundedDistance:e,totalcharge:n}=await Pt(t);Ue((s=>[...s,(0,i.A)((0,i.A)({},t),{},{distance:e,totalcharge:n})]))}else Ue((e=>e.filter((e=>e.customerid!==t.customerid))))}catch(n){console.error("Failed to calculate distance:",n)}finally{Ce(!1)}})(t,e)}),label:(0,xe.jsxs)(g.A,{sx:{width:"100%"},children:[(0,xe.jsxs)(v.A,{sx:{fontWeight:600,color:"#1e293b",fontSize:13.5},children:[e.firstname," (",e.contactno,")"]}),(0,xe.jsx)(v.A,{sx:{color:"#64748b",fontSize:12,mt:.25},children:e.address})]})})},e.customerid||t)}))})}),(0,xe.jsx)(O.A,{}),(0,xe.jsx)(U.A,{sx:{p:2,bgcolor:"#fafbfc"},children:(0,xe.jsx)(k.A,{variant:"outlined",color:0===Ke.length?"error":"primary",onClick:()=>_e(!1),sx:{borderRadius:"10px",textTransform:"none",fontWeight:600,px:3},children:0===Ke.length?"Close":"Continue"})})]})]})}},42041:()=>{},50623:()=>{},62217:e=>{"use strict";e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAA+CAYAAABzwahEAAAPnUlEQVR4AdVae3AU9R3/7d4jdyGQQKAhECBAJBSmEAtFSQUjqPgAHGlhRm0lDkWY6Tg+O9qiErR26h8WR8ZWqTMN1ur4qMpDrTyjtDwDJloeCYiBvAgkaZ53l7vb3X4/v9vfZS/Zu9uFwLSfmb3d293f7u/z+z5/399K7CphdW5JrupgBZosZ0ialmu8pklSjUOTamRJbvvjqTUV7CpAYlcIj+SWZHQ55WJZlm7UNK2IXpRhpZ3GWJskSWXUZrPD4Sp77eSva9gVwIATXz35+SJNYWs1phWxAYDEpDKVaZv+fOrZUjaAGDDiK695rpgetpYOc82upw72sMycdJbz/SzmHeKl/ynRay31bbS1s7rjTczXGYj3ihrShnUDNQCXTXzlNS8UyExdbybhSdeNYwXz81nBzflE2pKms7oT51ntiSa276NKVn3wrNktNcGQelNpTUkNuwxcFvFV+S88rKnKy8ZzkOz84uvYvOJZ/PhyAE3Y/+HXbN+HFVwjjJAlR8lr1WueY9wt2MclEYfj8rnkj+nwRnHOLuGWhnbmpfuMKh/3Xn0Atm74IuY8OcGPFYk99kbVM98xm7BFnDyttHLyb3MlRdsjSWycOA+VLv79YpY5Ork6V5efY59s/JJVHznH/+dMymLz7v0Rm71oWtK2GIDSJ7ew6kMxJlCjytI8u+Qddm4+93bPBIfqiiG96KG5RPouljokuZT3b/2avf7EB6ylsZ1dM2MsG5OfxU7RAFSWVbMAObUphRMTtsc7CpdMh6c3kqe8gN117Yh5W4627GljFmGZ+C/ynx/flzSkDPW2Aqj2+lV/Y5mj0tljG3/GFhQXspkLpnBJVx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YI6depUjYhbtuWrBW775GGd1FEXFQA8FFsR8+HRMdFBKocgPrTvRkgnh4l70ijPxtwAzpLnCLpDvSztvFqQ9C8PuAPEINDeTdpgjADYjOFQhESn3s6hP+OKr9dfSUhCaiIcYjNIMur52f850f95/BfoYlARf1CQvwAAAABJRU5ErkJggg=="},79520:(e,t,n)=>{"use strict";n.d(t,{D:()=>s,F:()=>i});const i=async(e,t)=>{const n=null===e||void 0===e?void 0:e.latitude,i=null===e||void 0===e?void 0:e.longitude,s=null===t||void 0===t?void 0:t.latitude,r=null===t||void 0===t?void 0:t.longitude;if(null==n||null==i||null==s||null==r)throw new Error("Invalid coordinates");const o={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_API_URL:"https://mock-data-api-nextjs.vercel.app/",REACT_APP_AUTH0_CLIENT_ID:"",REACT_APP_AUTH0_DOMAIN:"",REACT_APP_AWS_APP_CLIENT_ID:"",REACT_APP_AWS_POOL_ID:"",REACT_APP_FIREBASE_API_KEY:"",REACT_APP_FIREBASE_APP_ID:"",REACT_APP_FIREBASE_AUTH_DOMAIN:"",REACT_APP_FIREBASE_MEASUREMENT_ID:"",REACT_APP_FIREBASE_MESSAGING_SENDER_ID:"",REACT_APP_FIREBASE_PROJECT_ID:"",REACT_APP_FIREBASE_STORAGE_BUCKET:"",REACT_APP_RIDER_ACCESS_ID:"AAAAILMpCEU:APA91bEavuOllBI6sFgYtxXAgNmAVwNA-MnCMHLGlR4_t7UqpLajAkdn3T0CZr_zaLBknLyim9ytFLMZgbeXmKqTad_PKCbqlYjHpaizVrLXtecxqyEy4UktIacK2UvHVUATHL-7VQQk",REACT_APP_STAFF_TOKEN:"",REACT_APP_URL:"https://jupiter.nearle.app/live/api/v1",REACT_APP_URL2:"https://jupiter.nearle.app/live/api/v2",REACT_APP_URL3:"https://jupiter.nearle.app/live/api/v3",REACT_APP_VERSION:"v2.1.0"}.REACT_APP_OSRM_URL||"https://router.project-osrm.org";try{const e="".concat(o,"/route/v1/driving/").concat(i,",").concat(n,";").concat(r,",").concat(s,"?overview=false"),t=await fetch(e);if(t.ok){const e=await t.json();if(e.routes&&e.routes.length>0){const t=e.routes[0].distance/1e3;return Math.round(t)}}}catch(p){console.warn("OSRM API failed, falling back to Haversine math:",p)}const l=e=>e*Math.PI/180,a=l(s-n),c=l(r-i),d=Math.sin(a/2)*Math.sin(a/2)+Math.cos(l(n))*Math.cos(l(s))*Math.sin(c/2)*Math.sin(c/2),h=6371*(2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)));return Math.round(1.3*h)},s=(e,t,n,i)=>e<i?t:(e-i)*n+t},94826:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var i=n(60308),s=n(12010),r=n(62217),o=n(65908);const l=(0,i.Ay)("div")((()=>({position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:2001,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255, 255, 255, 0.7)",padding:"20px",borderRadius:"10px"}))),a=(0,i.Ay)("div")((()=>({position:"absolute",width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center"}))),c=()=>(0,o.jsxs)(l,{children:[(0,o.jsx)(s.A,{color:"primary",size:80,thickness:6}),(0,o.jsx)(a,{children:(0,o.jsx)("img",{src:r,alt:"Logo",style:{width:"100%",height:"100%"}})})]})}}]);