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