import{j as a,ej as f,Y as i,h as c,i as o,aL as m,bV as h,bT as u}from"./app-BgLa5dit.js";import{T as x}from"./lZO4aq5x.chunk.js";import{C as g}from"./c3I67AiW.chunk.js";function U(e){if(m.getUserRole(e)===h.Admin)return"Administrator";switch(m.getUserType(e)){case u.Learner:return"Student";case u.Staff:return"Staff";case u.Unknown:return"Unknown";default:return"Unknown"}}function S(e){const s="rounded-pill text-white py-1 px-2 text-sm d-inline-block";switch(e){case"Administrator":return`bg-indigo ${s}`;case"Student":return`bg-teal ${s}`;case"Staff":return`bg-purple ${s}`;default:return`bg-black ${s}`}}function d(e,s){return e.length<=s?e:e.slice(0,s-1)+"…"}const r=f(),T={name:r.accessor(e=>e,{id:"name",header:"Name",cell:e=>{const s=e.getValue(),t=`${s.name} ${s.surname}`,n=d(t,20);return a.jsx(i,{appLink:{application:o.CRM_STUDIO,action:c.CrmStudio.USER_OVERVIEW,args:[s.id]},className:"text-info",children:n})},size:200}),username:r.accessor("username",{id:"username",header:"Username",cell:e=>{const s=e.getValue();return a.jsx("p",{className:"text-truncate mb-0",children:d(s,20)})},size:150}),email:r.accessor(e=>e,{id:"email",header:"Email",cell:e=>{const s=e.getValue();return a.jsx("p",{className:"mb-0",children:s.email||s.unverifiedEmail||"-"})},size:200}),type:r.accessor(e=>e,{id:"type",header:"Type",cell:e=>{const s=e.getValue(),t=U(s);return a.jsx("div",{className:S(t),children:t})},size:120}),customerType:r.accessor(e=>e,{id:"customers",header:"Customers",cell:e=>{var n;const s=e.getValue(),t=((n=s.customers)==null?void 0:n.data)??[];return a.jsxs("ul",{className:"list-unstyled d-flex flex-column gap-1 mb-0",children:[t.slice(0,5).map((l,p)=>a.jsx("li",{children:a.jsx(i,{className:"text-info",appLink:{application:o.CRM_STUDIO,action:c.CrmStudio.CUSTOMER_OVERVIEW,args:[l.id]},children:`${l.name} - ${l.crmId}`})},p)),t.length>5&&a.jsx("li",{children:a.jsxs(i,{className:"text-info",appLink:{application:o.CRM_STUDIO,action:c.CrmStudio.USER_CUSTOMER_SCHOOLS,args:[s.id]},children:["See all ",t.length," customers"]})})]})},size:250})};function R(e){return a.jsx(x,{data:e.data,columns:Object.values(T),theme:g})}export{R as U,S as a,U as g};
//# sourceMappingURL=C6-eluIr.chunk.js.map
