"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[58809],{24659:(e,t,a)=>{a.d(t,{A:()=>d});a(65043);var s=a(67784),n=a(4701),l=a(17392),i=a(10155),r=a(70579);const o=(0,n.A)({}),u=e=>{let{onClick:t}=e;return(0,r.jsx)(l.A,{onClick:t,children:(0,r.jsx)(i.A,{})})},d=e=>{const t=o();return(0,r.jsx)(s.A,{InputProps:{...t,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(u,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},58809:(e,t,a)=>{a.r(t),a.d(t,{default:()=>N});var s=a(65043),n=a(11906),l=a(68903),i=a(38624),r=a(96446),o=a(24659),u=a(63516),d=a(14556),c=a(73033),m=a(73216),h=a(66675),v=a(10159),p=a(96801),g=a(70579);const x=(0,p.Gq)("enuseloc"),A=(x&&Object.keys(x).length>0&&x.user_id,{groupName:"",status:""}),j=c.Ik().shape({groupName:c.Yj().nullable().required("Enter Category Name"),status:c.Ik().nullable().required("Select Status")});const N=function(e){const t=(0,m.zy)(),a=(null===t||void 0===t?void 0:t.state)._original,[c,p]=(0,s.useState)(!1),x=[{id:"Active",name:"Active"},{id:"InActive",name:"In Active"}],N=s.useRef(null),[b,f]=(0,s.useState)(A),y=(0,d.wA)(),k=(0,m.Zp)(),C=()=>{k(-1)};(0,s.useEffect)((()=>{a&&f({...b,groupName:null===a||void 0===a?void 0:a.category_name,status:{id:null===a||void 0===a?void 0:a.status,name:null===a||void 0===a?void 0:a.status}})}),[a]);const S=()=>{const{groupName:e,status:t,...a}=A;f({...b,...a})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"common-header-label-bold",children:[(0,g.jsx)(n.A,{onClick:C,children:(0,g.jsx)(h.A,{})}),"Update Category Item"]}),(0,g.jsx)("div",{className:"component-list",children:(0,g.jsx)(u.l1,{enableReinitialize:!0,innerRef:N,validationSchema:j,initialValues:b,onSubmit:async(e,t)=>{var s,n;const l={categoryID:null===a||void 0===a?void 0:a.id,categoryName:e.groupName,status:null!==(s=e.status)&&void 0!==s&&s.id?null===(n=e.status)||void 0===n?void 0:n.id:""};console.log("finalPayload",l),t.setSubmitting(!0),await y((0,v.Kzt)(l)),S(),C()},children:e=>{let{errors:t,handleSubmit:a,handleChange:s,handleBlur:d,setFieldValue:c,isSubmitting:m,isValid:h,touched:v,values:p}=e;return(0,g.jsx)(u.lV,{onSubmit:a,children:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(l.Ay,{container:!0,className:"component-form",children:(0,g.jsxs)(l.Ay,{container:!0,children:[(0,g.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,g.jsx)(o.A,{fullWidth:!0,label:"Category Name *",name:"groupName",onBlur:d,value:p.groupName,onChange:(e,t)=>{c("groupName",t),f({...b,groupName:e.target.value})},variant:"outlined",size:"small",helperText:v.groupName&&t.groupName,error:v.groupName&&Boolean(t.groupName)})}),(0,g.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,g.jsx)(i.A,{name:"status",value:p.status,fullWidth:!0,options:x||[],onBlur:d,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,t)=>{c("status",t),f({...b,status:t})},renderInput:e=>(0,g.jsx)(o.A,{...e,fullWidth:!0,label:"Status*",name:"status",variant:"outlined",helperText:t.status&&t.status,error:t.status&&Boolean(t.status)})})})]})}),(0,g.jsx)(l.Ay,{className:"d-flex justify-content-center",p:2,children:(0,g.jsx)(r.A,{children:(0,g.jsx)(n.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:m,children:"SAVE"})})})]})})}})})]})}},10155:(e,t,a)=>{var s=a(24994);t.A=void 0;var n=s(a(40039)),l=a(70579);t.A=(0,n.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,t,a)=>{var s=a(24994);t.A=void 0;var n=s(a(40039)),l=a(70579);t.A=(0,n.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=58809.1caadd79.chunk.js.map