1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9438],{31425:function(e,t,a){"use strict";a.d(t,{Z:function(){return g}});var i=a(63366),n=a(87462),r=a(67294),o=a(86010),l=a(94780),s=a(90948),d=a(71657),c=a(1588),x=a(34867);function m(e){return(0,x.Z)("MuiDialogActions",e)}(0,c.Z)("MuiDialogActions",["root","spacing"]);var h=a(85893);let u=["className","disableSpacing"],p=e=>{let{classes:t,disableSpacing:a}=e;return(0,l.Z)({root:["root",!a&&"spacing"]},m,t)},f=(0,s.ZP)("div",{name:"MuiDialogActions",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:a}=e;return[t.root,!a.disableSpacing&&t.spacing]}})(({ownerState:e})=>(0,n.Z)({display:"flex",alignItems:"center",padding:8,justifyContent:"flex-end",flex:"0 0 auto"},!e.disableSpacing&&{"& > :not(:first-of-type)":{marginLeft:8}})),Z=r.forwardRef(function(e,t){let a=(0,d.Z)({props:e,name:"MuiDialogActions"}),{className:r,disableSpacing:l=!1}=a,s=(0,i.Z)(a,u),c=(0,n.Z)({},a,{disableSpacing:l}),x=p(c);return(0,h.jsx)(f,(0,n.Z)({className:(0,o.Z)(x.root,r),ownerState:c,ref:t},s))});var g=Z},6514:function(e,t,a){"use strict";a.d(t,{Z:function(){return j}});var i=a(63366),n=a(87462),r=a(67294),o=a(86010),l=a(94780),s=a(90948),d=a(71657),c=a(1588),x=a(34867);function m(e){return(0,x.Z)("MuiDialogContent",e)}(0,c.Z)("MuiDialogContent",["root","dividers"]);var h=a(4472),u=a(85893);let p=["className","dividers"],f=e=>{let{classes:t,dividers:a}=e;return(0,l.Z)({root:["root",a&&"dividers"]},m,t)},Z=(0,s.ZP)("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:a}=e;return[t.root,a.dividers&&t.dividers]}})(({theme:e,ownerState:t})=>(0,n.Z)({flex:"1 1 auto",WebkitOverflowScrolling:"touch",overflowY:"auto",padding:"20px 24px"},t.dividers?{padding:"16px 24px",borderTop:`1px solid ${(e.vars||e).palette.divider}`,borderBottom:`1px solid ${(e.vars||e).palette.divider}`}:{[`.${h.Z.root} + &`]:{paddingTop:0}})),g=r.forwardRef(function(e,t){let a=(0,d.Z)({props:e,name:"MuiDialogContent"}),{className:r,dividers:l=!1}=a,s=(0,i.Z)(a,p),c=(0,n.Z)({},a,{dividers:l}),x=f(c);return(0,u.jsx)(Z,(0,n.Z)({className:(0,o.Z)(x.root,r),ownerState:c,ref:t},s))});var j=g},58951:function(e,t,a){"use strict";a.d(t,{Z:function(){return j}});var i=a(63366),n=a(87462),r=a(67294),o=a(86010),l=a(94780),s=a(90948),d=a(71657),c=a(15861),x=a(1588),m=a(34867);function h(e){return(0,m.Z)("MuiDialogContentText",e)}(0,x.Z)("MuiDialogContentText",["root"]);var u=a(85893);let p=["children","className"],f=e=>{let{classes:t}=e,a=(0,l.Z)({root:["root"]},h,t);return(0,n.Z)({},t,a)},Z=(0,s.ZP)(c.Z,{shouldForwardProp:e=>(0,s.FO)(e)||"classes"===e,name:"MuiDialogContentText",slot:"Root",overridesResolver:(e,t)=>t.root})({}),g=r.forwardRef(function(e,t){let a=(0,d.Z)({props:e,name:"MuiDialogContentText"}),{className:r}=a,l=(0,i.Z)(a,p),s=f(l);return(0,u.jsx)(Z,(0,n.Z)({component:"p",variant:"body1",color:"text.secondary",ref:t,ownerState:l,className:(0,o.Z)(s.root,r)},a,{classes:s}))});var j=g},4472:function(e,t,a){"use strict";a.d(t,{a:function(){return r}});var i=a(1588),n=a(34867);function r(e){return(0,n.Z)("MuiDialogTitle",e)}let o=(0,i.Z)("MuiDialogTitle",["root"]);t.Z=o},51905:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/operai",function(){return a(2672)}])},1479:function(e,t,a){"use strict";var i=a(85893),n=a(87357),r=a(66242),o=a(15861),l=a(44267),s=a(63730),d=a(60155);let c=e=>{let{sx:t,icon:a,stats:c,title:x,subtitle:m,trendDiff:h,iconSize:u=24,avatarSize:p=38,trend:f="positive",avatarColor:Z="primary"}=e;return(0,i.jsx)(r.Z,{sx:{...t},children:(0,i.jsxs)(l.Z,{sx:{gap:3,display:"flex",justifyContent:"space-between"},children:[(0,i.jsxs)(n.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[(0,i.jsx)(o.Z,{sx:{mb:1,color:"text.secondary"},children:x}),(0,i.jsxs)(n.Z,{sx:{mb:1,columnGap:1.5,display:"flex",flexWrap:"wrap",alignItems:"center"},children:[(0,i.jsx)(o.Z,{variant:"h4",children:c}),h&&(0,i.jsx)(o.Z,{sx:{color:"negative"===f?"error.main":"success.main"},children:"(".concat(h,")%")})]}),(0,i.jsx)(o.Z,{variant:"h6",sx:{color:"text.secondary"},children:m})]}),(0,i.jsx)(d.Z,{skin:"light",variant:"rounded",color:Z,sx:{width:p,height:p},children:(0,i.jsx)(s.Z,{icon:a,fontSize:u})})]})})};t.Z=c},2672:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSP:function(){return ea},default:function(){return ei}});var i=a(85893),n=a(67294),r=a(41664),o=a.n(r),l=a(87357),s=a(66242),d=a(38333),c=a(86886),x=a(67720),m=a(18972),h=a(93946),u=a(15861),p=a(78445),f=a(44267),Z=a(90948),g=a(92949),j=a(63730),v=a(9473),y=a(56456),_=a(1479),b=a(44153),C=a(12449),w=a(42176),k=a(19001),D=a(50130),W=a(11057);let S=e=>{let{handleFilter:t,toggle:a,value:n}=e;return(0,i.jsx)(l.Z,{sx:{py:4,px:6,rowGap:2,columnGap:4,display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between"},children:(0,i.jsxs)(l.Z,{sx:{rowGap:2,display:"flex",flexWrap:"wrap",alignItems:"center"},children:[(0,i.jsx)(y.Z,{value:n,sx:{mr:4},placeholder:"Cerca per nome",onChange:e=>t(e.target.value)}),(0,i.jsxs)(W.Z,{onClick:a,variant:"contained",sx:{"& svg":{mr:2}},children:[(0,i.jsx)(j.Z,{fontSize:"1.125rem",icon:"tabler:plus"}),"Aggiungi Nuovo Operaio"]})]})})};var P=a(86501),I=a(6154);async function z(){let e=await I.Z.get("https://www.portale-meatsservicesrl.com/api/operai/stats",{withCredentials:!0}),t=await e.data;return t}var M=a(71862);async function N(e){let t=await I.Z.get("https://www.portale-meatsservicesrl.com/api/operai/tasks",{params:e}),a=await t.data;return a}var F=a(50657),T=a(6514),A=a(82229),O=a(32424);let R=e=>{let{open:t,handleClose:a,cantieri:r,departments:o}=e;return(0,i.jsx)(n.Fragment,{children:(0,i.jsxs)(F.Z,{fullWidth:!0,maxWidth:"xl",open:t,onClose:a,"aria-labelledby":"form-dialog-title",children:[(0,i.jsx)(h.Z,{size:"small","aria-label":"close",onClick:a,sx:{position:"absolute",right:8,top:8,p:"0.438rem",borderRadius:1,color:"text.primary",backgroundColor:"action.selected","&:hover":{backgroundColor:e=>"rgba(".concat(e.palette.customColors.main,", 0.16)")}},children:(0,i.jsx)(j.Z,{icon:"tabler:x",fontSize:"1.125rem"})}),(0,i.jsx)(T.Z,{sx:{mt:6},children:(0,i.jsx)(A.Z,{sx:{"& .react-datepicker-wrapper":{width:"auto"}},children:(0,i.jsx)(O.Z,{reparti:o,cantieri:r})})})]})})};
1var E=a(31425),Y=a(58951),G=a(53457),L=a(50480),B=a(72852),K=a(58160),V=a(44523),$=a(66250);let H=e=>{var t;let{open:a,operaio:r,handleClose:o,upgradeOperai:s,cantieri:d,repartiList:x}=e,[p,f]=(0,n.useState)({...r}),Z=(e,t)=>{f({...p,[e]:t})},g=e=>{let t=[...D];t.splice(e,1),S(t),f({...p,ctr_expiration:t})},v=e=>/^IT\d{2}[A-Z]\d{10}[0-9A-Z]{12}$/.test(e),_=e=>/^[A-Z0-9]{16}$/.test(e),b=()=>{var e;return(null==p?void 0:null===(e=p.iban)||void 0===e?void 0:e.length)>0?v(null==p?void 0:p.iban)?"":"Inserire iban valido":""},C=()=>{var e;return(null==p?void 0:null===(e=p.tax_code)||void 0===e?void 0:e.length)>0?_(null==p?void 0:p.tax_code)?"":"Inserire codice Fiscale valido":""},w=e=>{let t=[{name:"badge_number",to:e.badge_number},{name:"surname",to:e.surname},{name:"name",to:e.name},{name:"date_of_birth",to:e.date_of_birth},{name:"place_of_birth",to:e.place_of_birth},{name:"tax_code",to:e.tax_code},{name:"task",to:e.task},{name:"level",to:e.level},{name:"auto",to:e.auto},{name:"department",to:e.department},{name:"company",to:e.company},{name:"worksite",to:e.worksite},{name:"iban",to:e.iban},{name:"iban_check",to:e.iban_check},{name:"email",to:e.email},{name:"phone",to:e.phone},{name:"formation_expiration_3637",to:e.formation_expiration_3637},{name:"suitability_judgement_expiration",to:e.suitability_judgement_expiration},{name:"antifire_expiration",to:e.antifire_expiration},{name:"haccp_formation",to:e.haccp_formation},{name:"trainingInCharge_expiration",to:e.trainingInCharge_expiration},{name:"firstAid_expiration",to:e.firstAid_expiration},{name:"ctr_expiration",to:e.ctr_expiration},{name:"ctr_end",to:e.ctr_end},{name:"hired_at",to:e.hired_at},{name:"indeterminato",to:e.indeterminato},{name:"mod_retribuzione",to:e.mod_retribuzione},{name:"guadagno_orario",to:e.guadagno_orario},{name:"department",to:e.department},{name:"worksite",to:e.worksite},{name:"trasferta",to:e.trasferta},{name:"spesa_casa",to:e.spesa_casa},{name:"task",to:e.task}];return{id:e._id,fields:t}},k=async()=>{try{let e=w(p),t=await (0,V.K)(e);s(),P.ZP.success(t.message),o()}catch(e){P.ZP.error("Si \xe8 verificato un errore durante la modifica dell'operaio. Riprova.")}},[D,S]=(0,n.useState)((null==r?void 0:r.ctr_expiration)||[new Date]),[I,z]=(0,n.useState)(x),M=()=>{S([...D,new Date])},N=(e,t)=>{let a=[...D];e&&(a[t]=e,S(a),f({...p,ctr_expiration:a}))};(0,n.useEffect)(()=>{if(r){var e;let t="object"==typeof r.worksite?null==r?void 0:null===(e=r.worksite)||void 0===e?void 0:e._id:r.worksite;f({...r,worksite:t})}},[r]);let A=e=>{f({...p,indeterminato:e.target.checked,ctr_end:null})},O=e=>{let t=0;e.target.checked&&(t=null==p?void 0:p.spesa_casa),f({...p,trasferta:e.target.checked,ctr_end:null,spesa_casa:t})},R=e=>{let t=d.find(t=>t._id===e.target.value),a=t||p.worksite;f({...p,worksite:a})},H=e=>{let t=I.find(t=>t._id===e.target.value);t&&(null==t||t.name),f({...p,department:e.target.value})};return(0,n.useEffect)(()=>{if(p.worksite){let e=d.find(e=>e===p.worksite);if(e){let t=x.filter(t=>t.cantiere===e._id);z(t)}}else z(x)},[p.worksite,d,x]),(0,i.jsx)(n.Fragment,{children:(0,i.jsxs)(F.Z,{fullWidth:!0,maxWidth:"md",sx:{"& .MuiDialog-paper":{overflow:"visible"}},open:a,onClose:o,"aria-labelledby":"form-dialog-title",children:[" ",(0,i.jsxs)(T.Z,{children:[(0,i.jsxs)(Y.Z,{variant:"h4",sx:{mb:10},children:["Modifica le informazioni relative all'operaio ",null==r?void 0:r.name," ",null==r?void 0:r.surname," "]}),(0,i.jsx)(u.Z,{sx:{mb:5},variant:"h5",children:"Informazioni Anagrafiche"}),(0,i.jsxs)(c.ZP,{container:!0,spacing:5,children:[(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsx)(y.Z,{fullWidth:!0,label:"Nome ",value:p.name,placeholder:"",onChange:e=>Z("name",e.target.value)})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsx)(y.Z,{fullWidth:!0,label:"Cognome",value:p.surname,placeholder:"",onChange:e=>Z("surname",e.target.value)})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsx)(y.Z,{fullWidth:!0,label:"Codice fiscale",value:null==p?void 0:p.tax_code,error:""!==C(),helperText:C(),placeholder:"",onChange:e=>Z("tax_code",e.target.value)})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsx)(y.Z,{fullWidth:!0,label:"Paese di nascita",value:p.place_of_birth,placeholder:"",onChange:e=>Z("place_of_birth",e.target.value)})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center",width:"100%"},children:(0,i.jsx)($.Z,{locale:K.Z,dateFormat:"dd/MM/yyyy",id:"due-date",selected:p.date_of_birth instanceof Date?p.date_of_birth:new Date,showYearDropdown:!0,customInput:(0,i.jsx)(y.Z,{label:"Data di nascita:",fullWidth:!0}),onChange:e=>Z("date_of_birth",e)})})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsx)(y.Z,{fullWidth:!0,label:"Email",placeholder:"[email protected]",value:p.email,onChange:e=>Z("email",e.target.value)})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsx)(y.Z,{fullWidth:!0,value:p.phone,onChange:e=>
1Z("phone",e.target.value),type:"phone",label:"Telefono",placeholder:""})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsx)(y.Z,{fullWidth:!0,value:p.auto,onChange:e=>Z("auto",e.target.value),type:"string",label:"Veicolo",placeholder:""})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsx)(y.Z,{fullWidth:!0,label:"IBAN",value:p.iban,placeholder:"",autoComplete:"off",error:""!==b(),helperText:b(),onChange:e=>Z("iban",e.target.value.toUpperCase())})})]}),(0,i.jsx)(u.Z,{sx:{mb:5,mt:10},variant:"h5",children:"Contratti e mansioni"}),(0,i.jsxs)(c.ZP,{container:!0,spacing:2,rowSpacing:7,children:[" ",(0,i.jsxs)(c.ZP,{item:!0,xs:12,sm:4,children:[(0,i.jsx)(y.Z,{select:!0,fullWidth:!0,label:"Cantiere",value:"object"==typeof p.worksite?p.worksite._id:p.worksite,onChange:e=>R(e),children:d.map(e=>(0,i.jsx)(m.Z,{value:e._id,children:e.name},e._id))})," "]}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsx)(y.Z,{select:!0,fullWidth:!0,label:"Reparto",value:"object"==typeof p.department?null===(t=p.department)||void 0===t?void 0:t._id:p.department,onChange:e=>H(e),children:void 0!==I&&I.map(e=>(0,i.jsx)(m.Z,{value:e._id?e._id.toString():"defaultValue",children:e.name},e._id?e._id.toString():"defaultKey"))})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsx)(y.Z,{fullWidth:!0,label:"Mansione",value:p.task,onChange:e=>f({...p,task:e.target.value})})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(y.Z,{select:!0,fullWidth:!0,label:"Modalit\xe0 retribuzione",value:p.mod_retribuzione,onChange:e=>f({...p,mod_retribuzione:e.target.value}),children:[(0,i.jsx)(m.Z,{value:"Oraria",children:"Oraria"}),(0,i.jsx)(m.Z,{value:"Giornaliera",children:"Giornaliera"}),(0,i.jsx)(m.Z,{value:"Pezzi",children:"Pezzi"})]})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsx)(y.Z,{fullWidth:!0,value:p.guadagno_orario,onChange:e=>f({...p,guadagno_orario:e.target.value}),type:"number",label:"Guadagno orario/giornaliero",placeholder:""})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"column"},mt:4,children:[p.trasferta&&(0,i.jsx)(y.Z,{fullWidth:!0,value:p.spesa_casa,onChange:e=>f({...p,spesa_casa:e.target.value}),type:"number",label:"Affitto Casa",placeholder:""}),(0,i.jsx)(G.Z,{row:!0,children:(0,i.jsx)(L.Z,{label:"Contartto di affitto attivo",control:(0,i.jsx)(B.Z,{checked:p.trasferta,onChange:O})})})]})}),(0,i.jsx)(c.ZP,{item:!0,xs:6,md:4,lg:4,sm:4,children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)($.Z,{locale:K.Z,dateFormat:"dd/MM/yyyy",id:"haccp-date",showYearDropdown:!0,selected:p.hired_at instanceof Date?p.hired_at:new Date,customInput:(0,i.jsx)(y.Z,{label:"Data Assunzione:",fullWidth:!0}),onChange:e=>Z("hired_at",e)})})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"column"},children:[!(null==p?void 0:p.indeterminato)&&(0,i.jsx)($.Z,{locale:K.Z,dateFormat:"dd/MM/yyyy",id:"end-ctr-date",autoComplete:"off",showYearDropdown:!0,selected:p.ctr_end instanceof Date?p.ctr_end:new Date,customInput:(0,i.jsx)(y.Z,{label:"Fine CTR:",fullWidth:!0}),onChange:e=>Z("ctr_end",e)}),(0,i.jsx)(G.Z,{row:!0,children:(0,i.jsx)(L.Z,{label:"Indeterminato",control:(0,i.jsx)(B.Z,{checked:p.indeterminato,onChange:A})})})]})}),(0,i.jsxs)(c.ZP,{item:!0,xs:12,sm:4,children:[D.map((e,t)=>(0,i.jsxs)(l.Z,{sx:{display:"flex",mb:2},children:[(0,i.jsx)($.Z,{locale:K.Z,dateFormat:"dd/MM/yyyy",id:"ctrexpiration-date-".concat(t),autoComplete:"off",showYearDropdown:!0,selected:e instanceof Date?e:new Date,customInput:(0,i.jsx)(y.Z,{label:"Scadenza CTR ".concat(t+1," prorogra:"),fullWidth:!0}),onChange:e=>N(e,t)}),t>0&&(0,i.jsx)(h.Z,{sx:{pr:0},size:"small",onClick:()=>g(t),children:(0,i.jsx)(j.Z,{icon:"tabler:x",fontSize:"1rem"})})]},t)),(0,i.jsx)(W.Z,{variant:"contained",sx:{my:4,mx:2},onClick:M,children:"+ Proroga"})]})]}),(0,i.jsx)(u.Z,{sx:{mt:10,mb:5},variant:"h5",children:"Scadenze e Date"}),(0,i.jsxs)(c.ZP,{container:!0,spacing:5,children:[" ",(0,i.jsx)(c.ZP,{item:!0,xs:6,md:6,lg:6,sm:6,children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)($.Z,{locale:K.Z,dateFormat:"dd/MM/yyyy",id:"3672-date",showYearDropdown:!0,selected:p.formation_expiration_3637
1instanceof Date?p.formation_expiration_3637:new Date,customInput:(0,i.jsx)(y.Z,{label:"Scadenza formazione 36 37:",fullWidth:!0}),onChange:e=>Z("formation_expiration_3637",e)})})}),(0,i.jsx)(c.ZP,{item:!0,xs:6,md:6,lg:6,sm:6,children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)($.Z,{locale:K.Z,dateFormat:"dd/MM/yyyy",id:"haccp-date",showYearDropdown:!0,selected:p.suitability_judgement_expiration instanceof Date?p.suitability_judgement_expiration:new Date,customInput:(0,i.jsx)(y.Z,{label:"Scadenza giudizio idoniet\xe0:",fullWidth:!0}),onChange:e=>Z("suitability_judgement_expiration",e)})})}),(0,i.jsx)(c.ZP,{item:!0,xs:6,md:6,lg:6,sm:6,children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)($.Z,{locale:K.Z,dateFormat:"dd/MM/yyyy",id:"antifire_expiration-date",showYearDropdown:!0,selected:p.antifire_expiration instanceof Date?p.antifire_expiration:new Date,customInput:(0,i.jsx)(y.Z,{label:"Scadenza anticendio:",fullWidth:!0}),onChange:e=>Z("antifire_expiration",e)})})}),(0,i.jsx)(c.ZP,{item:!0,md:6,lg:6,xs:6,sm:6,children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)($.Z,{locale:K.Z,dateFormat:"dd/MM/yyyy",id:"haccp_formation-date",showYearDropdown:!0,selected:p.haccp_formation instanceof Date?p.haccp_formation:new Date,customInput:(0,i.jsx)(y.Z,{label:"Formazione haccp:",fullWidth:!0}),onChange:e=>Z("haccp_formation",e)})})}),(0,i.jsx)(c.ZP,{item:!0,xs:6,sm:6,children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)($.Z,{locale:K.Z,dateFormat:"dd/MM/yyyy",showYearDropdown:!0,id:"firstAid_expirationfirstAid_expiration-date",selected:p.firstAid_expiration instanceof Date?p.firstAid_expiration:new Date,customInput:(0,i.jsx)(y.Z,{label:"Scadenza primo soccorso:",fullWidth:!0}),onChange:e=>Z("firstAid_expiration",e)})})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)($.Z,{locale:K.Z,dateFormat:"dd/MM/yyyy",autoComplete:"off",id:"trainingInCharge_expiration-date",showYearDropdown:!0,selected:p.trainingInCharge_expiration instanceof Date?p.trainingInCharge_expiration:new Date,customInput:(0,i.jsx)(y.Z,{label:"Scadenza formazione Preposto:",fullWidth:!0}),onChange:e=>Z("trainingInCharge_expiration",e)})})})]})]}),(0,i.jsxs)(E.Z,{className:"dialog-actions-dense",children:[(0,i.jsx)(W.Z,{onClick:o,children:"Annulla"}),(0,i.jsx)(W.Z,{onClick:k,disabled:!(!b()&&!C()),children:"Salva"})]})]})})};var q=a(4299),Q=a(9008),X=a.n(Q);let J=e=>new Date(e).toLocaleDateString("it-IT",{year:"numeric",month:"2-digit",day:"2-digit"}),U=e=>{let{id:t,row:a,toggleModifyOperaioDrawer:r,setOperaioToModify:l}=e,s=(0,v.I0)(),[c,x]=(0,n.useState)(null),u=e=>{x(e.currentTarget)},p=()=>{x(null)},f=async()=>{let e=await s((0,C.lJ)(t));e.payload.deleted?P.ZP.success(e.payload.message):P.ZP.error(e.payload.message),p()},Z=()=>{r(),l(a),p()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(X(),{children:[(0,i.jsx)("title",{children:"Meats Service s.r.l -Operai"})," "]}),(0,i.jsx)(h.Z,{size:"small",onClick:u,children:(0,i.jsx)(j.Z,{icon:"tabler:dots-vertical"})}),(0,i.jsxs)(d.Z,{keepMounted:!0,anchorEl:c,open:!!c,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},PaperProps:{style:{minWidth:"8rem"}},children:[(0,i.jsxs)(m.Z,{component:o(),sx:{"& svg":{mr:2}},href:"/dashboard/operai/".concat(t),onClick:p,children:[(0,i.jsx)(j.Z,{icon:"tabler:eye",fontSize:20}),"Visualizza"]}),(0,i.jsxs)(m.Z,{component:o(),sx:{"& svg":{mr:2}},href:"/dashboard/operai/fogli-di-calcolo?operaio=".concat(t,"}"),onClick:p,children:[(0,i.jsx)(j.Z,{icon:"teenyicons:invoice-outline",fontSize:20}),"Busta paga"]}),(0,i.jsxs)(m.Z,{onClick:Z,sx:{"& svg":{mr:2}},children:[(0,i.jsx)(j.Z,{icon:"tabler:edit",fontSize:20}),"Modifica"]}),(0,i.jsxs)(m.Z,{onClick:f,sx:{"& svg":{mr:2}},children:[(0,i.jsx)(j.Z,{icon:"tabler:trash",fontSize:20}),"Elimina"]})]})]})},ee=(0,Z.ZP)(o())(e=>{let{theme:t}=e;return{textDecoration:"none",fontSize:t.typography.body1.fontSize,color:"".concat(t.palette.primary.main," !important")}}),et=e=>{let{}=e,t=(0,v.I0)(),a=(0,v.v9)(e=>
1e.operaio),[r,o]=(0,n.useState)([]),[d,h]=(0,n.useState)([]),[Z,W]=(0,n.useState)([]),[P,I]=(0,n.useState)([]),[F,T]=(0,n.useState)([]),[A,O]=(0,n.useState)([]),[E,Y]=(0,n.useState)(""),[G,L]=(0,n.useState)(""),[B,K]=(0,n.useState)(!1),[V,$]=(0,n.useState)(!1),[Q,X]=(0,n.useState)({page:0,pageSize:10}),[et,ea]=(0,n.useState)(),[ei,en]=(0,n.useState)(""),[er,eo]=(0,n.useState)(""),[el,es]=(0,n.useState)(""),ed=(0,n.useCallback)(e=>{Y(e)},[]),ec=(0,n.useCallback)(e=>{L(e.target.value)},[]),ex=(0,n.useCallback)(e=>{en(e.target.value)},[]),em=(0,n.useCallback)(e=>{eo(e)},[]),eh=(0,n.useCallback)(e=>{es(e)},[]),eu=()=>K(!B),ep=()=>$(!V),ef=()=>(0,i.jsx)(w.D,{sx:{my:"10px !important"},children:(0,i.jsx)(k.n,{printOptions:{hideFooter:!0,hideToolbar:!0}})});return(0,n.useEffect)(()=>{t((0,C.rQ)({status:G,q:E,worksite:ei,department:er,task:el}))},[t,G,E,ei,er,el]),(0,n.useEffect)(()=>{(async function(){try{let e=await z(),t=await (0,M.u)(),a=await N(),i=await (0,q.B)(),n=await (0,q.B)();n=n.filter(e=>e.name).map(e=>e.name),o(e),h(t),W(a),I(n),O(i)}catch(e){console.error(e)}})()},[]),(0,i.jsxs)(c.ZP,{container:!0,spacing:6.5,children:[(0,i.jsx)(c.ZP,{item:!0,xs:12,children:r&&(0,i.jsx)(c.ZP,{container:!0,spacing:6,children:r.map((e,t)=>(console.log(e,"statisttica"),(0,i.jsx)(c.ZP,{item:!0,xs:12,md:3,sm:6,children:(0,i.jsx)(_.Z,{...e})},t)))})}),(0,i.jsx)(c.ZP,{item:!0,xs:12,children:(0,i.jsxs)(s.Z,{children:[(0,i.jsx)(p.Z,{title:"Filtri di ricerca"}),(0,i.jsx)(f.Z,{children:(0,i.jsxs)(c.ZP,{container:!0,spacing:6,children:[(0,i.jsx)(c.ZP,{item:!0,sm:3,xs:12,children:(0,i.jsxs)(y.Z,{select:!0,fullWidth:!0,label:"Seleziona Cantiere ",defaultValue:"Seleziona Cantiere",SelectProps:{value:ei,displayEmpty:!0,onChange:e=>ex(e)},children:[(0,i.jsx)(m.Z,{value:"",children:"Nessuna selezione"}),d.map(e=>(0,i.jsx)(m.Z,{value:e.name,children:e.name},e._id))]})}),(0,i.jsx)(c.ZP,{item:!0,sm:3,xs:12,children:(0,i.jsxs)(y.Z,{select:!0,fullWidth:!0,label:"Cerca per stato contratto",defaultValue:"Seleziona Stato",SelectProps:{value:G,displayEmpty:!0,onChange:e=>ec(e)},children:[(0,i.jsx)(m.Z,{value:"",children:"Seleziona stato"}),(0,i.jsx)(m.Z,{value:"active",children:"Attivo"}),(0,i.jsx)(m.Z,{value:"expired",children:"Scaduto"})]})}),(0,i.jsx)(c.ZP,{item:!0,sm:3,xs:12,children:(0,i.jsx)(g.Z,{freeSolo:!0,value:el,selectOnFocus:!0,handleHomeEndKeys:!0,sx:{minWidth:300,pr:3},fullWidth:!0,options:Z,renderOption:(e,t)=>(0,i.jsx)("li",{...e,children:t}),renderInput:e=>(0,i.jsx)(y.Z,{...e,label:"Cerca per mansione",value:""}),getOptionLabel:e=>e,onChange:(e,t)=>
1{t?eh(t):eh("")}})}),(0,i.jsx)(c.ZP,{item:!0,sm:3,xs:12,children:(0,i.jsx)(g.Z,{freeSolo:!0,value:er,selectOnFocus:!0,handleHomeEndKeys:!0,sx:{minWidth:300,pr:3},fullWidth:!0,options:P,renderOption:(e,t)=>(0,i.jsx)("li",{...e,children:t}),renderInput:e=>(0,i.jsx)(y.Z,{...e,label:"Cerca per reparto",value:""}),getOptionLabel:e=>e,onChange:(e,t)=>{t?em(t):em("")}})})]})}),(0,i.jsx)(x.Z,{sx:{m:"0 !important"}}),(0,i.jsx)(S,{value:E,handleFilter:ed,toggle:eu}),(0,i.jsx)(D._,{autoHeight:!0,rowHeight:62,rows:a.data,columns:[{flex:.01,minWidth:100,field:"badge_number",headerName:"Matricola",renderCell:e=>{let{row:t}=e,{badge_number:a}=t;return(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"flex-start",flexDirection:"column"},children:(0,i.jsx)(u.Z,{noWrap:!0,component:ee,href:"/dashboard/operai/".concat(t._id),sx:{fontWeight:500,textDecoration:"none",color:"text.secondary","&:hover":{color:"primary.main"}},children:"#".concat(a)})})})}},{flex:.01,minWidth:220,field:"nomeCompleto",headerName:"Nome completo",renderCell:e=>{let{row:t}=e,{surname:a,name:n,email:r,phone:o}=t;return(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsxs)(l.Z,{sx:{display:"flex",alignItems:"flex-start",flexDirection:"column"},children:[(0,i.jsxs)(u.Z,{noWrap:!0,component:ee,href:"/dashboard/operai/".concat(t._id),sx:{fontWeight:500,textDecoration:"none",color:"text.secondary","&:hover":{color:"primary.main"}},children:[n," ",a]}),(0,i.jsx)(u.Z,{noWrap:!0,variant:"body2",sx:{color:"text.disabled"},children:r}),(0,i.jsx)(u.Z,{noWrap:!0,variant:"body2",sx:{color:"text.disabled"},children:o})]})})}},{flex:.01,minWidth:250,field:"tax_code",headerName:"Cod.Fiscale",renderCell:e=>{let{row:t}=e,{tax_code:a}=t;return(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"flex-start",flexDirection:"column"},children:(0,i.jsx)(u.Z,{noWrap:!0,children:a})})})}},{flex:.01,minWidth:200,field:"place_of_birth",headerName:"Luogo Nascita",renderCell:e=>{let{row:t}=e,{place_of_birth:a}=t;return(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"flex-start",flexDirection:"column"},children:(0,i.jsx)(u.Z,{noWrap:!0,children:a})})})}},{flex:.01,minWidth:200,field:"date_of_birth",headerName:"Data Nascita",renderCell:e=>{let{row:t}=e,{date_of_birth:a}=t;return(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"flex-start",flexDirection:"column"},children:(0,i.jsx)(u.Z,{sx:{color:"text.secondary"},children:J(a)})})})}},{minWidth:190,field:"task",flex:.01,headerName:"Mansione",renderCell:e=>{let{row:t}=e;return(0,i.jsx)(u.Z,{noWrap:!0,sx:{color:"text.secondary"},children:t.task})}},{minWidth:190,flex:.01,field:"worksiteName",headerName:"Cantiere",renderCell:e=>{let{row:t}=e;return(0,i.jsx)(u.Z,{noWrap:!0,component:ee,target:"_blank",sx:{fontWeight:500,textDecoration:"none",color:"text.secondary","&:hover":{color:"primary.main"}},href:t.worksite?"/dashboard/clienti/".concat(t.worksite._id):"#",children:t.worksite?t.worksite.name:""})}},{flex:.01,minWidth:200,field:"hired_at",headerName:"Data assunzione",renderCell:e=>{let{row:t}=e,{hired_at:a}=t;return(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,i.jsx)(l.Z,{sx:{display:"flex",alignItems:"flex-start",flexDirection:"column"},children:(0,i.jsx)(u.Z,{sx:{color:"text.secondary"},children:J(a)})})})}},{flex:.01,minWidth:220,field:"departmentName",headerName:"Reparto",renderCell:e=>{let{row:t}=e;return(0,i.jsx)(u.Z,{component:ee,target:"_blank",href:"/dashboard/clienti/reparti",noWrap:!0,sx:{color:"text.secondary"},children:t.department?t.department.name:""})}},{minWidth:50,field:"level",headerName:"Liv.",renderCell:e=>{let{row:t}=e;return(0,i.jsx)(u.Z,{children:t.level})}},{minWidth:300,flex:.01,field:"iban",headerName:"IBAN",disableExport:!0,renderCell:e=>{let{row:t}=e;return(0,i.jsx)(u.Z,{noWrap:!0,children:t.iban})}},{flex:.01,minWidth:100,field:"operaiDaConsuntivare",disableExport:!0,headerName:"Consuntivo",renderCell:e=>{let{row:t}=e;return(0,i.jsx)(i.Fragment,{children:!1===t.operaiDaConsuntivare?(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(u.Z,{noWrap:!0,component:ee,href:"/dashboard/operai/".concat(t._id,"?tab=timesheet"),sx:{color:"text.secondary"},children:(0,i.jsx)(j.Z,{style:{marginRight:4},icon:"flat-color-icons:medium-priority"})})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(u.Z,{noWrap:!0,sx:{color:"text.secondary"},children:(0,i.jsx)(j.Z,{style:{marginRight:4},icon:"flat-color-icons:ok"})})})})}},{flex:.01,minWidth:100,field:"operaiToDoPaycheck",disableExport:!0,headerName:"Foglio Paga",renderCell:e=>{let{row:t}=e;return(0,i.jsx)(i.Fragment,{children:!1===t.operaiToDoPaycheck?(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(u.Z,{noWrap:!0,component:ee,href:"/dashboard/operai/".concat(t._id,"?tab=paga"),sx:{color:"text.secondary"},children:(0,i.jsx)(j.Z,{style:{marginRight:4},icon:"flat-color-icons:medium-priority"})})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(u.Z,{noWrap:!0,sx:{color:"text.secondary"},children:(0,i.jsx)(j.Z,{style:{marginRight:4},icon:"flat-color-icons:ok"})})})})}},{flex:.1,minWidth:100,sortable:!1,field:"actions",disableExport:!0,headerName:"",renderCell:e=>{let{row:t}=e;return(0,i.jsx)(U,{id:t._id,row:t,toggleModifyOperaioDrawer:ep,setOperaioToModify:ea})}}],disableRowSelectionOnClick:!0,pageSizeOptions:[10,25,50],paginationModel:Q,localeText:b.K.components.MuiDataGrid.defaultProps.localeText,onPaginationModelChange:X,slots:{toolbar:ef},getRowId:e=>e._id})]})}),(0,i.jsx)(H,{repartiList:F,open:V,cantieri:d,operaio:et,upgradeOperai:()=>{t((0,C.rQ)({status:G,q:E,worksite:ei,department:er,task:el}))},handleClose:()=>$(!1)}),(0,i.jsx)(R,{open:B,cantieri:d,handleClose:()=>K(!1),departments:A})]})};et.acl={action:"read",subject:"operai"};var ea=!0,ei=et},44523:function(e,t,a){"use strict";a.d(t,{K:function(){return n}});var i=a(6154);async function n(e){let t=await i.Z.post("https://www.portale-meatsservicesrl.com/api/operai/modify",e,{withCredentials:!0}),a=await t.data;return a}}},function(e){e.O(0,[3863,9230,130,9198,6457,9172,3062,2229,8342,4531,9774,2888,179],function(){return e(e.s=51905)}),_N_E=e.O()}]);
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.