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