"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[4062],{69875:(e,s,n)=>{n.d(s,{A:()=>t});n(65043);const t=n.p+"static/media/Upload.4216d61323e67ba8fcaf839d79ad9d80.svg"},24659:(e,s,n)=>{n.d(s,{A:()=>m});n(65043);var t=n(67784),l=n(4701),i=n(17392),a=n(10155),o=n(70579);const d=(0,l.A)({}),r=e=>{let{onClick:s}=e;return(0,o.jsx)(i.A,{onClick:s,children:(0,o.jsx)(a.A,{})})},m=e=>{const s=d();return(0,o.jsx)(t.A,{InputProps:{...s,endAdornment:(0,o.jsxs)(o.Fragment,{children:[" ",e.iscross&&(0,o.jsx)(r,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},4062:(e,s,n)=>{n.r(s),n.d(s,{default:()=>k});var t=n(65043),l=n(11906),i=n(68903),a=n(38624),o=n(96446),d=n(24659),r=n(53193),m=n(51292),u=n(78492),c=n(74605),h=n(14256),x=(n(69875),n(63516)),p=n(14556),v=n(73033),j=n(73216),A=n(66675),y=n(11852),b=n(96801),g=(n(17115),n(70579));const I=(0,b.Gq)("enuseloc"),N=I&&Object.keys(I).length>0?I.user_id:null;console.log("LoginuserId",N);const f={milestoneName:"",milestoneType:"",statusID:""},D=v.Ik().shape({milestoneName:v.Yj("Enter Milstone Name ").required("Milestone Name is required"),statusID:v.Ik().nullable().required("Select Status")});const k=function(e){const s=(0,j.zy)(),n=(null===s||void 0===s?void 0:s.state)._original;console.log("milestoneTypeData",n);const[v,b]=(0,t.useState)(!1),I=[{id:"Active",name:"Active"},{id:"InActive",name:"In Active"}],N=t.useRef(null),[k,S]=(0,t.useState)(f),T=(0,p.wA)(),C=(0,j.Zp)();(0,t.useEffect)((()=>{n&&S({...k,milestoneName:null===n||void 0===n?void 0:n.milestone_name,milestoneType:null===n||void 0===n?void 0:n.milestone_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("milestoneTypeData",n);const w=()=>{const{milestoneName:e,...s}=f;S({...k,...s})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"common-header-label-bold",children:[(0,g.jsx)(l.A,{onClick:()=>{C(-1)},children:(0,g.jsx)(A.A,{})}),"Update Payment Milestone"]}),(0,g.jsx)("div",{className:"component-list",children:(0,g.jsx)(x.l1,{enableReinitialize:!0,innerRef:N,validationSchema:D,initialValues:k,onSubmit:async(e,s)=>{var t,l;const i={milestoneId:null===n||void 0===n?void 0:n.id,milestoneName:e.milestoneName,milestoneType:e.milestoneType?e.milestoneType:"",milestoneStatus:null!==(t=e.statusID)&&void 0!==t&&t.id?null===(l=e.statusID)||void 0===l?void 0:l.id:""};console.log("finalPayload",i),s.setSubmitting(!0),await T((0,y.pMO)(i)),w(),C("/bd-masters/PaymentMilestone")},children:e=>{let{errors:s,handleSubmit:n,handleChange:t,handleBlur:p,setFieldValue:v,isSubmitting:j,isValid:A,touched:y,values:b}=e;return(0,g.jsx)(x.lV,{onSubmit:n,children:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(i.Ay,{container:!0,className:"component-form",children:(0,g.jsxs)(i.Ay,{container:!0,children:[(0,g.jsx)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,g.jsx)(d.A,{fullWidth:!0,label:"Milestone Name*",name:"milestoneName",onBlur:p,value:b.milestoneName,onChange:(e,s)=>{v("milestoneName",s),S({...k,milestoneName:e.target.value})},variant:"outlined",size:"small",helperText:y.milestoneName&&s.milestoneName,error:y.milestoneName&&Boolean(s.milestoneName)})}),(0,g.jsx)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,g.jsxs)(r.A,{children:[(0,g.jsx)(m.A,{id:"milestoneType",children:"Milestone Type*"}),(0,g.jsxs)(u.A,{row:!0,"aria-labelledby":"milestoneType",name:"milestoneType",value:b.milestoneType,onChange:t,children:[(0,g.jsx)(c.A,{value:"LandOwner",control:(0,g.jsx)(h.A,{required:!0}),label:"Land Owner"}),(0,g.jsx)(c.A,{value:"LandBroker",control:(0,g.jsx)(h.A,{required:!0}),label:"Land Broker"})]})]})}),(0,g.jsx)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,g.jsx)(a.A,{name:"statusID",value:b.statusID,fullWidth:!0,options:I||[],onBlur:p,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,s)=>{v("statusID",s),S({...k,statusID:s})},renderInput:e=>(0,g.jsx)(d.A,{...e,fullWidth:!0,label:"Status *",name:"statusID",variant:"outlined",helperText:s.statusID&&s.statusID,error:s.statusID&&Boolean(s.statusID)})})})]})}),(0,g.jsx)(i.Ay,{className:"d-flex justify-content-center",p:2,children:(0,g.jsx)(o.A,{children:(0,g.jsx)(l.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:j,children:"SAVE"})})})]})})}})})]})}}}]);
//# sourceMappingURL=4062.b952e700.chunk.js.map