(this["webpackJsonpcustomer-portal"]=this["webpackJsonpcustomer-portal"]||[]).push([[0],{325:function(e,t,n){},397:function(e,t,n){},398:function(e,t,n){},522:function(e,t,n){},524:function(e,t,n){"use strict";n.r(t),t.default=n.p+"static/media/medatech-logo.d9b936ff.png"},525:function(e,t,n){"use strict";n.r(t);var a=n(0),r=n.n(a),c=n(40),s=n.n(c),o=(n(397),n(398),n(5)),i=n(4),l=n(15),u=n(6),d=n(259),j=n(667),b=n(639),O=n(659),h=n(624),f=n(671),x=n(668),m=n(669),p=n(177),g=n(622),S=n(543),v=n(670),E=n(541),T=n(355),C=n.n(T),D=n(356),A=n.n(D),k=n(649),y=n(620),w=n(621),N=n(330),I=n.n(N),P=n(336),U=n.n(P),R=n(48),L=n(68),F=n(79),M=n(21),B=n.n(M),W=n(326),_=new(function(){function e(){Object(L.a)(this,e)}return Object(F.a)(e,[{key:"login",value:function(e){return B.a.post("/customer_portal/login",e)}},{key:"logout",value:function(){localStorage.removeItem("token"),window.location.reload()}},{key:"getCurrentUser",value:function(){var e=localStorage.getItem("token");if(e)var t=Object(W.a)(e);return t}},{key:"changePassword",value:function(e){return B.a.post("/customer_portal/changePassword",e)}},{key:"forgotPassword",value:function(e){return B.a.post("/customer_portal/forgotPassword",e)}}]),e}()),G=["title","titleId"];function Y(){return Y=Object.assign||function(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function V(e,t){var n=e.title,r=e.titleId,c=z(e,G);return a.createElement("svg",Y({viewBox:"0 0 24 24",width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:t,"aria-labelledby":r},c),n?a.createElement("title",{id:r},n):null,a.createElement("path",{d:"M15.7,16.6c-0.2,0.2 -0.6,0.3 -0.8,0.4c-0.5,0.2 -1,0.2 -1.7,0.1c-1.2,-0.1 -1.3,-0.4 -2,-0.3c-0.8,0.1 -1.5,0.5 -1.5,0.4c0,-0.1 0.3,-0.3 0.8,-0.8c0.4,-0.5 0.9,-1.1 0.8,-1.9c0,-0.4 -0.1,-0.9 -0.1,-1.1l2.3,0l0,-1.8l-3,0c-0.1,-0.1 -0.5,-0.9 -0.7,-1.7c-0.2,-1.1 0,-1.6 0.1,-1.9c0.3,-0.7 1,-1.3 1.9,-1.3c0.3,0 0.639,0.049 0.839,0.149c0.2,0.1 0.42,0.22 0.635,0.396c0.384,0.314 0.457,0.641 0.626,1.055c0.056,0.137 0.1,0.6 0.1,0.7l2.7,0c0.1,-0.8 -0.5,-2.3 -1.2,-3c-0.8,-0.8 -1.7,-1.2 -2.1,-1.4c-1.7,-0.6 -4.1,-0.4 -5.6,1.2c-0.2,0.2 -1.2,1.3 -1.2,2.9c0,0.5 0.2,1 0.5,1.9c0.1,0.3 0.2,0.6 0.3,0.9l-0.9,0l0,1.8l1.7,0c0.2,0.4 0.3,0.8 0.3,1.3c0,0.2 -0.1,1.6 -1,2.4c-0.3,0.3 -0.7,0.4 -0.9,0.6l1.6,2c0.6,-0.2 1.1,-1 2.2,-0.8c2.1,0.4 2.9,1.2 4.6,0.7c0.5,-0.1 1,-0.4 1.8,-0.7c0.4,-0.2 0.5,-0.3 0.6,-0.4l-1.7,-1.8Z",style:{fillRule:"nonzero",fill:"rgb(128, 128, 128)"}}))}var H=a.forwardRef(V),q=(n.p,n(335)),X=n.n(q),J=n(332),Q=n.n(J),K=n(333),Z=n.n(K),$=n(331),ee=n.n($),te=n(1),ne=Object(te.jsx)("div",{children:_.getCurrentUser()?Object(te.jsxs)(te.Fragment,{children:[Object(te.jsxs)(k.a,{button:!0,component:R.b,to:"/dashboard",children:[Object(te.jsx)(y.a,{children:Object(te.jsx)(I.a,{})}),Object(te.jsx)(w.a,{primary:"Dashboard"})]}),Object(te.jsxs)(k.a,{button:!0,component:R.b,to:"/dashboard/invoices",children:[Object(te.jsx)(y.a,{children:Object(te.jsx)(H,{})}),Object(te.jsx)(w.a,{primary:"Invoices"})]}),Object(te.jsxs)(k.a,{button:!0,component:R.b,to:"/dashboard/statements",children:[Object(te.jsx)(y.a,{children:Object(te.jsx)(ee.a,{})}),Object(te.jsx)(w.a,{primary:"Statements"})]}),Object(te.jsxs)(k.a,{button:!0,component:R.b,to:"/dashboard/kanban",children:[Object(te.jsx)(y.a,{children:Object(te.jsx)(Q.a,{})}),Object(te.jsx)(w.a,{primary:"Kanban Board"})]}),Object(te.jsxs)(k.a,{button:!0,component:R.b,to:"/dashboard/gantt",children:[Object(te.jsx)(y.a,{children:Object(te.jsx)(Z.a,{})}),Object(te.jsx)(w.a,{primary:"Gantt Chart"})]}),Object(te.jsx)(g.a,{}),Object(te.jsxs)(k.a,{button:!0,component:R.b,to:"/dashboard/servicecalls",children:[Object(te.jsx)(y.a,{children:Object(te.jsx)(X.a,{})}),Object(te.jsx)(w.a,{primary:"Service Calls"})]})]}):Object(te.jsx)(te.Fragment,{children:Object(te.jsxs)(k.a,{button:!0,component:R.b,to:"/login",children:[Object(te.jsx)(y.a,{children:Object(te.jsx)(U.a,{})}),Object(te.jsx)(w.a,{primary:"Login"})]})})}),ae=n(677),re=n(682),ce=n(676),se=n(681),oe=n(651),ie=n(675),le=n(364);function ue(){var e=localStorage.getItem("token");return e?{"x-access-token":e}:{}}var de=new(function(){function e(){Object(L.a)(this,e)}return Object(F.a)(e,[{key:"getItemsForSale",value:function(e,t){return B.a.get("/customer_portal/itemsForSale/".concat(e,"/").concat(t),{headers:ue()})}},{key:"getOrders",value:function(){return B.a.get("/customer_portal/orders",{headers:ue()})}},{key:"getCustomerOrders",value:function(e){return B.a.get("/customer_portal/customerOrders/".concat(e),{headers:ue()})}},{key:"getOrderItems",value:function(e){return B.a.get("/customer_portal/orderItems/".concat(e),{headers:ue()})}},{key:"getShipments",value:function(){return B.a.get("/customer_portal/shipments",{headers:ue()})}},{key:"getCustomerShipments",value:function(e){return B.a.get("/customer_portal/customerShipments/".concat(e),{headers:ue()})}},{key:"getShipmentItems",value:function(e,t){return B.a.get("/customer_portal/shipmentItems/".concat(e,"/").concat(t),{headers:ue()})}},{key:"getInvoices",value:function(){return B.a.get("/customer_portal/invoices",{headers:ue()})}},{key:"getCustomerInfo",value:function(e){return B.a.get("/customer_portal/getCustomerInfo",{headers:ue()})}},{key:"getCustomerInvoices",value:function(e){return B.a.get("/customer_portal/customerInvoices/".concat(e),{headers:ue()})}},{key:"getInvoiceItems",value:function(e,t,n){return B.a.get("/customer_portal/invoiceItems/".concat(e,"/").concat(t,"/").concat(n),{headers:ue()})}},{key:"getInvoiceStatus",value:function(e){return B.a.get("/customer_portal/invoiceStatus/".concat(e),{headers:ue()})}},{key:"getCustomerParts",value:function(){return B.a.get("/customer_portal/customerParts",{headers:ue()})}},{key:"createOrder",value:function(e){return B.a.post("/customer_portal/createOrder",e,{headers:ue()})}},{key:"getUserNotifications",value:function(){return B.a.get("/customer_portal/userNotifications",{headers:ue()})}},{key:"setNotificationRead",value:function(e){return B.a.post("/customer_portal/userNotifications",e,{headers:ue()})}},{key:"createTask",value:function(e){return B.a.post("/customer_portal/createTask",e,{headers:ue()})}},{key:"updateTask",value:function(e){return B.a.patch("/customer_portal/updateTask",e,{headers:ue()})}},{key:"getServiceCalls",value:function(e){return B.a.get("/customer_portal/servicecalls/".concat(e),{headers:ue()})}},{key:"getServiceCall",value:function(e){return B.a.get("/customer_portal/servicecall/".concat(e),{headers:ue()})}},{key:"getServiceCallExternalRemarks",value:function(e){return B.a.get("/customer_portal/servicecall/remarks/".concat(e),{headers:ue()})}},{key:"getTaskExplanation",value:function(e){return B.a.get("/customer_portal/taskExplanation/".concat(e),{headers:ue()})}},{key:"getTaskAttachments",value:function(e){return B.a.get("/customer_portal/taskAttachments/".concat(e),{headers:ue()})}},{key:"getCallStatuses",value:function(){return B.a.get("/customer_portal/callStatuses",{headers:ue()})}},{key:"getStatusLang2",value:function(e){return B.a.get("/customer_portal/statusLang2/".concat(e),{headers:ue()})}},{key:"getCallTypes",value:function(){return B.a.get("/customer_portal/callTypes",{headers:ue()})}},{key:"getCallSeverities",value:function(){return B.a.get("/customer_portal/callSeverities",{headers:ue()})}},{key:"getCustomerContacts",value:function(){return B.a.get("/customer_portal/customerContacts",{headers:ue()})}},{key:"getUserProjects",value:function(e){return B.a.get("/customer_portal/userProjects/".concat(e),{headers:ue()})}},{key:"getProjectTasks",value:function(e){return B.a.get("/customer_portal/projectTasks/".concat(e),{headers:ue()})}},{key:"getProjectWBS",value:function(e){return B.a.get("/customer_portal/projectWBS/".concat(e),{headers:ue()})}},{key:"getGanttWBS",value:function(e){return B.a.get("/customer_portal/ganttWBS/".concat(e),{headers:ue()})}},{key:"getSCAttachments",value:function(e){return B.a.get("/customer_portal/scAttachments/".concat(e),{headers:ue()})}},{key:"getTaskStatuses",value:function(){return B.a.get("/customer_portal/taskStatuses",{headers:ue()})}},{key:"getTaskTypes",value:function(){return B.a.get("/customer_portal/taskTypes",{headers:ue()})}},{key:"getTaskSizes",value:function(){return B.a.get("/customer_portal/taskSizes",{headers:ue()})}},{key:"getUsers",value:function(){return B.a.get("/customer_portal/users",{headers:ue()})}},{key:"getCustomerStatements",value:function(e){return B.a.get("/customer_portal/customerStatements/".concat(e),{headers:ue()})}},{key:"addServiceCallComment",value:function(e){return B.a.post("/customer_portal/addServiceCallComment",e,{headers:ue()})}},{key:"updateServiceCall",value:function(e){return B.a.patch("/customer_portal/updateServiceCall",e,{headers:ue()})}},{key:"updateCallStatus",value:function(e){return B.a.post("/customer_portal/updateCallStatus",e,{headers:ue()})}},{key:"changeTaskStatus",value:function(e){return B.a.patch("/customer_portal/changeTaskStatus",e,{headers:ue()})}},{key:"CreateServiceCall",value:function(e){return B.a.post("/customer_portal/createServiceCall",e,{headers:ue()})}},{key:"addServiceCallAttachment",value:function(e){return B.a.post("/customer_portal/addServiceCallAttachment",e,{headers:ue()})}},{key:"getCustomerSignup",value:function(e){return B.a.get("/customer_portal/CustomerSignup/".concat(e))}},{key:"checkContact",value:function(e){return B.a.get("/customer_portal/check_contact/".concat(e))}},{key:"checkUser",value:function(e){return B.a.get("/customer_portal/check_user/".concat(e))}},{key:"createContact",value:function(e){return B.a.post("/customer_portal/CreateContact/",e)}},{key:"createUser",value:function(e){return B.a.post("/customer_portal/CreateUser/",e)}},{key:"getTheseCustomers",value:function(e){return B.a.get("/customer_portal/customers/".concat(e),{headers:ue()})}},{key:"getOrderForStatus",value:function(){return B.a.get("/customer_portal/orderForStatus",{headers:ue()})}},{key:"getLoginData",value:function(e,t){return B.a.get("/customer_portal/getLoginData/".concat(e,"/").concat(t),{headers:ue()})}},{key:"getTaskslist",value:function(e,t,n,a,r,c){return B.a.get("/customer_portal/getTaskslist",{headers:ue(),params:{projetNO:e,User:t,taskType:n,Order:a,WBSVAL:r,statdesArray:JSON.stringify(c)}})}},{key:"getInternalDialog",value:function(e){return B.a.get("/customer_portal/InternalDialog/".concat(e),{headers:ue()})}},{key:"getProjectList",value:function(){return B.a.get("/customer_portal/getProjectList",{headers:ue()})}},{key:"downloadOrderPdf",value:function(e){return B()({url:"/customer_portal/downloadOrderPdf",method:"POST",responseType:"blob",headers:ue(),data:{ORDNAME:e}})}},{key:"downloadInvoicePdf",value:function(e){return B()({url:"/customer_portal/downloadInvoicePdf",method:"POST",responseType:"blob",headers:ue(),data:{IVNUM:e}})}},{key:"downloadShipmentPdf",value:function(e){return B()({url:"/customer_portal/downloadShipmentPdf",method:"POST",responseType:"blob",headers:ue(),data:{DOCNO:e}})}},{key:"downloadServicePdf",value:function(e){return B()({url:"/customer_portal/downloadServicePdf",method:"POST",responseType:"blob",headers:ue(),data:{DOCNO:e}})}},{key:"downloadStatementPdf",value:function(e){return B()({url:"/customer_portal/downloadStatementPdf",method:"POST",responseType:"blob",headers:ue(),data:{STATEMENTNO:e}})}}]),e}()),je=n(22),be=n(673),Oe=n(660),he=function(){return Object(te.jsxs)(te.Fragment,{children:[Object(te.jsx)(be.a,{}),Object(te.jsx)(Oe.a,{variant:"rectangular",height:50,style:{marginBottom:10}}),Object(je.a)(Array(25)).map((function(e,t){return Object(te.jsx)(Oe.a,{variant:"rectangular",height:25,style:{marginBottom:5}},t)}))]})},fe=n(89),xe=n.n(fe),me=n(34),pe=n(538);function ge(e,t,n){return t[n]e[n]?1:0}function Se(e,t){return"desc"===e?function(e,n){return ge(e,n,t)}:function(e,n){return-ge(e,n,t)}}function ve(e,t){var n=e.map((function(e,t){return[e,t]}));return n.sort((function(e,n){var a=t(e[0],n[0]);return 0!==a?a:e[1]-n[1]})),n.map((function(e){return e[0]}))}var Ee=n(674),Te=n(661),Ce=n(625);function De(e){var t=e.order,n=e.orderBy,a=e.onRequestSort;return Object(te.jsx)(Ee.a,{children:Object(te.jsx)(ie.a,{children:e.headCells.map((function(e){return Object(te.jsx)(ce.a,{align:"center",padding:e.disablePadding?"none":"normal",sortDirection:n===e.id&&t,children:Object(te.jsxs)(Te.a,{active:n===e.id,direction:n===e.id?t:"asc",onClick:(r=e.id,function(e){return a(e,r)}),children:[Object(te.jsx)("b",{children:e.label}),n===e.id?Object(te.jsx)(h.a,{component:"span",sx:Ce.a,children:"desc"===t?"sorted descending":"sorted ascending"}):null]})},e.id);var r}))})})}var Ae=function(e){var t=e.title;return Object(te.jsx)(x.a,{sx:{pl:{sm:2},pr:{xs:1,sm:1}},children:Object(te.jsx)(p.a,{sx:{flex:"1 1 100%"},variant:"h6",id:"tableTitle",component:"div",children:t})})},ke=n(338),ye=n.n(ke),we=n(666),Ne=[{id:"IVDATE",numeric:!1,disablePadding:!0,label:"Date",align:"center"},{id:"IVNUM",numeric:!0,disablePadding:!1,label:"Invoice No.",align:"center"},{id:"TOTPRICE",numeric:!0,disablePadding:!1,label:"Total Price",align:"center"},{id:"REFERENCE",numeric:!0,disablePadding:!1,label:"Cust. P.O.",align:"center"},{id:"PAYDATE",numeric:!1,disablePadding:!0,label:"Due Date",align:"center"},{id:"ACTION",numeric:!0,disablePadding:!1,label:"PDF",align:"center"}];function Ie(e){var t=e.row,n=Object(a.useState)(!1),c=Object(i.a)(n,2),s=(c[0],c[1],Object(a.useState)([])),o=Object(i.a)(s,2),l=(o[0],o[1],Object(a.useState)(!0)),u=Object(i.a)(l,2),d=(u[0],u[1],Object(me.b)()),j=d.enqueueSnackbar;d.closeSnackbar;return Object(te.jsx)(r.a.Fragment,{children:Object(te.jsxs)(ie.a,{sx:{"& > *":{borderBottom:"unset"}},children:[Object(te.jsx)(ce.a,{component:"th",scope:"row",align:"center",children:new Date(t.IVDATE).toLocaleDateString("en-GB")}),Object(te.jsx)(ce.a,{align:"center",children:t.IVNUM}),Object(te.jsxs)(ce.a,{align:"center",children:[t.CODE," ",Number(t.TOTPRICE).toFixed(2)]}),Object(te.jsx)(ce.a,{align:"center",children:t.REFERENCE}),Object(te.jsx)(ce.a,{component:"th",scope:"row",align:"center",children:new Date(t.PAYDATE).toLocaleDateString("en-GB")}),Object(te.jsx)(ce.a,{align:"center",children:Object(te.jsx)(S.a,{onClick:function(){return e=t.IVNUM,void de.downloadInvoicePdf(e).then((function(t){var n=window.URL.createObjectURL(new Blob([t.data])),a=document.createElement("a");a.href=n,a.setAttribute("download","".concat(e,".pdf")),document.body.appendChild(a),a.click()})).catch((function(e){console.log(e.response),j("File not found. Please contact system manager.",{variant:"error"})}));var e},children:Object(te.jsx)(xe.a,{})})})]})})}function Pe(e){var t=e.selectedCustomer,n=Object(a.useState)("asc"),r=Object(i.a)(n,2),c=r[0],s=r[1],o=Object(a.useState)("calories"),l=Object(i.a)(o,2),u=l[0],d=l[1],j=Object(a.useState)([]),b=Object(i.a)(j,2),O=b[0],f=b[1],x=Object(a.useState)(0),m=Object(i.a)(x,2),p=m[0],g=m[1],S=Object(a.useState)(5),v=Object(i.a)(S,2),E=v[0],T=v[1],C=Object(a.useState)([]),D=Object(i.a)(C,2),A=D[0],k=D[1],y=Object(a.useState)([]),w=Object(i.a)(y,2),N=w[0],I=w[1],P=Object(a.useState)(!1),U=Object(i.a)(P,2),R=U[0],L=U[1],F=Object(a.useState)(""),M=Object(i.a)(F,2),B=M[0],W=M[1];Object(a.useEffect)((function(){var e="";if(t&&(e=t.CUSTNAME),!e){var n=localStorage.getItem("selectedCUSTNAME");if(n)try{e=JSON.parse(n)}catch(a){console.error("Error parsing stored customer:",a),e=null}}de.getCustomerInvoices(e).then((function(e){k(e.data.value),I(e.data.value),void 0!==e.data.value&&null!==e.data.value&&L(!0)})).catch((function(e){console.log(e)}))}),[t]);return R?Object(te.jsx)(h.a,{sx:{width:"100%"},children:Object(te.jsxs)(le.a,{sx:{width:"100%",mb:2},children:[Object(te.jsx)(ae.a,{children:Object(te.jsxs)(ie.a,{children:[Object(te.jsx)(ce.a,{children:Object(te.jsx)(Ae,{title:"Invoices"})}),Object(te.jsx)(ce.a,{children:Object(te.jsx)(pe.a,{id:"search-bar",className:"text",value:B,onChange:function(e){var t=e.target.value;if(W(t),""!==t){var n;n=A.filter((function(e){return e.IVNUM.toLowerCase().includes(t.toLowerCase())})),k(n)}else k(N)},label:"Invoice Search",variant:"outlined",placeholder:"Invoice Number...",InputProps:{startAdornment:Object(te.jsx)(we.a,{position:"start",children:Object(te.jsx)(ye.a,{})})},style:{height:"60px"}})})]})}),Object(te.jsx)(se.a,{children:Object(te.jsxs)(ae.a,{sx:{minWidth:750},"aria-labelledby":"tableTitle",size:"medium",children:[Object(te.jsx)(De,{numSelected:O.length,order:c,orderBy:u,onSelectAllClick:function(e){if(e.target.checked){var t=A.map((function(e){return e.name}));f(t)}else f([])},onRequestSort:function(e,t){s(u===t&&"asc"===c?"desc":"asc"),d(t)},rowCount:A.length,headCells:Ne}),Object(te.jsx)(re.a,{children:A.slice().sort(Se(c,u)).slice(p*E,p*E+E).map((function(e,t){return Object(te.jsx)(Ie,{row:e},t)}))})]})}),Object(te.jsx)(oe.a,{rowsPerPageOptions:[5,10,25],component:"div",count:A.length,rowsPerPage:E,page:p,onPageChange:function(e,t){g(t)},onRowsPerPageChange:function(e){T(parseInt(e.target.value,10)),g(0)}})]})}):Object(te.jsx)(he,{})}var Ue=function(){return Object(te.jsx)(v.a,{maxWidth:"lg",sx:{mt:4,mb:4},children:Object(te.jsx)(E.a,{item:!0,xs:12,children:Object(te.jsx)(Pe,{})})})},Re=n(139),Le=n.n(Re),Fe=n(138),Me=n.n(Fe),Be=n(684),We=n(685),_e=n(663),Ge=[{id:"CURDATE",numeric:!1,disablePadding:!0,label:"Date"},{id:"ORDNAME",numeric:!0,disablePadding:!1,label:"Order No."},{id:"REFERENCE",numeric:!0,disablePadding:!1,label:"Cust. P.O."},{id:"QPRICE",numeric:!0,disablePadding:!1,label:"Price ex. VAT"},{id:"TOTPRICE",numeric:!0,disablePadding:!1,label:"Total Price"},{id:"ORDSTATUSDES",numeric:!0,disablePadding:!1,label:"Order Status"},{id:"NAME",numeric:!1,disablePadding:!0,label:"Contact"},{id:"ACTION",numeric:!0,disablePadding:!1,label:"PDF"}];function Ye(e){var t=e.row,n=Object(a.useState)(!1),c=Object(i.a)(n,2),s=c[0],o=c[1],l=Object(a.useState)([]),u=Object(i.a)(l,2),d=u[0],j=u[1],b=Object(a.useState)(!0),O=Object(i.a)(b,2),f=O[0],x=O[1],m=Object(me.b)(),g=m.enqueueSnackbar,v=(m.closeSnackbar,function(){s?o(!s):(x(!1),de.getOrderItems(t.ORDNAME).then((function(e){j(e.data.value),x(!0),o(!s)})).catch((function(e){console.log(e)})))});return Object(te.jsxs)(r.a.Fragment,{children:[Object(te.jsxs)(ie.a,{sx:{"& > *":{borderBottom:"unset"}},children:[Object(te.jsx)(ce.a,{children:f?Object(te.jsx)(S.a,{"aria-label":"expand row",size:"small",onClick:v,children:s?Object(te.jsx)(Me.a,{}):Object(te.jsx)(Le.a,{})}):Object(te.jsx)(Be.a,{size:28})}),Object(te.jsx)(ce.a,{component:"th",scope:"row",children:new Date(t.CURDATE).toLocaleDateString("en-GB")}),Object(te.jsx)(ce.a,{align:"center",children:t.ORDNAME}),Object(te.jsx)(ce.a,{align:"center",children:t.REFERENCE}),Object(te.jsxs)(ce.a,{align:"center",children:[t.CODE," ",t.QPRICE.toLocaleString()]}),Object(te.jsxs)(ce.a,{align:"center",children:[t.CODE," ",t.TOTPRICE.toLocaleString()]}),Object(te.jsx)(ce.a,{align:"center",children:Object(te.jsx)(_e.a,{style:{color:function(e){switch(e){case"Draft":return"#00ff00";case"Confirmed":return"#fe9e00";case"In Progress":return"#5ab963";case"Completed":return"#80ffff";case"Assm Opened":case"Partial Assm":case"Assembled":return"#ff80ff";case"Paid":return"#ffff00";case"Canceled":return"#ff0000";default:return"black"}}(t.ORDSTATUSDES)},label:t.ORDSTATUSDES})}),Object(te.jsx)(ce.a,{align:"center",children:t.NAME}),Object(te.jsx)(ce.a,{align:"center",children:Object(te.jsx)(S.a,{onClick:function(){return e=t.ORDNAME,void de.downloadOrderPdf(e).then((function(t){var n=window.URL.createObjectURL(new Blob([t.data])),a=document.createElement("a");a.href=n,a.setAttribute("download","".concat(e,".pdf")),document.body.appendChild(a),a.click()})).catch((function(e){console.log(e.response),g("File not found. Please contact system manager.",{variant:"error"})}));var e},children:Object(te.jsx)(xe.a,{})})})]}),Object(te.jsx)(ie.a,{children:Object(te.jsx)(ce.a,{style:{paddingBottom:0,paddingTop:0,paddingLeft:100,backgroundColor:"#F8F8F8"},colSpan:8,children:Object(te.jsx)(We.a,{in:s,timeout:"auto",unmountOnExit:!0,onClick:v,children:Object(te.jsxs)(h.a,{sx:{margin:1},children:[Object(te.jsx)(p.a,{variant:"h6",gutterBottom:!0,component:"div",children:"Order Items"}),f?Object(te.jsxs)(ae.a,{size:"small","aria-label":"order-items",children:[Object(te.jsx)(Ee.a,{children:Object(te.jsxs)(ie.a,{children:[Object(te.jsx)(ce.a,{children:Object(te.jsx)("b",{children:"Part No."})}),Object(te.jsx)(ce.a,{children:Object(te.jsx)("b",{children:"Part Name"})}),Object(te.jsx)(ce.a,{align:"right",children:Object(te.jsx)("b",{children:"Quantity"})}),Object(te.jsx)(ce.a,{align:"right",children:Object(te.jsx)("b",{children:"Balance"})}),Object(te.jsx)(ce.a,{align:"right",children:Object(te.jsx)("b",{children:"Price"})}),Object(te.jsx)(ce.a,{align:"right",children:Object(te.jsx)("b",{children:"Total Price ex. VAT"})}),Object(te.jsx)(ce.a,{align:"right",children:Object(te.jsx)("b",{children:"Total Price"})})]})}),Object(te.jsx)(re.a,{children:d.map((function(e,t){return Object(te.jsxs)(ie.a,{children:[Object(te.jsx)(ce.a,{component:"th",scope:"row",children:e.PARTNAME}),Object(te.jsx)(ce.a,{children:e.PDES}),Object(te.jsx)(ce.a,{align:"right",children:e.TQUANT}),Object(te.jsx)(ce.a,{align:"right",children:e.TBALANCE}),Object(te.jsxs)(ce.a,{align:"right",children:[e.CODE," ",e.PRICE]}),Object(te.jsxs)(ce.a,{align:"right",children:[e.CODE," ",e.QPRICE]}),Object(te.jsxs)(ce.a,{align:"right",children:[e.CODE," ",e.VATPRICE]})]},t)}))})]}):Object(te.jsx)(Be.a,{})]})})})})]})}function ze(e){var t=e.selectedCustomer,n=Object(a.useState)("asc"),r=Object(i.a)(n,2),c=r[0],s=r[1],o=Object(a.useState)("calories"),l=Object(i.a)(o,2),u=l[0],d=l[1],j=Object(a.useState)([]),b=Object(i.a)(j,2),O=b[0],f=(b[1],Object(a.useState)(0)),x=Object(i.a)(f,2),m=x[0],p=x[1],g=Object(a.useState)(5),S=Object(i.a)(g,2),v=S[0],E=S[1],T=Object(a.useState)([]),C=Object(i.a)(T,2),D=C[0],A=C[1],k=Object(a.useState)(!1),y=Object(i.a)(k,2),w=y[0],N=y[1];Object(a.useEffect)((function(){var e="";if(t&&(e=t.CUSTNAME),!e){var n=localStorage.getItem("selectedCUSTNAME");if(n)try{e=JSON.parse(n)}catch(a){console.error("Error parsing stored customer:",a),e=null}}de.getCustomerOrders(e).then((function(e){A(e.data.value),void 0!==e.data.value&&null!==e.data.value&&N(!0)})).catch((function(e){console.log(e)}))}),[t]);return w?Object(te.jsx)(h.a,{sx:{width:"100%"},children:Object(te.jsxs)(le.a,{sx:{width:"100%",mb:2},children:[Object(te.jsx)(Ae,{title:"Orders"}),Object(te.jsx)(se.a,{children:Object(te.jsxs)(ae.a,{sx:{minWidth:750},"aria-labelledby":"tableTitle",size:"medium",children:[Object(te.jsx)(De,{numSelected:O.length,order:c,orderBy:u,onRequestSort:function(e,t){s(u===t&&"asc"===c?"desc":"asc"),d(t)},rowCount:D.length,headCells:Ge}),Object(te.jsx)(re.a,{children:D.slice().sort(Se(c,u)).slice(m*v,m*v+v).map((function(e,t){return Object(te.jsx)(Ye,{row:e},t)}))})]})}),Object(te.jsx)(oe.a,{rowsPerPageOptions:[5,10,25],component:"div",count:D.length,rowsPerPage:v,page:m,onPageChange:function(e,t){p(t)},onRowsPerPageChange:function(e){E(parseInt(e.target.value,10)),p(0)}})]})}):Object(te.jsx)("div",{children:"No Order for this Customer"})}var Ve=function(){return Object(te.jsx)(v.a,{maxWidth:"lg",sx:{mt:4,mb:4},children:Object(te.jsx)(E.a,{item:!0,xs:12,children:Object(te.jsx)(ze,{})})})},He=[{id:"CURDATE",numeric:!1,disablePadding:!0,label:"Date"},{id:"DOCNO",numeric:!0,disablePadding:!1,label:"Shipment No."},{id:"REFERENCE",numeric:!0,disablePadding:!1,label:"Cust. P.O."},{id:"QPRICE",numeric:!0,disablePadding:!1,label:"Price ex. VAT"},{id:"TOTPRICE",numeric:!0,disablePadding:!1,label:"Total Price"},{id:"STATDES",numeric:!0,disablePadding:!1,label:"Shipment Status"},{id:"ACTION",numeric:!0,disablePadding:!1,label:"PDF"}];function qe(e){var t=e.row,n=Object(a.useState)(!1),c=Object(i.a)(n,2),s=c[0],o=c[1],l=Object(a.useState)([]),u=Object(i.a)(l,2),d=u[0],j=u[1],b=Object(a.useState)(!0),O=Object(i.a)(b,2),f=O[0],x=O[1],m=Object(me.b)(),g=m.enqueueSnackbar,v=(m.closeSnackbar,function(){s?o(!s):(x(!1),de.getShipmentItems(t.DOCNO,t.TYPE).then((function(e){j(e.data.value),x(!0),o(!s)})).catch((function(e){console.log(e)})))});return Object(te.jsxs)(r.a.Fragment,{children:[Object(te.jsxs)(ie.a,{sx:{"& > *":{borderBottom:"unset"}},children:[Object(te.jsx)(ce.a,{children:f?Object(te.jsx)(S.a,{"aria-label":"expand row",size:"small",onClick:v,children:s?Object(te.jsx)(Me.a,{}):Object(te.jsx)(Le.a,{})}):Object(te.jsx)(Be.a,{size:28})}),Object(te.jsx)(ce.a,{component:"th",scope:"row",children:new Date(t.CURDATE).toLocaleDateString("en-GB")}),Object(te.jsx)(ce.a,{align:"center",children:t.DOCNO}),Object(te.jsx)(ce.a,{align:"center",children:t.REFERENCE}),Object(te.jsxs)(ce.a,{align:"center",children:[t.CODE," ",t.QPRICE.toLocaleString()]}),Object(te.jsxs)(ce.a,{align:"center",children:[t.CODE," ",t.TOTPRICE.toLocaleString()]}),Object(te.jsx)(ce.a,{align:"center",children:Object(te.jsx)(_e.a,{style:{color:function(e){switch(e){case"Draft":return"#00ff00";case"Final":return"#ffd233";case"Canceled":return"#f56b62";default:return"black"}}(t.STATDES)},label:t.STATDES})}),Object(te.jsx)(ce.a,{align:"center",children:Object(te.jsx)(S.a,{onClick:function(){return e=t.DOCNO,void de.downloadShipmentPdf(e).then((function(t){var n=window.URL.createObjectURL(new Blob([t.data])),a=document.createElement("a");a.href=n,a.setAttribute("download","".concat(e,".pdf")),document.body.appendChild(a),a.click()})).catch((function(e){console.log(e.response),g("File not found. Please contact system manager.",{variant:"error"})}));var e},children:Object(te.jsx)(xe.a,{})})})]}),Object(te.jsx)(ie.a,{children:Object(te.jsx)(ce.a,{style:{paddingBottom:0,paddingTop:0,paddingLeft:100,backgroundColor:"#F8F8F8"},colSpan:8,children:Object(te.jsx)(We.a,{in:s,timeout:"auto",unmountOnExit:!0,onClick:v,children:Object(te.jsxs)(h.a,{sx:{margin:1},children:[Object(te.jsx)(p.a,{variant:"h6",gutterBottom:!0,component:"div",children:"Shipped Items"}),f?Object(te.jsxs)(ae.a,{size:"small","aria-label":"purchases",children:[Object(te.jsx)(Ee.a,{children:Object(te.jsxs)(ie.a,{children:[Object(te.jsx)(ce.a,{children:Object(te.jsx)("b",{children:"Part No."})}),Object(te.jsx)(ce.a,{children:Object(te.jsx)("b",{children:"Part Name"})}),Object(te.jsx)(ce.a,{align:"right",children:Object(te.jsx)("b",{children:"Quantity"})}),Object(te.jsx)(ce.a,{align:"right",children:Object(te.jsx)("b",{children:"Price"})}),Object(te.jsx)(ce.a,{align:"right",children:Object(te.jsx)("b",{children:"Total Price ex. VAT"})})]})}),Object(te.jsx)(re.a,{children:d.map((function(e,t){return Object(te.jsxs)(ie.a,{children:[Object(te.jsx)(ce.a,{component:"th",scope:"row",children:e.PARTNAME}),Object(te.jsx)(ce.a,{children:e.PDES}),Object(te.jsx)(ce.a,{align:"right",children:e.TQUANT}),Object(te.jsxs)(ce.a,{align:"right",children:[e.CODE," ",e.PRICE]}),Object(te.jsxs)(ce.a,{align:"right",children:[e.CODE," ",e.QPRICE]})]},t)}))})]}):Object(te.jsx)(Be.a,{})]})})})})]})}function Xe(e){var t=e.selectedCustomer,n=Object(a.useState)("asc"),r=Object(i.a)(n,2),c=r[0],s=r[1],o=Object(a.useState)("calories"),l=Object(i.a)(o,2),u=l[0],d=l[1],j=Object(a.useState)([]),b=Object(i.a)(j,2),O=b[0],f=b[1],x=Object(a.useState)(0),m=Object(i.a)(x,2),p=m[0],g=m[1],S=Object(a.useState)(5),v=Object(i.a)(S,2),E=v[0],T=v[1],C=Object(a.useState)([]),D=Object(i.a)(C,2),A=D[0],k=D[1],y=Object(a.useState)(!1),w=Object(i.a)(y,2),N=w[0],I=w[1];Object(a.useEffect)((function(){var e="";if(t&&(e=t.CUSTNAME),!e){var n=localStorage.getItem("selectedCUSTNAME");if(n)try{e=JSON.parse(n)}catch(a){console.error("Error parsing stored customer:",a),e=null}}de.getCustomerShipments(e).then((function(e){k(e.data.value),void 0!==e.data.value&&null!==e.data.value&&I(!0)})).catch((function(e){console.log(e)}))}),[t]);return N?Object(te.jsx)(h.a,{sx:{width:"100%"},children:Object(te.jsxs)(le.a,{sx:{width:"100%",mb:2},children:[Object(te.jsx)(Ae,{title:"Shipments"}),Object(te.jsx)(se.a,{children:Object(te.jsxs)(ae.a,{sx:{minWidth:750},"aria-labelledby":"tableTitle",size:"medium",children:[Object(te.jsx)(De,{numSelected:O.length,order:c,orderBy:u,onSelectAllClick:function(e){if(e.target.checked){var t=A.map((function(e){return e.name}));f(t)}else f([])},onRequestSort:function(e,t){s(u===t&&"asc"===c?"desc":"asc"),d(t)},rowCount:A.length,headCells:He}),Object(te.jsx)(re.a,{children:A.slice().sort(Se(c,u)).slice(p*E,p*E+E).map((function(e,t){return Object(te.jsx)(qe,{row:e},t)}))})]})}),Object(te.jsx)(oe.a,{rowsPerPageOptions:[5,10,25],component:"div",count:A.length,rowsPerPage:E,page:p,onPageChange:function(e,t){g(t)},onRowsPerPageChange:function(e){T(parseInt(e.target.value,10)),g(0)}})]})}):Object(te.jsx)(he,{})}var Je=function(){return Object(te.jsx)(v.a,{maxWidth:"lg",sx:{mt:4,mb:4},children:Object(te.jsx)(E.a,{item:!0,xs:12,children:Object(te.jsx)(Xe,{})})})},Qe=n(46),Ke=n(652),Ze=n(151),$e=n(653),et=n(646),tt=n(125),nt=n.n(tt),at=n(527),rt=n(686),ct=n(140),st=n.n(ct),ot=n(339),it=n.n(ot),lt=n(340),ut=n.n(lt);function dt(e){return Number.parseFloat(e).toFixed(2)}var jt=[{id:"PARTDES",numeric:!1,disablePadding:!0,label:"Item Description"},{id:"PARTNAME",numeric:!0,disablePadding:!1,label:"Item Number"},{id:"BASEPLPRICE",numeric:!0,disablePadding:!1,label:"Price"},{id:"VAT Price",numeric:!0,disablePadding:!1,label:"VAT Price"},{id:"QUANTITY",numeric:!0,disablePadding:!1,label:"Quantity"},{id:"total-price",numeric:!0,disablePadding:!1,label:"Total Price"}];function bt(e){var t=e.order,n=e.orderBy,a=e.onRequestSort;return Object(te.jsx)(Ee.a,{children:Object(te.jsxs)(ie.a,{children:[Object(te.jsx)(ce.a,{padding:"checkbox"}),jt.map((function(e){return Object(te.jsx)(ce.a,{align:e.numeric?"right":"left",padding:e.disablePadding?"none":"normal",sortDirection:n===e.id&&t,children:Object(te.jsxs)(Te.a,{active:n===e.id,direction:n===e.id?t:"asc",onClick:(r=e.id,function(e){a(e,r)}),children:[Object(te.jsx)("b",{children:e.label}),n===e.id?Object(te.jsx)(h.a,{component:"span",sx:Ce.a,children:"desc"===t?"sorted descending":"sorted ascending"}):null]})},e.id);var r}))]})})}var Ot=function(e){var t=e.numSelected;return Object(te.jsxs)(x.a,{sx:Object(l.a)({pl:{sm:2},pr:{xs:1,sm:1}},t>0&&{bgcolor:function(e){return Object(at.a)(e.palette.primary.main,e.palette.action.activatedOpacity)}}),children:[t>0?Object(te.jsxs)(p.a,{sx:{flex:"1 1 100%"},color:"inherit",variant:"subtitle1",component:"div",children:[t," selected"]}):Object(te.jsx)(p.a,{sx:{flex:"1 1 100%"},variant:"h6",id:"tableTitle",component:"div",children:"Items in Order"}),t>0?Object(te.jsx)(rt.a,{title:"Delete",children:Object(te.jsx)(S.a,{onClick:e.onDelete,children:Object(te.jsx)(st.a,{})})}):Object(te.jsx)(rt.a,{title:"Filter list",children:Object(te.jsx)(S.a,{children:Object(te.jsx)(it.a,{})})})]})};function ht(e){var t=a.useState("asc"),n=Object(i.a)(t,2),r=n[0],c=n[1],s=a.useState("calories"),o=Object(i.a)(s,2),l=o[0],u=o[1],d=a.useState([]),j=Object(i.a)(d,2),b=j[0],O=j[1],f=e.items;return Object(te.jsx)(h.a,{sx:{width:"100%"},children:Object(te.jsxs)(le.a,{sx:{width:"100%",mb:2},children:[Object(te.jsx)(Ot,{}),Object(te.jsx)(se.a,{children:Object(te.jsxs)(ae.a,{sx:{minWidth:750},"aria-labelledby":"tableTitle",size:"medium",children:[Object(te.jsx)(bt,{numSelected:b.length,order:r,orderBy:l,onSelectAllClick:function(e){if(e.target.checked){var t=f.map((function(e){return e.PARTNAME}));O(t)}else O([])},onRequestSort:function(e,t){c(l===t&&"asc"===r?"desc":"asc"),u(t)},rowCount:f.length}),Object(te.jsxs)(re.a,{children:[ve(f,Se(r,l)).map((function(t,n){var a,r=(a=t.PARTNAME,-1!==b.indexOf(a)),c="enhanced-table-checkbox-".concat(n);return Object(te.jsxs)(ie.a,{hover:!0,role:"checkbox","aria-checked":r,tabIndex:-1,selected:r,children:[Object(te.jsx)(ce.a,{padding:"checkbox"}),Object(te.jsx)(ce.a,{component:"th",id:c,scope:"row",padding:"none",children:t.PARTDES}),Object(te.jsx)(ce.a,{align:"right",children:t.PARTNAME}),Object(te.jsxs)(ce.a,{align:"right",children:[t.BASEPLCODE," ",dt(t.BASEPLPRICE)]}),Object(te.jsxs)(ce.a,{align:"right",children:[t.BASEPLCODE," ",dt(t.VATPRICE)]}),Object(te.jsxs)(ce.a,{align:"right",children:[Object(te.jsx)(S.a,{onClick:function(n){return e.onDecrement(t,n)},children:Object(te.jsx)(ut.a,{})}),t.QUANTITY,Object(te.jsx)(S.a,{onClick:function(n){return e.onIncrement(t,n)},children:Object(te.jsx)(nt.a,{})})]}),Object(te.jsxs)(ce.a,{align:"right",children:[t.BASEPLCODE," ",dt(t.VATPRICE*t.QUANTITY)]})]},n)})),Object(te.jsxs)(ie.a,{children:[Object(te.jsx)(ce.a,{colSpan:6,align:"right",children:Object(te.jsx)("b",{children:"Total Price"})}),Object(te.jsx)(ce.a,{align:"right",children:function(){for(var e=0,t=0;t0){var n=g.findIndex((function(e){return e.PARTNAME===u.PARTNAME}));console.log(u.PARTNAME),n>-1?(t[n].QUANTITY=parseInt(u.QUANTITY)+parseInt(O),S(t)):(u.QUANTITY=O,S((function(e){return[].concat(Object(je.a)(e),[u])})))}else console.log("Quantity must be greater than 0.")},children:"Add"})}),Object(te.jsx)(E.a,{item:!0,md:12,children:Object(te.jsx)(ht,{items:g,onDecrement:function(e){var t=Object(je.a)(g),n=g.findIndex((function(t){return t.PARTNAME===e.PARTNAME}));1===t[n].QUANTITY?t.splice(n,1):t[n].QUANTITY-=1,S(t)},onIncrement:function(e){var t=Object(je.a)(g),n=g.findIndex((function(t){return t.PARTNAME===e.PARTNAME}));t[n].QUANTITY=parseInt(t[n].QUANTITY)+1,S(t)}})}),Object(te.jsx)(E.a,{item:!0,md:12,children:Object(te.jsx)(Ze.a,{disabled:0===g.length,onClick:function(){console.log(g);for(var e=Object(je.a)(g),t=[],n=0;n0?c.map((function(e,t){return Object(te.jsxs)(mt.a,{onClick:function(){return 0===e.READ?function(e,t){de.setNotificationRead({ID:e}).then((function(e){var n=Object(je.a)(c);n[t].READ=1,s(n),console.log(c)})).catch((function(e){console.log(e)}))}(e.ID,t):null},selected:0===e.READ,children:[Object(te.jsx)(y.a,{children:Object(te.jsx)(It.a,{fontSize:"small"})}),Object(te.jsxs)(w.a,{children:[e.ORDNAME," has been changed to ",e.ORDSTATUSDES," ",x.format(new Date(e.DATE))]})]},t)})):Object(te.jsx)(p.a,{children:"No notifications."})})]}):Object(te.jsx)(Be.a,{})}var Lt=n(32),Ft=n.n(Lt),Mt=n(49),Bt=n(688),Wt=n(689),_t=n(99),Gt=n(83),Yt=n.n(Gt),zt=n(207),Vt=n.n(zt),Ht=n(26),qt=(n(194),n(325),n(111)),Xt=n(542);function Jt(){var e=r.a.useState(!0),t=Object(i.a)(e,2),n=t[0];t[1];return Object(te.jsx)("div",{children:Object(te.jsx)(Xt.a,{sx:{color:"#fff",zIndex:function(e){return e.zIndex.drawer+1}},open:n,children:Object(te.jsx)(Be.a,{color:"inherit"})})})}var Qt=function(e){return{sx:{bgcolor:Zt(e),fontSize:16,width:30,height:30},children:Kt(e)}},Kt=function(e){var t=e.charAt(0),n=e.charAt(e.length-1);return t.toUpperCase()+n.toUpperCase()},Zt=function(e){var t,n=0;for(t=0;t>8*t&255).toString(16)).slice(-2)}return a},$t=function(e){return new Date(e).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).toUpperCase()},en=function(e){return new Promise((function(t,n){return function(e,t){var n=new FileReader;n.readAsDataURL(e),n.onload=function(){return t(n.result)},n.onerror=function(e){}}(e,(function(e){return t({data:{link:e}})}))}))},tn=function(e,t,n){var a=document.createElement("a");a.href=e,a.download=t+"."+n,a.click()},nn=n(343),an=n.n(nn),rn=(n(518),n(519),n(520),n(521),n(14)),cn=n(358),sn=n(84),on=n(114),ln=n(342),un=(n(522),n(687)),dn=n(654),jn=Object(a.createContext)();function bn(){return Object(a.useContext)(jn)}function On(e){var t=e.children,n=Object(a.useState)([]),r=Object(i.a)(n,2),c=r[0],s=r[1],o=Object(a.useState)([]),l=Object(i.a)(o,2),u=l[0],d=l[1],j=Object(a.useState)(!0),b=Object(i.a)(j,2),O=b[0],h=b[1],f=Object(a.useState)(!1),x=Object(i.a)(f,2),m=x[0],p=x[1],g=Object(a.useState)({}),S=Object(i.a)(g,2),v=S[0],E=S[1],T=Object(a.useState)(""),C=Object(i.a)(T,2),D=C[0],A=C[1],k=Object(a.useState)([]),y=Object(i.a)(k,2),w=y[0],N=y[1],I=Object(a.useState)([]),P=Object(i.a)(I,2),U=P[0],R=P[1],L=Object(a.useState)([]),F=Object(i.a)(L,2),M=F[0],B=F[1],W=Object(a.useState)([]),_=Object(i.a)(W,2),G=_[0],Y=_[1],z=Object(a.useState)([]),V=Object(i.a)(z,2),H=V[0],q=V[1],X=Object(a.useState)([]),J=Object(i.a)(X,2),Q=J[0],K=J[1],Z=Object(a.useState)([]),$=Object(i.a)(Z,2),ee=$[0],ne=$[1];return Object(te.jsx)(jn.Provider,{value:{serviceCallData:c,setServiceCallData:s,serviceCallStatus:u,setServiceCallStatus:d,hideAnsweredCalls:O,setHideAnsweredCalls:h,viewcallDataTable:m,setviewcallDataTable:p,filtersBlock:v,setFiltersBlock:E,globalFilterData:D,setGlobalFilterData:A,orders:w,setOrders:N,orderforStatus:U,setOrderForStatus:R,logincustData:M,setLogincustData:B,userBkup:G,setUserBakup:Y,filteredOrdersBkup:H,setFilteredOrdersBkup:q,taskTypesBkup:Q,setTaskTypesBkup:K,projectsBkup:ee,setProjectsBkup:ne},children:t})}var hn=function(e){var t,n=e.selectedCustomer,r=Object(a.useState)(""),c=Object(i.a)(r,2),s=c[0],o=c[1],u=Object(a.useState)(null),d=Object(i.a)(u,2),j=d[0],b=d[1],O=Object(a.useState)(null),h=Object(i.a)(O,2),f=h[0],x=h[1],m=Object(a.useState)(!0),p=Object(i.a)(m,2),g=p[0],v=p[1],E=function(){return{global:{value:null,matchMode:rn.a.CONTAINS},DOCNO:{operator:rn.b.AND,constraints:[{value:null,matchMode:rn.a.STARTS_WITH}]},ZEMG_SVC_DETAILS:{operator:rn.b.AND,constraints:[{value:null,matchMode:rn.a.STARTS_WITH}]},REFERENCE:{operator:rn.b.AND,constraints:[{value:null,matchMode:rn.a.STARTS_WITH}]},NAME:{operator:rn.b.AND,constraints:[{value:null,matchMode:rn.a.STARTS_WITH}]},STARTDATE:{operator:rn.b.AND,constraints:[{value:null,matchMode:rn.a.DATE_IS}]},CALLTYPECODE:{operator:rn.b.AND,constraints:[{value:null,matchMode:rn.a.EQUALS}]},CDES:{operator:rn.b.OR,constraints:[{value:null,matchMode:rn.a.EQUALS}]},CALLSTATUSCODE:{operator:rn.b.AND,constraints:[{value:null,matchMode:rn.a.EQUALS}]},STATUSDATE:{operator:rn.b.AND,constraints:[{value:null,matchMode:rn.a.DATE_IS}]}}},T=Object(a.useState)(E()),C=Object(i.a)(T,2),D=C[0],A=C[1],k=Object(a.useState)(!0),y=Object(i.a)(k,2),w=y[0],N=y[1],I=Object(me.b)(),P=I.enqueueSnackbar,U=(I.closeSnackbar,bn()),L=U.serviceCallData,F=U.serviceCallStatus,M=U.setServiceCallData,B=U.setServiceCallStatus,W=U.hideAnsweredCalls,_=U.setHideAnsweredCalls,G=U.viewcallDataTable,Y=U.setviewcallDataTable,z=U.filtersBlock,V=U.setFiltersBlock,H=U.globalFilterData,q=U.setGlobalFilterData,X=Object(a.useState)(!1),J=Object(i.a)(X,2),Q=J[0],K=J[1];Object(a.useEffect)((function(){x($(L)),b(F),N(!1),!0===G?(A(z),o(H)):V(E())}),[]);var Z=function(){var e=Object(Mt.a)(Ft.a.mark((function e(){var t,a,r,c;return Ft.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V(E()),A(E()),o(""),q(""),t="",n&&(t=n.CUSTNAME),!t&&(a=localStorage.getItem("selectedCUSTNAME")))try{t=JSON.parse(a)}catch(s){console.error("Error parsing stored customer:",s),t=null}return K(!0),e.prev=8,e.next=11,de.getServiceCalls(t);case 11:return r=e.sent,x($(r.data.value)),M($(r.data.value)),e.next=16,de.getCallStatuses();case 16:c=e.sent,b(c.data.value),B(c.data.value),e.next=24;break;case 21:e.prev=21,e.t0=e.catch(8),console.error(e.t0);case 24:return e.prev=24,K(!1),N(!1),e.finish(24);case 28:case"end":return e.stop()}}),e,null,[[8,21,24,28]])})));return function(){return e.apply(this,arguments)}}();var $=function(e){return Object(je.a)(e||[]).map((function(e){return e.STARTDATE=new Date(e.STARTDATE),e.STATUSDATE=new Date(e.STATUSDATE),e}))},ee=function(e){return e.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"})},ne=function(e){var t=e.target.value,n=Object(l.a)({},D);n.global.value=t,A(n),V(n),o(t),q(t)},re=function(e){_(e.target.checked)},ce=function(e){return Object(te.jsx)(ln.a,{value:e.value,onChange:function(t){return e.filterCallback(t.value,e.index)},dateFormat:"dd/mm/yy",placeholder:"dd/mm/yyyy",mask:"99/99/9999"})},se=function(e){v(e.target.checked)},oe=Object(te.jsxs)(te.Fragment,{children:[Object(te.jsx)(ae.a,{children:Object(te.jsx)("tr",{children:Object(te.jsxs)("td",{children:[Object(te.jsx)("h5",{className:"m-0",children:"Service Calls \xa0\xa0\xa0"}),Q?Object(te.jsxs)("p",{style:{fontSize:15,color:"red"},children:["Please wait. The Data is loading....",Object(te.jsxs)("box",{children:[Object(te.jsx)(Be.a,{style:{width:20,height:23,color:"red"}})," "]})," "]}):Object(te.jsx)(te.Fragment,{})]})})}),Object(te.jsx)(un.a,{control:Object(te.jsx)(dn.a,{onChange:se,checked:g,name:"gilad"}),label:"Show Only Active Tickets"})," ",Object(te.jsx)(un.a,{control:Object(te.jsx)(dn.a,{onChange:re,checked:W,name:"gilad"}),label:"Hide Answered Calls"})," ",Object(te.jsxs)("span",{className:"p-input-icon-left",children:[Object(te.jsx)("i",{className:"pi pi-search"}),Object(te.jsx)(on.a,{value:s,onChange:ne,placeholder:"Keyword Search"}),Object(te.jsx)(Ze.a,{onClick:Z,sx:{m:1},size:"small",variant:"contained",children:"Refresh Data"})]})]});return w?Object(te.jsx)(he,{}):Object(te.jsx)("div",{className:"datatable-doc-demo",children:Object(te.jsx)("div",{className:"card",children:Object(te.jsxs)(cn.a,{value:function(e,n){if(""!==(t=g&&W?e.filter((function(e){return"Y"===e.ACTIVEFLAG&&"Answered"!==e.CALLSTATUSCODE})):g?e.filter((function(e){return"Y"===e.ACTIVEFLAG})):W?e.filter((function(e){return"Answered"!==e.CALLSTATUSCODE})):e))return t.map((function(e){var t=n.find((function(t){return t.CODE===e.CALLSTATUSCODE}));return t&&t.ESTATDES?Object(l.a)(Object(l.a)({},e),{},{CALLSTATUSCODE:t.ESTATDES}):e}))}(f,j),paginator:!0,className:"p-datatable-customers",header:oe,rows:10,breakpoint:"960px",paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown",rowsPerPageOptions:[10,25,50],dataKey:"id",rowHover:!0,filters:D,filterDisplay:"menu",loading:w,responsiveLayout:"stack",globalFilterFields:["DOCNO","ZEMG_SVC_DETAILS","REFERENCE","NAME","STARTDATE","ZEMG_SEVDES","CALLTYPECODE","CALLSTATUSCODE","STATUSDATE"],emptyMessage:"No service calls found.",currentPageReportTemplate:"Showing {first} to {last} of {totalRecords} entries",onFilter:function(e){A(e.filters),V(e.filters)},children:[Object(te.jsx)(sn.a,{field:"DOCNO",header:"Ticket ID",filterField:"DOCNO",sortable:!0,body:function(e){return Object(te.jsxs)(R.b,{style:{textDecoration:"none",color:"blue"},to:"/dashboard/servicecall/".concat(e.DOCNO),sx:{mt:3},onClick:function(){return e.DOCNO,void Y(!1)},children:[" ",e.DOCNO]})},filter:!0,filterPlaceholder:"Search by Ticket ID"}),Object(te.jsx)(sn.a,{field:"ZEMG_SVC_DETAILS",header:"Subject",sortable:!0,filter:!0,filterPlaceholder:"Search by Subject"}),Object(te.jsx)(sn.a,{field:"REFERENCE",header:"Cust. Ref",sortable:!0,filter:!0,filterPlaceholder:"Search by Reference"}),Object(te.jsx)(sn.a,{field:"NAME",header:"Contact",sortable:!0,filter:!0,filterPlaceholder:"Search by Contact"}),Object(te.jsx)(sn.a,{field:"STARTDATE",header:"Open Date",sortable:!0,filterField:"STARTDATE",dataType:"date",body:function(e){return ee(e.STARTDATE)},filter:!0,filterPlaceholder:"Search by Open Date",filterElement:ce}),Object(te.jsx)(sn.a,{field:"CALLTYPECODE",header:"Classification",sortable:!0,filter:!0,filterPlaceholder:"Search by Classification"}),Object(te.jsx)(sn.a,{field:"ZEMG_SEVDES",header:"Call Severity",sortable:!0,filter:!0,filterPlaceholder:"Search by Call Severity"}),Object(te.jsx)(sn.a,{field:"CALLSTATUSCODE",header:"Status",sortable:!0,filter:!0,filterPlaceholder:"Search by Status"}),Object(te.jsx)(sn.a,{field:"STATUSDATE",header:"Update Date",sortable:!0,filterField:"STATUSDATE",dataType:"date",body:function(e){return ee(e.STATUSDATE)},filter:!0,filterPlaceholder:"Search by Update Date",filterElement:ce}),Object(te.jsx)(sn.a,{header:"Action",body:function(e){return Object(te.jsx)(S.a,{onClick:function(){return function(e){de.downloadServicePdf(e.DOCNO).then((function(t){var n=window.URL.createObjectURL(new Blob([t.data])),a=document.createElement("a");a.href=n,a.setAttribute("download","".concat(e.DOCNO,".pdf")),document.body.appendChild(a),a.click()})).catch((function(e){P("File not found. Please contact system manager.",{variant:"error"})}))}(e)},style:{fontSize:"24px"},children:Object(te.jsx)(xe.a,{style:{fontSize:"24px"}})})}})]})})})},fn=function(e){return Object(te.jsx)(E.a,{item:!0,md:3,children:Object(te.jsx)(Bt.a,{children:Object(te.jsx)(Wt.a,{children:Object(te.jsxs)(p.a,{sx:{fontSize:14},gutterBottom:!0,children:[Object(te.jsxs)("b",{children:[e.subject,":"]})," ",e.info]})})})})},xn=function(){var e,t=Object(me.b)(),n=t.enqueueSnackbar,c=(t.closeSnackbar,Object(a.useState)(!1)),s=Object(i.a)(c,2),o=s[0],l=s[1],u=Object(Qe.h)().docno,d=Object(a.useState)(null),j=Object(i.a)(d,2),b=j[0],O=j[1],h=Object(a.useState)(null),f=Object(i.a)(h,2),x=f[0],m=f[1],g=Object(a.useState)(!0),T=Object(i.a)(g,2),C=T[0],D=T[1],A=Object(a.useState)(0),k=Object(i.a)(A,2),y=(k[0],k[1],Object(a.useState)(_.getCurrentUser().name)),w=Object(i.a)(y,2),N=w[0],I=(w[1],Object(a.useState)([])),P=Object(i.a)(I,2),U=P[0],R=P[1],L=Object(qt.a)({accept:"*",readAs:"DataURL"}),F=Object(i.a)(L,2),M=F[0],B=F[1],W=(B.plainFiles,B.filesContent),G=B.clear,Y=Object(a.useState)([]),z=Object(i.a)(Y,2),V=z[0],H=z[1],q=Object(a.useState)(!0),X=Object(i.a)(q,2),J=(X[0],X[1],Object(a.useState)(!1)),Q=Object(i.a)(J,2),K=Q[0],Z=Q[1],$=bn(),ee=$.viewcallDataTable,ne=$.setviewcallDataTable,ae=function(e){console.info(W[0]),G(),R([])},re=(Ht.EditorState.createEmpty(),r.a.useState()),ce=Object(i.a)(re,2),se=ce[0],oe=ce[1],ie=function(){var e=Object(Mt.a)(Ft.a.mark((function e(){var t,n,a,r;return Ft.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,de.getServiceCall(u);case 2:if(1!==(t=e.sent.data).value.length){e.next=21;break}return e.next=6,de.getStatusLang2(t.value[0].CALLSTATUSCODE);case 6:return n=e.sent.data,e.next=9,de.getSCAttachments(u);case 9:return a=e.sent.data.value,t.ESTATDES=n.value[0].ESTATDES,t.CHANGEFLAG=n.value[0].CHANGEFLAG,O(t),e.next=15,de.getServiceCallExternalRemarks(u);case 15:r=e.sent.data,m(r),H(a),D(!1),e.next=22;break;case 21:Z(!0);case 22:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(a.useEffect)(Object(Mt.a)(Ft.a.mark((function e(){return Ft.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:!1===ee&&ie();case 1:case"end":return e.stop()}}),e)}))),[C,ee]),Object(a.useEffect)((function(){if(W){var e=W;R((function(t){return t.concat(e)}))}}),[W]);return Object(te.jsx)(te.Fragment,{children:ee?Object(te.jsx)(hn,{}):C&&!1===K?Object(te.jsx)(Jt,{}):K?Object(te.jsx)("div",{children:Object(te.jsx)("p",{children:Object(te.jsx)(et.a,{severity:"error",children:Object(te.jsx)("b",{children:"Sorry!..Invalid Service Call Number"})})})}):Object(te.jsxs)(v.a,{maxWidth:"lg",sx:{mt:4,mb:4},children:[Object(te.jsx)(Ze.a,{onClick:function(){ne(!0),O(null),D(!0),Z(!1)},size:"small",variant:"contained",children:"Back to search results"}),Object(te.jsxs)(E.a,{container:!0,spacing:1,direction:"row",alignItems:"center",children:[Object(te.jsx)(fn,{subject:"Ticket Number",info:b.value[0].DOCNO}),Object(te.jsx)(fn,{subject:"Subject",info:b.value[0].ZEMG_SVC_DETAILS}),Object(te.jsx)(fn,{subject:"Customer",info:b.value[0].CDES}),Object(te.jsx)(fn,{subject:"Contact",info:b.value[0].NAME}),Object(te.jsx)(fn,{subject:"Type of Call ",info:b.value[0].CALLTYPECODE}),Object(te.jsx)(fn,{subject:"Cust. Reference",info:b.value[0].REFERENCE}),Object(te.jsx)(fn,{subject:"Status",info:null!==(e=b.value[0].ESTATDES)&&void 0!==e?e:b.value[0].CALLSTATUSCODE})]}),"Y"===b.CHANGEFLAG?Object(te.jsxs)(te.Fragment,{children:[Object(te.jsx)(Bt.a,{sx:{mt:2,mb:2},children:Object(te.jsxs)(Wt.a,{children:[Object(te.jsxs)("div",{sx:{display:"flex",flexDirection:"row"},children:[Object(te.jsx)(p.a,{sx:{fontSize:14},gutterBottom:!0,children:Object(te.jsx)("b",{children:"Add a Comment"})}),Object(te.jsx)(S.a,{children:Object(te.jsx)(an.a,{})})]}),Object(te.jsx)(_t.Editor,{wrapperClassName:"wrapperClassName",editorState:se,editorStyle:{overflow:"hidden",minHeight:"20vh"},onEditorStateChange:function(e){oe(e)},toolbar:{options:["inline","blockType","fontSize","list","textAlign","colorPicker","link","history"]}})]})}),Object(te.jsx)(Ze.a,{onClick:function(){return M()},variant:"outlined",startIcon:Object(te.jsx)(Vt.a,{}),children:"Add File"}),Object(te.jsx)(Ze.a,{variant:"contained",sx:{marginLeft:"77.5%"},disabled:void 0===se,onClick:function(){if(1===Object(Ht.convertToRaw)(se.getCurrentContent()).blocks.length&""===Object(Ht.convertToRaw)(se.getCurrentContent()).blocks[0].text)n("You can not submit an empty comment.",{variant:"error"});else{l(!0);var e=Ht.EditorState.createEmpty();oe(e);var t,a=(new Date).toLocaleString("en-GB"),r=[];for(var c in W){var s={EXTFILEDES:W[c].name.split(".")[0],EXTFILENAME:W[c].content};"msg"===W[c].name.split(".")[1]&&(s.SUFFIX=".msg"),"lic"===W[c].name.split(".")[1]&&(s.SUFFIX=".lic"),r.push(s)}t=0!==r.length?a+Yt()(Object(Ht.convertToRaw)(se.getCurrentContent()))+"
"+r.length+" files attached.
"+"

".concat(N,"


"):a+Yt()(Object(Ht.convertToRaw)(se.getCurrentContent()))+"

".concat(N,"


");b.CALLSTATUSCODE;var o={DOCNO:u,TEXT:t,APPEND:!0,SIGNATURE:!1,EXTFILES:r};de.updateServiceCall(o).then((function(e){"ZMED_TEMPSCTEXT"===e.data?n("There was a problem updating the call. The support team have been notified.",{variant:"error"}):n("Service call updated succesfully.",{variant:"success"}),l(!1),ae(),D(!0)})).catch((function(e){n("Error updating service call.",{variant:"error"}),l(!1),ae(),D(!0)}))}},children:"Update Ticket"})]}):null,0!=(null===U||void 0===U?void 0:U.length)?Object(te.jsx)(S.a,{color:"error","aria-label":"delete",component:"label",children:Object(te.jsx)(st.a,{onClick:ae})}):Object(te.jsx)(te.Fragment,{}),null===U||void 0===U?void 0:U.map((function(e,t){return Object(te.jsx)(_e.a,{label:e.name})})),1==C||1==o?Object(te.jsx)(Jt,{}):null,Object(te.jsx)(Bt.a,{sx:{mt:2},children:Object(te.jsxs)(Wt.a,{children:[Object(te.jsx)(p.a,{sx:{fontSize:14},gutterBottom:!0,children:Object(te.jsx)("b",{children:"Description"})}),(null===x||void 0===x?void 0:x.TEXT)&&Object(te.jsx)("div",{style:{overflow:"auto"},dangerouslySetInnerHTML:{__html:x.TEXT.replaceAll("../../system/mail/","https://priority.medatecherp.co.uk/primail/")}})]})}),Object(te.jsx)(Bt.a,{sx:{mt:2},children:Object(te.jsxs)(Wt.a,{children:[Object(te.jsx)(p.a,{sx:{fontSize:14},gutterBottom:!0,children:Object(te.jsx)("b",{children:"Attachments"})}),null===V||void 0===V?void 0:V.map((function(e,t){return Object(te.jsx)(_e.a,{label:e.EXTFILEDES+"."+e.SUFFIX,color:"primary",size:"small",sx:{mr:1,mb:1},onClick:function(){return tn(e.EXTFILENAME,e.EXTFILEDES,e.SUFFIX)}},t)}))]})})]})})},mn=n(647),pn=n(690),gn=n(632);function Sn(e){var t=e.items,n=e.onChange,r=e.labelname,c=e.title,s=e.description,o=e.description1,u=e.required,d=e.disabled,j=a.useState(!1),b=Object(i.a)(j,2),O=b[0],h=b[1],f=O&&0===t.length;return a.useEffect((function(){if(f)return function(){!1}}),[f]),Object(te.jsx)(Ke.a,{sx:{m:1},disabled:d,fullWidth:!0,open:O,onOpen:function(){return h(!0)},onClose:function(){return h(!1)},onChange:n,isOptionEqualToValue:function(e,t){return r?e[r]===t[r]:e===t},getOptionLabel:function(e){var t=r?e[r]:e,n=s?e[s]:"",a=o?e[o]:"",c="";return n&&a?c="".concat(n," : ").concat(a):n?c=n:a&&(c=a),c?"".concat(t,": ").concat(c):t},options:t,loading:f,renderInput:function(e){return Object(te.jsx)(pe.a,Object(l.a)(Object(l.a)({required:u},e),{},{label:c,InputProps:Object(l.a)(Object(l.a)({},e.InputProps),{},{endAdornment:Object(te.jsxs)(a.Fragment,{children:[f?Object(te.jsx)(Be.a,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})})}))}})}var vn=function(e){var t=Object(a.useState)(!0),n=Object(i.a)(t,2),r=n[0],c=n[1],s=Object(a.useState)([{CODE:"From Portal"}]),o=Object(i.a)(s,2),l=(o[0],o[1]),u=Object(a.useState)(""),d=Object(i.a)(u,2),j=d[0],b=d[1],O=Object(a.useState)([]),h=Object(i.a)(O,2),f=h[0],x=h[1],m=Object(a.useState)(),g=Object(i.a)(m,2),T=(g[0],g[1]),C=Object(a.useState)([]),D=Object(i.a)(C,2),A=D[0],k=D[1],y=Object(a.useState)([]),w=Object(i.a)(y,2),N=w[0],I=w[1],P=Object(a.useState)(),U=Object(i.a)(P,2),R=U[0],L=U[1],F=Object(me.b)(),M=F.enqueueSnackbar,B=(F.closeSnackbar,Ht.EditorState.createEmpty()),W=Object(a.useState)(""),G=Object(i.a)(W,2),Y=G[0],z=G[1],V=Object(a.useState)(B),H=Object(i.a)(V,2),q=H[0],X=H[1],J=Object(a.useState)(_.getCurrentUser().name),Q=Object(i.a)(J,2),K=Q[0],Z=(Q[1],Object(qt.a)({accept:"*",readAs:"DataURL"})),$=Object(i.a)(Z,2),ee=$[0],ne=$[1],ae=ne.plainFiles,re=ne.filesContent,ce=ne.clear,se=Object(a.useState)(!1),oe=Object(i.a)(se,2),ie=oe[0],le=oe[1],ue=Object(a.useState)(""),be=Object(i.a)(ue,2),Oe=be[0],he=be[1],fe=bn(),xe=fe.serviceCallData,ge=fe.setServiceCallData,Se=Object(a.useState)(null),ve=Object(i.a)(Se,2),Ee=ve[0],Te=ve[1];Object(a.useEffect)((function(){var e=function(){try{var e=localStorage.getItem("selectedCUSTNAME");if(e){var t=JSON.parse(e);return Te(t),t}}catch(n){console.error("Error parsing stored customer:",n)}return null}();if(e){c(!0);var t=function(){var e=Object(Mt.a)(Ft.a.mark((function e(){var t;return Ft.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,de.getCallSeverities();case 2:t=e.sent,x(t.data.value);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),n=function(){var t=Object(Mt.a)(Ft.a.mark((function t(){var n;return Ft.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,de.getCustomerContacts(e);case 2:n=t.sent,k(n.data.value);case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();Promise.all([n(),t()]).then((function(){c(!1)})).catch((function(e){console.error(e),c(!1)}))}var a=function(e){if("selectedCUSTNAME"===e.key){var t=e.newValue?JSON.parse(e.newValue):null;Te(t),I([]),T(null),L(null),z(""),b(""),X(Ht.EditorState.createEmpty()),ce(),t?(c(!0),Promise.all([de.getCustomerContacts(t),de.getCallSeverities()]).then((function(e){var t=Object(i.a)(e,3),n=t[0],a=(t[1],t[2]);k(n.data.value),x(a.data.value),c(!1)})).catch((function(e){console.error(e),c(!1)}))):(k([]),l([]),x([]))}};return window.addEventListener("storage",a),function(){window.removeEventListener("storage",a)}}),[]);return Object(te.jsxs)(v.a,{maxWidth:"lg",sx:{mt:4,mb:4},children:[""!=Oe?Object(te.jsx)(Qe.a,{to:"/dashboard/servicecall/".concat(Oe)}):null,1==r||1==ie?Object(te.jsx)(Jt,{}):null,Ee?Object(te.jsxs)(E.a,{container:!0,spacing:2,children:[Object(te.jsx)(E.a,{item:!0,md:8,children:Object(te.jsx)(pe.a,{sx:{m:1},fullWidth:!0,required:!0,onChange:function(e){return z(e.target.value)},label:"Subject",inputProps:{maxLength:48}})}),Object(te.jsx)(E.a,{item:!0,md:4,children:Object(te.jsx)(pe.a,{sx:{m:1},fullWidth:!0,onChange:function(e){return b(e.target.value)},label:"Customer's Reference",inputProps:{maxLength:12}})}),Object(te.jsx)(E.a,{item:!0,md:4,children:Object(te.jsx)(Sn,{required:!0,title:"Call Severity",labelname:"SEVDES",items:f,onChange:function(e,t){return L(t)}})}),Object(te.jsx)(E.a,{item:!0,md:4,children:Object(te.jsx)(Sn,{required:!0,title:"Contact",labelname:"NAME",items:A,onChange:function(e,t){return I(t)}})}),Object(te.jsxs)(E.a,{item:!0,md:12,children:[Object(te.jsx)(Bt.a,{sx:{mt:2},children:Object(te.jsxs)(Wt.a,{children:[Object(te.jsx)(p.a,{sx:{fontSize:14},gutterBottom:!0,children:Object(te.jsx)("b",{children:"Details"})}),Object(te.jsx)(_t.Editor,{wrapperClassName:"wrapperClassName",editorStyle:{overflow:"hidden",minHeight:"40vh"},editorState:q,onEditorStateChange:function(e){X(e)},toolbar:{options:["inline","blockType","fontSize","list","textAlign","colorPicker","link","history"]}})]})}),Object(te.jsx)("p",{}),Object(te.jsx)(Ze.a,{onClick:function(){return ee()},variant:"outlined",startIcon:Object(te.jsx)(Vt.a,{}),children:"Add File"}),Object(te.jsx)(Ze.a,{variant:"contained",sx:{marginLeft:"82.5%"},disabled:ie,onClick:function(){if(1===Object(Ht.convertToRaw)(q.getCurrentContent()).blocks.length&""===Object(Ht.convertToRaw)(q.getCurrentContent()).blocks[0].text)M("You can not submit an empty comment.",{variant:"error"});else if(/^ *$/.test(Y))M("Please fill out the Subject field.",{variant:"error"});else if(void 0!=(null===R||void 0===R?void 0:R.SEV))if(void 0!=(null===N||void 0===N?void 0:N.NAME))if(Ee){le(!0);var e,t=(new Date).toLocaleString("en-GB"),n=[];for(var a in re){var r={EXTFILEDES:re[a].name.split(".")[0],EXTFILENAME:re[a].content};"msg"===re[a].name.split(".")[1]&&(r.SUFFIX=".msg"),"lic"===re[a].name.split(".")[1]&&(r.SUFFIX=".lic"),n.push(r)}e=0!==n.length?t+Yt()(Object(Ht.convertToRaw)(q.getCurrentContent()))+"
"+n.length+" files attached.
"+"

".concat(K,"


"):t+Yt()(Object(Ht.convertToRaw)(q.getCurrentContent()))+"

".concat(K,"


");var s={DETAILS:Y,CALLTYPECODE:"From Portal",ZEMG_SEVNAME:null===R||void 0===R?void 0:R.SEVNAME,TEXT:e,APPEND:!0,SIGNATURE:!1,REFERENCE:j,NAME:null===N||void 0===N?void 0:N.NAME,EXTFILES:n},o=function(e){de.getServiceCall(e).then((function(e){!function(e){var t={ACTIVEFLAG:e.ACTIVEFLAG,CALLSTATUSCODE:e.CALLSTATUSCODE,CALLTYPECODE:e.CALLTYPECODE,CDES:e.CDES,DOCNO:e.DOCNO,NAME:e.NAME,REFERENCE:e.REFERENCE,STARTDATE:e.STARTDATE,STATUSDATE:e.STATUSDATE,ZEMG_SEVDES:e.ZEMG_SEVDES,ZEMG_SVC_DETAILS:e.ZEMG_SVC_DETAILS};ge([t].concat(Object(je.a)(xe)))}(e.data)})).catch((function(e){console.log(e)}))};de.CreateServiceCall(s,Ee).then((function(e){void 0!=e.data.DOCNO?(M("Service Call ".concat(e.data.DOCNO," successfully created!"),{variant:"success"}),o(e.data.DOCNO),ce(),c(!0),he(e.data.DOCNO)):(M("Error creating service call.",{variant:"error"}),le(!1))})).catch((function(e){e.response.data.message?M(e.response.data.message,{variant:"error"}):M("Error creating service call.",{variant:"error"}),le(!1)}))}else M("Please select a customer first.",{variant:"error"});else M("Please select a Contact.",{variant:"error"});else M("Please select a Call Severity.",{variant:"error"})},children:"Submit"}),0!=ae.length?Object(te.jsx)(S.a,{color:"error","aria-label":"delete",component:"label",children:Object(te.jsx)(st.a,{onClick:function(e){ce()}})}):Object(te.jsx)(te.Fragment,{}),ae.map((function(e,t){return Object(te.jsx)(_e.a,{label:e.name})}))]})]}):Object(te.jsx)(gn.a,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60vh",children:Object(te.jsx)(p.a,{variant:"h6",color:"text.secondary",children:"Please select a customer to create a service call"})})]})},En=function(e){e.selectedCustomer;var t=r.a.useState(0),n=Object(i.a)(t,2),c=n[0],s=n[1],o=bn().setviewcallDataTable;return Object(a.useEffect)((function(){o(!1)}),[]),Object(te.jsxs)(v.a,{maxWidth:!1,sx:{mt:4,mb:4},children:[Object(te.jsxs)(mn.a,{value:c,onChange:function(e,t){s(t)},"aria-label":"Service Call tabs",children:[Object(te.jsx)(pn.a,{label:"Service Call List"}),Object(te.jsx)(pn.a,{label:"Create Service Call"})]}),Object(te.jsxs)(h.a,{sx:{mt:2},children:[0===c&&Object(te.jsx)(E.a,{item:!0,xs:12,children:Object(te.jsx)(hn,{})}),1===c&&Object(te.jsx)(E.a,{item:!0,xs:12,children:Object(te.jsx)(vn,{})})]})]})},Tn=n(637),Cn=n(691),Dn=n(537),An=n(261),kn=n(545),yn=n(544),wn=n(213),Nn=n.n(wn),In=n(350),Pn=n.n(In),Un=n(218),Rn=n(634),Ln=n(208),Fn=n(636),Mn=n(680),Bn=n(655),Wn=n(650),_n=n(662),Gn=n(365),Yn=n(644),zn=n(359),Vn=n(145),Hn=n(43),qn=n.n(Hn),Xn=n(635),Jn=n(212),Qn=n.n(Jn),Kn=n(664),Zn=n(648),$n={display:"flex",flexDirection:"column",gap:"12px","& p:empty":{display:"none"},"& p:nth-of-type(odd)":{fontWeight:600,fontSize:"12px",color:"#000",backgroundColor:"#f2f2f2",padding:"10px 14px 4px",borderTopLeftRadius:"16px",borderTopRightRadius:"16px"},"& p:nth-of-type(even)":{fontSize:"14px",color:"#000",backgroundColor:"#f2f2f2",padding:"4px 14px 10px",borderBottomLeftRadius:"16px",borderBottomRightRadius:"16px",lineHeight:1.4}};function ea(e){var t=e.dlgOpen,n=e.handleUpdateClose,r=e.subjectInfo,c=e.WBSInfo,s=e.assignedToInfo,o=e.startDateInfo,u=e.endDateInfo,d=e.descriptionInfo,j=e.taskTypes,b=e.taskSizes,O=e.users,f=e.project,x=e.projectWBS,m=e.STATDES,g=e.CUSTNOTE,E=e.CUSTNOTETYPEDES,T=e.TaskSizeVal,C=(e.refreshTasks,e.selectedOrder),D=e.internalDialogResponse,A=e.handleClose,k=(e.handlegetFilterData,e.getInternalDialogue),y=Object(me.b)().enqueueSnackbar,w=Object(a.useState)(t),N=Object(i.a)(w,1)[0],I=Object(a.useState)(r),P=Object(i.a)(I,2),U=P[0],R=P[1],L=Object(a.useState)(s[0]),F=Object(i.a)(L,2),M=F[0],B=F[1],W=Object(a.useState)(c),_=Object(i.a)(W,2),G=_[0],Y=_[1],z=Object(a.useState)(E),V=Object(i.a)(z,2),H=V[0],q=V[1],X=Object(a.useState)(T),J=Object(i.a)(X,2),Q=J[0],K=J[1],Z=Object(a.useState)(qn()(o)),$=Object(i.a)(Z,2),ee=$[0],ne=$[1],se=Object(a.useState)(qn()(u)),oe=Object(i.a)(se,2),ue=oe[0],je=oe[1],be=Object(a.useState)(),Oe=Object(i.a)(be,2),he=Oe[0],fe=Oe[1],xe=Object(a.useState)("INTERNAL"),ge=Object(i.a)(xe,2),Se=ge[0],ve=ge[1],Ee=Object(a.useState)(Ht.EditorState.createEmpty()),Te=Object(i.a)(Ee,2),Ce=Te[0],De=Te[1],Ae=Object(a.useState)(!1),ke=Object(i.a)(Ae,2),ye=ke[0],we=ke[1],Ne=Object(qt.a)({readAs:"DataURL"}),Ie=Object(i.a)(Ne,2),Pe=Ie[0],Ue=Ie[1],Re=Ue.plainFiles,Le=Ue.filesContent,Fe=Ue.clear;Object(a.useEffect)((function(){d&&fe(function(e){var t=e.getCurrentContent(),n=Object(Ht.convertToRaw)(t),a=n.blocks.map((function(e){return Object(l.a)(Object(l.a)({},e),{},{text:e.text.replace(/\s+/g," ").trim()})})).filter((function(e){return e.text.length>0})),r=Object(l.a)(Object(l.a)({},n),{},{blocks:a});return Ht.EditorState.createWithContent(Object(Ht.convertFromRaw)(r))}(d))}),[]);var Me=function(){n(!1),A()},We=function(){var e=Ce.getCurrentContent(),t=Object(Ht.convertToRaw)(e).blocks;return 1===t.length&&""===t[0].text.trim()};return Object(te.jsxs)(Dn.a,{open:N,onClose:Me,fullWidth:!0,maxWidth:"lg",children:[Object(te.jsx)(yn.a,{children:"Update Task"}),Object(te.jsxs)(An.a,{children:[Object(te.jsx)(pe.a,{fullWidth:!0,variant:"standard",label:"Subject",value:U,onChange:function(e){return R(e.target.value)},sx:{mb:2}}),Object(te.jsx)(zn.a,{dateAdapter:Vn.a,children:Object(te.jsx)(ae.a,{size:"small",sx:{borderCollapse:"collapse"},children:Object(te.jsxs)(re.a,{children:[Object(te.jsxs)(ie.a,{children:[Object(te.jsx)(ce.a,{sx:{borderBottom:"none",p:0},children:Object(te.jsxs)(Mn.a,{size:"small",fullWidth:!0,sx:{m:0},children:[Object(te.jsx)(Bn.a,{children:"Assigned To"}),Object(te.jsx)(Wn.a,{value:M,onChange:function(e){return B(e.target.value)},input:Object(te.jsx)(_n.a,{label:"Assigned To",size:"small"}),children:O.map((function(e){return Object(te.jsx)(mt.a,{value:e.USERLOGIN,children:e.USERLOGIN},e.USERLOGIN)}))})]})}),Object(te.jsx)(ce.a,{sx:{borderBottom:"none",p:1},children:Object(te.jsxs)(Mn.a,{size:"small",fullWidth:!0,sx:{m:0},children:[Object(te.jsx)(Bn.a,{children:"WBS"}),Object(te.jsx)(Wn.a,{value:G||"",onChange:function(e){return Y(e.target.value)},input:Object(te.jsx)(_n.a,{label:"WBS",size:"small"}),children:x.map((function(e){return Object(te.jsxs)(mt.a,{value:e.WBS,children:[e.WBS," : ",e.ACTDES]},e.WBS)}))})]})})]}),Object(te.jsxs)(ie.a,{children:[Object(te.jsx)(ce.a,{sx:{borderBottom:"none",p:0},children:Object(te.jsxs)(Mn.a,{size:"small",fullWidth:!0,sx:{m:0},children:[Object(te.jsx)(Bn.a,{children:"Task Type"}),Object(te.jsx)(Wn.a,{value:H||"",onChange:function(e){return q(e.target.value)},input:Object(te.jsx)(_n.a,{label:"Task Type",size:"small"}),children:j.map((function(e){return Object(te.jsx)(mt.a,{value:e.CUSTNOTETYPEDES,children:e.CUSTNOTETYPEDES},e.CUSTNOTETYPEDES)}))})]})}),Object(te.jsx)(ce.a,{sx:{borderBottom:"none",p:1},children:Object(te.jsxs)(Mn.a,{size:"small",fullWidth:!0,sx:{m:0},children:[Object(te.jsx)(Bn.a,{children:"Task Size"}),Object(te.jsx)(Wn.a,{value:Q||"",onChange:function(e){return K(e.target.value)},input:Object(te.jsx)(_n.a,{label:"Task Size",size:"small"}),children:b.map((function(e){return Object(te.jsxs)(mt.a,{value:e.SIZENAME,children:[e.SIZENAME," : ",e.SIZEDES]},e.SIZENAME)}))})]})})]}),Object(te.jsxs)(ie.a,{children:[Object(te.jsx)(ce.a,{sx:{borderBottom:"none",p:0},children:Object(te.jsx)(Yn.a,{label:"Start Date & Time",value:ee,onChange:ne,renderInput:function(e){return Object(te.jsx)(pe.a,Object(l.a)(Object(l.a)({},e),{},{size:"small",fullWidth:!0,sx:{m:0}}))}})}),Object(te.jsx)(ce.a,{sx:{borderBottom:"none",p:1},children:Object(te.jsx)(Yn.a,{label:"End Date & Time",value:ue,onChange:je,renderInput:function(e){return Object(te.jsx)(pe.a,Object(l.a)(Object(l.a)({},e),{},{size:"small",fullWidth:!0,sx:{m:0}}))}})})]})]})})}),Object(te.jsx)(Mn.a,{component:"fieldset",sx:{mb:1},children:Object(te.jsxs)(Kn.a,{row:!0,value:Se,onChange:function(e){return ve(e.target.value)},children:[Object(te.jsx)(un.a,{value:"INTERNAL",control:Object(te.jsx)(Zn.a,{}),label:"Internal Dialog"}),Object(te.jsx)(un.a,{value:"TASK",control:Object(te.jsx)(Zn.a,{}),label:"Explanation of Task"})]})}),"TASK"===Se&&Object(te.jsxs)(te.Fragment,{children:[Object(te.jsx)(p.a,{children:"Explanation of Task"}),Object(te.jsx)(le.a,{sx:{p:1},children:Object(te.jsx)(_t.Editor,{editorState:he,onEditorStateChange:fe,toolbar:{image:{uploadCallback:en}},wrapperStyle:{width:"100%"},editorStyle:{minHeight:120,maxHeight:200}})})]}),"INTERNAL"===Se&&Object(te.jsxs)(v.a,{sx:{display:"flex",gap:2},disableGutters:!0,children:[Object(te.jsxs)(v.a,{sx:{flex:1.2},disableGutters:!0,children:[Object(te.jsx)(p.a,{children:"Internal Dialog"}),Object(te.jsx)(le.a,{sx:{p:1,height:240,overflowY:"auto"},children:Object(te.jsx)(_t.Editor,{editorState:Ce,onEditorStateChange:De,wrapperStyle:{width:"100%"},editorStyle:{minHeight:180,maxHeight:180,overflowY:"auto"},toolbar:{options:["inline","blockType","list","link","emoji","history"]}})})]}),Object(te.jsxs)(v.a,{sx:{flex:1},disableGutters:!0,children:[Object(te.jsx)(p.a,{children:"Conversation History"}),Object(te.jsx)(le.a,{sx:{p:1,height:240,overflowY:"auto"},children:Object(te.jsxs)(h.a,{sx:{display:"flex",alignItems:"flex-start",gap:1},children:[Object(te.jsx)(pt.a,{sx:{bgcolor:"#444",width:32,height:32},children:Object(te.jsx)(Qn.a,{fontSize:"small"})}),Object(te.jsx)(h.a,{className:"conversation-history",sx:$n,dangerouslySetInnerHTML:{__html:D}})]})})]})]}),Object(te.jsxs)(v.a,{sx:{display:"flex",gap:1,mt:1},disableGutters:!0,children:[Re.length>0&&Object(te.jsx)(S.a,{color:"error",onClick:Fe,children:Object(te.jsx)(Rn.a,{})}),Re.map((function(e,t){return Object(te.jsx)(_e.a,{label:e.name},t)}))]})]}),Object(te.jsx)(Gn.a,{children:ye?Object(te.jsxs)(h.a,{sx:{display:"flex",alignItems:"center",gap:1},children:[Object(te.jsx)(Be.a,{size:18,sx:{color:"#d21919"}}),Object(te.jsx)(p.a,{variant:"body2",children:"Task Updates is in progress. Please wait\u2026"})]}):Object(te.jsxs)(te.Fragment,{children:[Object(te.jsx)(Ze.a,{startIcon:Object(te.jsx)(Xn.a,{}),onClick:Pe,children:"Update File"}),Object(te.jsx)(Ze.a,{onClick:Me,children:"Cancel"}),Object(te.jsx)(Ze.a,{disabled:!Ce.getCurrentContent().hasText(),onClick:function(){if(1===Object(Ht.convertToRaw)(he.getCurrentContent()).blocks.length&""===Object(Ht.convertToRaw)(he.getCurrentContent()).blocks[0].text)y("The task must have an explanation.",{variant:"error"});else if(U)if(void 0!==M){var e;we(!0);var t=(new Date).toLocaleString("en-GB"),n=Object(Ht.convertToRaw)(he.getCurrentContent());if(We()||(e=Object(Ht.convertToRaw)(Ce.getCurrentContent())),U&&M){var a=Le.map((function(e){return{EXTFILEDES:e.name.split(".")[0],EXTFILENAME:e.content}})),r={SUBJECT:U,USERLOGIN:M,CUSTNOTETYPEDES:H,ZMED_TASKSIZENAME:Q,CURDATE:ee.format("YYYY-MM-DD"),TILLDATE:ue.format("YYYY-MM-DD"),STIME:ee.format("HH:mm"),ETIME:ue.format("HH:mm"),PROJDOCNO:Object.keys(f||{}).length>0?f.DOCNO:"",WBS:G,STATDES:m,TEXT:Yt()(n),INTERNALTEXT:We()?"":t+Yt()(e),APPEND:!0,CUSTNOTEEXTFILES:a,TODOREFA:C||"",IVDES:C?"Sales Order":"",CUSTNOTE:g};de.updateTask(r).then((function(){y("Task Updated successfully.",{variant:"success"}),we(!1),De(Ht.EditorState.createEmpty()),k()})).catch((function(){y("Error updating task.",{variant:"error"}),we(!1),De(Ht.EditorState.createEmpty()),A()}))}else y("Subject and Assigned To are required.",{variant:"error"})}else y("Please select an Assigned To.",{variant:"error"});else y("Please fill out the Subject field.",{variant:"error"})},children:"Update"})," "]})})]})}var ta=n(349),na=n.n(ta);function aa(e){var t,n=e.open,r=e.description,c=e.loading,s=e.attachments,o=e.handleClose,u=e.refreshTasks,d=e.handleTaskStatusChange,j=e.taskTypes,b=e.taskSizes,O=e.users,f=e.project,x=e.projectWBS,m=e.selectedOrder,g=e.internalDialogResponse,v=e.handlegetFilterData,E=e.getInternalDialogue,T=e.task,C=T.SUBJECT,D=T.STATDES,A=T.USERLOGIN,k=T.CUSTNOTETYPEDES,y=T.CUSTNOTE,w=(T.EXTFILEFLAG,T.CURDATE),N=T.TILLDATE,I=T.STIME,P=T.ETIME,U=T.WBS,R=T.ACTDES,L=T.USERLOGIN2,F=T.USERLOGIN3,M=T.USERLOGIN4,B=T.USERLOGIN5,W=T.USERLOGIN6,_=T.USERLOGIN7,G=T.USERLOGIN8,Y=T.ZMED_TASKSIZENAME,z=[A,L,F,M,B,W,_,G],V=Object(Un.a)("div")({marginBottom:16}),H=Object(a.useState)(!1),q=Object(i.a)(H,2),X=q[0],J=q[1],Q=Object(Ln.b)(),K=Object(a.useState)(!1),Z=Object(i.a)(K,2),$=Z[0],ee=Z[1],ne="",ae="",re="";return Object(te.jsx)("div",{children:Object(te.jsxs)(Dn.a,{open:n,onClose:o,scroll:"paper","aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",children:[Object(te.jsx)("div",{children:Object(te.jsxs)(yn.a,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",fontWeight:"bold"},id:"scroll-dialog-title",children:[null!==C&&void 0!==C?C:"Task Subject",Object(te.jsxs)(h.a,{display:"flex",gap:1,children:[" ",Object(te.jsx)(rt.a,{title:"Edit task",children:Object(te.jsx)(S.a,{disabled:X||"On Hold"===D,onClick:function(){ee(!0)},color:"secondary","aria-label":"Edit-task",component:"label",children:Object(te.jsx)(Fn.a,{})})}),Object(te.jsx)(rt.a,{placement:"right",title:"Cancel task.",children:Object(te.jsx)(S.a,{disabled:X,onClick:function(){Q({description:"This will cancel the task."}).then((function(){J(!0),d(D,"Cancelled",y),o()})).catch((function(){console.log("Confirmation declined.")}))},color:"error","aria-label":"Cancel-task",component:"label",children:Object(te.jsx)(Rn.a,{})})})]})]})}),c?Object(te.jsx)(be.a,{}):null,Object(te.jsxs)(An.a,{dividers:!c,sx:{minHeight:"50vh",minWidth:"30vw"},children:[Object(te.jsxs)(V,{children:[Object(te.jsx)(p.a,{variant:"subtitle2",children:"Members"}),Object(te.jsx)("div",{style:{display:"flex",flexDirection:"row"},children:null===z||void 0===z?void 0:z.filter((function(e){return e})).map((function(e,t){return Object(te.jsx)(rt.a,{style:{marginRight:8},title:e,children:Object(te.jsx)(pt.a,Object(l.a)({},Qt(e)))},t)}))})]}),U?Object(te.jsxs)(V,{children:[Object(te.jsx)(p.a,{variant:"subtitle2",children:"WBS"}),Object(te.jsx)(p.a,{children:U+": "+R})]}):null,Object(te.jsxs)(V,{children:[Object(te.jsx)(p.a,{variant:"subtitle2",children:"Dates"}),Object(te.jsx)(rt.a,{placement:"left",title:"Start and end date.",children:Object(te.jsx)(_e.a,{icon:Object(te.jsx)(Pn.a,{}),size:"small",label:$t(w)+" - "+$t(N)})}),Object(te.jsx)(rt.a,{sx:{ml:1},placement:"right",title:"Start and end time.",children:Object(te.jsx)(_e.a,{icon:Object(te.jsx)(Nn.a,{}),size:"small",label:I+" - "+P})})]}),Object(te.jsxs)(V,{children:[Object(te.jsx)(p.a,{variant:"subtitle2",children:"Description"}),Object(te.jsx)(kn.a,{id:"scroll-dialog-description",tabIndex:-1,children:c?Object(te.jsx)(Oe.a,{}):Object(te.jsx)("div",{dangerouslySetInnerHTML:{__html:r}})})]})]}),s.length>0?Object(te.jsxs)(An.a,{dividers:!0,children:[Object(te.jsx)(p.a,{children:"Attachments"}),null===s||void 0===s?void 0:s.map((function(e,t){return Object(te.jsx)(_e.a,{label:e.EXTFILEDES+"."+e.SUFFIX,color:"primary",size:"small",sx:{mr:1,mb:1},onClick:function(){return tn(e.EXTFILENAME,e.EXTFILEDES,e.SUFFIX)}},t)}))]}):null,$?(function(){t=null===z||void 0===z?void 0:z.filter((function(e){return e})).map((function(e,t){return e})),b.find((function(e){return e.SIZENAME===Y}));var e=w.split("T")[0],n=qn()("".concat(e,"T").concat(I)),a=N.split("T")[0],c=qn()("".concat(a,"T").concat(P));ne=n.format("YYYY-MM-DDTHH:mm"),ae=c.format("YYYY-MM-DDTHH:mm"),re=function(e){var t=e.replace(/\s+/g," ").replace(/\n\s*\n/g,"\n").trim(),n=na()(t),a=n.contentBlocks,r=n.entityMap,c=Ht.ContentState.createFromBlockArray(a,r);return Ht.EditorState.createWithContent(c)}({__html:r}.__html)}(),Object(te.jsx)(ea,{dlgOpen:$,handleUpdateClose:function(){ee(!1)},subjectInfo:C,WBSInfo:U,assignedToInfo:t,startDateInfo:ne,endDateInfo:ae,descriptionInfo:re,taskTypes:j,taskSizes:b,users:O,project:f,projectWBS:x,STATDES:D,CUSTNOTE:y,CUSTNOTETYPEDES:k,TaskSizeVal:Y,refreshTasks:u,selectedOrder:m,internalDialogResponse:g,handleClose:o,handlegetFilterData:v,getInternalDialogue:E})):Object(te.jsx)(te.Fragment,{})]})})}var ra=n(351),ca=n.n(ra),sa=function(e){var t,n=e.task,r=n.SUBJECT,c=n.USERLOGIN,s=n.CUSTNOTETYPEDES,o=n.CUSTNOTE,u=n.EXTFILEFLAG,d=n.CURDATE,j=n.TILLDATE,b=n.ACTDES,O=(n.STIME,n.ETIME,n.WBS),h=n.USERLOGIN2,f=n.USERLOGIN3,x=n.USERLOGIN4,m=n.USERLOGIN5,g=n.USERLOGIN6,S=n.USERLOGIN7,v=n.USERLOGIN8,E=n.ZMED_TASKSIZENAME,T=n.CUSTNAME,C=n.TODOREFA,D=e.refreshTasks,A=e.handleTaskStatusChange,k=e.taskTypes,y=e.taskSizes,w=e.users,N=e.project,I=e.projectWBS,P=e.STATDES,U=e.selectedOrder,R=e.handlegetFilterData,L=[c,h,f,x,m,g,S,v],F=Object(a.useState)(!1),M=Object(i.a)(F,2),B=M[0],W=M[1],_=Object(a.useState)("There is no description."),G=Object(i.a)(_,2),Y=G[0],z=G[1],V=Object(a.useState)([]),H=Object(i.a)(V,2),q=H[0],X=H[1],J=Object(a.useState)([]),Q=Object(i.a)(J,2),K=Q[0],Z=Q[1],$=Object(a.useState)(!1),ee=Object(i.a)($,2),ne=ee[0],ae=ee[1],re=function(){ae(!0),de.getTaskExplanation(o).then((function(e){e.data.hasOwnProperty("error")?z("There is no description."):z(e.data.TEXT)})).catch((function(e){console.log(e)})),de.getInternalDialog(o).then((function(e){e.data.hasOwnProperty("error")?X("There is no Internal Dialog."):X(e.data.TEXT)})).catch((function(e){console.log(e)})),ae(!1)},ce=function(){de.getTaskAttachments(o).then((function(e){e.data.hasOwnProperty("error")||Z(e.data.value)})).catch((function(e){console.log(e)}))};return Object(te.jsxs)(Bt.a,{onClick:function(){B||(re(),"Y"===u&&ce(),W(!0))},sx:{mb:2},children:[Object(te.jsx)(aa,{open:B,description:Y,handleClose:function(){W(!1)},task:e.task,loading:ne,attachments:K,refreshTasks:D,handleTaskStatusChange:A,taskTypes:k,taskSizes:y,users:w,project:N,projectWBS:I,STATDES:P,selectedOrder:U,internalDialogResponse:q,handlegetFilterData:R,getInternalDialogue:re}),Object(te.jsxs)(Wt.a,{sx:{display:"flex",flexDirection:"column"},children:[Object(te.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[Object(te.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[s?Object(te.jsx)(rt.a,{enterDelay:500,placement:"top",title:"Task type.",children:Object(te.jsx)(_e.a,{label:s,color:"primary",size:"small",sx:{bgcolor:Zt(s),mr:1}})}):null,E?Object(te.jsx)(rt.a,{enterDelay:500,placement:"top",title:"Task size.",children:Object(te.jsx)(_e.a,{label:E,color:"primary",size:"small",sx:{bgcolor:(t=E,"S"===t?"#00FF00":"M"===t?"#FFA500":"L"===t?"#FF0000":"XL"===t?"#8b0000":void 0)}})}):null]}),u?Object(te.jsx)(rt.a,{enterDelay:500,placement:"top",title:"Includes attachments.",children:Object(te.jsx)(ca.a,{color:"disabled"})}):null]}),Object(te.jsx)(p.a,{sx:{fontWeight:"bold",mt:1},component:"div",children:null!==r&&void 0!==r?r:"Task Subject"}),Object(te.jsx)(p.a,{sx:{mb:1},variant:"subtitle2",children:null!=O?O+": "+b:null}),Object(te.jsx)(p.a,{sx:{mb:1},variant:"subtitle2",children:T}),Object(te.jsx)(p.a,{sx:{mb:1},variant:"subtitle2",children:C}),Object(te.jsx)(rt.a,{enterDelay:500,title:"Start and end date.",children:Object(te.jsx)(_e.a,{icon:Object(te.jsx)(Nn.a,{}),size:"small",label:$t(d)+" - "+$t(j)})}),Object(te.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:Object(te.jsx)(Cn.a,{sx:{"& .MuiAvatar-root":{width:30,height:30,fontSize:16}},max:2,children:null===L||void 0===L?void 0:L.filter((function(e){return e})).map((function(e,t){return Object(te.jsx)(rt.a,{title:e,children:Object(te.jsx)(pt.a,Object(l.a)({},Qt(e)))},t)}))})})]})]})},oa=n(142);function ia(e){var t=e.disabled,n=e.taskTypes,r=e.taskSizes,c=e.users,s=e.projectWBS,o=e.project,u=e.handleUpdateTasks,d=e.STATDES,j=e.selectedOrder,b=(e.refreshTasks,e.selectedCustomer),O=e.handlegetFilterData,f=Object(a.useState)(!1),x=Object(i.a)(f,2),m=x[0],g=x[1],E=Object(a.useState)(!1),T=Object(i.a)(E,2),C=T[0],D=T[1],A=Object(a.useState)(),k=Object(i.a)(A,2),y=k[0],w=k[1],N=Object(a.useState)(),I=Object(i.a)(N,2),P=I[0],U=I[1],R=Object(a.useState)(),L=Object(i.a)(R,2),F=L[0],M=L[1],B=Object(a.useState)(),W=Object(i.a)(B,2),_=W[0],G=W[1],Y=Object(a.useState)(),z=Object(i.a)(Y,2),V=z[0],H=z[1],q=Object(a.useState)(qn()()),X=Object(i.a)(q,2),J=X[0],Q=X[1],K=Object(a.useState)(qn()()),Z=Object(i.a)(K,2),$=Z[0],ee=Z[1],ne=Object(me.b)(),ae=ne.enqueueSnackbar,re=(ne.closeSnackbar,Ht.EditorState.createEmpty()),ce=Object(a.useState)(re),se=Object(i.a)(ce,2),oe=se[0],ie=se[1],ue=Object(qt.a)({accept:"*",readAs:"DataURL"}),je=Object(i.a)(ue,2),be=je[0],Oe=je[1],he=Oe.plainFiles,fe=Oe.filesContent,xe=Oe.clear,ge=Object(a.useState)(!1),Se=Object(i.a)(ge,2),ve=Se[0],Ee=Se[1],Te=function(){g(!1)},Ce=function(){G(),w(),U(),M(),Te(),D(!1)};return Object(te.jsxs)(te.Fragment,{children:[Object(te.jsx)(Ze.a,{disabled:t,size:"small",variant:"contained",startIcon:Object(te.jsx)(nt.a,{}),color:"inherit",onClick:function(){g(!0)},children:"Add a Task"}),Object(te.jsx)("div",{children:Object(te.jsxs)(Dn.a,{open:m,onClose:Te,children:[Object(te.jsx)(yn.a,{children:"Add a Task"}),Object(te.jsxs)(An.a,{children:[Object(te.jsx)(pe.a,{autoFocus:!0,margin:"dense",id:"subject",label:"Subject",type:"subject",fullWidth:!0,variant:"standard",autoComplete:"off",value:y,onChange:function(e){return w(e.target.value)},sx:{mb:2}}),Object(te.jsxs)(v.a,{maxWidth:!1,sx:{display:"flex"},disableGutters:!0,children:[Object(te.jsx)(Sn,{required:!0,title:"Assigned To",labelname:"USERLOGIN",items:c,onChange:function(e,t){return G(t)}}),Object(te.jsx)(Sn,{title:"WBS",labelname:"WBS",items:s,onChange:function(e,t){return H(t)},description:"ACTDES"})]}),Object(te.jsxs)(v.a,{maxWidth:!1,sx:{display:"flex"},disableGutters:!0,children:[Object(te.jsx)(Sn,{title:"Task Type",labelname:"CUSTNOTETYPEDES",items:n,onChange:function(e,t){return U(t)}}),Object(te.jsx)(Sn,{title:"Task Size",labelname:"SIZENAME",items:r,onChange:function(e,t){return M(t)},description:"SIZEDES"})]}),Object(te.jsx)(zn.a,{dateAdapter:Vn.a,children:Object(te.jsxs)(v.a,{maxWidth:!1,sx:{display:"flex"},disableGutters:!0,children:[Object(te.jsx)(Yn.a,{disablePast:!0,ampm:!1,label:"Start Date & Time",value:J,onChange:function(e){return Q(e)},renderInput:function(e){return Object(te.jsx)(pe.a,Object(l.a)({fullWidth:!0,sx:{m:1}},e))}}),Object(te.jsx)(Yn.a,{disablePast:!0,ampm:!1,label:"End Date & Time",value:$,onChange:function(e){return ee(e)},renderInput:function(e){return Object(te.jsx)(pe.a,Object(l.a)({fullWidth:!0,sx:{m:1}},e))}})]})}),Object(te.jsxs)(v.a,{maxWidth:!1,sx:{mt:1},children:[Object(te.jsx)(p.a,{variant:"subtitle",children:"Explanation of Task"}),Object(te.jsx)(le.a,{children:Object(te.jsx)(_t.Editor,{editorStyle:{height:"150px"},editorState:oe,onEditorStateChange:function(e){ie(e)},toolbar:{image:{uploadCallback:en,previewImage:!0}}})})]}),Object(te.jsxs)(v.a,{maxWidth:!1,sx:{display:"flex",flexWrap:"wrap",gap:"3px",mt:1},children:[0!=he.length?Object(te.jsx)(S.a,{color:"error","aria-label":"delete",component:"label",children:Object(te.jsx)(Rn.a,{onClick:function(e){xe()}})}):Object(te.jsx)(te.Fragment,{}),he.map((function(e,t){return Object(te.jsx)(_e.a,{label:e.name})}))]})]}),Object(te.jsx)(Gn.a,{children:ve?Object(te.jsxs)(h.a,{sx:{display:"flex",alignItems:"center",gap:1},children:[Object(te.jsx)(Be.a,{size:18,sx:{color:"#d21919"}}),Object(te.jsx)(p.a,{variant:"body2",children:"Task Creates is in progress. Please wait\u2026"})]}):Object(te.jsxs)(te.Fragment,{children:[Object(te.jsx)(Ze.a,{onClick:function(){return be()},variant:"outlined",startIcon:Object(te.jsx)(Xn.a,{}),children:"Add File"}),Object(te.jsx)(Ze.a,{onClick:Te,children:"Cancel"}),Object(te.jsx)(Ze.a,{disabled:C,onClick:function(){var e,t,n;if(1===Object(Ht.convertToRaw)(oe.getCurrentContent()).blocks.length&""===Object(Ht.convertToRaw)(oe.getCurrentContent()).blocks[0].text)ae("The task must have an explanation.",{variant:"error"});else if(y)if(void 0!==_){Ee(!0),D(!0);var a=[];for(var r in fe){var c={EXTFILEDES:fe[r].name.split(".")[0],EXTFILENAME:fe[r].content};a.push(c)}var s={SUBJECT:y,CUSTNOTETYPEDES:null!==(e=null===P||void 0===P?void 0:P.CUSTNOTETYPEDES)&&void 0!==e?e:"",ZMED_TASKSIZENAME:null!==(t=null===F||void 0===F?void 0:F.SIZENAME)&&void 0!==t?t:"",USERLOGIN:null===_||void 0===_?void 0:_.USERLOGIN,CURDATE:J.format("YYYY-MM-DD"),TILLDATE:$.format("YYYY-MM-DD"),STIME:J.format("HH:mm"),ETIME:$.format("HH:mm"),PROJDOCNO:Object.keys(o||{}).length>0?o.DOCNO:"",WBS:null!==(n=null===V||void 0===V?void 0:V.WBS)&&void 0!==n?n:"",STATDES:d,TEXT:Yt()(Object(Ht.convertToRaw)(null===oe||void 0===oe?void 0:oe.getCurrentContent())),CUSTNOTEEXTFILES:a,TODOREFA:j||"",IVDES:j?"Sales Order":"",CUSTNAME:b};de.createTask(s).then((function(e){ae("Task created succesfully.",{variant:"success"}),u(e.data),Ce();try{O(),Ee(!1)}catch(t){console.error("Error in handlegetFilterData:",t)}})).catch((function(e){ae("Error creating task.",{variant:"error"}),Ce(),console.log(e)}))}else ae("Please select an Assigned To.",{variant:"error"});else ae("Please fill out the Subject field.",{variant:"error"})},children:"Add"})]})})]})})]})}var la=Object(Tn.a)(le.a)({marginLeft:15,padding:8,display:"flex",flexDirection:"column",top:0,bottom:0,maxHeight:"75vh",width:250,minWidth:250,background:"#ebecf0",overflow:"auto",position:"relative"}),ua=function(e){var t=e.title,n=e.tasks,a=e.project,r=e.taskTypes,c=e.taskSizes,s=e.users,o=e.projectWBS,i=e.handleUpdateTasks,u=e.refreshTasks,d=e.handleTaskStatusChange,j=e.selectedOrder,b=e.selectedUser,O=e.selectedType,h=e.selectedCustomer,f=e.handlegetFilterData;return Object(te.jsx)(oa.c,{droppableId:t,type:"COLUMN",children:function(e,x){return Object(te.jsx)("div",Object(l.a)(Object(l.a)({},e.droppableProps),{},{ref:e.innerRef,children:Object(te.jsxs)(la,{children:[Object(te.jsx)(p.a,{component:"h2",variant:"h6",color:"inherit",gutterBottom:!0,children:t||"Title"}),Object(te.jsx)("div",{style:{overflowY:"auto"},children:null===n||void 0===n?void 0:n.map((function(e,n){return Object(te.jsx)(oa.b,{draggableId:e.CUSTNOTE.toString(),index:n,type:"TASK",children:function(n,i){return Object(te.jsx)("div",Object(l.a)(Object(l.a)(Object(l.a)({ref:n.innerRef},n.draggableProps),n.dragHandleProps),{},{children:Object(te.jsx)(sa,{task:e,refreshTasks:u,handleTaskStatusChange:d,taskTypes:r,taskSizes:c,users:s,project:a,projectWBS:o,STATDES:t,selectedOrder:j,handlegetFilterData:f},e.CUSTNOTE)}))}},e.CUSTNOTE.toString())}))}),e.placeholder,Object(te.jsx)(ia,{disabled:""===a&&""===j&&""===b&&""===O,taskTypes:r,taskSizes:c,users:s,project:a,projectWBS:o,handleUpdateTasks:i,STATDES:t,selectedOrder:j,refreshTasks:u,selectedCustomer:h,handlegetFilterData:f})]})}))}})},da=function(){return Object(te.jsx)(te.Fragment,{children:Object(je.a)(Array(6)).map((function(e,t){return Object(te.jsx)(Oe.a,{sx:{marginLeft:2,padding:8,display:"flex",flexDirection:"column"},variant:"rectangular",width:250,height:"75vh",style:{marginBottom:5}},t)}))})},ja=n(657),ba=n(257),Oa=n.n(ba),ha=n(353),fa=n.n(ha),xa=function(e){var t,n=e.selectedCustomer,r=Object(a.useState)([]),c=Object(i.a)(r,2),s=c[0],o=c[1],u=Object(a.useState)(""),d=Object(i.a)(u,2),j=d[0],b=d[1],O=Object(a.useState)([]),f=Object(i.a)(O,2),x=f[0],m=f[1],g=Object(a.useState)(!1),E=Object(i.a)(g,2),T=E[0],C=E[1],D=Object(me.b)(),A=D.enqueueSnackbar,k=(D.closeSnackbar,Object(a.useState)()),y=Object(i.a)(k,2),w=y[0],N=y[1],I=Object(a.useState)([]),P=Object(i.a)(I,2),U=P[0],R=P[1],L=Object(a.useState)([]),F=Object(i.a)(L,2),M=F[0],B=F[1],W=Object(a.useState)([]),_=Object(i.a)(W,2),G=_[0],Y=_[1],z=Object(a.useState)([]),V=Object(i.a)(z,2),H=V[0],q=V[1],X=Object(a.useState)([]),J=Object(i.a)(X,2),Q=J[0],K=J[1],Z=Object(a.useState)(""),$=Object(i.a)(Z,2),ee=$[0],ne=$[1],ae=Object(a.useState)(""),re=Object(i.a)(ae,2),ce=re[0],se=re[1],oe=Object(a.useState)(""),ie=Object(i.a)(oe,2),le=ie[0],ue=ie[1],be=Object(a.useState)(""),Oe=Object(i.a)(be,2),he=Oe[0],fe=Oe[1],xe=Object(a.useState)(""),ge=Object(i.a)(xe,2),Se=ge[0],ve=ge[1],Ee=Object(a.useState)("ORDNAME"),Te=Object(i.a)(Ee,2),Ce=Te[0],De=Te[1],Ae=Object(a.useState)("DOCNO"),ke=Object(i.a)(Ae,2),ye=ke[0],we=ke[1],Ne=Object(a.useState)([]),Ie=Object(i.a)(Ne,2),Pe=Ie[0],Ue=Ie[1],Re=Object(a.useState)(qn()()),Le=Object(i.a)(Re,2),Fe=Le[0],Me=Le[1],We=Object(a.useState)(qn()()),_e=Object(i.a)(We,2),Ge=_e[0],Ye=_e[1],ze=bn(),Ve=ze.logincustData,He=(ze.orders,ze.orderforStatus),qe=ze.userBkup,Xe=ze.setUserBakup,Je=ze.filteredOrdersBkup,Qe=ze.setFilteredOrdersBkup,Ke=ze.taskTypesBkup,Ze=ze.setTaskTypesBkup,$e=ze.projectsBkup,et=ze.setProjectsBkup;Object(a.useEffect)((function(){var e=function(){var e=Object(Mt.a)(Ft.a.mark((function e(){var t,n,a,r,c;return Ft.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,C(!0),e.next=4,Promise.all([de.getTaskTypes(),de.getTaskSizes(),de.getUsers()]);case 4:t=e.sent,n=Object(i.a)(t,3),a=n[0],r=n[1],c=n[2],R(a.data.value),B(r.data.value),Y(c.data.value),Ze(a.data.value),Xe(c.data.value),K(He),Qe(He),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0),console.error(e.t0);case 21:return e.prev=21,C(!1),e.finish(21);case 24:case"end":return e.stop()}}),e,null,[[0,18,21,24]])})));return function(){return e.apply(this,arguments)}}();e()}),[]),Object(a.useEffect)((function(){var e=!0,t=function(){var t=Object(Mt.a)(Ft.a.mark((function t(){var a,r,c,s,l,u,d,j;return Ft.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,r="",null===n||void 0===n?void 0:n.CUSTNAME)r=n.CUSTNAME;else if(c=localStorage.getItem("selectedCUSTNAME"))try{r=JSON.parse(c)}catch(b){console.error("Error parsing stored customer:",b),r=null}return t.next=5,Promise.all([de.getTaskStatuses(),"Y"!==(null===(a=Ve[0])||void 0===a?void 0:a.MEDATECHCUSTOMER)?de.getUserProjects(r):de.getProjectList()]);case 5:if(s=t.sent,l=Object(i.a)(s,2),u=l[0],d=l[1],e){t.next=11;break}return t.abrupt("return");case 11:j=[].concat(Object(je.a)(u.data.value),[{STATDES:"Cancelled"}]),m(j),o(d.data.value),et(d.data.value),C(!1),t.next=21;break;case 18:t.prev=18,t.t0=t.catch(0),e&&console.error(t.t0);case 21:case"end":return t.stop()}}),t,null,[[0,18]])})));return function(){return t.apply(this,arguments)}}();return t(),function(){e=!1}}),[n]),Object(a.useEffect)((function(){var e=function(){var e=Object(Mt.a)(Ft.a.mark((function e(){return Ft.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,Se||ce||le||ee||he){e.next=13;break}return o($e),Y(qe),R(Ke),K(Je),Ue([]),Me(qn()()),Ye(qn()()),De("ORDNAME"),we("DOCNO"),C(!1),e.abrupt("return");case 13:return e.next=15,tt();case 15:e.next=20;break;case 17:e.prev=17,e.t0=e.catch(0),console.error("Error fetching tasks in useEffect:",e.t0);case 20:case"end":return e.stop()}}),e,null,[[0,17]])})));return function(){return e.apply(this,arguments)}}();e()}),[Se,ce,le,ee,he]);var tt=function(){var e=Object(Mt.a)(Ft.a.mark((function e(){var t,n,a,r,c,s,i,u,d,j,b;return Ft.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=[],n=0;n=a&&n<=r:a?t>=a:!r||n<=r}));nt(e)}},sx:{border:"1px solid #515558",borderRadius:1,height:55,width:45},children:Object(te.jsx)(Oa.a,{})})}),Object(te.jsx)(rt.a,{title:"Clear filter",children:Object(te.jsxs)(S.a,{color:"primary",onClick:function(){nt(Pe)},sx:{border:"1px solid #515558",borderRadius:1,height:55,width:45,position:"relative"},children:[Object(te.jsx)(Oa.a,{}),Object(te.jsx)(h.a,{sx:{position:"absolute",top:6,right:6,background:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center"},children:Object(te.jsx)(fa.a,{sx:{fontSize:12}})})]})})]})]}),Object(te.jsx)(oa.a,{onDragEnd:dt,children:Object(te.jsx)(v.a,{maxWidth:!1,sx:{display:"flex",mt:2,mb:4},children:T?Object(te.jsx)(da,{}):null===at||void 0===at?void 0:at.filter((function(e){return"Cancelled"!==e.STATDES})).map((function(e){return Object(te.jsx)(ua,{title:e.STATDES,tasks:e.TASKS,project:j,taskTypes:Ke,taskSizes:M,users:qe,projectWBS:H,handleUpdateTasks:jt,refreshTasks:ot,handleTaskStatusChange:ut,selectedOrder:ce,selectedUser:ee,selectedType:le,selectedCustomer:n.CUSTNAME,handlegetFilterData:tt},e.DOCSTATUSSORT)}))})})]})},ma=n(117);var pa=function(e){return Object(te.jsx)(p.a,{component:"h2",variant:"h6",color:"primary",gutterBottom:!0,children:e.children})},ga=n(665),Sa=n(692),va=n(693),Ea=n(638);function Ta(e){var t=e.title,n=e.data,c=e.statusLabel,s=n.hasOwnProperty("value"),o=Object(a.useState)([]),l=Object(i.a)(o,2),u=l[0],d=l[1];return Object(a.useEffect)((function(){s&&c&&d(function(){var e,t={},a=Object(ma.a)(n.value);try{for(a.s();!(e=a.n()).done;){var r=e.value[c];t[r]?t[r]+=1:t[r]=1}}catch(s){a.e(s)}finally{a.f()}return t}())}),[n]),Object(te.jsxs)(r.a.Fragment,{children:[Object(te.jsxs)(le.a,{sx:{p:2,display:"flex",flexDirection:"column",minHeight:120},children:[Object(te.jsx)(pa,{children:t}),s?Object(te.jsxs)(p.a,{component:"p",variant:"h4",children:[n.value.length," ",t]}):Object(te.jsx)(be.a,{})]}),Object(te.jsxs)(ga.a,{disabled:0===u.length,children:[Object(te.jsx)(Sa.a,{expandIcon:Object(te.jsx)(Ea.a,{}),"aria-controls":"panel1a-content",id:"panel1a-header",children:Object(te.jsx)(p.a,{children:"Status Breakdown"})}),Object(te.jsx)(va.a,{children:Object(te.jsx)("div",{children:Object.entries(u).map((function(e){var t=Object(i.a)(e,2),n=t[0],a=t[1];return Object(te.jsxs)(p.a,{color:"text.secondary",sx:{flex:1},children:[n,": ",a]},n)}))})})]})]})}var Ca=function(e){var t=e.selectedCustomer,n=Object(a.useRef)(null),r=Object(a.useState)([]),c=Object(i.a)(r,2),s=c[0],o=c[1],l=Object(a.useState)(""),u=Object(i.a)(l,2),d=u[0],j=u[1],b=Object(a.useState)([]),O=Object(i.a)(b,2),f=O[0],x=O[1],m=function(e){var t=function(e){var t=function(e){return e&&"string"===typeof e?e.split(".").map((function(e){return parseInt(e,10)||0})):[0]};return Object(je.a)(e).sort((function(e,n){for(var a=t(e.WBS),r=t(n.WBS),c=0;c0;a--){var r=t.slice(0,a).join(".");if(n[r])return n[r]}return 0},r=t.map((function(e,t){var n=new Date(e.STARTDATE),r=new Date(e.ENDDATE);(isNaN(n.getTime())||n.getFullYear()<2e3)&&(console.warn("Invalid start date for ".concat(e.WBS,": ").concat(e.STARTDATE)),n=new Date),(isNaN(r.getTime())||r.getFullYear()<2e3)&&(console.warn("Invalid end date for ".concat(e.WBS,": ").concat(e.ENDDATE)),r=new Date),r=5&&(s="gtaskpink"),{pID:t+1,pName:"".concat(e.WBS,": ").concat(e.ACTDES),pStart:n,pEnd:r,pClass:s,pLink:"",pMile:0,pRes:e.HR||"",pComp:e.EXECPERCENT||0,pGroup:0,pParent:a(e.WBS),pOpen:1,pDepend:"",pCaption:"",pNotes:"WBS: ".concat(e.WBS),originalWBS:e.WBS,sortOrder:t}}));return r.forEach((function(e){r.some((function(t){return t.pParent===e.pID}))&&(e.pGroup=1)})),t.forEach((function(e,t){if(e.PROJACTPRED_SUBFORM&&e.PROJACTPRED_SUBFORM.length>0){var a=e.PROJACTPRED_SUBFORM.map((function(e){return n[e.WBS]})).filter((function(e){return e&&e!==t+1})).join(",");a&&(r[t].pDepend=a)}})),r};return Object(a.useEffect)((function(){var e=t.CUSTNAME;if(!e){var n=localStorage.getItem("selectedCUSTNAME");if(n)try{e=JSON.parse(n)}catch(a){console.error("Error parsing stored customer:",a),e=null}}de.getUserProjects(e).then((function(e){o(e.data.value)})).catch((function(e){console.log(e)}))}),[]),Object(a.useEffect)((function(){if(f.length>0&&n.current){var e=function(e){return'\n\n\n\n \n jsGantt Chart\n \n