import{k as n,l as m,j as s,E as p,G as d,ao as x,ax as h,a9 as u}from"./app-BgLa5dit.js";import{c as o}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 N(e){const r=n(),i=m();async function l(a){try{const t=await r(c.customer(e.id));t.customerStatus=o[a.status],await r(c.updateCustomer(e.id,{...t})),i.success("Successfully updated the status")}catch{i.error("Failed to update the status. Please try again.")}finally{e.closePopup()}}return s.jsx(p,{title:"Update status",closePopup:e.closePopup,children:s.jsx(d,{initialValues:{status:e.currentValue},onSubmit:l,children:a=>s.jsxs(s.Fragment,{children:[s.jsx(x,{children:s.jsx(h,{name:"status",as:"select",value:a.values.status||"",onChange:t=>a.setFieldValue("status",t.target.value),children:Object.entries(o).filter(([t])=>isNaN(Number(t))).map(([t])=>s.jsx("option",{value:t,children:t},t))})}),s.jsxs(u,{children:[s.jsx(u.Cancel,{onClick:e.closePopup,text:"Cancel"}),s.jsx(u.Submit,{text:"Update status",variant:"dark",onClick:()=>a.submitForm()})]})]})})})}export{N as EditCustomerStatusView};
//# sourceMappingURL=BGf1jXB8.chunk.js.map
