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