"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[62012],{24659:(e,n,i)=>{i.d(n,{A:()=>m});i(65043);var l=i(67784),s=i(4701),t=i(17392),o=i(10155),a=i(70579);const r=(0,s.A)({}),d=e=>{let{onClick:n}=e;return(0,a.jsx)(t.A,{onClick:n,children:(0,a.jsx)(o.A,{})})},m=e=>{const n=r();return(0,a.jsx)(l.A,{InputProps:{...n,endAdornment:(0,a.jsxs)(a.Fragment,{children:[" ",e.iscross&&(0,a.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},62012:(e,n,i)=>{i.r(n),i.d(n,{default:()=>T});var l=i(65043),s=i(68903),t=i(11906),o=i(96446),a=i(63516),r=i(24659),d=i(73216),m=i(66675),c=i(11852),u=i(53193),h=i(51292),v=i(78492),x=i(74605),j=i(14256),p=i(73033),A=i(14556),y=i(96801),N=i(70579);const f={milestoneName:"",milestoneType:""},b=p.Ik().shape({milestoneName:p.Yj("Enter Milstone Name ").required("Milestone Name is required")}),k=[],g=(0,y.Gq)("enuseloc"),C=g&&Object.keys(g).length>0?g.user_id:null;const T=function(e){const n=l.useRef(null),[i,p]=(0,l.useState)(f),y=(0,d.Zp)(),g=(0,A.wA)(),[T,S]=(0,l.useState)([]),M=(0,A.d4)((e=>{var n;return null===(n=e.bd.getFunctionalityPermissionDetail)||void 0===n?void 0:n.data})),z=l.useRef("No"),E=l.useRef("No");return(0,l.useEffect)((()=>{const e={userID:C,functionalityID:118,functionalityItemIDs:k};return g((0,c.P8M)(e)),()=>{g((0,c.qo7)())}}),[]),(0,l.useEffect)((()=>(M&&118===(null===M||void 0===M?void 0:M.functionalityID)&&(S(M),z.current=null===M||void 0===M?void 0:M.permission_report,E.current=null===M||void 0===M?void 0:M.permission_admin),()=>{S([]),z.current="NO",E.current="NO"})),[M]),(0,N.jsxs)("div",{className:"component-list",children:[(0,N.jsx)(s.Ay,{container:!0,className:"d-flex justify-content-between align-items-center",py:1,children:(0,N.jsxs)(s.Ay,{item:!0,className:"common-header-label",children:[(0,N.jsx)(t.A,{onClick:()=>{y(-1)},children:(0,N.jsx)(m.A,{})}),"Add Payment Milestone"]})}),T&&Object.keys(T).length>0&&118===(null===T||void 0===T?void 0:T.functionalityID)&&"YES"===(null===T||void 0===T?void 0:T.permission_admin)?(0,N.jsx)(a.l1,{enableReinitialize:!0,innerRef:n,initialValues:i,validationSchema:b,onSubmit:async(e,n)=>{const i={milestoneName:null!==e&&void 0!==e&&e.milestoneName?null===e||void 0===e?void 0:e.milestoneName:"",milestoneType:null!==e&&void 0!==e&&e.milestoneType?null===e||void 0===e?void 0:e.milestoneType:""};n.setSubmitting(!0),await g((0,c.KdT)(i)),n.resetForm({}),y("/bd-masters/PaymentMilestone")},children:e=>{let{errors:n,handleSubmit:i,handleChange:l,setFieldValue:d,handleBlur:m,isSubmitting:c,isValid:A,touched:y,values:b}=e;return(0,N.jsx)(a.lV,{onSubmit:i,children:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(s.Ay,{container:!0,className:"component-form",children:(0,N.jsxs)(s.Ay,{container:!0,children:[(0,N.jsx)(s.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,N.jsx)(r.A,{name:"milestoneName",fullWidth:!0,onBlur:m,onChange:l,value:b.milestoneName,error:n.milestoneName&&Boolean(n.milestoneName),helperText:n.milestoneName&&n.milestoneName,id:"milestoneName",size:"small",label:"Milestone Type Name*",variant:"outlined"})}),(0,N.jsx)(s.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,N.jsxs)(u.A,{children:[(0,N.jsx)(h.A,{id:"milestoneType",children:"Milestone Type*"}),(0,N.jsxs)(v.A,{row:!0,"aria-labelledby":"milestoneType",name:"milestoneType",value:b.milestoneType,onChange:l,children:[(0,N.jsx)(x.A,{value:"LandOwner",control:(0,N.jsx)(j.A,{required:!0}),label:"Land Owner"}),(0,N.jsx)(x.A,{value:"LandBroker",control:(0,N.jsx)(j.A,{required:!0}),label:"Land Broker"})]})]})})]})}),(0,N.jsxs)(s.Ay,{className:"d-flex justify-content-start",p:2,children:[(0,N.jsxs)(o.A,{mx:2,children:[" ",(0,N.jsx)(t.A,{text:"CANCEL",variant:"contained",color:"secondary",size:"medium",type:"reset",onClick:()=>{p({...f})},children:"RESET"})]}),(0,N.jsx)(o.A,{children:(0,N.jsx)(t.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:c,children:"SAVE"})})]})]})})}}):(0,N.jsx)("div",{className:"common-header-label-bold",children:"You don't have permission to access this page!"})]})}},10155:(e,n,i)=>{var l=i(24994);n.A=void 0;var s=l(i(40039)),t=i(70579);n.A=(0,s.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")},66675:(e,n,i)=>{var l=i(24994);n.A=void 0;var s=l(i(40039)),t=i(70579);n.A=(0,s.default)((0,t.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=62012.7122d791.chunk.js.map