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