Files
Express_console_build/build/static/js/6248.bf8f395b.chunk.js
2026-05-25 16:32:21 +05:30

1 line
27 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[6248],{66248:(e,s,i)=>{i.r(s),i.d(s,{default:()=>ae});var n=i(89379),t=i(9950),r=i(46702),a=i(28429),o=i(26910),l=i(63189),c=i(19474),d=i(58833),h=i(53067),x=i(62824),A=i(52329),j=i(36256),m=i(32653),g=i(96583),p=i(28170),u=i(93230),f=i(41413),v=i(60899),y=i(25277),b=i(65429),w=i(92743),Y=i(36080),S=i(82053),C=i(29925),D=i(82223),z=i(40033),k=i(48159),M=i(84142),I=i(46639),F=i(1320),H=i(15769),T=i(69780),O=i(9213),E=i(21671),_=i(34075),R=i(93038),N=i(83274),U=i(25333),L=i(79739),P=i(25713),W=i(82917),q=i(25979),B=i(33738),K=i(74745),$=i(37476),G=i(72179),Z=i(50027),J=i(52351),Q=i(4159),V=i.n(Q),X=i(14857),ee=i(46585),se=i(94118),ie=i(97973),ne=i(8881),te=i(44414),re=i(36220);V().extend(re);const ae=()=>{const[e,s]=(0,t.useState)([]),[i,Q]=(0,t.useState)(!0),re=(0,a.zy)(),[ae,oe]=(0,t.useState)(""),[le,ce]=(0,t.useState)(""),[de,he]=(0,t.useState)(""),[xe,Ae]=(0,t.useState)(""),[je,me]=(0,t.useState)(!1),[ge,pe]=(0,t.useState)(""),[ue,fe]=(0,t.useState)(""),[ve,ye]=(0,t.useState)(!1),[be,we]=(0,t.useState)(""),[Ye]=(0,t.useState)(""),[Se,Ce]=(0,t.useState)(""),[De,ze]=(0,t.useState)(""),[ke,Me]=(0,t.useState)(""),[Ie,Fe]=(0,t.useState)(""),[He,Te]=(0,t.useState)([]),[Oe,Ee]=(0,t.useState)(""),[_e,Re]=(0,t.useState)(""),[Ne,Ue]=(0,t.useState)([]),[Le,Pe]=(0,t.useState)([]),[We,qe]=(0,t.useState)(""),[Be,Ke]=(0,t.useState)(""),[$e]=(0,t.useState)(""),[Ge]=(0,t.useState)(""),[Ze,Je]=(0,t.useState)(""),[Qe,Ve]=(0,t.useState)([]),[Xe,es]=(0,t.useState)({shifts:0,assigned:0,remaining:0,shiftid:0,price:0}),[ss,is]=(0,t.useState)(0),{state:ns}=(0,a.zy)(),[ts,rs]=(0,t.useState)(""),as=(0,a.Zp)(),[os,ls]=(0,t.useState)(["",""]),[cs,ds]=(0,t.useState)(""),[hs,xs]=(0,t.useState)(!1);(0,t.useEffect)((()=>{console.log("categoryarr"),console.log(e,le,Ie,$e,Ge)}),[Qe]),(0,t.useEffect)((()=>{ns&&(qe(ns.orderheaderid),Ke(ns.tenantid)),console.log(ns),console.log(Date.now())}),[]),(0,t.useEffect)((()=>{ns&&(qe(ns.orderheaderid),Ke(ns.tenantid)),console.log(ns),console.log(Date.now())}),[ns.orderheaderid,ns.tenantid]);const As=(0,X.A)(),js=async()=>{Q(!0),await o.A.get("".concat("https://jupiter.nearle.app/live/api/v2","/orders/getordersbystatus?tenantid=").concat(Be)).then((e=>{console.log(e);let s=e.data.Details.find((e=>e.orderheaderid==We));console.log("result"),console.log(s),Te(s.orderaddons),Fe(s.venuetype),Ee(s.remarks),ds(s.startdate),pe(s.tenantname),ce(""),fe(s.tenantaddress),Ae(s.eventname),he(V()(s.orderdate).format("MM/DD/YYYY")||""),oe(s.orderid),we(s.orderstatus),Ce(s.taxamount),ze(s.orderamount),Me(s.ordervalue),Re(V()(s.cancelled).format("MM/DD/YYYY")||""),Je(s.pending),Q(!1)})).catch((e=>{console.log(e),Q(!1)}))},ms=async()=>{Q(!0),await o.A.get("".concat("https://jupiter.nearle.app/live/api/v2","/orders/getorderdetails?orderheaderid=").concat(We)).then((e=>{console.log("res"),console.log(e),s(e.data.Details||[]),console.log("categoryarr"),Ve(e.data.Details),console.log(e.data.Details),Q(!1)})).catch((e=>{console.log(e),Q(!1)}))},gs=e=>{let s;console.log(e);let i=[e.userfcmtoken],n=[{notificationid:0,notificationdate:V()().format("YYYY-MM-DD HH:mm:ss"),Title:"Staff Un-Asigned",message:"".concat(e.firstname," has been Un-assigned to the order ").concat(ae),configid:2,tenantid:Be,orderheaderid:We,orderprocessid:e.orderprocessid,shiftid:e.shiftid,userid:e.userid,orderid:ae,success:0,orderstatus:"assigned",processing:V()().format("YYYY-MM-DD HH:mm:ss"),notifytype:2,notifyreason:"Staff Un-Assigned"}];s={Title:"Staff Un-Asigned",message:"A Staff has been Un-assigned to the order ".concat(ae),tenantid:Be,orderheaderid:We,orderid:ae,configid:2};let t={notifications:n,fcmmodel:{priority:"high",registration_ids:i,data:s,notification:{body:"An order has been Un-assigned ".concat(ae),title:"Legendary",sound:"ring",content_available:!0,click_action:"FLUTTER_NOTIFICATION_CLICK"}}};console.log("grpnotifyobj unassign"),console.log(t),us(t)};(0,t.useEffect)((()=>{console.log(We),We&&Be?(js(),ms(),fs(),console.log(re.state||"")):Q(!1),console.log(We,Be)}),[We,Be,ts]);const ps=()=>{ye(!1),Pe([]),ls(["",""])};(0,t.useEffect)((()=>{console.log(Xe)}));const us=async e=>{console.log(e),await o.A.post("".concat("https://jupiter.nearle.app/live/api/v2","/utils/notification/sendall"),e,{headers:{Authorization:"Bearer ".concat("")}}).then((e=>{console.log(e),e.data.status&&((0,ne.M8)("Notification sent successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3}),js())})).catch((e=>{console.log(e)}))},fs=async()=>{await o.A.get("".concat("https://jupiter.nearle.app/live/api/v2","/orders/getorderstatuscount?orderheaderid=").concat(We)).then((e=>{e.data.status?(console.log(e),rs(e.data.pendingcount),js()):(rs(e.data.pendingcount),js())})).catch((e=>{console.log(e)}))};function vs(e){let{open:s,handleClose:i}=e;const[n,r]=(0,t.useState)("");return(0,te.jsx)(g.A,{open:s,onClose:()=>i(!1),maxWidth:"xs",children:(0,te.jsx)(p.A,{sx:{mt:2,my:1},children:(0,te.jsxs)(u.A,{alignItems:"center",spacing:3.5,children:[(0,te.jsx)(f.A,{color:"error",sx:{width:72,height:72,fontSize:"1.75rem"},children:(0,te.jsx)(j.A,{})}),(0,te.jsx)(v.Ay,{children:(0,te.jsx)(y.A,{label:ae.slice(4),variant:"combined",color:"warning",size:"small"})}),(0,te.jsxs)(u.A,{spacing:2,children:[hs&&(0,te.jsxs)(b.A,{color:"warning",variant:"border",icon:(0,te.jsx)(ee.A,{}),children:[(0,te.jsx)(w.A,{children:"Order is within 24Hrs time frame. The order will be invoiced with standard pricing as agreed."}),(0,te.jsx)(Y.A,{href:"https://thelegendarystaff.com/",target:"_blank",children:"Terms & Condition link"})]}),(0,te.jsx)(S.A,{variant:"h4",align:"center",children:"Please type in the order number to confirm."}),(0,te.jsx)(C.A,{type:"text",onChange:e=>{console.log(e.target.value),r(e.target.value)},error:n!==ae.slice(4),value:n})]}),(0,te.jsxs)(u.A,{direction:"row",spacing:2,sx:{width:1},children:[(0,te.jsx)(D.A,{fullWidth:!0,color:"error",variant:"contained",onClick:()=>{n===ae.slice(4)&&((async()=>{await o.A.put("".concat("https://jupiter.nearle.app/live/api/v2","/orders/cancel"),{orderheaderid:parseInt(We),orderstatus:"cancelled",cancelled:V()().format("YYYY-MM-DD HH:mm:ss"),unserviceable:hs?0:1}).then((e=>{console.log(e),e.data.status&&We&&Be&&(js(),ms())})).catch((e=>{console.log(e)}))})(),i(!0))},autoFocus:!0,children:"Yes, Cancel"}),(0,te.jsx)(D.A,{fullWidth:!0,onClick:()=>i(!1),color:"secondary",variant:"outlined",children:"No"})]})]})})})}return(0,te.jsxs)(te.Fragment,{children:[i&&(0,te.jsx)(J.A,{}),(0,te.jsx)(vs,{open:je,handleClose:()=>{me(!1)}}),(0,te.jsxs)(g.A,{maxWidth:!1,fullWidth:!0,open:ve,onClose:ps,scroll:"paper",TransitionComponent:$.s,children:[(0,te.jsxs)(z.A,{children:[(0,te.jsxs)(u.A,{direction:"row",justifyContent:"space-between",children:[(0,te.jsxs)(u.A,{direction:{sm:"row",xs:"column"},spacing:2,alignItems:"center",children:[(0,te.jsx)(S.A,{variant:"h3",children:"Assign Roles"}),(0,te.jsx)(y.A,{label:ge,variant:"light",color:"primary"})]}),(0,te.jsx)(y.A,{label:ae,variant:"combined",color:"warning",size:"large"})]}),(0,te.jsxs)(v.Ay,{container:!0,sx:{p:1},spacing:2,children:[(0,te.jsx)(v.Ay,{item:!0,sm:6,xs:12,children:(0,te.jsx)(k.A,{value:ss,onChange:()=>is((e=>0===e?1:0)),variant:"scrollable",scrollButtons:"auto",children:(0,te.jsx)(M.A,{label:Ye})})}),(0,te.jsx)(v.Ay,{item:!0,sm:6,xs:12,children:(0,te.jsxs)(u.A,{direction:"row",justifyContent:{xs:"flex-start",sm:"flex-end"},sx:{height:"100%"},spacing:2,children:[(0,te.jsx)(y.A,{sx:{width:"130px"},label:"Required:".concat(Xe.shifts),variant:"combined",color:"primary",size:"normal"}),(0,te.jsx)(y.A,{sx:{width:"130px"},label:"Assigned: ".concat(Xe.assigned),variant:"combined",color:"success",size:"normal"}),(0,te.jsx)(y.A,{sx:{width:"130px"},label:"Remaining: ".concat(Xe.remaining),variant:"combined",color:"error",size:"normal"})]})})]})]}),(0,te.jsx)(p.A,{dividers:!0,children:0===Ne.length?(0,te.jsx)(te.Fragment,{children:i?(0,te.jsx)(te.Fragment,{children:(0,te.jsx)(u.A,{alignItems:"center",children:(0,te.jsx)(I.A,{})})}):(0,te.jsx)(S.A,{children:"No Staffs Available"})}):(0,te.jsx)(F.A,{children:(0,te.jsxs)(H.A,{children:[(0,te.jsx)(T.A,{children:(0,te.jsxs)(O.A,{children:[(0,te.jsx)(E.A,{children:"#"}),(0,te.jsx)(E.A,{children:"Staff"}),(0,te.jsx)(E.A,{children:"Category"}),(0,te.jsx)(E.A,{children:"Price"}),(0,te.jsx)(E.A,{children:"Experience"}),(0,te.jsx)(E.A,{children:"Level"}),(0,te.jsx)(E.A,{children:"City"}),(0,te.jsx)(E.A,{children:"Action"}),(0,te.jsx)(E.A,{})]})}),(0,te.jsx)(_.A,{children:Ne.map(((e,s)=>(0,te.jsx)(t.Fragment,{children:(0,te.jsxs)(O.A,{sx:{backgroundColor:Le.find((s=>s.userid==e.userid))?"#f5f5f5":"",":hover":{backgroundColor:Le.find((s=>s.userid==e.userid))?"#f5f5f5 !important":""}},children:[(0,te.jsx)(E.A,{component:"th",scope:"row",padding:"none",children:s+1}),(0,te.jsx)(E.A,{align:"left",sx:{paddingLeft:"0px !important"},children:(0,te.jsxs)(u.A,{direction:"row",alignItems:"center",spacing:1,justifyContent:"flex-start",children:[(0,te.jsx)(f.A,{alt:"",size:"sm",src:"",sx:{width:"25px",height:"25px"}}),(0,te.jsxs)(u.A,{direction:"column",children:[(0,te.jsx)(S.A,{variant:"caption",children:e.firstname}),(0,te.jsx)(S.A,{variant:"caption",color:"textSecondary",children:e.contactno})]})]})}),(0,te.jsx)(E.A,{align:"left",children:(0,te.jsxs)(u.A,{direction:"column",alignItems:"flex-start",children:[(0,te.jsx)(S.A,{variant:"caption",color:"textSecondary",children:e.cateoryname}),(0,te.jsx)(y.A,{label:e.subcategoryname,color:"info",size:"small",variant:"light"})]})}),(0,te.jsx)(E.A,{children:e.rolecost}),(0,te.jsxs)(E.A,{align:"left",children:[e.experience," Years"]}),(0,te.jsx)(E.A,{align:"left",children:(0,te.jsx)(y.A,{label:e.levelofexperience,size:"small",color:"primary",variant:"light"})}),(0,te.jsx)(E.A,{align:"left",children:e.city}),(0,te.jsx)(E.A,{align:"left",children:e.orderdetailid!==orderdetailid?(0,te.jsx)(te.Fragment,{children:(0,te.jsx)(R.A,{disabled:0!==e.orderdetailid,checked:!!Le.find((s=>s.userid==e.userid)),onClick:s=>{if(console.log(Xe),Xe.remaining>=0){if(s.target.checked&&0!=Xe.remaining){let s=Le;s.push({userid:e.userid,orderdetailid:orderdetailid,productid:productid,shiftid:Xe.shiftid,userrate:Xe.price,productrate:e.rolecost,firstname:e.firstname}),Pe([...s]);let i=Xe;i.assigned++,i.remaining=i.shifts-i.assigned,es((0,n.A)({},i))}else if(Xe.assigned!=Xe.shifts||0===Xe.remaining&&!s.target.checked){let s=Le,i=s.findIndex((s=>s.userid===e.userid));s.splice(i,1),Pe([...s]);let t=Xe;t.assigned--,t.remaining=t.shifts-t.assigned,es((0,n.A)({},t))}console.log(Le)}}})}):(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)(y.A,{label:"Assigned",color:"success",size:"small",sx:{mr:1}}),(0,te.jsx)(N.A,{title:"Unassign",children:(0,te.jsx)(U.A,{color:"error",onClick:()=>{console.log(e),(async e=>{let s={orderheaderid:We,orderprocessid:e.orderprocessid,orderdetailid:e.orderdetailid,orderstatus:"pending",pending:V()().format("YYYY-MM-DD HH:mm:ss"),status:1};console.log(s),await o.A.put("".concat("https://jupiter.nearle.app/live/api/v2","/orders/updateprocessstatus"),s).then((s=>{console.log(s),"Successful"===s.data.message&&((0,ne.M8)("Role unassigned successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3}),Xe.assigned>Xe.shifts&&gs(e),js(),ms(),me(!1),fs(),ps(),setTimeout((()=>{fs()}),2e3))})).catch((e=>{console.log(e)}))})(e)},children:(0,te.jsx)(se.A,{})})}),(0,te.jsx)(N.A,{title:"Send Notification",children:(0,te.jsx)(U.A,{color:"info",onClick:()=>{console.log(e),(async e=>{let s=e.userfcmtoken,i={notificationid:0,notificationdate:V()().format("YYYY-MM-DD HH:mm:ss"),Title:"Staff Asigned",message:"A Staff has been assigned to the order ".concat(ae),configid:2,tenantid:Be,orderheaderid:We,orderprocessid:e.orderprocessid,shiftid:e.shiftid,userid:e.userid,orderid:ae,sound:"ring",click_action:"FLUTTER_NOTIFICATION_CLICK"};console.log(i,s),await o.A.post("".concat("https://jupiter.nearle.app/live/api/v2","/utils/notification/send"),{priority:"high",registration_ids:[s],data:i,notification:{body:"A Staff has been assigned to ".concat(ae),title:"Legendary",sound:"ring",content_available:!0}},{headers:{Authorization:"Bearer ".concat("")}}).then((e=>{console.log(e),(0,ne.M8)("Notification sent successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3})})).catch((e=>{console.log(e)}))})(e)},children:(0,te.jsx)(m.A,{})})})]})}),(0,te.jsx)(E.A,{children:e.orderid&&(0,te.jsx)(te.Fragment,{children:(0,te.jsx)(y.A,{label:e.orderid,color:"warning",size:"small",variant:"light"})})})]})},s)))})]})})}),(0,te.jsx)(L.A,{children:(0,te.jsxs)(u.A,{sx:{mt:2},direction:"row",justifyContent:"flex-end",spacing:5,children:[Ne.length>0&&(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)(D.A,{sx:{width:"130px"},variant:"contained",onClick:async()=>{let e=[],s=[];Le.map((i=>{e.push({orderprocessid:0,processdate:V()().format("YYYY-MM-DD HH:mm:ss"),tenantid:Be,orderheaderid:We,orderdetailid:i.orderdetailid,productid:i.productid,userid:i.userid,orderstatus:"pending",pending:"".concat(V()(Ze).format("YYYY-MM-DD")," ").concat(V()(Ze).format("HH:mm:ss")),starttime:"".concat(V()($e).format("YYYY-MM-DD")," ").concat(V()($e).format("HH:mm:ss")),endtime:"".concat(V()(Ge).format("YYYY-MM-DD")," ").concat(V()(Ge).format("HH:mm:ss")),appuserid:parseInt(localStorage.getItem("appuserid")),shiftid:i.shiftid,userrate:i.userrate,productrate:i.productrate}),Le.map((e=>{s.push({notificationid:0,notificationdate:V()().format("YYYY-MM-DD HH:mm:ss"),Title:"Staff Asigned",message:"A Staff has been assigned to the order ".concat(ae),configid:2,tenantid:Be,orderheaderid:We,orderprocessid:0,shiftid:e.shiftid,userid:e.userid,orderid:ae,sound:"ring",click_action:"FLUTTER_NOTIFICATION_CLICK",firstname:e.firstname})}))})),console.log("arr"),console.log(e),await o.A.post("".concat("https://jupiter.nearle.app/live/api/v2","/orders/createorderprocess"),e).then((e=>{console.log(e),"Successfully created"===e.data.message&&((0,ne.M8)("Roles assigned successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:2e3}),ye(!1),ms(),fs())})).catch((e=>{console.log(e)})),console.log(e)},children:"OK"}),(0,te.jsx)(D.A,{sx:{width:"130px"},color:"warning",variant:"contained",onClick:()=>{Pe([]);let e=Xe;e.remaining=e.shifts,e.assigned=0,es(e)},children:"clear"})]}),(0,te.jsx)(D.A,{sx:{width:"130px"},color:"error",variant:"contained",onClick:()=>{ps()},children:"Close"})]})})]}),(0,te.jsxs)(v.Ay,{container:!0,rowSpacing:2,columnSpacing:2.75,children:[(0,te.jsx)(P.A,{sx:{position:"sticky",top:"60px",bgcolor:As.palette.background.default,zIndex:1,width:"100%"},children:(0,te.jsx)(v.Ay,{item:!0,xs:12,children:(0,te.jsxs)(u.A,{direction:{md:"row",xs:"column"},justifyContent:"space-between",alignItems:"flex-end",sx:{width:"100%",p:1},children:[(0,te.jsxs)(u.A,{direction:"row",spacing:2,alignItems:"center",justifyContent:"flex-start",sx:{width:{xs:"100%",md:"0"}},children:[(0,te.jsx)(U.A,{onClick:()=>history.back(),children:(0,te.jsx)(l.A,{})}),(0,te.jsxs)(u.A,{direction:"column",alignItems:"flex-start",children:[(0,te.jsx)(S.A,{variant:"h3",children:"Details"}),(0,te.jsxs)(u.A,{direction:"row",spacing:1,children:[(0,te.jsx)(y.A,{label:""===ae?(0,te.jsx)(W.A,{sx:{width:"80px",bgcolor:"#fff9c4"},animation:"wave"}):ae,variant:"combined",color:"warning",size:"small"}),(0,te.jsx)(y.A,{label:""===de?(0,te.jsx)(W.A,{sx:{width:"80px",bgcolor:"#b3e5fc"},animation:"wave"}):de,variant:"combined",color:"primary",size:"small"}),"pending"===be&&(0,te.jsx)(y.A,{label:"Pending",color:"error",size:"small"}),"cancelled"===be&&(0,te.jsx)(y.A,{label:"Cancelled",color:"secondary",size:"small"}),"completed"===be&&(0,te.jsx)(y.A,{label:"Completed",color:"primary",size:"small"}),"processing"===be&&(0,te.jsx)(y.A,{label:"Processing",color:"primary",size:"small"}),"assigned"===be&&(0,te.jsx)(y.A,{label:"Assigned",color:"warning",size:"small"}),"confirmed"===be&&(0,te.jsx)(y.A,{label:"Confirmed",color:"success",size:"small"}),"active"===be&&(0,te.jsx)(y.A,{label:"Active",color:"info",size:"small"}),"closed"===be&&(0,te.jsx)(y.A,{label:"Closed",color:"info",size:"small"}),"modified"===be&&(0,te.jsx)(y.A,{label:"Modified",color:"secondary",size:"small",variant:"contained"})]})]})]}),(0,te.jsxs)(u.A,{direction:"row",spacing:2,sx:{mt:{md:0,xs:2}},children:[("pending"===be||"assigned"===be||"confirmed"===be||"modified"===be)&&(0,te.jsx)(N.A,{title:"Edit",children:(0,te.jsx)(D.A,{variant:"outlined",color:"info",sx:{borderRadius:"40px"},startIcon:(0,te.jsx)(r.A,{color:"info"}),onClick:e=>{e.stopPropagation(),V()(V()().format("MM-DD-YYYY")).isBefore(V()(V()(cs).format("MM-DD-YYYY")))?as("/editorder",{state:{orderheaderid:We,tenantid:Be}}):(0,ne.M8)("Order cannot be edited.\n Order date is not valid at this time",{variant:"error",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:4e3,style:{whiteSpace:"pre-line"}})},children:"Edit Order"})}),"cancelled"!==be&&""!==be&&"completed"!==be&&"closed"!==be&&(0,te.jsx)(te.Fragment,{children:(0,te.jsx)(D.A,{variant:"outlined",color:"error",onClick:()=>{console.log(V()(cs).diff(V()(),"m")/60),V()(cs).diff(V()(),"m")/60>24?(xs(!1),me(!0)):(xs(!0),me(!0))},sx:{borderRadius:"40px",mt:{xs:2,sm:0}},startIcon:(0,te.jsx)(G.A,{}),children:"Cancel Order"})}),"cancelled"===be&&(0,te.jsx)(te.Fragment,{children:(0,te.jsx)(y.A,{label:"Order Cancelled on ".concat(_e),variant:"combined",color:"error"})})]})]})})}),(0,te.jsx)(v.Ay,{item:!0,xs:12,sx:{mt:-2},children:(0,te.jsx)(Z.A,{content:!1,width:"100%",children:(0,te.jsxs)(v.Ay,{container:!0,spacing:2.5,sx:{p:2.5},children:[(0,te.jsx)(v.Ay,{item:!0,xs:12,sm:6,children:(0,te.jsx)(Z.A,{sx:{height:"100%"},children:(0,te.jsxs)(u.A,{spacing:1,children:[(0,te.jsx)(S.A,{variant:"h5",children:"Client"}),(0,te.jsx)(S.A,{color:"secondary",children:""===ge?(0,te.jsx)(W.A,{sx:{width:"40%"},animation:"wave"}):ge}),(0,te.jsx)(q.A,{sx:{width:"100%"},children:(0,te.jsx)(S.A,{color:"secondary",children:""===ue?(0,te.jsx)(W.A,{sx:{width:"90%"},animation:"wave"}):ue})})]})})}),(0,te.jsx)(v.Ay,{item:!0,xs:12,sm:6,children:(0,te.jsx)(Z.A,{sx:{height:"100%"},children:(0,te.jsxs)(u.A,{spacing:1,children:[(0,te.jsx)(S.A,{variant:"h5",children:"Event"}),(0,te.jsx)(q.A,{sx:{width:"100%"},children:(0,te.jsx)(S.A,{color:"secondary",children:""===xe?(0,te.jsx)(W.A,{sx:{width:"40%"},animation:"wave"}):xe})})]})})}),Qe.map(((e,s)=>(0,te.jsx)(t.Fragment,{children:(0,te.jsx)(v.Ay,{item:!0,xs:12,children:(0,te.jsxs)(Z.A,{sx:{opacity:0==e.shiftstatus?"":"0.7"},children:[(0,te.jsxs)(u.A,{direction:{xs:"column",md:"row"},justifyContent:"space-between",alignItems:{md:"center",xs:"flex-start"},spacing:2,sx:{p:2},children:[(0,te.jsxs)(u.A,{direction:{xs:"column",md:"row"},spacing:2,alignItems:{md:"center",xs:"flex-start"},children:[(0,te.jsxs)(S.A,{variant:"h5",children:["Shift ",s+1]}),(0,te.jsxs)(S.A,{color:"secondary",children:[(0,te.jsx)(c.A,{})," ","",e.locationaddress]}),1===e.shiftstatus&&(0,te.jsx)(y.A,{label:"Cancelled",color:"secondary"})]}),(0,te.jsx)(u.A,{direction:"row",spacing:1,children:e.ordercontacts.map((e=>(0,te.jsx)(te.Fragment,{children:(0,te.jsx)(N.A,{title:e.contactname,children:(0,te.jsx)(f.A,{sx:{bgcolor:"#2196f3",width:30,height:30},alt:"A",children:e.contactname.charAt(0).toUpperCase()})})})))})]}),(0,te.jsx)(F.A,{children:(0,te.jsxs)(H.A,{children:[(0,te.jsx)(T.A,{children:(0,te.jsxs)(O.A,{children:[(0,te.jsx)(E.A,{children:"#"}),(0,te.jsx)(E.A,{children:"Role"}),(0,te.jsx)(E.A,{children:"Start Date"}),(0,te.jsx)(E.A,{children:"End Date"}),(0,te.jsx)(E.A,{children:"Unpaid break"}),(0,te.jsx)(E.A,{children:"Count"}),(0,te.jsx)(E.A,{children:"Assigned"}),(0,te.jsx)(E.A,{children:"Attire"}),(0,te.jsx)(E.A,{children:"Price"}),(0,te.jsx)(E.A,{children:"Amount"}),(0,te.jsx)(E.A,{children:"Action"})]})}),(0,te.jsxs)(_.A,{children:[0===e.orderdetails.length&&(0,te.jsx)(te.Fragment,{children:(0,te.jsxs)(O.A,{children:[(0,te.jsx)(E.A,{children:(0,te.jsx)(W.A,{animation:"wave"})}),(0,te.jsx)(E.A,{children:(0,te.jsx)(W.A,{animation:"wave"})}),(0,te.jsxs)(E.A,{children:[(0,te.jsx)(W.A,{animation:"wave"}),(0,te.jsx)(W.A,{animation:"wave"})]}),(0,te.jsxs)(E.A,{children:[(0,te.jsx)(W.A,{animation:"wave"}),(0,te.jsx)(W.A,{animation:"wave"})]}),(0,te.jsx)(E.A,{children:(0,te.jsx)(W.A,{animation:"wave"})}),(0,te.jsx)(E.A,{children:(0,te.jsx)(W.A,{animation:"wave"})}),(0,te.jsx)(E.A,{children:(0,te.jsx)(W.A,{animation:"wave"})}),(0,te.jsx)(E.A,{children:(0,te.jsx)(W.A,{animation:"wave"})}),(0,te.jsx)(E.A,{children:(0,te.jsx)(W.A,{animation:"wave"})}),(0,te.jsx)(E.A,{children:(0,te.jsx)(W.A,{animation:"wave"})}),(0,te.jsx)(E.A,{children:(0,te.jsx)(W.A,{animation:"wave"})})]})}),e.orderdetails.map(((e,n)=>(0,te.jsxs)(te.Fragment,{children:[(0,te.jsxs)(O.A,{sx:{"&:last-child td, &:last-child th":{border:0},opacity:0==e.status?"":"0.7"},children:[(0,te.jsx)(E.A,{children:n+1}),(0,te.jsx)(E.A,{children:e.productname}),(0,te.jsx)(E.A,{children:(0,te.jsxs)(u.A,{direction:"column",children:[(0,te.jsx)(S.A,{variant:"body1",children:V()(e.starttime).format("MM/DD/YYYY")}),(0,te.jsx)(S.A,{variant:"body2",children:V()(e.starttime).format("hh:mm A")})]})}),(0,te.jsxs)(E.A,{children:[" ",(0,te.jsxs)(u.A,{direction:"column",children:[(0,te.jsx)(S.A,{variant:"body1",children:V()(e.endtime).format("MM/DD/YYYY")}),(0,te.jsx)(S.A,{variant:"body2",children:V()(e.endtime).format("hh:mm A")})]})]}),(0,te.jsx)(E.A,{children:e.unpaidbreak||0}),(0,te.jsx)(E.A,{align:"center",children:(0,te.jsx)(y.A,{label:e.orderqty,color:"success",variant:"light",size:"small"})}),(0,te.jsx)(E.A,{align:"center",children:(0,te.jsx)(y.A,{label:e.supplyqty,color:0===e.supplyqty?"error":"warning",variant:"light",size:"small"})}),(0,te.jsx)(E.A,{width:"100px"}),(0,te.jsxs)(E.A,{children:["$",e.price]}),(0,te.jsxs)(E.A,{children:["$",e.landingamount]}),(0,te.jsx)(E.A,{children:(0,te.jsxs)(u.A,{direction:"row",children:[(0,te.jsx)(N.A,{title:"Expand",children:(0,te.jsx)(U.A,{"aria-label":"expand row",style:{color:As.palette.primary.main},onClick:()=>{Ue([]),ls(os[0]===s&&os[1]===n?["",""]:[s,n]),(async e=>{Q(!0);try{await o.A.get("".concat("https://jupiter.nearle.app/live/api/v2","/orders/getassignedinfo?orderdetailid=").concat(e)).then((e=>{console.log(e),e.data.status&&Ue(e.data.Details),Q(!1)})).catch((e=>{console.log(e),Q(!1)}))}catch(s){console.log(s),Q(!1)}})(e.orderdetailid)},children:os[0]===s&&os[1]===n?(0,te.jsx)(x.A,{}):(0,te.jsx)(A.A,{})})}),"cancelled"===be&&(0,te.jsx)(te.Fragment,{children:(0,te.jsx)(U.A,{sx:{minWidth:"10px !important"},disabled:!0,children:(0,te.jsx)(d.A,{})})}),1===e.status&&(0,te.jsx)(N.A,{title:"Cancelled",children:(0,te.jsx)(U.A,{sx:{minWidth:"10px !important"},children:(0,te.jsx)(G.A,{color:"error"})})}),e.supplyqty>e.orderqty&&(0,te.jsx)(N.A,{title:"Assigned count is greater than ordered count",children:(0,te.jsx)(U.A,{color:"warning",children:(0,te.jsx)(ie.A,{})})})]})})]},n+1),(0,te.jsx)(O.A,{sx:{p:2},children:(0,te.jsx)(E.A,{style:{paddingBottom:0,paddingTop:0,paddingLeft:0,paddingRight:0},colSpan:11,sx:{width:"100%"},children:(0,te.jsx)(B.A,{in:os[0]===s&&os[1]===n,timeout:"auto",unmountOnExit:!0,children:(0,te.jsx)(Z.A,{sx:{width:"100%"},children:0===Ne.length?(0,te.jsx)(te.Fragment,{children:i?(0,te.jsx)(te.Fragment,{children:(0,te.jsx)(u.A,{alignItems:"center",children:(0,te.jsx)(I.A,{})})}):(0,te.jsx)(te.Fragment,{children:(0,te.jsx)(u.A,{sx:{p:1},children:(0,te.jsx)(S.A,{children:"No Staffs has been Assigned"})})})}):(0,te.jsx)(F.A,{children:(0,te.jsxs)(H.A,{children:[(0,te.jsx)(T.A,{children:(0,te.jsxs)(O.A,{children:[(0,te.jsx)(E.A,{children:"#"}),(0,te.jsx)(E.A,{children:"Staff"}),(0,te.jsx)(E.A,{children:"Start Time"}),(0,te.jsx)(E.A,{children:"End Time"}),(0,te.jsx)(E.A,{children:"Pay Rate"}),(0,te.jsx)(E.A,{align:"center",children:"Clockin"}),(0,te.jsx)(E.A,{align:"center",children:"Clockout"}),(0,te.jsx)(E.A,{children:"Hours Worked"}),(0,te.jsx)(E.A,{children:"Status"})]})}),(0,te.jsx)(_.A,{children:Ne.map(((e,s)=>(0,te.jsx)(t.Fragment,{children:(0,te.jsxs)(O.A,{sx:{},children:[(0,te.jsx)(E.A,{component:"th",scope:"row",padding:"none",children:s+1}),(0,te.jsx)(E.A,{align:"left",children:(0,te.jsxs)(u.A,{direction:"column",children:[(0,te.jsx)(S.A,{variant:"caption",children:e.staffname}),(0,te.jsx)(v.Ay,{children:(0,te.jsx)(y.A,{label:e.productname,color:"info",variant:"light",size:"small"})})]})}),(0,te.jsx)(E.A,{children:(0,te.jsxs)(u.A,{direction:"column",children:[(0,te.jsx)(S.A,{variant:"body2",children:V()(e.Starttime).format("MM/DD/YYYY")}),(0,te.jsx)(S.A,{variant:"caption",children:V()(e.Starttime).format("hh:mm A")})]})}),(0,te.jsx)(E.A,{children:(0,te.jsxs)(u.A,{direction:"column",children:[(0,te.jsx)(S.A,{variant:"body2",children:V()(e.Endtime).format("MM/DD/YYYY")}),(0,te.jsx)(S.A,{variant:"caption",children:V()(e.Endtime).format("hh:mm A")})]})}),(0,te.jsx)(E.A,{children:e.rolecost}),(0,te.jsx)(E.A,{children:(0,te.jsxs)(u.A,{spacing:.5,alignItems:"center",children:[(0,te.jsx)(y.A,{label:e.clockin?V()(e.clockin).format("MM/DD/YYYY"):"",color:"primary",variant:"light",size:"small"}),(0,te.jsx)(y.A,{label:e.clockin?V()(e.clockin).format("hh:mm A"):"",color:"info",variant:"light",size:"small"})]})}),(0,te.jsx)(E.A,{children:(0,te.jsxs)(u.A,{spacing:.5,alignItems:"center",children:[(0,te.jsx)(y.A,{label:e.clockout?V()(e.clockout).format("MM/DD/YYYY"):"",color:"primary",variant:"light",size:"small"}),(0,te.jsx)(y.A,{label:e.clockout?V()(e.clockout).format("hh:mm A"):"",color:"info",variant:"light",size:"small"})]})}),(0,te.jsx)(E.A,{children:e.hoursworked}),(0,te.jsx)(E.A,{align:"left",children:(0,te.jsxs)(u.A,{direction:"row",children:["pending"===e.orderstatus&&(0,te.jsx)(y.A,{label:"Pending",color:"error",size:"small"}),"cancelled"===e.orderstatus&&(0,te.jsx)(y.A,{label:"Cancelled",color:"secondary",size:"small"}),"completed"===e.orderstatus&&(0,te.jsx)(y.A,{label:"Completed",color:"primary",size:"small"}),"processing"===e.orderstatus&&(0,te.jsx)(y.A,{label:"Processing",color:"primary",size:"small"}),"assigned"===e.orderstatus&&(0,te.jsx)(y.A,{label:"Assigned",color:"warning",size:"small"}),"confirmed"===e.orderstatus&&(0,te.jsx)(y.A,{label:"Confirmed",color:"success",size:"small"}),"active"===e.orderstatus&&(0,te.jsx)(y.A,{label:"Active",color:"info",size:"small"}),"closed"===e.orderstatus&&(0,te.jsx)(y.A,{label:"Closed",color:"info",size:"small"})]})})]})},s)))})]})})})})})})]})))]})]})})]})})},e.locationaddress))),(0,te.jsx)(v.Ay,{item:!0,xs:12,children:(0,te.jsx)(K.A,{sx:{borderWidth:1}})}),(0,te.jsx)(v.Ay,{item:!0,xs:12,sm:6,children:(0,te.jsx)(Z.A,{title:"Order Addons",sx:{height:"100%"},children:(0,te.jsx)(v.Ay,{container:!0,spacing:2,children:(He||[]).map((e=>(0,te.jsx)(t.Fragment,{children:(0,te.jsx)(v.Ay,{item:!0,children:(0,te.jsx)(y.A,{icon:(0,te.jsx)(h.A,{}),variant:"outlined",color:"error",label:e.addon})})},e.addon)))})})}),(0,te.jsx)(v.Ay,{item:!0,xs:12,sm:6,children:(0,te.jsx)(Z.A,{title:"Total",sx:{height:"100%"},children:(0,te.jsxs)(u.A,{spacing:2,children:[(0,te.jsxs)(u.A,{direction:"row",justifyContent:"space-between",children:[(0,te.jsx)(S.A,{color:As.palette.grey[500],children:"Sub Total:"}),(0,te.jsxs)(S.A,{children:["$",""===De?(0,te.jsx)(W.A,{sx:{width:"30px"}}):De]})]}),(0,te.jsxs)(u.A,{direction:"row",justifyContent:"space-between",children:[(0,te.jsx)(S.A,{color:As.palette.grey[500],children:"Tax:"}),(0,te.jsx)(S.A,{children:""===Se?(0,te.jsx)(W.A,{sx:{width:"30px"}}):Se})]}),(0,te.jsxs)(u.A,{direction:"row",justifyContent:"space-between",children:[(0,te.jsx)(S.A,{variant:"subtitle1",children:"Grand Total:"}),(0,te.jsx)(S.A,{variant:"subtitle1",children:""===ke?(0,te.jsx)(W.A,{sx:{width:"30px"}}):"$".concat(ke)})]})]})})}),(0,te.jsx)(v.Ay,{item:!0,xs:12,children:(0,te.jsxs)(u.A,{direction:"column",sx:{mt:2},children:[(0,te.jsx)(S.A,{color:"secondary",children:"Other Instructions:"}),(0,te.jsx)(S.A,{sx:{ml:3},children:Oe})]})})]})})})]})]})}}}]);