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