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