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