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