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