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