import{k as u,l as c,j as e,E as l,G as p,ao as d,ax as x,a9 as o}from"./app-BgLa5dit.js";import{C as n}from"./q-IBKcuF.chunk.js";import"./DUpYPoLs.chunk.js";import"./EZim8aq-.chunk.js";import"./BD9MrUJP.chunk.js";import"./s6cGcwlA.chunk.js";import"./Zwjmkasg.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(t){const m=u(),r=c();async function i(a){try{const s=await m(n.customer(t.id));s.name=a.name,await m(n.updateCustomer(t.id,{...s})),r.success("Successfully updated the customers name")}catch{r.error("Failed to update the customers name. Please try again.")}finally{t.closePopup()}}return e.jsx(l,{title:"Update customer name",closePopup:t.closePopup,children:e.jsx(p,{initialValues:{name:t.currentValue},onSubmit:i,children:a=>e.jsxs(e.Fragment,{children:[e.jsx(d,{children:e.jsx(x,{name:"name",type:"text",value:a.values.name||"",onChange:s=>a.setFieldValue("name",s.target.value)})}),e.jsxs(o,{children:[e.jsx(o.Cancel,{onClick:t.closePopup,text:"Cancel"}),e.jsx(o.Submit,{text:"Update customer name",variant:"dark",onClick:()=>a.submitForm()})]})]})})})}export{S as EditCustomerNameView};
//# sourceMappingURL=DmbG18Qf.chunk.js.map
