"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[48303],{24659:(e,t,s)=>{s.d(t,{A:()=>d});s(65043);var n=s(67784),i=s(4701),a=s(17392),l=s(10155),r=s(70579);const o=(0,i.A)({}),u=e=>{let{onClick:t}=e;return(0,r.jsx)(a.A,{onClick:t,children:(0,r.jsx)(l.A,{})})},d=e=>{const t=o();return(0,r.jsx)(n.A,{InputProps:{...t,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(u,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},48303:(e,t,s)=>{s.r(t),s.d(t,{default:()=>b});var n=s(65043),i=s(68903),a=s(11906),l=s(96446),r=s(63516),o=s(24659),u=s(73216),d=s(66675),c=s(14556),m=s(96801),h=s(11852),v=s(6994),x=s(73033),j=s(70579);const A={statusName:""},p=x.Ik().shape({statusName:x.Yj().required("Status 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 t=(0,c.wA)(),s=(0,u.Zp)(),m=n.useRef(null),[x,f]=(0,n.useState)(A),[b,S]=(0,n.useState)([]),k=(0,c.d4)((e=>{var t;return null===(t=e.bd.getFunctionalityPermissionDetail)||void 0===t?void 0:t.data})),g=(0,n.useRef)("NO"),C=(0,n.useRef)("NO");return(0,n.useEffect)((()=>{const e={userID:N,functionalityID:287,functionalityItemIDs:y};return t((0,h.P8M)(e)),()=>{t((0,h.qo7)())}}),[]),(0,n.useEffect)((()=>(k&&287===(null===k||void 0===k?void 0:k.functionalityID)&&(S(k),g.current=null===k||void 0===k?void 0:k.permission_report,C.current=null===k||void 0===k?void 0:k.permission_admin),()=>{S([]),g.current="NO",C.current="NO"})),[k]),(0,j.jsxs)("div",{className:"component-list",children:[(0,j.jsx)(i.Ay,{container:!0,className:"d-flex justify-content-between align-items-center",py:1,children:(0,j.jsxs)(i.Ay,{item:!0,className:"common-header-label",children:[(0,j.jsx)(a.A,{onClick:()=>{s(-1)},children:(0,j.jsx)(d.A,{})}),"Add Enquiry Call Status"]})}),b&&Object.keys(b).length>0&&287===(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,n)=>{const i={statusName:null!==e&&void 0!==e&&e.statusName?null===e||void 0===e?void 0:e.statusName:""};console.log("finalPayload",i),n.setSubmitting(!0),await t((0,v.xOY)(i)),n.resetForm({}),s("/crm/crm-enquiry-call-status")},children:e=>{let{errors:t,handleSubmit:s,handleChange:n,setFieldValue:u,handleBlur:d,isSubmitting:c,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)(i.Ay,{container:!0,className:"component-form",children:(0,j.jsx)(i.Ay,{container:!0,children:(0,j.jsx)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,j.jsx)(o.A,{fullWidth:!0,name:"statusName",onBlur:d,onChange:n,value:v.statusName,error:h.statusName&&Boolean(t.statusName),helperText:h.statusName&&t.statusName,id:"statusName",size:"small",label:"Status Name *",variant:"outlined"})})})}),(0,j.jsxs)(i.Ay,{className:"d-flex justify-content-end",p:2,children:[(0,j.jsxs)(l.A,{mx:2,children:[" ",(0,j.jsx)(a.A,{text:"CANCEL",variant:"contained",size:"medium",type:"reset",color:"secondary",onClick:()=>{f({...A})},children:"RESET"})]}),(0,j.jsx)(l.A,{children:(0,j.jsx)(a.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,t,s)=>{var n=s(24994);t.A=void 0;var i=n(s(40039)),a=s(70579);t.A=(0,i.default)((0,a.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,t,s)=>{var n=s(24994);t.A=void 0;var i=n(s(40039)),a=s(70579);t.A=(0,i.default)((0,a.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=48303.ea88abbd.chunk.js.map