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