"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[26901],{24659:(e,n,s)=>{s.d(n,{A:()=>c});s(65043);var i=s(67784),a=s(4701),l=s(17392),t=s(10155),r=s(70579);const o=(0,a.A)({}),d=e=>{let{onClick:n}=e;return(0,r.jsx)(l.A,{onClick:n,children:(0,r.jsx)(t.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})}},26901:(e,n,s)=>{s.r(n),s.d(n,{default:()=>b});var i=s(65043),a=s(68903),l=s(11906),t=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:""},p=x.Ik().shape({reasonName:x.Yj().required("Reason Name is required")}),f=(0,m.Gq)("enuseloc"),N=f&&Object.keys(f).length>0?f.user_id:null,y=[];const b=function(e){const n=(0,u.wA)(),s=(0,d.Zp)(),m=i.useRef(null),[x,f]=(0,i.useState)(A),[b,k]=(0,i.useState)([]),g=(0,u.d4)((e=>{var n;return null===(n=e.bd.getFunctionalityPermissionDetail)||void 0===n?void 0:n.data})),C=(0,i.useRef)("NO"),S=(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)((()=>(g&&297===(null===g||void 0===g?void 0:g.functionalityID)&&(k(g),C.current=null===g||void 0===g?void 0:g.permission_report,S.current=null===g||void 0===g?void 0:g.permission_admin),()=>{k([]),C.current="NO",S.current="NO"})),[g]),(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)(l.A,{onClick:()=>{s(-1)},children:(0,j.jsx)(c.A,{})}),"Add Block Reason"]})}),b&&Object.keys(b).length>0&&297===(null===b||void 0===b?void 0:b.functionalityID)&&"YES"===(null===b||void 0===b?void 0:b.permission_admin)?(0,j.jsx)(r.l1,{enableReinitialize:!0,innerRef:m,initialValues:x,validationSchema:p,onSubmit:async(e,i)=>{const a={blockReasonName:null!==e&&void 0!==e&&e.reasonName?null===e||void 0===e?void 0:e.reasonName:""};console.log("finalPayload",a),i.setSubmitting(!0),await n((0,v.t9o)(a)),i.resetForm({}),s("/crm/crm-block-reason")},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:"Reason Name *",variant:"outlined"})})})}),(0,j.jsxs)(a.Ay,{className:"d-flex justify-content-end",p:2,children:[(0,j.jsxs)(t.A,{mx:2,children:[" ",(0,j.jsx)(l.A,{text:"CANCEL",variant:"contained",size:"medium",type:"reset",color:"secondary",onClick:()=>{f({...A})},children:"RESET"})]}),(0,j.jsx)(t.A,{children:(0,j.jsx)(l.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)),l=s(70579);n.A=(0,a.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,s)=>{var i=s(24994);n.A=void 0;var a=i(s(40039)),l=s(70579);n.A=(0,a.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=26901.f595c9f6.chunk.js.map