import{aP as g,l as j,o as n,j as t,E as I,dO as S,aQ as R,f as A,h as o,g as l,i as p,bT as E}from"./app-BgLa5dit.js";import{C as a}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 O(e){const f=g(),i=j(),s=n(a.getUser(e.customerId,e.userId)),u=n(a.customer(e.customerId)),c=n(a.otherCustomers(e.customerId,e.userId));function C(){R(f,a.removeUserFromCustomer(e.customerId,e.userId,()=>i.success("Successfully removed user"),()=>i.error("Could not remove user from customer"),h))}function h(){var d;const r=c.data.data.find(x=>x.id!==e.customerId);if(A.getCurrentRoute().appLink.action!==o.Customers.EDIT_USER){e.closePopup();return}r?l.trigger({application:p.CUSTOMERS,action:o.Customers.EDIT_USER,args:[r==null?void 0:r.id,e.userId]}):l.trigger({application:p.CUSTOMERS,action:((d=s.data)==null?void 0:d.userType)===E.Staff?o.Customers.MANAGE_STAFF:o.Customers.MANAGE_STUDENTS,args:[e.customerId]}),e.closePopup()}const m="Remove user from customer";return s.data&&u.data&&c.data?t.jsxs(S,{title:m,onClickConfirm:C,closePopup:e.closePopup,confirmButtonVariant:"danger",confirmButtonText:"Remove",children:[t.jsxs("p",{children:["Are you sure you want to remove: ",t.jsx("br",{})]}),t.jsxs("p",{className:"ps-2",children:[t.jsxs("strong",{children:[s.data.name," ",s.data.surname]})," (",s.data.username,") ",t.jsx("br",{}),s.data.email]}),t.jsxs("p",{children:["From this customer: ",t.jsx("br",{})]}),t.jsxs("p",{className:"ps-2",children:[t.jsx("strong",{children:u.data.name})," (",u.data.crmId,")"]})]}):t.jsx(I,{title:m,showLoadingSpinner:!0,closePopup:e.closePopup})}export{O as RemoveUserFromCustomerView};
//# sourceMappingURL=9ZHuKSDj.chunk.js.map
