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