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