"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:()=>u});t(65043);var s=t(67784),n=t(4701),a=t(17392),i=t(10155),r=t(70579);const d=(0,n.A)({}),o=e=>{let{onClick:l}=e;return(0,r.jsx)(a.A,{onClick:l,children:(0,r.jsx)(i.A,{})})},u=e=>{const l=d();return(0,r.jsx)(s.A,{InputProps:{...l,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.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),i=t(38624),r=t(96446),d=t(24659),o=(t(69875),t(63516)),u=t(14556),v=t(73033),c=t(73216),m=t(66675),h=t(80884),x=t(96801),p=(t(17115),t(70579));const j=(0,x.Gq)("enuseloc"),A=j&&Object.keys(j).length>0?j.user_id:null;console.log("LoginuserId",A);const g={levelName:"",levelOrder:"",statusID:""},b=v.Ik().shape({levelName:v.Yj("Enter Level Name").required("Level Name is required"),levelOrder:v.ai("Enter Level Order").required("Level Order is required").positive("Level Order Must be Positive Number"),statusID:v.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[v,x]=(0,s.useState)(!1),j=[{id:"Active",name:"Active"},{id:"InActive",name:"In Active"}],A=s.useRef(null),[I,N]=(0,s.useState)(g),O=(0,u.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:A,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:u,setFieldValue:v,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:u,value:null===x||void 0===x?void 0:x.levelName,onChange:(e,l)=>{v("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:u,value:null===x||void 0===x?void 0:x.levelOrder,onChange:(e,l)=>{v("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)(i.A,{name:"statusID",value:x.statusID,fullWidth:!0,options:j||[],onBlur:u,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,l)=>{v("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)(r.A,{children:(0,p.jsx)(n.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:c,children:"SAVE"})})})]})})}})})]})}}}]);
//# sourceMappingURL=6281.160a9e56.chunk.js.map