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