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