"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[11986],{24659:(e,i,t)=>{t.d(i,{A:()=>d});t(65043);var l=t(67784),s=t(4701),n=t(17392),a=t(10155),r=t(70579);const m=(0,s.A)({}),u=e=>{let{onClick:i}=e;return(0,r.jsx)(n.A,{onClick:i,children:(0,r.jsx)(a.A,{})})},d=e=>{const i=m();return(0,r.jsx)(l.A,{InputProps:{...i,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(u,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},11986:(e,i,t)=>{t.r(i),t.d(i,{default:()=>I});var l=t(65043),s=t(68903),n=t(11906),a=t(38624),r=t(96446),m=t(63516),u=t(24659),d=t(73216),o=t(66675),c=t(14556),p=t(96801),v=t(73033),h=t(6994),x=t(70579);const y={premiumTypeName:"",statusID:""},A=v.Ik().shape({premiumTypeName:v.Yj().required("Premium Type Name is required"),statusID:v.Ik().nullable().required("Select Status")}),j=(0,p.Gq)("enuseloc");j&&Object.keys(j).length>0&&j.user_id;const I=function(e){const i=(0,c.wA)(),t=(0,d.Zp)(),p=l.useRef(null),[v,j]=(0,l.useState)(y),I=(0,d.zy)(),N=null===I||void 0===I?void 0:I.state,T=null===N||void 0===N?void 0:N._original,b=[{id:"1",name:"Active"},{id:"0",name:"In Active"}];return(0,l.useEffect)((()=>{T&&j({...v,premiumTypeName:null===T||void 0===T?void 0:T.premium_type_name,statusID:{id:T.is_active,name:1==(null===T||void 0===T?void 0:T.is_active)?"Active":"InActive"}})}),[T]),(0,x.jsxs)("div",{className:"component-list",children:[(0,x.jsx)(s.Ay,{container:!0,className:"d-flex justify-content-between align-items-center",py:1,children:(0,x.jsxs)(s.Ay,{item:!0,className:"common-header-label",children:[(0,x.jsx)(n.A,{onClick:()=>{t(-1)},children:(0,x.jsx)(o.A,{})}),"Update Premium Type"]})}),(0,x.jsx)(m.l1,{enableReinitialize:!0,innerRef:p,initialValues:v,validationSchema:A,onSubmit:async(e,l)=>{var s;const n={premiumTypeID:null!==T&&void 0!==T&&T.id?null===T||void 0===T?void 0:T.id:"",premiumTypeName:null!==e&&void 0!==e&&e.premiumTypeName?null===e||void 0===e?void 0:e.premiumTypeName:"",isActive:null!==e&&void 0!==e&&e.statusID.id?null===e||void 0===e||null===(s=e.statusID)||void 0===s?void 0:s.id:""};l.setSubmitting(!0),await i((0,h.lH)(n)),l.resetForm({}),t("/crm/crm-site-premium-type")},children:e=>{let{errors:i,handleSubmit:t,handleChange:d,setFieldValue:o,handleBlur:c,isSubmitting:p,isValid:v,touched:h,values:y}=e;return(0,x.jsx)(m.lV,{onSubmit:t,children:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(s.Ay,{container:!0,className:"component-form",children:(0,x.jsxs)(s.Ay,{container:!0,children:[(0,x.jsx)(s.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(u.A,{fullWidth:!0,name:"premiumTypeName",onBlur:c,onChange:d,value:y.premiumTypeName,error:h.premiumTypeName&&Boolean(i.premiumTypeName),helperText:h.premiumTypeName&&i.premiumTypeName,id:"premiumTypeName",size:"small",label:" Premium Type Name *",variant:"outlined"})}),(0,x.jsx)(s.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(a.A,{disablePortal:!0,id:"statusID",options:b||[],name:"statusID",value:y.statusID,size:"small",getOptionLabel:e=>(null===e||void 0===e?void 0:e.name)||"",renderOption:(e,i)=>(0,l.createElement)("li",{...e,style:{textAlign:"left"},key:null===i||void 0===i?void 0:i.id},null===i||void 0===i?void 0:i.name),onChange:(e,i)=>{o("statusID",i)},renderInput:e=>(0,x.jsx)(u.A,{...e,label:"Status",size:"small",helperText:h.statusID&&i.StatusValuesID,error:h.statusID&&Boolean(i.statusID)})})})]})}),(0,x.jsx)(s.Ay,{className:"d-flex justify-content-center",p:2,children:(0,x.jsx)(r.A,{children:(0,x.jsx)(n.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:p,children:"SAVE"})})})]})})}})]})}},10155:(e,i,t)=>{var l=t(24994);i.A=void 0;var s=l(t(40039)),n=t(70579);i.A=(0,s.default)((0,n.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,t)=>{var l=t(24994);i.A=void 0;var s=l(t(40039)),n=t(70579);i.A=(0,s.default)((0,n.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=11986.951ae2ec.chunk.js.map