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