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