"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[43177],{69875:(e,a,n)=>{n.d(a,{A:()=>s});n(65043);const s=n.p+"static/media/Upload.4216d61323e67ba8fcaf839d79ad9d80.svg"},24659:(e,a,n)=>{n.d(a,{A:()=>u});n(65043);var s=n(67784),o=n(4701),t=n(17392),l=n(10155),i=n(70579);const r=(0,o.A)({}),d=e=>{let{onClick:a}=e;return(0,i.jsx)(t.A,{onClick:a,children:(0,i.jsx)(l.A,{})})},u=e=>{const a=r();return(0,i.jsx)(s.A,{InputProps:{...a,endAdornment:(0,i.jsxs)(i.Fragment,{children:[" ",e.iscross&&(0,i.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},43177:(e,a,n)=>{n.r(a),n.d(a,{default:()=>C});var s=n(65043),o=n(11906),t=n(68903),l=n(38624),i=n(96446),r=n(24659),d=(n(69875),n(63516)),u=n(14556),c=n(73033),m=n(73216),v=n(66675),g=n(11852),h=n(96801),x=(n(17115),n(70579));const j=(0,h.Gq)("enuseloc"),A=j&&Object.keys(j).length>0?j.user_id:null;console.log("LoginuserId",A);const p={reasonCategory:"",reasonName:"",statusID:""},y=c.Ik().shape({reasonCategory:c.Ik().nullable().required("Select Reason Category"),reasonName:c.Yj("Enter Reason Name ").required("Reason Name is required"),statusID:c.Ik().nullable().required("Select Status")});const C=function(e){const a=(0,m.zy)(),n=(null===a||void 0===a?void 0:a.state)._original;console.log("rejectionReasonTypeData",n);const[c,h]=(0,s.useState)(!1),j=[{id:"ProjectTask",name:"ProjectTask"},{id:"LiaisonDocumentationTask",name:"LiaisonDocumentationTask"},{id:"ApfTask",name:"ApfTask"},{id:"LiaisonTask",name:"LiaisonTask"},{id:"LiaisonProcess",name:"LiaisonProcess"},{id:"WorkOrder",name:"WorkOrder"},{id:"All",name:"All"}],A=[{id:"Active",name:"Active"},{id:"InActive",name:"In Active"}],C=s.useRef(null),[k,I]=(0,s.useState)(p),f=(0,u.wA)(),b=(0,m.Zp)(),N=()=>{b(-1)};(0,s.useEffect)((()=>{n&&I({...k,reasonCategory:{id:null===n||void 0===n?void 0:n.category,name:null===n||void 0===n?void 0:n.category},reasonName:null===n||void 0===n?void 0:n.reason_name,statusID:{id:null===n||void 0===n?void 0:n.status,name:null===n||void 0===n?void 0:n.status}})}),[n]),console.log("rejectionReasonTypeData",n);const D=()=>{const{reasonName:e,...a}=p;I({...k,...a})};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"common-header-label-bold",children:[(0,x.jsx)(o.A,{onClick:N,children:(0,x.jsx)(v.A,{})}),"Update Rejection Reason"]}),(0,x.jsx)("div",{className:"component-list",children:(0,x.jsx)(d.l1,{enableReinitialize:!0,innerRef:C,validationSchema:y,initialValues:k,onSubmit:async(e,a)=>{var s,o,t,l;const i={reasonID:null===n||void 0===n?void 0:n.id,reasonCategory:null!==e&&void 0!==e&&null!==(s=e.reasonCategory)&&void 0!==s&&s.id?null===e||void 0===e||null===(o=e.reasonCategory)||void 0===o?void 0:o.id:"",reasonName:e.reasonName,status:null!==(t=e.statusID)&&void 0!==t&&t.id?null===(l=e.statusID)||void 0===l?void 0:l.id:""};console.log("finalPayload",i),a.setSubmitting(!0),await f((0,g.iFu)(i)),D(),N()},children:e=>{let{errors:a,handleSubmit:n,handleChange:s,handleBlur:u,setFieldValue:c,isSubmitting:m,isValid:v,touched:g,values:h}=e;return(0,x.jsx)(d.lV,{onSubmit:n,children:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(t.Ay,{container:!0,className:"component-form",children:(0,x.jsxs)(t.Ay,{container:!0,children:[(0,x.jsx)(t.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(l.A,{name:"reasonCategory",value:h.reasonCategory,fullWidth:!0,options:j||[],onBlur:u,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,a)=>{c("reasonCategory",a),I({...k,reasonCategory:a})},renderInput:e=>(0,x.jsx)(r.A,{...e,fullWidth:!0,label:"Rejection Reason *",name:"reasonCategory",variant:"outlined",helperText:a.reasonCategory&&a.reasonCategory,error:a.reasonCategory&&Boolean(a.reasonCategory)})})}),(0,x.jsx)(t.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(r.A,{fullWidth:!0,label:"Reason Name*",name:"reasonName",onBlur:u,value:h.reasonName,onChange:(e,a)=>{c("reasonName",a),I({...k,reasonName:e.target.value})},variant:"outlined",size:"small",helperText:g.reasonName&&a.reasonName,error:g.reasonName&&Boolean(a.reasonName)})}),(0,x.jsx)(t.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(l.A,{name:"statusID",value:h.statusID,fullWidth:!0,options:A||[],onBlur:u,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,a)=>{c("statusID",a),I({...k,statusID:a})},renderInput:e=>(0,x.jsx)(r.A,{...e,fullWidth:!0,label:"Status *",name:"statusID",variant:"outlined",helperText:a.statusID&&a.statusID,error:a.statusID&&Boolean(a.statusID)})})})]})}),(0,x.jsx)(t.Ay,{className:"d-flex justify-content-center",p:2,children:(0,x.jsx)(i.A,{children:(0,x.jsx)(o.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:m,children:"SAVE"})})})]})})}})})]})}},10155:(e,a,n)=>{var s=n(24994);a.A=void 0;var o=s(n(40039)),t=n(70579);a.A=(0,o.default)((0,t.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")}}]);
//# sourceMappingURL=43177.a7da3768.chunk.js.map