"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:()=>o});n(65043);var a=n(67784),l=n(4701),s=n(17392),i=n(10155),r=n(70579);const m=(0,l.A)({}),d=e=>{let{onClick:t}=e;return(0,r.jsx)(s.A,{onClick:t,children:(0,r.jsx)(i.A,{})})},o=e=>{const t=m();return(0,r.jsx)(a.A,{InputProps:{...t,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},49202:(e,t,n)=>{n.r(t),n.d(t,{default:()=>f});var a=n(65043),l=n(11906),s=n(68903),i=n(38624),r=n(96446),m=n(24659),d=(n(69875),n(63516)),o=n(14556),u=n(73033),c=n(73216),g=n(66675),p=n(11852),v=n(96801),h=(n(17115),n(70579));const A=(0,v.Gq)("enuseloc"),x=A&&Object.keys(A).length>0?A.user_id:null;console.log("LoginuserId",x);const y={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 f=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),A=[{id:"Active",name:"Active"},{id:"InActive",name:"In Active"}],x=a.useRef(null),[f,T]=(0,a.useState)(y),I=(0,o.wA)(),N=(0,c.Zp)();(0,a.useEffect)((()=>{n&&T({...f,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}=y;T({...f,...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)(d.l1,{enableReinitialize:!0,innerRef:x,validationSchema:j,initialValues:f,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:o,setFieldValue:u,isSubmitting:c,isValid:g,touched:p,values:v}=e;return(0,h.jsx)(d.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:o,value:v.agreementName,onChange:(e,t)=>{u("agreementName",t),T({...f,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:o,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,t)=>{u("agreementType",t),T({...f,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:A||[],onBlur:o,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,t)=>{u("statusID",t),T({...f,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"})})})]})})}})})]})}},10155:(e,t,n)=>{var a=n(24994);t.A=void 0;var l=a(n(40039)),s=n(70579);t.A=(0,l.default)((0,s.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=49202.4ce6c16a.chunk.js.map