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