"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[33258],{24659:(e,t,a)=>{a.d(t,{A:()=>u});a(65043);var s=a(67784),n=a(4701),l=a(17392),i=a(10155),o=a(70579);const r=(0,n.A)({}),d=e=>{let{onClick:t}=e;return(0,o.jsx)(l.A,{onClick:t,children:(0,o.jsx)(i.A,{})})},u=e=>{const t=r();return(0,o.jsx)(s.A,{InputProps:{...t,endAdornment:(0,o.jsxs)(o.Fragment,{children:[" ",e.iscross&&(0,o.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},33258:(e,t,a)=>{a.r(t),a.d(t,{default:()=>b});var s=a(65043),n=a(11906),l=a(68903),i=a(38624),o=a(96446),r=a(24659),d=a(63516),u=a(14556),c=a(73033),m=a(73216),v=a(66675),h=(a(10159),a(96801)),g=a(80884),p=a(74919),y=a.n(p),x=a(70579);const A=(0,h.Gq)("enuseloc"),j=A&&Object.keys(A).length>0?A.user_id:null;console.log("LoginuserId",j);const N={categoryName:"",status:null},f=c.Ik().shape({categoryName:c.Yj().nullable().required("Enter Category Name"),status:c.Ik().nullable().required("Select Status")});const b=function(e){const t=(0,m.zy)(),a=(null===t||void 0===t?void 0:t.state)._original;console.log("optionData",a);const[c,h]=(0,s.useState)(!1),p=[{id:"Active",name:"Active"},{id:"InActive",name:"In Active"}],A=((0,u.d4)((e=>{var t;return null===(t=e.hr.getAppraisalQuestion)||void 0===t?void 0:t.data})),s.useRef(null)),[j,b]=(0,s.useState)(N),S=(0,u.wA)(),k=(0,m.Zp)(),C=()=>{k(-1)},[I,z]=(0,s.useState)(""),[V,D]=(0,s.useState)((()=>y().createEmptyValue()));(0,s.useEffect)((()=>{S((0,g.xWs)({processID:"",authorityID:"",status:"",departmentID:"",designationID:"",sortOrder:"",generalSearch:"",iDisplayStart:0,iDisplayLength:-1}))}),[]),(0,s.useEffect)((()=>{a&&(b({categoryName: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}}),z(null===a||void 0===a?void 0:a.description),D(y().createValueFromString(null===a||void 0===a?void 0:a.description,"html")))}),[a]);const E=()=>{const{categoryName:e,status:t,...a}=N;b({...j,...a})};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"common-header-label-bold",children:[(0,x.jsx)(n.A,{onClick:C,children:(0,x.jsx)(v.A,{})}),"Update Todo Category"]}),(0,x.jsx)("div",{className:"component-list",children:(0,x.jsx)(d.l1,{enableReinitialize:!0,innerRef:A,validationSchema:f,initialValues:j,onSubmit:async(e,t)=>{var s,n;const l={categoryID:null===a||void 0===a?void 0:a.id,categoryName:null===e||void 0===e?void 0:e.categoryName,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 S((0,g.p3u)(l)),E(),C()},children:e=>{let{errors:t,handleSubmit:a,handleChange:s,handleBlur:u,setFieldValue:c,isSubmitting:m,isValid:v,touched:h,values:g}=e;return(0,x.jsx)(d.lV,{onSubmit:a,children:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Ay,{container:!0,className:"component-form",children:(0,x.jsxs)(l.Ay,{container:!0,children:[(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(r.A,{name:"categoryName",fullWidth:!0,id:"categoryName",placeholder:"Rate Name",type:"text",onBlur:u,value:j.categoryName,onChange:(e,t)=>{c("categoryName",t),b({...j,categoryName:e.target.value})},error:h.categoryName&&Boolean(t.categoryName),helperText:h.categoryName&&t.categoryName,size:"small",label:"Category Name",variant:"outlined"})}),(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(i.A,{name:"status",value:g.status,fullWidth:!0,options:p||[],onBlur:u,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,t)=>{c("status",t),b({...j,status:t})},renderInput:e=>(0,x.jsx)(r.A,{...e,fullWidth:!0,label:"Status *",name:"status",variant:"outlined",helperText:t.status&&t.status,error:t.status&&Boolean(t.status)})})})]})}),(0,x.jsx)(l.Ay,{className:"d-flex justify-content-center",p:2,children:(0,x.jsx)(o.A,{children:(0,x.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=33258.b96bc6de.chunk.js.map