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