import{k as m,l as n,j as e,E as p,G as d,ao as y,ax as x,a9 as r}from"./app-BgLa5dit.js";import{a as u}from"./Zwjmkasg.chunk.js";import{C as c}from"./q-IBKcuF.chunk.js";import"./DUpYPoLs.chunk.js";import"./EZim8aq-.chunk.js";import"./BD9MrUJP.chunk.js";import"./s6cGcwlA.chunk.js";import"./4qGb1BIY.chunk.js";import"./DnXDEnAR.chunk.js";import"./DpUpv6rY.chunk.js";import"./CG7zbly5.chunk.js";import"./m4aqaK_l.chunk.js";import"./MEkA24R1.chunk.js";import"./C53kfXmd.chunk.js";function S(s){const o=m(),i=n();async function l(a){try{const t=await o(c.customer(s.id));t.customerType=u[a.type],await o(c.updateCustomer(s.id,{...t})),i.success("Successfully updated the customer type")}catch{i.error("Failed to update the customer type. Please try again.")}finally{s.closePopup()}}return e.jsx(p,{title:"Update customer type",closePopup:s.closePopup,children:e.jsx(d,{initialValues:{type:s.currentValue},onSubmit:l,children:a=>e.jsxs(e.Fragment,{children:[e.jsx(y,{children:e.jsx(x,{name:"type",as:"select",value:a.values.type||"",onChange:t=>a.setFieldValue("type",t.target.value),children:Object.entries(u).filter(([t])=>isNaN(Number(t))&&t!=="Unclassified").map(([t])=>e.jsx("option",{value:t,children:t},t))})}),e.jsxs(r,{children:[e.jsx(r.Cancel,{onClick:s.closePopup,text:"Cancel"}),e.jsx(r.Submit,{text:"Update customer type",variant:"dark",onClick:()=>a.submitForm()})]})]})})})}export{S as EditCustomerTypeView};
//# sourceMappingURL=D9tx75fk.chunk.js.map
