"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[44005],{69875:(e,t,a)=>{a.d(t,{A:()=>n});a(65043);const n=a.p+"static/media/Upload.4216d61323e67ba8fcaf839d79ad9d80.svg"},24659:(e,t,a)=>{a.d(t,{A:()=>m});a(65043);var n=a(67784),s=a(4701),l=a(17392),i=a(10155),r=a(70579);const d=(0,s.A)({}),o=e=>{let{onClick:t}=e;return(0,r.jsx)(l.A,{onClick:t,children:(0,r.jsx)(i.A,{})})},m=e=>{const t=d();return(0,r.jsx)(n.A,{InputProps:{...t,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(o,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},44005:(e,t,a)=>{a.r(t),a.d(t,{default:()=>I});var n=a(65043),s=a(11906),l=a(68903),i=a(38624),r=a(96446),d=a(24659),o=(a(69875),a(63516)),m=a(14556),u=a(73033),c=a(73216),p=a(66675),v=a(80884),h=a(96801),x=(a(17115),a(70579));const j=(0,h.Gq)("enuseloc"),A=j&&Object.keys(j).length>0?j.user_id:null;console.log("LoginuserId",A);const g={departmentName:"",statusID:""},D=u.Ik().shape({departmentName:u.Yj("Enter Department Name").required("Department Name is required"),statusID:u.Ik().nullable().required("Select Status")});const I=function(e){const t=(0,c.zy)(),a=(null===t||void 0===t?void 0:t.state)._original;console.log("milestoneTypeData",a);const[u,h]=(0,n.useState)(!1),j=[{id:"1",name:"Active"},{id:"0",name:"In Active"}],A=n.useRef(null),[I,N]=(0,n.useState)(g),b=(0,m.wA)(),f=(0,c.Zp)();(0,n.useEffect)((()=>{a&&N({...I,departmentName:null===a||void 0===a?void 0:a.general_task_department_name,statusID:{id:null===a||void 0===a?void 0:a.general_task_department_active,name:1==(null===a||void 0===a?void 0:a.general_task_department_active)?"Active":"InActive"}})}),[a]),console.log("milestoneTypeData",a);const k=()=>{const{departmentName:e,...t}=g;N({...I,...t})};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"common-header-label-bold",children:[(0,x.jsx)(s.A,{onClick:()=>{f(-1)},children:(0,x.jsx)(p.A,{})}),"Update Department"]}),(0,x.jsx)("div",{className:"component-list",children:(0,x.jsx)(o.l1,{enableReinitialize:!0,innerRef:A,validationSchema:D,initialValues:I,onSubmit:async(e,t)=>{var n,s;const l={departmentID:null===a||void 0===a?void 0:a.general_task_department_id,departmentName:null!==e&&void 0!==e&&e.departmentName?null===e||void 0===e?void 0:e.departmentName:"",status:null!==(n=e.statusID)&&void 0!==n&&n.id?null===(s=e.statusID)||void 0===s?void 0:s.id:""};console.log("finalPayload",l),t.setSubmitting(!0),await b((0,v.LZX)(l)),k(),f("/HR/Department")},children:e=>{let{errors:t,handleSubmit:a,handleChange:n,handleBlur:m,setFieldValue:u,isSubmitting:c,isValid:p,touched:v,values:h}=e;return(0,x.jsx)(o.lV,{onSubmit:a,children:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Ay,{container:!0,className:"component-form",children:(0,x.jsxs)(l.Ay,{container:!0,children:[(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(d.A,{fullWidth:!0,label:"Department Name*",name:"departmentName",onBlur:m,value:h.departmentName,onChange:(e,t)=>{u("departmentName",t),N({...I,departmentName:e.target.value})},variant:"outlined",size:"small",helperText:v.departmentName&&t.departmentName,error:v.departmentName&&Boolean(t.departmentName)})}),(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(i.A,{name:"statusID",value:h.statusID,fullWidth:!0,options:j||[],onBlur:m,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,t)=>{u("statusID",t),N({...I,statusID:t})},renderInput:e=>(0,x.jsx)(d.A,{...e,fullWidth:!0,label:"Status *",name:"statusID",variant:"outlined",helperText:t.statusID&&t.statusID,error:t.statusID&&Boolean(t.statusID)})})})]})}),(0,x.jsx)(l.Ay,{className:"d-flex justify-content-center",p:2,children:(0,x.jsx)(r.A,{children:(0,x.jsx)(s.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:c,children:"SAVE"})})})]})})}})})]})}}}]);
//# sourceMappingURL=44005.0bba1d78.chunk.js.map