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