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