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