import{k as g,l as f,o as c,R as h,j as o,E as x,a9 as s}from"./app-BgLa5dit.js";import{O as u}from"./DNClpFKN.chunk.js";import{C as v}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 E(t){var n,m;const l=g(),a=f(),p=c(u.getOrganisation(t.id)),e=c(v.customer(t.customerId)),[r,i]=h.useState(!1);async function d(){try{i(!0),await l(u.removeFromOrganisation(t.id,t.customerId)),a.success("Successfully removed customer from the organisation.")}catch{a.error("Failed to remove customer from organisation. Please try again.")}finally{i(!1),t.closePopup()}}return o.jsxs(x,{title:"Remove customer from organisation",closePopup:t.closePopup,showLoadingSpinner:!p.hasCompleted||!e.hasCompleted,children:[o.jsxs("div",{className:"mb-3",children:["Are you sure you want to remove ",(n=e.data)==null?void 0:n.name," - (",(m=e.data)==null?void 0:m.crmId,") from the organisation?"]}),o.jsxs(s,{children:[o.jsx(s.Cancel,{text:"Cancel",onClick:t.closePopup}),o.jsx(s.Submit,{text:"Remove",variant:"danger",onClick:d,showSpinner:r,disabled:r})]})]})}export{E as RemoveCustomerFromOrganisationView};
//# sourceMappingURL=DuWJdjxB.chunk.js.map
