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