1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[76760],{541410:function(e,r,t){var o=t(564836);r.Z=void 0;var n=o(t(753564)),a=t(785893);r.Z=(0,n.default)((0,a.jsx)("path",{d:"M18.3 5.71a.9959.9959 0 0 0-1.41 0L12 10.59 7.11 5.7a.9959.9959 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4"}),"CloseRounded")},369035:function(e,r,t){t.d(r,{I:function(){return l}});var o=t(785893),n=t(762708),a=t(4538),i=t(95442);let l=e=>{let{open:r,children:t,onClose:l,className:s,overflowY:d="auto",hideScrollbar:c=!1,disableScrollLock:u=!1}=e;return(0,o.jsx)(n.Z,{open:r,onClose:l?()=>l():void 0,disableScrollLock:u,children:(0,o.jsx)(a.Z,{direction:"left",in:r,mountOnEnter:!0,unmountOnExit:!0,children:(0,o.jsx)(i.Z,{role:"dialog","aria-modal":"true",className:s,sx:{position:"absolute",top:0,right:0,width:{xs:"100%",md:"70vw"},height:"100vh",bgcolor:"background.paper",boxShadow:24,overflowX:"hidden",overflowY:d,...c&&{msOverflowStyle:"none",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}},children:t})})})}},133428:function(e,r,t){var o=t(785893),n=t(380224),a=t(764202),i=t(95442),l=t(298969),s=t(202302),d=t(137491),c=t(556143),u=t(76517),m=t(232186),p=t(869320),h=t(718984),f=t(378380),y=t(891444),x=t(673442),k=t(894036),v=t(567421),T=t(331812),g=t(188115),w=t(862952),R=t(505891),N=t(667294),I=t(369035),W=t(254675),j=t(729101),b=t(184295),A=t(9399),Z=t(342587),E=t(961021);r.Z=e=>{var r;let{open:t,onClose:D,workerTypes:O,data:C,refetch:_,onWorkerAdded:S,setWorkerTypes:P}=e,{t:M}=(0,v.$G)(),L=(0,n.Z)(),H=(0,a.Z)(L.breakpoints.down("md")),[U,z]=(0,N.useState)([]),[K,Y]=(0,N.useState)(!1),[G,F]=(0,N.useState)({type:"CONTRACTOR",workerName:"",contractorWorkers:[{contractorWorkerTypeId:"",rate:0,rateType:"HR",shiftDuration:0,durationType:"HR",overTimeRate:0,overTimeDurationType:"HR"}]}),[q,V]=(0,N.useState)(null),[$,B]=(0,N.useState)(!1),{localizationValue:X}=(0,W.W)(),{createWorker:J,isLoading:Q,updateWorker:ee}=(0,A.s)(),{createWorkerType:er,getOrganizationWorkerTypes:et,state:{organizationWorkerType:eo}}=(0,E.N)();(0,N.useEffect)(()=>{X&&V((0,j.LY)(X,"CURRENCY","SYMBOL"))},[X]),(0,N.useEffect)(()=>{eo&&(console.log("organizationWorkerType",eo),z(eo))},[eo]),(0,N.useEffect)(()=>{t&&(null==et||et())},[t]),(0,N.useEffect)(()=>{eo&&t&&el()},[eo,t]),(0,N.useEffect)(()=>{if(t){if(C){if(console.log("data",C),"CONTRACTOR"===C.type&&C.contractorWorkers&&C.contractorWorkers.length>0)F({type:"CONTRACTOR",workerName:C.workerName||"",contractorWorkers:C.contractorWorkers.map(e=>{var r,t,o;return{contractorWorkerId:e.contractorWorkerId,contractorWorkerTypeId:e.contractorWorkerTypeId||"",rate:null!==(r=e.rate)&&void 0!==r?r:0,rateType:e.rateType||"HR",shiftDuration:null!==(t=e.shiftDuration)&&void 0!==t?t:0,durationType:e.durationType||"HR",overTimeRate:null!==(o=e.overTimeRate)&&void 0!==o?o:0,overTimeDurationType:e.overTimeDurationType||"HR"}})});else{var e,r,o;F({type:"CONTRACTOR",workerName:C.workerName||"",contractorWorkers:[{contractorWorkerTypeId:C.workerTypeId||"",rate:null!==(e=C.rate)&&void 0!==e?e:0,rateType:C.rateType||"HR",shiftDuration:null!==(r=C.shiftDuration)&&void 0!==r?r:0,durationType:C.durationType||"HR",overTimeRate:null!==(o=C.overTimeRate)&&void 0!==o?o:0,overTimeDurationType:C.overTimeDurationType||"HR"}]})}}else F({type:"CONTRACTOR",workerName:"",contractorWorkers:[{contractorWorkerTypeId:"",rate:0,rateType:"HR",shiftDuration:0,durationType:"HR",overTimeRate:0,overTimeDurationType:"HR"}]})}t||F({type:"CONTRACTOR",workerName:"",contractorWorkers:[{contractorWorkerTypeId:"",rate:0,rateType:"HR",shiftDuration:0,durationType:"HR",overTimeRate:0,overTimeDurationType:"HR"}]})},[t,C]);let en=(e,r,t)=>{"workerName"===e?F(e=>({...e,workerName:r})):void 0!==t&&(F(o=>{if("CONTRACTOR"!==o.type)return o;let n=[...o.contractorWorkers||[]];return n[t]||(n[t]={contractorWorkerTypeId:"",rate:0,rateType:"HR",shiftDuration:0,durationType:"HR",overTimeRate:0,overTimeDurationType:"HR"}),n[t]={...n[t],[e]:r},{...o,contractorWorkers:n}}),"contractorWorkerTypeId"===e&&r&&el())},ea=e=>{F(r=>{var t;return"CONTRACTOR"!==r.type?r:{...r,contractorWorkers:(null===(t=r.contractorWorkers)||void 0===t?void 0:t.filter((r,t)=>t!==e))||[]}})},ei=async e=>{let r=e.trim();if(!r){(null==eo?void 0:eo.length)!==U.length&&z(eo);return}z(null==eo?void 0:eo.filter(e=>e.organizationWorkerTypeDisplayName.toLowerCase().includes(r.toLowerCase())))},el=()=>{eo&&eo.length>0&&z(eo)},es=async(e,r)=>{let t=e.trim();if(t)try{Y(!0);let e=await (null==er?void 0:er({organizationWorkerType:t,description:""}));e&&(el(),en("contractorWorkerTypeId",e.organizationWorkerTypeId,r),null==P||P(e))}catch(e){"ORGANIZATION_WORKER_TYPE_ALREADY_EXISTS"===e.message?y.Am.error(M("toast.existWorkerType")):y.Am.error((null==e?void 0:e.message)||M("toast.somethingWentWrong"))}finally{Y(!1)}},ed=async()=>{try{var e;if(B(!0),!(0,b.x)(G)){y.Am.error(M("toast.requiredField"));return}console.log(G,"worker handleSubmit");let r=null==G?void 0:null===(e=G.contractorWorkers)||void 0===e?void 0:e.map(e=>{let{contractorWorkerId:r="",...t}=e;return{...t,rate:t.rate||0,overTimeRate:t.overTimeRate||0}});try{let e;(e=C?await ee({...G,workerId:C.workerId,contractorWorkers:r},R.I.CONTRACTOR_WORKERS):await J({...G,contractorWorkers:r},R.I.CONTRACTOR_WORKERS))&&(y.Am.success(C?M("toast.successContractorAndWorkersUpdated"):M("toast.successContractorAndWorkersAdded")),!C&&S&&e&&S(e),null==_||_(),D())}catch(e){C?y.Am.error(M("toast.failedToUpdateContractorAndWorkers")):y.Am.error(M("toast.failToAddContractorAndWorkersAdded"))}}catch(e){console.error("Error submitting contractor data:",e),y.Am.error("Failed to add contractor and workers. Please try again.")}finally{B(!1)}};return console.log("worker data's",G),(0,o.jsxs)(I.I,{open:t,hideScrollbar:!0,className:"boqUI prodandserviceUI",children:[(0,o.jsxs)(i.Z,{sx:{position:"sticky",top:0,zIndex:1e3,background:"#fff"},children:[(0,o.jsxs)("div",{className:"d-flex justify-content-between my-1",children:[(0,o.jsx)("div",{style:{fontSize:"20px",display:"flex",alignItems:"center"},children:(0,o.jsx)(l.Z,{onClick:D,children:(0,o.jsx)(x.Z,{style:{width:"20px",height:"20px",fill:"#ccc"}})})}),(0,o.jsx)(k.r,{title:C?M("workerManagement.editWorkerTitle"):M("workerManagement.addContractor&Workers")}),(0,o.jsx)(T.Z,{disabled:$||Q,loading:Q,variant:"contained",sx:{maxWidth:"80px",minWidth:"80px",marginRight:"10px","&.Mu
1i-disabled":{color:"gray !important",opacity:1,cursor:"not-allowed"}},onClick:ed,children:(0,o.jsx)("span",{style:{visibility:Q?"hidden":"visible"},children:C?M("common.update"):M("common.add")})})]}),(0,o.jsx)(s.Z,{className:"my-2"})]}),(0,o.jsx)("div",{}),(0,o.jsx)(i.Z,{className:H?"p-0 pr-1":"p-2",children:(0,o.jsxs)(i.Z,{sx:{background:"#fbfdff",marginBottom:"20px"},className:"py-1 px-1",children:[(0,o.jsxs)(i.Z,{component:"section",id:"received payment information",children:[(0,o.jsx)(i.Z,{className:"d-flex justify-content-between align-items-center"}),(0,o.jsx)(i.Z,{sx:{width:"100vw",marginBottom:"30px",transition:"height 1s",transitionTimingFunction:"ease","&::-webkit-scrollbar, & *::-webkit-scrollbar":{backgroundColor:"#fbfdff"},"&::-webkit-scrollbar-thumb, & *::-webkit-scrollbar-thumb":{borderRadius:"0.7rem",backgroundColor:"#fbfdff",minHeight:24,border:"7px solid #fbfdff"}},children:(0,o.jsx)(d.ZP,{container:!0,spacing:3,sx:{width:"100%"},children:(0,o.jsx)(d.ZP,{item:!0,xs:12,lg:8,children:(0,o.jsx)(d.ZP,{container:!0,spacing:2,className:"pl-2",sx:{width:"100%"},children:(0,o.jsx)(d.ZP,{item:!0,xs:12,sm:4,lg:4,children:(0,o.jsxs)(i.Z,{className:"d-flex column",children:[(0,o.jsxs)(f.Z,{className:"fw-500 mb-1",children:[M("workerManagement.contractorName")," ",(0,o.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,o.jsx)(c.Z,{placeholder:M("workerManagement.enterContractorName"),name:"workerName",value:null==G?void 0:G.workerName,sx:{bgcolor:"white"},onChange:e=>{en("workerName",e.target.value)}})]})})})})})}),(0,o.jsx)(i.Z,{className:"mx-2",children:(0,o.jsx)(s.Z,{className:"my-2"})}),(0,o.jsx)(i.Z,{sx:{width:"100vw",transition:"height 1s",transitionTimingFunction:"ease","&::-webkit-scrollbar, & *::-webkit-scrollbar":{backgroundColor:"#fbfdff"},"&::-webkit-scrollbar-thumb, & *::-webkit-scrollbar-thumb":{borderRadius:"0.7rem",backgroundColor:"#fbfdff",minHeight:24,border:"7px solid #fbfdff"}},children:(0,o.jsx)(d.ZP,{container:!0,spacing:3,sx:{width:"100%",marginLeft:"-5px",marginTop:"20px"},className:"px-2",children:(0,o.jsx)(d.ZP,{item:!0,xs:12,lg:8,children:(0,o.jsx)(d.ZP,{container:!0,spacing:3,sx:{width:"100%"},children:null===(r=(null==G?void 0:G.contractorWorkers)||[{}])||void 0===r?void 0:r.map((e,r)=>{var t,n,a,s,p,y,x,k,v,T,R,N;return(0,o.jsxs)(d.ZP,{container:!0,spacing:2,sx:{width:"100%",marginTop:"20px",overflowX:H?"visible":"auto",flexWrap:H?"wrap":"nowrap",alignItems:"flex-end"},children:[(0,o.jsx)(d.ZP,{item:!0,xs:12,sm:6,md:3,sx:{minWidth:H?"auto":"200px",flex:"1 1 0",height:"auto"},children:(0,o.jsxs)(i.Z,{className:"d-flex column",children:[(0,o.jsxs)(f.Z,{className:"fw-500 mb-1",children:[M("workerManagement.workerType")," ",(0,o.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,o.jsx)(h.Z,{value:(null==e?void 0:e.contractorWorkerTypeId)||"",options:(((null==eo?void 0:eo.length)?eo:O)||[]).map(e=>({label:e.organizationWorkerTypeDisplayName,value:e.organizationWorkerTypeId})),isLoading:K,placeholder:M("common.select"),onChange:e=>{en("contractorWorkerTypeId",e||"",r)},disabled:null!=e&&!!e.contractorWorkerId,onInputChange:e=>{ei(e)},isAddNewItem:!0,addItemText:M("workerManagement.addWorkerType"),onAddItem:async e=>es(e,r)})]})}),(0,o.jsx)(d.ZP,{item:!0,xs:12,sm:6,md:3,sx:{minWidth:H?"auto":"200px",flex:"1 1 0"},children:(0,o.jsxs)(i.Z,{className:"d-flex column",children:[(0,o.jsxs)(f.Z,{className:"fw-500 mb-1",children:[M("workerManagement.workingHours")," ",(0,o.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,o.jsx)(c.Z,{type:"number",fullWidth:!0,placeholder:M("workerManagement.workingHours"),variant:"outlined",value:(null==e?void 0:e.shiftDuration)||"",onChange:e=>{let t=e.target.value;if(""===t){en("shiftDuration","",r);return}let o=parseInt(t,10);!isNaN(o)&&o>=0&&en("shiftDuration",o,r)},inputProps:{maxLength:10,step:1,inputMode:"numeric",pattern:"[0-9]*"},InputProps:{endAdornment:(0,o.jsx)("span",{children:M("common.hrs")})}})]})}),(0,o.jsx)(d.ZP,{item:!0,xs:12,sm:6,md:3,sx:{minWidth:H?"auto":"200px",flex:"1 1 0"},children:(0,o.jsxs)(i.Z,{className:"d-flex column",children:[(0,o.jsx)(f.Z,{className:"fw-500 mb-1",children:M("workerManagement.workerRate")}),(0,o.jsx)(c.Z,{type:"number",placeholder:M("common.enterRate"),variant:"outlined",value:null==e?void 0:e.rate,onChange:e=>{let t=e.target.value;if(""===t){en("rate","",r);return}if(!/^\d*(?:\.\d{0,2})?$/.test(t))return;let o=parseFloat(t);!isNaN(o)&&o>=0&&en("rate",o,r)},inputProps:{maxLength:10,inputMode:"decimal",pattern:"^\\d*(?:\\.\\d{0,2})?$",step:1},InputProps:{startAdornment:(0,o.jsx)(u.Z,{position:"start",children:q}),endAdornment:(0,o.jsx)(u.Z,{position:"end",sx:{whiteSpace:"nowrap",flexShrink:0},children:(0,o.jsx)(h.Z,{underline:!0,disableClearable:!0,value:(null==e?void 0:e.rateType)||"HR",onChange:e=>{en("rateType",null!=e?e:"HR",r)},options:g.dN.map(e=>({value:e,label:M("common.timePeriod.".concat((0,w.vs)(e)))})),sx:{"& .MuiInput-root:before":{borderBottom:"none"}}})})}})]})}),(0,o.jsx)(d.ZP,{item:!0,xs:12,sm:6,md:3,sx:{minWidth:H?"auto":"200px",flex:"1 1 0"},children:(0,o.jsxs)(i.Z,{className:"d-flex column",children:[(0,o.jsx)(f.Z,{className:"fw-500 mb-1",children:M("workerManagement.overTimeRate")}),(0,o.jsx)(c.Z,{type:"number",fullWidth:!0,placeholder:M("common.enterRate"),variant:"outlined",value:null==e?void 0:e.overTimeRate,onChange:e=>{let t=e.target.value;if(""===t){en("overTimeRate","",r);return}if(!/^\d*(?:\.\d{0,2})?$/.test(t))return;let o=parseFloat(t);!isNaN(o)&&o>=0&&en("overTimeRate",o,r)},inputProps:{maxLength:10,inputMode:"decimal",pattern:"^\\d*(?:\\.\\d{0,2})?$",step:1},InputProps:{startAdornment:(0,o.jsx)(u.Z,{position:"start",children:q}),endAdornment:(0,o.jsx)("span",{children:M("common.hrs")})}})]})}),((null==G?void 0:G.contractorWorkers)||[]).length>
11&&(0,o.jsx)(d.ZP,{item:!0,xs:12,md:"auto",sx:{display:"flex",alignItems:"center",justifyContent:H?"center":"flex-start",marginTop:H?"5px":"0px",flexShrink:0,paddingTop:"0px",marginBottom:"8px"},children:(0,o.jsx)(m.Z,{title:(null!==(T=null==C?void 0:null===(a=C.contractorWorkers)||void 0===a?void 0:null===(n=a[r])||void 0===n?void 0:null===(t=n.todaysShifts)||void 0===t?void 0:t.length)&&void 0!==T?T:0)>0?M("workerManagement.cannotDeleteWorkerWithActiveShifts"):"",children:(0,o.jsx)(l.Z,{color:"error",size:"small",disabled:(null!==(R=null==C?void 0:null===(y=C.contractorWorkers)||void 0===y?void 0:null===(p=y[r])||void 0===p?void 0:null===(s=p.todaysShifts)||void 0===s?void 0:s.length)&&void 0!==R?R:0)>0,onClick:()=>ea(r),sx:{"&.Mui-disabled":{color:"gray !important","& .MuiSvgIcon-root":{fill:"gray !important"}}},children:(0,o.jsx)(Z.Z,{style:{width:"20px",height:"20px",fill:(null!==(N=null==C?void 0:null===(v=C.contractorWorkers)||void 0===v?void 0:null===(k=v[r])||void 0===k?void 0:null===(x=k.todaysShifts)||void 0===x?void 0:x.length)&&void 0!==N?N:0)>0?L.palette.grey[400]:"#FD7164"}})})})})]},r)})})})})})]}),(0,o.jsx)(l.Z,{onClick:()=>{if(Q)return;let{contractorWorkers:e=[]}=G;if(e.some(e=>""===e.contractorWorkerTypeId||e.shiftDuration<=0)){y.Am.error(M("toast.requiredField"));return}F(e=>"CONTRACTOR"!==e.type?e:{...e,contractorWorkers:[...e.contractorWorkers||[],{contractorWorkerTypeId:"",rate:0,rateType:"HR",shiftDuration:0,durationType:"HR"}]})},className:"mt-3 mb-2",children:(0,o.jsxs)(p.Z,{className:"fs-7 m-1 ml-0 fw-600",sx:{color:e=>e.palette.primary.main},children:[M("workerManagement.addWorker")," +"]})})]})})]})}},893541:function(e,r,t){var o=t(785893),n=t(95442),a=t(298969),i=t(202302),l=t(137491),s=t(556143),d=t(76517),c=t(378380),u=t(891444),m=t(673442),p=t(894036),h=t(567421),f=t(331812),y=t(718984),x=t(188115),k=t(862952),v=t(505891),T=t(667294),g=t(961021),w=t(254675),R=t(729101),N=t(184295),I=t(369035),W=t(9399);r.Z=e=>{let{type:r,open:t,onClose:j,workerTypes:b,setWorkerTypes:A,data:Z,refetch:E,onWorkerAdded:D}=e,{t:O,i18n:C}=(0,h.$G)(),[_,S]=(0,T.useState)(void 0),[P,M]=(0,T.useState)(null),[L,H]=(0,T.useState)(!1),[U,z]=(0,T.useState)(!0),[K,Y]=(0,T.useState)(!1),{localizationValue:G}=(0,w.W)(),[F,q]=(0,T.useState)([]),{createWorker:V,isLoading:$,updateWorker:B}=(0,W.s)(),{createWorkerType:X,getOrganizationWorkerTypes:J,state:{organizationWorkerType:Q}}=(0,g.N)();(0,T.useEffect)(()=>{G&&M((0,R.LY)(G,"CURRENCY","SYMBOL"))},[G]),(0,T.useEffect)(()=>{if(t&&r===v.I.INDIVIDUAL){if(Z){var e,o,n;S({type:"INDIVIDUAL",workerName:Z.workerName||"",workerTypeId:Z.workerTypeId||"",rate:null!==(e=Z.rate)&&void 0!==e?e:0,rateType:Z.rateType||"HR",shiftDuration:null!==(o=Z.shiftDuration)&&void 0!==o?o:0,durationType:Z.durationType||"HR",overTimeRate:null!==(n=Z.overTimeRate)&&void 0!==n?n:0,overTimeDurationType:Z.overTimeDurationType||"HR"})}else S({type:"INDIVIDUAL",workerName:"",workerTypeId:"",rate:0,rateType:"HR",shiftDuration:0,durationType:"HR",overTimeRate:0,overTimeDurationType:"HR"})}},[r,t,Z]),(0,T.useEffect)(()=>{t&&(null==J||J())},[t]),(0,T.useEffect)(()=>{Q&&q(Q)},[Q]),(0,T.useEffect)(()=>{if(!_){z(!0);return}r===v.I.INDIVIDUAL&&z(!(_.workerName&&""!==_.workerName.trim()&&_.workerTypeId&&""!==_.workerTypeId.trim()))},[_,r]);let ee=()=>{Q&&Q.length>0&&q([...Q])},er=(e,r)=>{S(t=>t?{...t,[e]:r}:{type:"INDIVIDUAL",workerName:"",workerTypeId:"",[e]:r}),"workerTypeId"===e&&r&&ee()},et=async()=>{var e;if(!_){u.Am.error(O("toast.requiredField"));return}let t=!1;if(r==v.I.INDIVIDUAL&&(t=(0,N.A)(_)),!t){u.Am.error(O("toast.requiredField"));return}let o=null,n=(null==Q?void 0:null===(e=Q.find(e=>{var r;return e.organizationWorkerTypeId===(null==_?void 0:null===(r=_.workerTypeId)||void 0===r?void 0:r.trim())}))||void 0===e?void 0:e.organizationWorkerTypeDisplayName)||"";try{(o=Z?await B({..._,workerId:Z.workerId,organizationWorkerTypeDisplayName:n},r):await V({..._,organizationWorkerTypeDisplayName:n},r))&&((null==o?void 0:o.code)=="WORKER_ALREADY_EXISTS"?u.Am.error(O("toast.workerAlreadyExists")):(Z?u.Am.success(O("toast.successWorkerUpdated")):(u.Am.success(O("toast.successWorkerCreated")),D&&o&&D(o)),j(),null==E||E()))}catch(e){Z?u.Am.error(O("toast.faildToUpdateWorker")):u.Am.error(O("toast.faildToCreateWorker"))}},eo=async e=>{let r=e.trim();if(!r){(null==Q?void 0:Q.length)!==F.length&&q(Q);return}q(null==Q?void 0:Q.filter(e=>e.organizationWorkerTypeDisplayName.toLowerCase().includes(r.toLowerCase())))},en=async e=>{let r=e.trim();if(r)try{Y(!0);let e=await (null==X?void 0:X({organizationWorkerType:r,description:""}));e&&(er("workerTypeId",e.organizationWorkerTypeId),ee(),null==A||A(e),null==J||J())}catch(e){"ORGANIZATION_WORKER_TYPE_ALREADY_EXISTS"===e.message?u.Am.error(O("toast.existWorkerType")):u.Am.error((null==e?void 0:e.message)||O("toast.somethingWentWrong"))}finally{Y(!1)}};return console.log(_,"worker"),(0,o.jsxs)(I.I,{open:t,className:"boqUI prodandserviceUI",children:[(0,o.jsxs)(n.Z,{sx:{position:"sticky",top:0,zIndex:1e3,background:"#fff"},children:[(0,o.jsxs)("div",{className:"d-flex justify-content-between my-1",children:[(0,o.jsx)("div",{style:{fontSize:"20px",display:"flex",alignItems:"center"},children:(0,o.jsx)(a.Z,{onClick:j,children:(0,o.jsx)(m.Z,{style:{width:"20px",height:"20px",fill:"#ccc"}})})}),(0,o.jsx)(p.r,{title:Z?O("workerManagement.editIndividualWorker"):O
1("workerManagement.addIndividualWorker")}),(0,o.jsx)(f.Z,{disabled:$||U,loading:$,variant:"contained",sx:{maxWidth:"80px",minWidth:"80px",marginRight:"10px","&.Mui-disabled":{color:"gray !important",opacity:1,cursor:"not-allowed"},"&.Mui-loading":{color:"gray !important",opacity:1,cursor:"not-allowed"}},onClick:et,children:(0,o.jsx)("span",{style:{visibility:$?"hidden":"visible"},children:Z?O("common.update"):O("common.add")})})]}),(0,o.jsx)(i.Z,{className:"my-2"})]}),(0,o.jsx)("div",{}),(0,o.jsx)(n.Z,{className:"p-2",children:(0,o.jsx)(n.Z,{sx:{background:"#fbfdff"},className:"py-1 px-1",children:(0,o.jsxs)(n.Z,{component:"section",id:"received payment information",children:[(0,o.jsx)(n.Z,{className:"d-flex justify-content-between align-items-center"}),(0,o.jsx)(n.Z,{sx:{},children:(0,o.jsx)(l.ZP,{container:!0,spacing:3,sx:{width:"100%"},children:(0,o.jsxs)(l.ZP,{item:!0,xs:12,lg:12,children:[(0,o.jsxs)(l.ZP,{container:!0,spacing:2,className:"pl-2",sx:{width:"100%"},children:[(0,o.jsx)(l.ZP,{item:!0,xs:12,sm:4,lg:4,children:(0,o.jsxs)(n.Z,{className:"d-flex column",children:[(0,o.jsxs)(c.Z,{className:" fw-500 mb-1",children:[O("workerManagement.workerName")," ",(0,o.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,o.jsx)(s.Z,{placeholder:O("workerManagement.workerName"),name:"workerName",value:null==_?void 0:_.workerName,sx:{bgcolor:"white"},onChange:e=>{er("workerName",e.target.value)}})]})}),(0,o.jsx)(l.ZP,{item:!0,xs:12,sm:4,lg:4,children:(0,o.jsxs)(n.Z,{className:"d-flex column",children:[(0,o.jsxs)(c.Z,{className:" fw-500 mb-1",children:[O("workerManagement.workerType")," ",(0,o.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,o.jsx)(y.Z,{options:((F&&F.length?F:b)||[]).map(e=>({label:e.organizationWorkerTypeDisplayName,value:e.organizationWorkerTypeId})),isLoading:K,placeholder:O("workerManagement.workerType"),value:(null==_?void 0:_.workerTypeId)||"",onChange:e=>{""==e&&ee(),er("workerTypeId",e||"")},onInputChange:e=>{eo(e)},isAddNewItem:!0,onAddItem:async e=>en(e),addItemText:O("workerManagement.addWorkerType"),maxDisplayLength:30})]})}),(0,o.jsx)(l.ZP,{item:!0,xs:12,sm:4,lg:4,children:(0,o.jsxs)(n.Z,{className:"d-flex column",children:[(0,o.jsx)(c.Z,{className:" fw-500 mb-1",children:O("workerManagement.workerRate")}),(0,o.jsx)(s.Z,{type:"number",fullWidth:!0,name:"rate",placeholder:O("common.enterRate"),variant:"outlined",value:null==_?void 0:_.rate,disabled:L,onChange:e=>{let r=e.target.value;if(""===r){er("rate","");return}if(!/^\d*(?:\.\d{0,2})?$/.test(r))return;let t=parseFloat(r);!isNaN(t)&&t>=0&&er("rate",t)},inputProps:{maxLength:10,inputMode:"decimal",pattern:"^\\d*(?:\\.\\d{0,2})?$",step:1},onKeyDown:e=>{let r=e.target;if(""===r.value&&("0"===e.key||"-"===e.key)||"-"===e.key||"e"===e.key||"E"===e.key||","===e.key){e.preventDefault();return}if("ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();let t=r.value?Math.floor(parseFloat(r.value)):0,o=t;"ArrowUp"===e.key?o=t+1:"ArrowDown"===e.key&&(o=t>0?t-1:0),er("rate",o)}},InputProps:{endAdornment:(0,o.jsx)(d.Z,{position:"end",sx:{whiteSpace:"nowrap",flexShrink:0},children:(0,o.jsx)(y.Z,{size:"small",underline:!0,disableClearable:!0,disableSearch:!0,disabled:L,value:(null==_?void 0:_.rateType)||"HR",options:x.dN.map(e=>({value:e,label:O("common.timePeriod.".concat((0,k.vs)(e)))})),onChange:e=>{er("rateType",null!=e?e:"")}})}),startAdornment:(0,o.jsx)(d.Z,{position:"start",children:P})}})]})})]}),(0,o.jsxs)(l.ZP,{container:!0,spacing:2,className:"pl-2",sx:{width:"100%",marginTop:"15px"},children:[(0,o.jsx)(l.ZP,{item:!0,xs:12,sm:4,lg:4,children:(0,o.jsxs)(n.Z,{className:"d-flex column",children:[(0,o.jsxs)(c.Z,{className:" fw-500 mb-1",children:[O("workerManagement.workingHours")," "]}),(0,o.jsx)(s.Z,{type:"number",fullWidth:!0,name:"shiftDuration",placeholder:O("workerManagement.workingHours"),variant:"outlined",value:(null==_?void 0:_.shiftDuration)||"",disabled:L,onChange:e=>{let r=e.target.value;if(""===r){er("shiftDuration","");return}let t=parseInt(r,10);!isNaN(t)&&t>=0&&er("shiftDuration",t)},inputProps:{maxLength:10,min:0,step:1,inputMode:"numeric",pattern:"[0-9]*"},onKeyDown:e=>{let r=e.target;(""===r.value&&"0"===e.key||""===r.value&&"-"===e.key||"-"===e.key||"."===e.key||","===e.key||"e"===e.key||"E"===e.key)&&e.preventDefault()},InputProps:{endAdornment:(0,o.jsx)("span",{children:O("common.hrs")})}})]})}),(0,o.jsx)(l.ZP,{item:!0,xs:12,sm:4,lg:4,children:(0,o.jsxs)(n.Z,{className:"d-flex column",children:[(0,o.jsx)(c.Z,{className:" fw-500 mb-1",children:O("workerManagement.overTimeRate")}),(0,o.jsx)(s.Z,{type:"number",fullWidth:!0,name:"overTimeRate",placeholder:O("common.enterRate"),variant:"outlined",value:null==_?void 0:_.overTimeRate,disabled:L,onChange:e=>{let r=e.target.value;if(""===r){er("overTimeRate","");return}if(!/^\d*(?:\.\d{0,2})?$/.test(r))return;let t=parseFloat(r);!isNaN(t)&&t>=0&&er("overTimeRate",t)},inputProps:{maxLength:10,inputMode:"decimal",pattern:"^\\d*(?:\\.\\d{0,2})?$",step:1},onKeyDown:e=>{let r=e.target;if(""===r.value&&("0"===e.key||"-"===e.key)||"-"===e.key||"e"===e.key||"E"===e.key||","===e.key){e.preventDefault();return}if("ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();let t=r.value?Math.floor(parseFloat(r.value)):0,o=t;"ArrowUp"===e.key?o=t+1:"ArrowDown"===e.key&&(o=t>0?t-1:0),er("overTimeRate",o)}},InputProps:{endAdornment:(0,o.jsx)("span",{children:O("common.hrs")}),startAdornment:(0,o.jsx)(d.Z,{position:"start",children:P})}})]})})]})]})})})]})})})]})}},9399:function(e,r,t){t.d(r,{s:function(){return i}});var o=t(450905),n=t(254339),a=t(667294);let i=()=>{let[e,r]=(0,a.useState)(!1),{NEXT_PUBLIC_PROCUREMENT_ENDPOINT:t}=(0,n.k)(),{post:i}=(0,o.m)(t+"/worker-management");return{createWorker:async(e,t)=>{if(!t)return;let o={eventType:"CREATE_WORKER",...e,..."CONTRACTOR"!=t&&{rate:(null==e?void 0:e.rate)||0,overTimeRate:(null==e?void 0:e.overTimeRate)||0},type:t};try{r(!0);let e=await i(o);if("WORKER_CREATED"==e.code)return e.body.worker;if("WORKER_ALREADY_EXISTS"==e.code)return e;throw Error((null==e?void 0:e.code)||"something wrong")}catch(e){if(e instanceof Error)throw Error(null==e?void 0:e.message);throw Error("something wrong")}finally{r(!1)}},isLoading:e,updateWorker:async(e,t)=>{if(!t)return;let o={eventType:"EDIT_WORKER",...e,rate:(null==e?void 0:e.rate)||0,overTimeRate:(null==e?void 0:e.overTimeRate)||0,type:t};try{r(!0);let e=await i(o);if("WORKER_UPDATED"==e.code)return e.body.worker;throw Error((null==e?void 0:e.code)||"something wrong")}catch(e){if(e instanceof Error)throw Error(null==e?void 0:e.message);throw Error("something wrong")}finally{r(!1)}}}}},961021:function(e,r,t){t.d(r,{N:function(){return l}});var o=t(450905),n=t(254339),a=t(433299),i=t(667294);let l=()=>{let[e,r]=(0,i.useState)([]),[t,l]=(0,i.useState)(!1),{NEXT_PUBLIC_PROCUREMENT_ENDPOINT:s}=(0,n.k)(),{post:d}=(0,o.m)(s+"/worker-management"),{data:c}=(0,a.useSession)(),u=async e=>{if(!c)return;let t={eventType:"FETCH_ORGANIZATION_WORKER_TYPES",organizationId:null==c?void 0:c["custom:organization_id"],organizationType:null==c?void 0:c["custom:organization_type"]};try{l(!0);let e=await d(t);if("ORGANIZATION_WORKER_TYPES_FOUND"===e.code){let{result:t=[]}=e.body||{};r(t)}}catch(e){console.log("error",e)}finally{l(!1)}};return{createWorkerType:async e=>{let{organizationWorkerType:t,description:o}=e;if(t)try{l(!0);let e=await d({eventType:"CREATE_ORGANIZATION_WORKER_TYPE",organizationWorkerType:t,description:o});if("ORGANIZATION_WORKER_TYPE_CREATED"==e.code){var n;return console.log(e.message),r(r=>{var t;return console.log("prev",r),[...r,null===(t=e.body)||void 0===t?void 0:t.organizationWorkerType]}),null===(n=e.body)||void 0===n?void 0:n.organizationWorkerType}throw Error((null==e?void 0:e.code)||"something wrong")}catch(e){if(e instanceof Error)throw Error(null==e?void 0:e.message);throw Error("something wrong")}finally{l(!1)}},isLoading:t,deleteWorkerType:async(e,r)=>{if(!e)return;let t={eventType:"DELETE_ORGANIZATION_WORKER_TYPE",organizationWorkerTypeId:e,...r&&{organizationWorkerTypeDisplayName:r}};try{let e=await d(t);if("ORGANIZATION_WORKER_TYPE_DELETED"==e.code)return await u(),e.message;throw Error((null==e?void 0:e.code)||"SOMETHING_WRONG")}catch(e){if(e instanceof Error)throw Error(null==e?void 0:e.message);throw Error("SOMETHING_WRONG")}},editWorkerType:async e=>{let{organizationWorkerTypeId:r,organizationWorkerType:t,description:o}=e;try{l(!0);let e=await d({eventType:"EDIT_ORGANIZATION_WORKER_TYPE",organizationWorkerTypeId:r,organizationWorkerType:t,description:o});if("ORGANIZATION_WORKER_TYPE_UPDATED"==e.code){var n;return console.log(e.message),null===(n=e.body)||void 0===n?void 0:n.organizationWorkerType}throw Error((null==e?void 0:e.code)||"something wrong")}catch(e){if(e instanceof Error)throw Error(null==e?void 0:e.message);throw Error("something wrong")}finally{l(!1)}},getOrganizationWorkerTypes:u,state:{organizationWorkerType:e,setOrganizationWorkerType:r}}}},505891:function(e,r,t){var o,n,a,i;t.d(r,{I:function(){return o}}),(a=o||(o={})).INDIVIDUAL="INDIVIDUAL",a.CONTRACTOR_WORKERS="CONTRACTOR",(i=n||(n={})).INDIVIDUAL="INDIVIDUAL",i.CONTRACTOR="CONTRACTOR",i.ORGANIZATION_USER="ORGANIZATION_USER"},184295:function(e,r,t){t.d(r,{A:function(){return o},x:function(){return n}});let o=e=>{for(let{field:r,type:t}of[{field:"workerName",type:"string"},{field:"workerTypeId",type:"string"}]){let o=e[r];if("string"===t){if(!o||"string"==typeof o&&""===o.trim())return!1}else if("number"===t&&(!o||"number"==typeof o&&o<=0))return!1}return!0},n=e=>{if("CONTRACTOR"!==e.type||!e.workerName||""===e.workerName.trim()||!e.contractorWorkers||0===e.contractorWorkers.length)return!1;console.log("stp3");let r=[{field:"contractorWorkerTypeId",type:"string"},{field:"shiftDuration",type:"number"},{field:"durationType",type:"string"}];for(let t of e.contractorWorkers)for(let{field:e,type:o}of r){let r=t[e];if("string"===o){if(!r||"string"==typeof r&&""===r.trim())return!1}else if("number"===o&&(!r||"number"==typeof r&&r<=0))return!1}return!0}},572526:function(e,r,t){t.d(r,{Z:function(){return o}});let o=(0,t(966157).Z)("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}
1],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]])},418969:function(e,r,t){t.d(r,{Z:function(){return o}});let o=(0,t(966157).Z)("users-round",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]])}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.