"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[45035],{24659:(e,l,n)=>{n.d(l,{A:()=>u});n(65043);var r=n(67784),i=n(4701),s=n(17392),t=n(10155),a=n(70579);const d=(0,i.A)({}),o=e=>{let{onClick:l}=e;return(0,a.jsx)(s.A,{onClick:l,children:(0,a.jsx)(t.A,{})})},u=e=>{const l=d();return(0,a.jsx)(r.A,{InputProps:{...l,endAdornment:(0,a.jsxs)(a.Fragment,{children:[" ",e.iscross&&(0,a.jsx)(o,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},45035:(e,l,n)=>{n.r(l),n.d(l,{default:()=>y});var r=n(65043),i=n(68903),s=n(11906),t=n(96446),a=n(63516),d=n(24659),o=n(73216),u=n(66675),c=n(11852),v=n(73033),m=n(80884),h=n(14556),x=n(96801),j=n(70579);const p={levelName:"",levelOrder:""},A=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")}),N=[],f=(0,x.Gq)("enuseloc"),b=f&&Object.keys(f).length>0?f.user_id:null;const y=function(e){const l=r.useRef(null),[n,v]=(0,r.useState)(p),x=(0,o.Zp)(),f=(0,h.wA)(),[y,O]=(0,r.useState)([]),g=(0,h.d4)((e=>{var l;return null===(l=e.bd.getFunctionalityPermissionDetail)||void 0===l?void 0:l.data})),k=r.useRef("No"),C=r.useRef("No");return(0,r.useEffect)((()=>{const e={userID:b,functionalityID:179,functionalityItemIDs:N};return f((0,c.P8M)(e)),()=>{f((0,c.qo7)())}}),[]),(0,r.useEffect)((()=>(g&&179===(null===g||void 0===g?void 0:g.functionalityID)&&(O(g),k.current=null===g||void 0===g?void 0:g.permission_report,C.current=null===g||void 0===g?void 0:g.permission_admin),()=>{O([]),k.current="NO",C.current="NO"})),[g]),(0,j.jsxs)("div",{className:"component-list",children:[(0,j.jsx)(i.Ay,{container:!0,className:"d-flex justify-content-between align-items-center",py:1,children:(0,j.jsxs)(i.Ay,{item:!0,className:"common-header-label",children:[(0,j.jsx)(s.A,{onClick:()=>{x(-1)},children:(0,j.jsx)(u.A,{})}),"Add Level"]})}),y&&Object.keys(y).length>0&&179===(null===y||void 0===y?void 0:y.functionalityID)&&"YES"===(null===y||void 0===y?void 0:y.permission_admin)?(0,j.jsx)(a.l1,{enableReinitialize:!0,innerRef:l,initialValues:n,validationSchema:A,onSubmit:async(e,l)=>{const n={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:""};l.setSubmitting(!0),await f((0,m.S4d)(n)),l.resetForm({}),x("/HR/Level")},children:e=>{let{errors:l,handleSubmit:n,handleChange:r,setFieldValue:o,handleBlur:u,isSubmitting:c,isValid:m,touched:h,values:x}=e;return(0,j.jsx)(a.lV,{onSubmit:n,children:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.Ay,{container:!0,className:"component-form",children:(0,j.jsxs)(i.Ay,{container:!0,children:[(0,j.jsx)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,j.jsx)(d.A,{id:"levelName",name:"levelName",fullWidth:!0,onBlur:u,onChange:r,value:x.levelName,error:l.levelName&&Boolean(l.levelName),helperText:l.levelName&&l.levelName,size:"small",label:"Level*",variant:"outlined"})}),(0,j.jsx)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,j.jsx)(d.A,{id:"levelOrder",name:"levelOrder",fullWidth:!0,onBlur:u,onChange:r,value:x.levelOrder,error:l.levelOrder&&Boolean(l.levelOrder),helperText:l.levelOrder&&l.levelOrder,type:"number",size:"small",label:"Level Order*",variant:"outlined"})})]})}),(0,j.jsxs)(i.Ay,{className:"d-flex justify-content-start",p:2,children:[(0,j.jsxs)(t.A,{mx:2,children:[" ",(0,j.jsx)(s.A,{text:"CANCEL",variant:"contained",color:"secondary",size:"medium",type:"reset",onClick:()=>{v({...p})},children:"RESET"})]}),(0,j.jsx)(t.A,{children:(0,j.jsx)(s.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:c,children:"SAVE"})})]})]})})}}):(0,j.jsx)("div",{className:"common-header-label-bold",children:"You don't have permission to access this page!"})]})}},10155:(e,l,n)=>{var r=n(24994);l.A=void 0;var i=r(n(40039)),s=n(70579);l.A=(0,i.default)((0,s.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")},66675:(e,l,n)=>{var r=n(24994);l.A=void 0;var i=r(n(40039)),s=n(70579);l.A=(0,i.default)((0,s.jsx)("path",{d:"M3 18h13v-2H3zm0-5h10v-2H3zm0-7v2h13V6zm18 9.59L17.42 12 21 8.41 19.59 7l-5 5 5 5z"}),"MenuOpen")}}]);
//# sourceMappingURL=45035.11b764c8.chunk.js.map