"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[57010],{24659:(e,i,r)=>{r.d(i,{A:()=>u});r(65043);var n=r(67784),t=r(4701),l=r(17392),s=r(10155),a=r(70579);const o=(0,t.A)({}),d=e=>{let{onClick:i}=e;return(0,a.jsx)(l.A,{onClick:i,children:(0,a.jsx)(s.A,{})})},u=e=>{const i=o();return(0,a.jsx)(n.A,{InputProps:{...i,endAdornment:(0,a.jsxs)(a.Fragment,{children:[" ",e.iscross&&(0,a.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},57010:(e,i,r)=>{r.r(i),r.d(i,{default:()=>f});var n=r(65043),t=r(68903),l=r(11906),s=r(96446),a=r(63516),o=r(24659),d=r(73216),u=r(14556),c=r(66675),m=r(11852),h=r(96801),y=r(73033),v=(r(80445),r(70579));const A={AuthorityName:"",DisplayOrder:""},p=y.Ik().shape({AuthorityName:y.Yj("Enter Authority Name ").required("Authority Name is required"),DisplayOrder:y.ai("Enter Display Order ").positive("Order Should be Positive Number").required("Display Order is required")}),x=[],j=(0,h.Gq)("enuseloc"),N=j&&Object.keys(j).length>0?j.user_id:null;const f=function(e){const i=n.useRef(null),[r,h]=(0,n.useState)(A),y=(0,u.wA)(),j=(0,d.Zp)(),[f,b]=(0,n.useState)([]),D=(0,u.d4)((e=>{var i;return null===(i=e.bd.getFunctionalityPermissionDetail)||void 0===i?void 0:i.data})),O=n.useRef("No"),g=n.useRef("No");return(0,n.useEffect)((()=>{const e={userID:N,functionalityID:106,functionalityItemIDs:x};return y((0,m.P8M)(e)),()=>{y((0,m.qo7)())}}),[]),(0,n.useEffect)((()=>(D&&106===(null===D||void 0===D?void 0:D.functionalityID)&&(b(D),O.current=null===D||void 0===D?void 0:D.permission_report,g.current=null===D||void 0===D?void 0:D.permission_admin),()=>{b([]),O.current="NO",g.current="NO"})),[D]),(0,v.jsxs)("div",{className:"component-list",children:[(0,v.jsx)(t.Ay,{container:!0,className:"d-flex justify-content-between align-items-center",py:1,children:(0,v.jsxs)(t.Ay,{item:!0,className:"common-header-label",children:[(0,v.jsx)(l.A,{onClick:()=>{j(-1)},children:(0,v.jsx)(c.A,{})}),"Add Planning Authority"]})}),f&&Object.keys(f).length>0&&106===(null===f||void 0===f?void 0:f.functionalityID)&&("YES"===(null===f||void 0===f?void 0:f.permission_admin)||"YES"===(null===f||void 0===f?void 0:f.AddLegalTask))?(0,v.jsx)(a.l1,{enableReinitialize:!0,innerRef:i,initialValues:r,validationSchema:p,onSubmit:async(e,i)=>{console.log(e,"nithish");const r={authorityName:null!==e&&void 0!==e&&e.AuthorityName?null===e||void 0===e?void 0:e.AuthorityName:"",displayOrder:null!==e&&void 0!==e&&e.DisplayOrder?null===e||void 0===e?void 0:e.DisplayOrder:""};console.log("finalPayload",r),i.setSubmitting(!0),await y((0,m.uhc)(r)),i.resetForm({}),j("/BD-Master/PlanningAuthority")},children:e=>{let{errors:i,handleSubmit:r,handleChange:n,setFieldvalue:d,handleBlur:u,isSubmitting:c,isValid:m,touched:y,values:p}=e;return(0,v.jsx)(a.lV,{onSubmit:r,children:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(t.Ay,{container:!0,className:"component-form",children:(0,v.jsxs)(t.Ay,{container:!0,children:[(0,v.jsx)(t.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,v.jsx)(o.A,{fullWidth:!0,name:"AuthorityName",onBlur:u,onChange:n,value:p.AuthorityName,error:i.AuthorityName&&Boolean(i.AuthorityName),helperText:i.AuthorityName&&i.AuthorityName,id:"AuthorityName",size:"small",label:"Authority Name *",variant:"outlined"})}),(0,v.jsx)(t.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,v.jsx)(o.A,{fullWidth:!0,name:"DisplayOrder",onBlur:u,onChange:n,value:p.DisplayOrder,error:i.DisplayOrder&&Boolean(i.DisplayOrder),helperText:i.DisplayOrder&&i.DisplayOrder,type:"number",id:"DisplayOrder",size:"small",label:"Display Order *",variant:"outlined"})})]})}),(0,v.jsxs)(t.Ay,{className:"d-flex justify-content-end",p:2,children:[(0,v.jsxs)(s.A,{mx:2,children:[" ",(0,v.jsx)(l.A,{text:"CANCEL",variant:"contained",size:"medium",type:"reset",color:"secondary",onClick:()=>{h(A)},children:"RESET"})]}),(0,v.jsx)(s.A,{children:(0,v.jsx)(l.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,i,r)=>{var n=r(24994);i.A=void 0;var t=n(r(40039)),l=r(70579);i.A=(0,t.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,i,r)=>{var n=r(24994);i.A=void 0;var t=n(r(40039)),l=r(70579);i.A=(0,t.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")},80445:()=>{}}]);
//# sourceMappingURL=57010.91f12972.chunk.js.map