1 line
37 KiB
JavaScript
1 line
37 KiB
JavaScript
(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[4859],{38215:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(17592),a=n(85281),i=n(46417),o=(0,r.ZP)("div")((function(){return{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"}})),c=(0,r.ZP)("div")((function(){return{position:"absolute",width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center"}})),s=function(){return(0,i.jsxs)(o,{children:[(0,i.jsx)(a.Z,{color:"primary",size:80,thickness:6}),(0,i.jsx)(c,{children:(0,i.jsx)("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAA+CAYAAABzwahEAAAPnUlEQVR4AdVae3AU9R3/7d4jdyGQQKAhECBAJBSmEAtFSQUjqPgAHGlhRm0lDkWY6Tg+O9qiErR26h8WR8ZWqTMN1ur4qMpDrTyjtDwDJloeCYiBvAgkaZ53l7vb3X4/v9vfZS/Zu9uFwLSfmb3d293f7u/z+z5/399K7CphdW5JrupgBZosZ0ialmu8pklSjUOTamRJbvvjqTUV7CpAYlcIj+SWZHQ55WJZlm7UNK2IXpRhpZ3GWJskSWXUZrPD4Sp77eSva9gVwIATXz35+SJNYWs1phWxAYDEpDKVaZv+fOrZUjaAGDDiK695rpgetpYOc82upw72sMycdJbz/SzmHeKl/ynRay31bbS1s7rjTczXGYj3ihrShnUDNQCXTXzlNS8UyExdbybhSdeNYwXz81nBzflE2pKms7oT51ntiSa276NKVn3wrNktNcGQelNpTUkNuwxcFvFV+S88rKnKy8ZzkOz84uvYvOJZ/PhyAE3Y/+HXbN+HFVwjjJAlR8lr1WueY9wt2MclEYfj8rnkj+nwRnHOLuGWhnbmpfuMKh/3Xn0Atm74IuY8OcGPFYk99kbVM98xm7BFnDyttHLyb3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EY9rSQqOTHAmP91TFdNGChJsyPTdlelztqcMu6i+XvNiIkBQRHlcPHGv6sUbHIKzo56J1AZBkvR5cSFhUVBR2CbD69bIpysvLecdoAHqINOytm0ijJt9J3r+TVBLHXfrGkwsiJRIMLF1i76MBEue7qE0XqTPadYiNnFen3j6Ad5HGYSDwTcslkQYGamVULLrLpH7y6dOnuY1TGctFFR0hcYfhvujinQ6eaNBgYc6sEHm+0WAKqatEWJkwYYI6depUjYhbtuWrBW775GGd1FEXFQA8FFsR8+HRMdFBKocgPrTvRkgnh4l70ijPxtwAzpLnCLpDvSztvFqQ9C8PuAPEINDeTdpgjADYjOFQhESn3s6hP+OKr9dfSUhCaiIcYjNIMur52f850f95/BfoYlARf1CQvwAAAABJRU5ErkJggg==",alt:"Logo",style:{width:"100%",height:"100%"}})})]})}},80887:function(e,t,n){"use strict";n.r(t);var r=n(93433),a=n(1413),i=n(74165),o=n(15861),c=n(29439),s=n(47313),l=n(11577),d=n(19860),u=n(97316),p=n(56573),h=n(23195),f=n(15708),m=n(11829),g=n(3598),v=n(40765),x=n(95569),Z=n(7308),j=n(29736),y=n(23208),S=n(45904),w=n(10658),k=n.n(w),Y=n(90842),b=n(58467),C=n(13997),A=n.n(C),M=n(48737),D=n(91554),P=n(9019),T=n(42832),E=n(61113),W=n(16783),z=n(41727),H=n(76088),I=n(57829),R=n(69099),L=n(1550),J=n(5178),N=n(54299),F=n(83929),U=n(74268),q=n(51629),V=n(70501),B=n(66835),G=n(23477),O=n(24076),K=n(67478),Q=n(57861),X=n(85281),_=n(94469),$=n(33604),ee=n(49914),te=n(47131),ne=n(19536),re=n(96467),ae=n(16429),ie=n(44758),oe=n(4117),ce=n(38215),se=n(46417),le=n(91635);k().extend(le);t.default=function(){var e,t=(0,b.s0)(),n=(0,d.Z)(),w=(0,s.useRef)(null),C=(0,s.useRef)(null),le=localStorage.getItem("userid"),de=(0,s.useState)([]),ue=(0,c.Z)(de,2),pe=(ue[0],ue[1]),he=(0,s.useState)([]),fe=(0,c.Z)(he,2),me=(fe[0],fe[1]),ge=(0,s.useState)(!1),ve=(0,c.Z)(ge,2),xe=ve[0],Ze=ve[1],je=(0,s.useState)(!1),ye=(0,c.Z)(je,2),Se=ye[0],we=ye[1],ke=(0,s.useState)(0),Ye=(0,c.Z)(ke,2),be=Ye[0],Ce=(Ye[1],(0,s.useState)([])),Ae=(0,c.Z)(Ce,2),Me=Ae[0],De=Ae[1],Pe=localStorage.getItem("tenantid"),Te=(0,s.useState)(0),Ee=(0,c.Z)(Te,2),We=Ee[0],ze=Ee[1],He=(0,s.useState)(0),Ie=(0,c.Z)(He,2),Re=Ie[0],Le=Ie[1],Je=(0,s.useState)(0),Ne=(0,c.Z)(Je,2),Fe=Ne[0],Ue=Ne[1],qe=(0,s.useState)(0),Ve=(0,c.Z)(qe,2),Be=Ve[0],Ge=Ve[1],Oe=(0,s.useState)(null),Ke=(0,c.Z)(Oe,2),Qe=Ke[0],Xe=Ke[1],_e=(0,s.useState)([]),$e=(0,c.Z)(_e,2),et=$e[0],tt=$e[1],nt=(0,s.useState)(!1),rt=(0,c.Z)(nt,2),at=rt[0],it=rt[1],ot=(0,s.useState)(""),ct=(0,c.Z)(ot,2),st=ct[0],lt=ct[1],dt=(0,s.useState)([]),ut=(0,c.Z)(dt,2),pt=ut[0],ht=ut[1],ft=(0,s.useState)(k()().format("MM-DD-YYYY")),mt=(0,c.Z)(ft,2),gt=mt[0],vt=mt[1],xt=(0,s.useState)([]),Zt=(0,c.Z)(xt,2),jt=Zt[0],yt=Zt[1],St=(0,s.useState)(),wt=(0,c.Z)(St,2),kt=(wt[0],wt[1]),Yt=(0,s.useState)(),bt=(0,c.Z)(Yt,2),Ct=(bt[0],bt[1]),At=(0,s.useState)(""),Mt=(0,c.Z)(At,2),Dt=Mt[0],Pt=Mt[1],Tt=(0,s.useState)(""),Et=(0,c.Z)(Tt,2),Wt=Et[0],zt=Et[1],Ht=(0,s.useState)(""),It=(0,c.Z)(Ht,2),Rt=It[0],Lt=It[1],Jt=(0,s.useState)(),Nt=(0,c.Z)(Jt,2),Ft=Nt[0],Ut=Nt[1],qt=(0,s.useState)(0),Vt=(0,c.Z)(qt,2),Bt=Vt[0],Gt=Vt[1],Ot=(0,s.useState)(0),Kt=(0,c.Z)(Ot,2),Qt=Kt[0],Xt=Kt[1],_t=(0,s.useState)(0),$t=(0,c.Z)(_t,2),en=$t[0],tn=$t[1],nn=(0,s.useState)(0),rn=(0,c.Z)(nn,2),an=rn[0],on=rn[1],cn=(0,s.useState)([]),sn=(0,c.Z)(cn,2),ln=sn[0],dn=sn[1],un=(0,s.useState)(null),pn=(0,c.Z)(un,2),hn=pn[0],fn=pn[1],mn=(0,s.useState)(null),gn=(0,c.Z)(mn,2),vn=(gn[0],gn[1],(0,s.useState)(null)),xn=(0,c.Z)(vn,2),Zn=xn[0],jn=xn[1],yn=(0,s.useState)(null),Sn=(0,c.Z)(yn,2),wn=Sn[0],kn=Sn[1],Yn=(0,s.useState)(null),bn=(0,c.Z)(Yn,2),Cn=bn[0],An=bn[1];(0,s.useEffect)((function(){if(jt[0]){var e=[];jt.map((function(t){k()().diff(k()("".concat(k()(gt).format("MM-DD-YYYY")," ").concat(k()(t).format("HH:mm:ss"))),"m")<=0&&e.push(t)}))}}),[jt]);var Mn=function(e,t,n){(0,Y.yv)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:n||1500}),console.log(Wt)},Dn={},Pn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e4,r="".concat(t,"-").concat(e);Dn[r]||(Mn(e,t,n),Dn[r]=!0,setTimeout((function(){return delete Dn[r]}),3e3))},Tn=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ze(!0),e.prev=1,e.next=4,p.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/partners/getlocations/?userid=").concat(le));case 4:t=e.sent,console.log("fetchAppLocations",t.data.details),pe(t.data.details),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(1),console.log("locationRes",e.t0),Pn(e.t0.message,"error",5e3);case 13:return e.prev=13,Ze(!1),e.finish(13);case 16:case"end":return e.stop()}}),e,null,[[1,9,13,16]])})));return function(){return e.apply(this,arguments)}}();(0,s.useEffect)((function(){Tn()}),[]);var En=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ze(!0),e.next=3,p.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenants/?applocationid=").concat(be,"&status=active")).then((function(e){if(console.log(e),e.data.status){var t=[];e.data.details.map((function(e){t.push((0,a.Z)((0,a.Z)({},e),{},{label:"".concat(e.tenantname)}))})),me(t)}Ze(!1)})).catch((function(e){console.log(e),Ze(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,s.useEffect)((function(){be&&En()}),[be]);var Wn=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(t){var n;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantpricing/?tenantid=").concat(t));case 3:n=e.sent,console.log("pricingResponse",n.data.details),Le(n.data.details.baseprice),Ue(n.data.details.priceperkm),Ge(n.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(t){return e.apply(this,arguments)}}();(0,s.useEffect)((function(){Wn(Pe)}),[Pe]);var zn=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(t){var n;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantlocations/?tenantid=").concat(t));case 3:n=e.sent,console.log("gettenantlocations",n.data.details),1==n.data.details.length?(De(n.data.details),Xe(n.data.details[0]),ze(n.data.details[0].locationid),jn(n.data.details[0].locationid),kn(n.data.details[0].slots)):De(n.data.details),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),console.log("gettenantlocations",e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t){return e.apply(this,arguments)}}();(0,s.useEffect)((function(){zn(Pe)}),[Pe]);var Hn=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=""==st?"".concat("https://jupiter.nearle.app/live/api/v1","/customers/gettenantcustomers/?tenantid=").concat(Pe,"&pageno=1&pagesize=30"):"".concat("https://jupiter.nearle.app/live/api/v1","/customers/search/?tenantid=").concat(Pe,"&keyword=").concat(st),e.next=4,p.Z.get(t).then((function(e){if(e.data.status){console.log("clientdetails",e.data.details),ht(e.data.details);var t=[];e.data.details.map((function(e){t.push((0,a.Z)({label:"".concat(e.firstname," | ").concat(e.contactno)},e))}))}})).catch((function(e){console.log(e),Mn("server error","warning")}));case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.log(e.t0);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(){return e.apply(this,arguments)}}();(0,s.useEffect)((function(){Pe&&Hn()}),[st.length>3,""==st,Pe]);(0,s.useEffect)((function(){!function(){var e=0,t=0,n=0,r=0;et.map((function(a){e+=a.distance,t+=a.totalcharge,n+=a.quantity,r+=a.collectionamt})),Gt(e),Xt(t),tn(n),on(r)}()}),[et]);var In=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(t,n){var o,c,s,l;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ze(!0),!t.target.checked){e.next=19;break}return e.prev=2,e.next=5,Ln(n);case 5:o=e.sent,c=o.roundedDistance,s=o.totalcharge,l=(0,a.Z)((0,a.Z)({},n),{},{distance:c,totalcharge:s}),tt((function(e){return[].concat((0,r.Z)(e),[l])})),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(2),console.error("Failed to calculate distance:",e.t0);case 14:return e.prev=14,Ze(!1),e.finish(14);case 17:e.next=21;break;case 19:tt((function(e){return e.filter((function(e){return e.customerid!==n.customerid}))})),Ze(!1);case 21:case"end":return e.stop()}}),e,null,[[2,11,14,17]])})));return function(t,n){return e.apply(this,arguments)}}(),Rn=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(t){var n,o,c,s;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("customer",t),Ze(!0),e.prev=2,tt((function(e){return e.some((function(e){return e.firstname===t.firstname}))?e.filter((function(e){return e.firstname!==t.firstname})):e})),et.some((function(e){return e.firstname===t.firstname}))){e.next=13;break}return e.next=8,Ln(t);case 8:n=e.sent,o=n.roundedDistance,c=n.totalcharge,s=(0,a.Z)((0,a.Z)({},t),{},{distance:o,totalcharge:c}),tt((function(e){return[].concat((0,r.Z)(e),[s])})),console.log("Rounded Distance: ".concat(o," km"));case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(2),console.error("Failed to calculate distance:",e.t0);case 18:return e.prev=18,Ze(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[2,15,18,21]])})));return function(t){return e.apply(this,arguments)}}(),Ln=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(t){var n,r,a,o,c,s,l,d,u,p,h;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new google.maps.DistanceMatrixService,r=function(e,t){return new Promise((function(r,a){try{if(!e||!t)return a(new Error("Origin or destination data missing."));n.getDistanceMatrix({origins:[new google.maps.LatLng(e.latitude,e.longitude)],destinations:[new google.maps.LatLng(t.latitude,t.longitude)],travelMode:"DRIVING",unitSystem:google.maps.UnitSystem.METRIC},(function(e,t){"OK"===t?r(e):a(new Error("Google API error: ".concat(t)))}))}catch(i){a(new Error("Unexpected error inside DistanceMatrixService: ".concat(i.message)))}}))},e.prev=2,t&&"object"===typeof t){e.next=5;break}throw new Error("Invalid customer data: expected an object.");case 5:if(Qe&&"object"===typeof Qe){e.next=7;break}throw new Error("Origin (pickCust) data missing or invalid.");case 7:return e.next=9,r(Qe,t);case 9:if(l=e.sent,null!==(a=l.rows)&&void 0!==a&&null!==(o=a[0])&&void 0!==o&&null!==(c=o.elements)&&void 0!==c&&c[0]&&null!==(s=l.rows[0].elements[0].distance)&&void 0!==s&&s.value){e.next=12;break}throw new Error("Malformed Distance Matrix response: missing distance value.");case 12:return d=l.rows[0].elements[0].distance.value,u=d/1e3,p=Math.round(u),h=p<Be?Re:(p-Be)*Fe+Re,e.abrupt("return",{roundedDistance:p,totalcharge:h});case 19:throw e.prev=19,e.t0=e.catch(2),console.log("on calculateDistance",e.t0.message),e.t0.message.includes("Google API")?(console.log("\ud83d\udea8 Google Maps API Error:",e.t0.message),Pn("Invalid file format, upload valid file","error",5e3)):e.t0.message.includes("Invalid coordinates")?(console.log("\ud83d\udccd Invalid coordinate format:",e.t0.message,3e3),Pn("Invalid coordinate format. Check location data.","warning")):e.t0.message.includes("Malformed Distance Matrix")?(console.log("\u26a0\ufe0f Unexpected Google response structure:",e.t0.message),Pn("Google Distance Matrix returned invalid data.","error",3e3)):e.t0.message.includes("Origin")||e.t0.message.includes("customer")?(console.log("\u274c Missing or invalid input data:",e.t0.message),Pn("Missing or invalid input data for distance calculation.","warning",3e3)):(console.log("\ud83d\udca5 Unexpected error calculating distance:",e.t0),Pn("Unexpected error during distance calculation.","error",3e3)),e.t0;case 24:case"end":return e.stop()}}),e,null,[[2,19]])})));return function(t){return e.apply(this,arguments)}}(),Jn=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ze(!0),e.next=3,p.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocations/?applocationid=").concat(be)).then((function(e){console.log("fetchTiming",e);var t=e.data.details[0],n=t.opentime,r=t.closetime;if(e.data.status){kt("".concat(k()().format("MM-DD-YYYY")," ").concat(n)),Ct("".concat(k()().format("MM-DD-YYYY")," ").concat(r)),console.log("starttime","".concat(k()().format("MM-DD-YYYY")," ").concat(n)),console.log("endtime","".concat(k()().format("MM-DD-YYYY")," ").concat(r," "));for(var a=[],i="".concat(k()().format("MM-DD-YYYY")," ").concat(n);k()("".concat(k()().format("MM-DD-YYYY")," ").concat(r," ")).diff(i,"m")>=0;i=k()(i).add(30,"m"))a.push(i);console.log("setTimeslotarr",a),yt(a)}Ze(!1)})).catch((function(e){console.log(e),Ze(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,s.useEffect)((function(){be&&Jn()}),[be]);var Nn=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ze(!0),e.next=3,p.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocationconfig/?applocationid=").concat(be)).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&&Ut(t),Ze(!1)})).catch((function(e){console.log(e),Ze(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,s.useEffect)((function(){be&&Nn()}),[be]),(0,s.useEffect)((function(){console.log("pickCust",Qe)}),[Qe]),(0,s.useEffect)((function(){console.log("dropCust",et)}),[et]);var Fn=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ze(!0),e.next=3,p.Z.post("".concat("https://jupiter.nearle.app/live/api/v1","/utils/sendnotifications"),{priority:"high",registration_ids:Ft,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"}}).then((function(e){console.log(e),"Success"==e.data.message&&(0,Y.yv)("Notification sent Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:1e3}),Ze(!1)})).catch((function(e){console.log(e),(0,Y.yv)(e.message,{variant:"error",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:1e3}),Ze(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Un=function(e){return"string"!==typeof e?e:e.replace(/^[\d.\s]+/,"").trim()},qn={"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"},Vn=function(e){return null===e||void 0===e?void 0:e.toString().trim().toLowerCase().replace(/\s+/g,"")},Bn=function(e){try{var t,n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!n)return void Mn("No file selected.","warning");var r=n.name.toLowerCase(),a=r.endsWith(".csv"),i=r.endsWith(".xls")||r.endsWith(".xlsx");if(!a&&!i)return void Mn("Invalid file type. Please upload a CSV or Excel file.","warning");var o=function(e,t){console.log("data",e);var n={};for(var r in qn)n[Vn(r)]=qn[r];console.log("normalizedMap",n);var a=e.map((function(e){var t={};for(var r in e){var a=Vn(r),i=n[a]||a,o=e[r];"firstname"===i&&(o=Un(o)),t[i]=o}return t})),o=Object.keys(qn).filter((function(e){return!t.includes(Vn(e))}));o.length>0&&i&&Mn("Missing columns: ".concat(o.join(", ")),"warning"),console.log("\u2705 Final Processed Data:",a),dn(a),Mn("File uploaded and successfully ","success",3e3),Mn("Press Continue","warning",3e3)};if(a&&A().parse(n,{header:!0,dynamicTyping:!0,skipEmptyLines:!0,complete:function(e){var t;if(null===(t=e.data)||void 0===t||!t.length)return Mn("CSV file is empty or has no valid rows.","warning"),void dn([]);var n=e.meta.fields.map(Vn);o(e.data,n)},error:function(e){console.error("\u274c CSV Parsing Error:",e),Mn("CSV parsing failed: ".concat(e.message),"warning")}}),i){var c=new FileReader;c.onload=function(e){try{var t,n=e.target.result;try{t=M.ij(n,{type:"binary"})}catch(l){var r=new Uint8Array(n);t=M.ij(r,{type:"array"})}var a=t.SheetNames[0],i=t.Sheets[a],c=M.P6.sheet_to_json(i,{defval:""});if(null===c||void 0===c||!c.length)return Mn("Excel file is empty or invalid.","warning"),void dn([]);var s=Object.keys(c[0]).map(Vn);o(c,s)}catch(d){console.error("\u274c Error processing Excel:",d),Mn("Error reading Excel: ".concat(d.message),"warning")}},c.readAsBinaryString(n)}}catch(s){console.error("Unexpected error during file upload:",s),Mn("Unexpected error: ".concat(s.message),"warning")}},Gn=function(){var e=(0,o.Z)((0,i.Z)().mark((function e(){var n,r,a,o,c;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=et.map((function(e){var t,n,r,a;return{applocationid:Qe.applocationid,configid:9,partnerid:Qe.partnerid,partneruserid:+le,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===(t=e.contactno)||void 0===t?void 0:t.toString())||"",deliverycustomer:e.firstname||"",deliveryid:+e.customerid,deliverylandmark:e.landmark||"",deliverylat:(null===(n=e.latitude)||void 0===n?void 0:n.toString())||"",deliverylocation:e.suburb||"",deliverylocationid:e.deliverylocationid||0,deliverylong:(null===(r=e.longitude)||void 0===r?void 0:r.toString())||"",deliverytime:"".concat(k()(gt).format("YYYY-MM-DD")," ").concat(k()(Dt.$d).format("HH:mm:ss")),deliverytype:"B",itemcount:1,quantity:e.quantity,collectionamt:e.collectionamt,kms:(null===(a=e.distance)||void 0===a?void 0:a.toString())||"0",locationid:+Qe.locationid,moduleid:+Qe.moduleid,orderamount:+e.totalcharge||0,ordercharges:0,orderdate:k()().format("YYYY-MM-DD HH:mm:ss"),ordernotes:Rt,orderstatus:"created",ordervalue:+e.totalcharge||0,pickupSlot:Cn}})),console.log("arr",n),Pe){e.next=5;break}return Mn("Choose Client","warning"),e.abrupt("return");case 5:return Ze(!0),e.prev=6,e.next=9,p.Z.post("".concat("https://jupiter.nearle.app/live/api/v1","/orders/createorders"),n);case 9:(r=e.sent).data.status?(Mn("Order Created Successfully","success",2e3),Ft&&Fn(),t("/nearle/orders"),Ze(!1)):(console.log(r.data),console.error("Create order failed (API response):",r.data),Mn((null===r||void 0===r||null===(a=r.data)||void 0===a?void 0:a.message)||"Order creation failed. Please try again.","warning",3e3)),e.next=22;break;case 13:e.prev=13,e.t0=e.catch(6),Mn(e.t0.message,"error",2e3),console.log("create orders",e.t0.message),console.error("Create order error:",{message:e.t0.message,response:e.t0.response,request:e.t0.request,stack:e.t0.stack}),o="Something went wrong. Please try again.",e.t0.response?o=(null===(c=e.t0.response.data)||void 0===c?void 0:c.message)||"Server error (".concat(e.t0.response.status,")"):e.t0.request&&(o="Network error. Check your internet connection."),Mn(o,"error"),Ze(!1);case 22:return e.prev=22,Ze(!1),we(!1),e.finish(22);case 26:case"end":return e.stop()}}),e,null,[[6,13,22,26]])})));return function(){return e.apply(this,arguments)}}(),On=(0,s.useState)(""),Kn=(0,c.Z)(On,2),Qn=Kn[0],Xn=Kn[1],_n=function(e,t){tt((function(n){return n.map((function(n){return n.customerid===e?(0,a.Z)((0,a.Z)({},n),{},{collectionamt:Number(t)||0}):n}))}))};return(0,se.jsxs)(se.Fragment,{children:[xe&&(0,se.jsx)(se.Fragment,{children:(0,se.jsx)(l.Z,{})}),(0,se.jsx)(D.Z,{sx:{color:"#fff",zIndex:function(e){return e.zIndex.drawer+1}},open:Se,children:(0,se.jsx)(ce.Z,{color:"inherit"})}),(0,se.jsxs)(P.ZP,{container:!0,spacing:3,sx:{position:"sticky",top:"60px",bgcolor:n.palette.background.default,zIndex:100,display:"flex",flexDirection:"column",justifyContent:"start",alignItems:"center",spacing:5},children:[(0,se.jsx)(P.ZP,{item:!0,xs:12,sx:{width:"100%",mt:-1},children:(0,se.jsx)(T.Z,{children:(0,se.jsx)(E.Z,{variant:"h3",children:" Create Multiple Order"})})}),(0,se.jsx)(P.ZP,{item:!0,xs:12,sx:{width:"100%",mt:-2},children:(0,se.jsx)(u.Z,{sx:{height:"100%"},children:(0,se.jsx)(P.ZP,{container:!0,spacing:3,sx:{},children:(0,se.jsx)(P.ZP,{item:!0,xs:12,sm:4,children:1==(null===Me||void 0===Me?void 0:Me.length)?(0,se.jsx)(W.Z,{variant:"outlined",fullWidth:!0,label:"Business Location",value:(null===(e=Me[0])||void 0===e?void 0:e.locationname)||"",focused:!0,InputProps:{style:{color:n.palette.primary.main},startAdornment:(0,se.jsx)(z.Z,{position:"start",children:(0,se.jsx)(Z.Z,{color:"primary"})})}}):(0,se.jsx)(H.Z,{fullWidth:!0,options:Me||[],getOptionLabel:function(e){return"".concat(e.locationname," (").concat(e.suburb,")")||0},value:Zn,onOpen:function(e){be||Pe?Pe||(e.preventDefault(),Pn("Please select Tenant first!","warning",3e3),setTimeout((function(){var e;null===(e=C.current)||void 0===e||e.focus()}),0)):(e.preventDefault(),Pn("Please select Location and Tenant first!","warning",3e3),setTimeout((function(){var e;null===(e=w.current)||void 0===e||e.focus()}),0))},onChange:function(e,t,n){"clear"===n?(ze(0),jn(null),Xe(null)):(ze(t.locationid||0),jn(t),Xe(t),kn(null===t||void 0===t?void 0:t.slots))},renderInput:function(e){return(0,se.jsx)(W.Z,(0,a.Z)((0,a.Z)({},e),{},{label:"Select Business Locations",color:"primary"}))}})})})})}),(0,se.jsx)(P.ZP,{item:!0,xs:12,sx:{width:"100%",mt:0},children:(0,se.jsxs)(P.ZP,{container:!0,xs:12,spacing:3,children:[0!==We&&(0,se.jsx)(P.ZP,{item:!0,xs:12,children:(0,se.jsx)(I.Z,{display:"flex",alignItems:"center",sx:{},children:(0,se.jsx)(W.Z,{label:"Pickup Location",fullWidth:!0,value:"".concat(null===Qe||void 0===Qe?void 0:Qe.locationname," (").concat(null===Qe||void 0===Qe?void 0:Qe.address,")"),InputProps:{readOnly:!0,style:{fontSize:"1rem",fontWeight:"bold",color:n.palette.primary.main}}})})}),(0,se.jsxs)(s.Fragment,{children:[(0,se.jsx)(P.ZP,{item:!0,xs:6,children:(0,se.jsx)(T.Z,{children:(0,se.jsx)(y._,{dateAdapter:S.y,sx:{},children:(0,se.jsx)(j.M,{format:"DD-MM-YYYY",onChange:function(e){vt(e);var t=k()().diff(k()("".concat(k()(e).format("YYYY-MM-DD"))),"d");if(console.log("dateres11"),console.log(t),Pt(""),t<=0){console.log("startdate",e),vt(e);var n=[];jt.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)}))}else zt("choose Upcoming Date"),Mn("choose Upcoming Date","warning"),vt(NaN)},value:k()(gt),sx:{width:"auto",mt:0},disablePast:!0})})})}),(0,se.jsx)(P.ZP,{item:!0,xs:6,children:(0,se.jsx)(H.Z,{options:wn||[],onChange:function(e,t,n){if("clear"===n)Pt(null),An(null);else{var r=k()(t.time,"HH:mm").format("hh:mm A");Pt(r);var a=k()("".concat(gt," ").concat(r),"MM-DD-YYYY hh:mm A").format("YYYY-MM-DD hh:mm A");An(a)}},getOptionLabel:function(e){return"".concat(e.name," (").concat(k()(e.time,"HH:mm").format("hh:mm A"),")")},renderInput:function(e){return(0,se.jsx)(W.Z,(0,a.Z)((0,a.Z)({},e),{},{placeholder:"Select Pickup Slot"}))}})})]})]})}),(0,se.jsx)(P.ZP,{item:!0,xs:12,sx:{width:"100%",mt:0},children:(0,se.jsx)(u.Z,{sx:{height:"100%"},title:(0,se.jsxs)(T.Z,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",sx:{mr:1},children:[(0,se.jsxs)(E.Z,{variant:"h5",sx:{p:3,whiteSpace:"nowrap"},children:["Drop (",(null===et||void 0===et?void 0:et.length)||0,")"]}),(0,se.jsxs)(T.Z,{direction:"row",gap:2,alignItems:"center",justifyContent:"flex-end",flexWrap:"wrap",sx:{m:3},children:[0===hn&&(0,se.jsxs)(se.Fragment,{children:[Qn&&(0,se.jsxs)(T.Z,{direction:"row",spacing:1,children:[(0,se.jsx)(f.Z,{}),(0,se.jsx)(E.Z,{variant:"body2",color:"text.secondary",children:Qn})]}),(0,se.jsx)("input",{accept:".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",id:"upload-file",type:"file",hidden:!0,onChange:function(e){var t=e.target.files[0];if(t){var n=function(e){return e.replace(/\.[^/.]+$/,"")}(t.name);Xn((function(e){return e?"".concat(e,", ").concat(n):n})),Bn(e)}}}),(0,se.jsx)("label",{htmlFor:"upload-file",children:(0,se.jsx)(R.Z,{variant:"contained",size:"small",component:"span",sx:{minHeight:36},children:(null===et||void 0===et?void 0:et.length)>0?"Add More Files":" Upload CSV"})})]}),ln.length>=1&&0===hn&&(0,se.jsx)(R.Z,{variant:"contained",size:"small",color:"warning",sx:(0,a.Z)({minHeight:36},!(null!==et&&void 0!==et&&et.length)&&{"@keyframes blink":{"0%":{opacity:1},"50%":{opacity:.3},"100%":{opacity:1}},animation:"blink 1s infinite"}),onClick:function(){ln.forEach((function(e){return Rn(e)}))},children:"Continue"}),1===hn&&(0,se.jsx)(R.Z,{variant:"outlined",size:"small",sx:{minHeight:36},onClick:function(){it(!0),lt("")},children:"Select Customers"}),(0,se.jsx)(T.Z,{sx:{bgcolor:"secondary.lighter",py:.5,px:1,borderRadius:2},children:(0,se.jsxs)(L.Z,{size:"small",children:[(0,se.jsx)(J.Z,{sx:{fontSize:12},children:"Upload Type"}),(0,se.jsxs)(N.Z,{row:!0,value:hn,onChange:function(e){We?(fn(Number(e.target.value)),tt([]),dn([]),Xn("")):Pn("Please select Business Location !","warning",3e3)},children:[(0,se.jsx)(F.Z,{value:0,control:(0,se.jsx)(U.Z,{size:"small"}),label:"Excel / CSV"}),(0,se.jsx)(F.Z,{value:1,control:(0,se.jsx)(U.Z,{size:"small"}),label:"Selection"})]})]})})]})]}),children:(0,se.jsx)(q.Z,{component:V.Z,children:(0,se.jsx)(B.Z,{children:(null===et||void 0===et?void 0:et.length)>0?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(G.Z,{children:(0,se.jsxs)(O.Z,{children:[(0,se.jsx)(K.Z,{children:"S.No"}),(0,se.jsx)(K.Z,{children:"Customer"}),(0,se.jsx)(K.Z,{children:"Address"}),(0,se.jsx)(K.Z,{align:0==hn?"right":"center",children:"Quantity"}),(0,se.jsx)(K.Z,{sx:{whiteSpace:"nowrap"},align:0==hn?"right":"center",children:"Cash Collect"}),(0,se.jsx)(K.Z,{children:"Kms"}),(0,se.jsx)(K.Z,{align:"right",children:"Charge"}),(0,se.jsx)(K.Z,{align:"center",children:"Action"})]})}),(0,se.jsxs)(Q.Z,{children:[null===et||void 0===et?void 0:et.map((function(e,t){var n;return(0,se.jsxs)(O.Z,{children:[(0,se.jsx)(K.Z,{children:t+1}),(0,se.jsx)(K.Z,{sx:{whiteSpace:"nowrap"},children:e.firstname}),(0,se.jsx)(K.Z,{children:e.address}),(0,se.jsx)(K.Z,{align:"center",children:0==hn?(0,se.jsx)(E.Z,{children:e.quantity}):(0,se.jsx)(W.Z,{size:"small",type:"number",value:e.quantity,onChange:function(t){return n=e.customerid,r=t.target.value,void tt((function(e){return e.map((function(e){return e.customerid===n?(0,a.Z)((0,a.Z)({},e),{},{quantity:Number(r)||0}):e}))}));var n,r},inputProps:{min:0}})}),(0,se.jsx)(K.Z,{align:"center",children:0==hn?(0,se.jsxs)(E.Z,{children:["\u20b9",Number(e.collectionamt||0).toFixed(2)]}):(0,se.jsx)(W.Z,{size:"small",type:"number",value:e.collectionamt?e.collectionamt:"",placeholder:"0",onChange:function(t){t.target.value<=0?_n(e.customerid,0):_n(e.customerid,t.target.value)},inputProps:{min:0},InputProps:{startAdornment:(0,se.jsx)(z.Z,{position:"start",children:"\u20b9"})}})}),(0,se.jsx)(K.Z,{children:e.distance}),(0,se.jsx)(K.Z,{align:"right",children:"\u20b9".concat(null===e||void 0===e||null===(n=e.totalcharge)||void 0===n?void 0:n.toFixed(2))}),(0,se.jsx)(K.Z,{align:"center",children:(0,se.jsx)(se.Fragment,{children:(0,se.jsx)(m.Z,{style:{cursor:"pointer",color:"red"},onClick:function(){return Rn(e)}})})})]},t)})),0!=(null===et||void 0===et?void 0:et.length)&&(0,se.jsxs)(O.Z,{children:[(0,se.jsx)(K.Z,{children:"Total"}),(0,se.jsx)(K.Z,{colSpan:2}),(0,se.jsx)(K.Z,{children:(0,se.jsx)(E.Z,{variant:"h5",align:"center",children:"".concat(en," ")})}),(0,se.jsx)(K.Z,{children:(0,se.jsx)(E.Z,{align:"center",variant:"h5",children:"".concat(null===an||void 0===an?void 0:an.toFixed(2)," ")})}),(0,se.jsx)(K.Z,{children:(0,se.jsx)(E.Z,{variant:"h5",children:"".concat(Bt," ")})}),(0,se.jsx)(K.Z,{align:"right",children:(0,se.jsx)(E.Z,{align:"right",variant:"h5",children:"\u20b9".concat(null===Qt||void 0===Qt?void 0:Qt.toFixed(2))})}),(0,se.jsx)(K.Z,{})]})]})]}):(0,se.jsxs)(T.Z,{spacing:2,elevation:0,sx:{bgcolor:"primary.lighter",border:"none",p:2.5,borderRadius:1},children:[(0,se.jsxs)(T.Z,{direction:"row",alignItems:"center",spacing:1,children:[(0,se.jsx)(g.Z,{style:{color:"red",fontSize:18}})," ",(0,se.jsx)(E.Z,{variant:"h5",sx:{fontWeight:600,color:"red"},children:"Important Instructions"})]}),(0,se.jsxs)(T.Z,{elevation:0,component:"ol",sx:{pl:4,m:0},children:[(0,se.jsxs)(E.Z,{component:"li",sx:{fontSize:15,mb:1},children:["Choose either ",(0,se.jsx)("b",{children:"Upload Type"})," to upload CSV/Excel files, or",(0,se.jsx)("b",{children:" Selection Type"})," to select from saved customers."]}),(0,se.jsx)(E.Z,{component:"li",sx:{fontSize:15,mb:1},children:"Uploaded CSV or Excel files must follow the required format and contain the correct column names."}),(0,se.jsxs)(E.Z,{component:"li",sx:{fontSize:15,mb:1},children:["Multiple files can be uploaded, but only ",(0,se.jsx)("b",{children:"one file at a time"}),"."]}),(0,se.jsx)(E.Z,{component:"li",sx:{fontSize:15,color:"error.main"},children:"Invalid or incorrectly formatted files will not be processed."})]})]})})})})}),(0,se.jsx)(P.ZP,{item:!0,xs:12,sx:{width:"100%",mt:-2},children:(0,se.jsx)(u.Z,{sx:{mt:2,p:3},title:"Notes",children:(0,se.jsxs)(P.ZP,{container:!0,children:[(0,se.jsx)(P.ZP,{item:!0,xs:12,children:(0,se.jsx)(W.Z,{focused:!0,id:"outlined-multiline-static",sx:{width:"100%",height:"100%",mb:2},multiline:!0,rows:1,placeholder:"Notes",value:Rt,onChange:function(e){return Lt(e.target.value)}})}),(0,se.jsx)(T.Z,{direction:"row",justifyContent:"end",sx:{mt:2,width:"100%"},children:(0,se.jsx)(R.Z,{disabled:0==et.length||!Cn,size:"medium",variant:"outlined",onClick:function(){Ze(!0),we(!0),Gn()},sx:{"&:hover":{transform:"scale(1.05)",transition:"transform 0.3s ease"}},children:Se?(0,se.jsx)(X.Z,{color:"primary",size:20,thickness:10}):"Create"})})]})})})]}),(0,se.jsxs)(_.Z,{open:at,onClose:function(){it(!1)},fullWidth:!0,sx:{minWidth:"lg"},children:[(0,se.jsx)($.Z,{sx:{bgcolor:n.palette.primary.main,color:"white"},children:(0,se.jsxs)(T.Z,{children:[(0,se.jsxs)(E.Z,{variant:"h4",children:[" ","Select Drop Customers (".concat(et.length||0,")")]}),(0,se.jsx)(L.Z,{sx:{width:"100%",mt:1},children:(0,se.jsx)(T.Z,{spacing:2,sx:{py:.2},children:(0,se.jsx)(ee.Z,{fullWidth:!0,id:"input-search-header",placeholder:"Search",value:st,onChange:function(e){return lt(e.target.value)},sx:{"& .MuiOutlinedInput-input":{p:"10.5px 0px 12px"},bgcolor:"white"},startAdornment:(0,se.jsx)(z.Z,{position:"start",children:(0,se.jsx)(v.Z,{style:{fontSize:"small"}})}),endAdornment:(0,se.jsx)(te.Z,{sx:{visibility:st?"visible":"hidden"},onClick:function(){lt("")},children:(0,se.jsx)(h.Z,{})}),autoComplete:"off"})})})]})}),(0,se.jsx)(ne.Z,{}),(0,se.jsx)(re.Z,{sx:{p:2.5},children:0==(null===pt||void 0===pt?void 0:pt.length)?(0,se.jsx)(T.Z,{spacing:2,direction:"row",alignItems:"center",justifyContent:"center",sx:{minHeight:600,maxHeight:600},children:(0,se.jsx)(x.Z,{})}):(0,se.jsx)(T.Z,{spacing:2,sx:{minHeight:600,maxHeight:600},children:pt&&(null===pt||void 0===pt?void 0:pt.map((function(e,t){return(0,se.jsx)(ae.Z,{children:(0,se.jsx)(F.Z,{control:(0,se.jsx)(ie.Z,{checked:et.some((function(t){return t.customerid===e.customerid})),onChange:function(t){return In(t,e)}}),label:(0,se.jsxs)("div",{style:{width:"100%"},children:[(0,se.jsx)(E.Z,{variant:"subtitle1",sx:{textAlign:"left"},children:"".concat(e.firstname," (").concat(e.contactno,")")}),(0,se.jsx)(E.Z,{variant:"body2",color:"secondary",sx:{textAlign:"left"},children:e.address})]})})},t)})))})}),(0,se.jsx)(ne.Z,{}),(0,se.jsx)(oe.Z,{sx:{p:2.5},children:(0,se.jsx)(R.Z,{color:0==et.length?"error":"primary",variant:"outlined",sx:{"&:hover":{bgcolor:0==et.length?"red":n.palette.primary.main,color:"white"}},onClick:function(){it(!1)},children:0==et.length?"Close":"Continue"})})]})]})}},20067:function(){}}]); |