"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[83043],{24659:(e,t,a)=>{a.d(t,{A:()=>u});a(65043);var s=a(67784),l=a(4701),n=a(17392),r=a(10155),i=a(70579);const o=(0,l.A)({}),d=e=>{let{onClick:t}=e;return(0,i.jsx)(n.A,{onClick:t,children:(0,i.jsx)(r.A,{})})},u=e=>{const t=o();return(0,i.jsx)(s.A,{InputProps:{...t,endAdornment:(0,i.jsxs)(i.Fragment,{children:[" ",e.iscross&&(0,i.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},83043:(e,t,a)=>{a.r(t),a.d(t,{default:()=>j});var s=a(65043),l=a(11906),n=a(68903),r=a(38624),i=a(96446),o=a(24659),d=a(63516),u=a(14556),c=a(73033),m=a(73216),v=a(66675),g=a(6994),h=a(96801),p=a(70579);const x=(0,h.Gq)("enuseloc"),y=(x&&Object.keys(x).length>0&&x.user_id,{categoryName:"",groupID:null,status:""}),A=c.Ik().shape({categoryName:c.Yj().nullable().required("Enter Category Name"),status:c.Ik().nullable().required("Select Status")});const j=function(e){const t=(0,m.zy)(),a=(null===t||void 0===t?void 0:t.state)._original,[c,h]=(0,s.useState)(!1),x=[{id:"1",name:"Active"},{id:"0",name:"In Active"}],j=((0,u.d4)((e=>{var t;return null===(t=e.civil.getCivilWorkOrderProcess)||void 0===t?void 0:t.data})),(0,u.d4)((e=>{var t;return null===(t=e.crm.getCrmSourceGroup)||void 0===t?void 0:t.data})),(0,u.d4)((e=>{var t;return null===(t=e.civil.getCivilWorkOrderCategory)||void 0===t?void 0:t.data})),s.useRef(null)),[N,f]=(0,s.useState)(y),b=(0,u.wA)(),C=(0,m.Zp)(),S=()=>{C(-1)};(0,s.useEffect)((()=>{a&&f({...N,categoryName:null===a||void 0===a?void 0:a.category_name,status:{id:null===a||void 0===a?void 0:a.is_active,name:1==(null===a||void 0===a?void 0:a.is_active)?"Active":"InActive"},groupID:{id:a.group_id,group_name:a.group_name}})}),[a]),console.log("taskData",a),(0,s.useEffect)((()=>{b((0,g.sK)({status:"1",sortOrder:"",generalSearch:"",iDisplayStart:1,iDisplayLength:-1}))}),[]);const k=()=>{const{categoryName:e,groupID:t,status:a,...s}=y;f({...N,...s})};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"common-header-label-bold",children:[(0,p.jsx)(l.A,{onClick:S,children:(0,p.jsx)(v.A,{})}),"Update Source Category"]}),(0,p.jsx)("div",{className:"component-list",children:(0,p.jsx)(d.l1,{enableReinitialize:!0,innerRef:j,validationSchema:A,initialValues:N,onSubmit:async(e,t)=>{var s,l;const n={categoryID:null===a||void 0===a?void 0:a.id,categoryName:e.categoryName,isActive:null!==(s=e.status)&&void 0!==s&&s.id?null===(l=e.status)||void 0===l?void 0:l.id:""};console.log("finalPayload",n),t.setSubmitting(!0),await b((0,g.KI)(n)),k(),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,p.jsx)(d.lV,{onSubmit:a,children:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.Ay,{container:!0,className:"component-form",children:(0,p.jsxs)(n.Ay,{container:!0,children:[(0,p.jsx)(n.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,p.jsx)(o.A,{fullWidth:!0,label:"Category Name*",name:"categoryName",onBlur:u,value:h.categoryName,onChange:(e,t)=>{c("categoryName",t),f({...N,categoryName:e.target.value})},variant:"outlined",size:"small",helperText:g.categoryName&&t.categoryName,error:g.categoryName&&Boolean(t.categoryName)})}),(0,p.jsx)(n.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,p.jsx)(r.A,{name:"status",value:h.status,fullWidth:!0,options:x||[],onBlur:u,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,t)=>{c("status",t),f({...N,status:t})},renderInput:e=>(0,p.jsx)(o.A,{...e,fullWidth:!0,label:"Status *",name:"status",variant:"outlined",helperText:t.status&&t.status,error:t.status&&Boolean(t.status)})})})]})}),(0,p.jsx)(n.Ay,{className:"d-flex justify-content-center",p:2,children:(0,p.jsx)(i.A,{children:(0,p.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=83043.b1d0312b.chunk.js.map