1import{d as G,w as H,x as Q,c as y,b as l,j as a,i as d,e as t,l as u,F as W,r as X,t as p,h as F,f as Y,y as D,k as Z,C as ee,p as te,a as ne,E as le,o as c,J as se}from"./D0kso2Yl.js";import{_ as ae}from"./CPh-YcdS.js";import{u as oe,a as ie,_ as re,b as de}from"./Cq3BWHYy.js";import{_ as ue}from"./DdQhP7bV.js";import{u as ce}from"./BzYGa1re.js";import"./oAXTOTRO.js";import"./DUGP_PXC.js";import"./6st1MhR-.js";import"./7sMwU5N7.js";import"./BwCB677Q.js";import"./CaQfu2AW.js";const me={class:"p-8 max-w-6xl mx-auto"},pe={class:"flex items-start justify-between gap-4 mb-6"},ve={key:0,class:"rounded-xl border border-default overflow-hidden"},fe={class:"w-full text-sm"},ye={class:"bg-elevated text-left text-xs uppercase tracking-wider text-muted"},be={class:"px-3 py-3 w-10"},xe=["checked","indeterminate"],ke={class:"px-3 py-2"},ge=["checked","onChange"],he={class:"px-3 py-2"},_e={class:"size-10 rounded bg-elevated overflow-hidden flex items-center justify-center p-1"},$e=["src","alt"],Ce={key:1,class:"font-display text-xs text-muted"},we={class:"px-4 py-3"},Ae={class:"text-xs text-muted font-mono"},De={class:"px-4 py-3"},Se={class:"px-2 py-0.5 rounded-full text-xs bg-elevated"},Te={class:"px-4 py-3 text-muted"},ze={class:"px-4 py-3 text-muted font-mono text-xs"},Ve={class:"px-4 py-3"},Be={class:"px-4 py-3 text-right"},Ue={class:"inline-flex items-center gap-1"},Ne={key:1,class:"rounded-xl border border-default p-12 text-center"},Fe={class:"text-muted"},He=G({__name:"index",async setup(Ee){let h,T;const E=le(),{data:v,refresh:z}=([h,T]=H(()=>ne("admin-members-list",()=>E("/api/admin/members"))),h=await h,T(),h),V=ce(),{search:_,sort:B,filters:m,sorted:$,toggleSort:b}=oe({rows:v,searchFields:s=>[s.name,s.title?.en],filters:{type:{default:"any",match:(s,e)=>e==="any"||s.type===e},status:{default:"any",match:(s,e)=>e==="any"||(e==="active"?s.active:!s.active)}},defaultSort:{column:"order",direction:"asc"},sortAccessor:(s,e)=>e==="title"?s.title?.en??"":s[e]}),o=ie($,s=>s.id),L={partner:"Partner",staff:"Team",advisor:"Advisor"},P=[{value:"any",label:"All types"},{value:"partner",label:"Partner"},{value:"staff",label:"Team"},{value:"advisor",label:"Advisor"}],j=[{value:"any",label:"Any status"},{value:"active",label:"Active"},{value:"inactive",label:"Inactive"}];function M(s){return s.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}const x=Q(),f=D(null),C=D(!1);function O(s){f.value=s}async function R(){const s=f.value;if(!(!s||C.value)){C.value=!0;try{await $fetch(`/api/admin/members/${s.id}`,{method:"DELETE"}),x.add({title:"Deleted",icon:"i-lucide-check-circle",color:"success"}),await z(),f.value=null}catch(e){const r=e?.statusMessage||"Delete failed";x.add({title:r,icon:"i-lucide-alert-triangle",color:"error"})}finally{C.value=!1}}}const i=D(null),w=D(!1);function S(s){o.count.value&&(i.value={kind:s,count:o.count.value})}async function I(){if(!i.value||w.value)return;const s=Array.from(o.selected.value);w.value=!0;try{if(i.value.kind==="delete")await $fetch("/api/admin/members/bulk-delete",{method:"POST",body:{ids:s}}),x.add({title:`Deleted ${s.length} member(s)`,color:"success",icon:"i-lucide-check-circle"});else{const e=i.value.kind==="activate";await $fetch("/api/admin/members/bulk-set-active",{method:"POST",body:{ids:s,active:e}}),x.add({title:`${e?"Activated":"Deactivated"} ${s.length} member(s)`,color:"success",icon:"i-lucide-check-circle"})}o.clear(),i.value=null,await z()}catch(e){const r=e?.statusMessage||"Action failed";x.add({title:r,color:"error",icon:"i-lucide-alert-triangle"})}finally{w.value=!1}}function k(s){return B.value.column!==s?"i-lucide-chevrons-up-down":B.value.direction==="asc"?"i-lucide-chevron-up":"i-lucide-chevron-down"}return(s,e)=>{const r=Z,A=ee("RouterLink"),U=ae,K=re,q=de,g=te,N=ue;return c(),y("div",me,[l("header",pe,[e[18]||(e[18]=l("div",null,[l("h1",{class:"text-2xl font-display font-semibold"},"Members"),l("p",{class:"mt-1 text-sm text-muted"},"Partners, team, and advisors shown on the public Team page.")],-1)),a(A,{to:"/admin/members/new"},{default:d(()=>[a(r,{color:"primary",variant:"solid",icon:"i-lucide-plus"},{default:d(()=>[...e[17]||(e[17]=[u("New member",-1)])]),_:1})]),_:1})]),a(K,{search:t(_),placeholder:"Search name or titleâ¦","onUpdate:search":e[2]||(e[2]=n=>_.value=n)},{default:d(()=>[a(U,{modelValue:t(m).type,"onUpdate:modelValue":e[0]||(e[0]=n=>t(m).type=n),items:P,"value-key":"value"},null,8,["modelValue"]),a(U,{modelValue:t(m).status,"onUpdate:modelValue":e[1]||(e[1]=n=>t(m).status=n),items:j,"value-key":"value"},null,8,["modelValue"])]),_:1},8,["search"]),a(q,{total:t($).length,"selected-count":t(o).count.value,onSelectAll:e[6]||(e[6]=n=>t(o).selectAllVisible()),onClear:e[7]||(e[7]=n=>t(o).clear())},{default:d(()=>[a(r,{icon:"i-lucide-check",color:"neutral",variant:"outline",size:"xs",disabled:!t(o).count.value,onClick:e[3]||(e[3]=n=>S("activate"))},{default:d(()=>[...e[19]||(e[19]=[u(" Activate ",-1)])]),_:1},8,["disabled"]),a(r,{icon:"i-lucide-x",color:"neutral",variant:"outline",size:"xs",disabled:!t(o).count.value,onClick:e[4]||(e[4]=n=>S("deactivate"))},{default:d(()=>[...e[20]||(e[20]=[u(" Deactivate ",-1)])]),_:1},8,["disabled"]),a(r,{icon:"i-lucide-trash-2",color:"error",variant:"outline",size:"xs",disabled:!t(o).count.value,onClick:e[5]||(e[5]=n=>S("delete"))},{default:d(()=>[...e[21]||(e[21]=[u(" Delete ",-1)])]),_:1},8,["disabled"])]),_:1},8,["total","selected-count"]),t($).length?(c(),y("div",ve,[l("table",fe,[l("thead",ye,[l("tr",null,[l("th",be,[l("input",{type:"checkbox",checked:t(o).headerState.value==="all",indeterminate:t(o).headerState.value==="some",onChange:e[8]||(e[8]=n=>t(o).headerState.value==="all"?t(o).clear():t(o).selectAllVisible())}
1,null,40,xe)]),e[27]||(e[27]=l("th",{class:"px-3 py-3 font-medium w-14"}," Photo ",-1)),l("th",{class:"px-4 py-3 font-medium cursor-pointer select-none",onClick:e[9]||(e[9]=n=>t(b)("name"))},[e[22]||(e[22]=u(" Name ",-1)),a(g,{name:k("name"),class:"size-3 inline"},null,8,["name"])]),l("th",{class:"px-4 py-3 font-medium cursor-pointer select-none",onClick:e[10]||(e[10]=n=>t(b)("type"))},[e[23]||(e[23]=u(" Type ",-1)),a(g,{name:k("type"),class:"size-3 inline"},null,8,["name"])]),l("th",{class:"px-4 py-3 font-medium cursor-pointer select-none",onClick:e[11]||(e[11]=n=>t(b)("title"))},[e[24]||(e[24]=u(" Title ",-1)),a(g,{name:k("title"),class:"size-3 inline"},null,8,["name"])]),l("th",{class:"px-4 py-3 font-medium cursor-pointer select-none",onClick:e[12]||(e[12]=n=>t(b)("order"))},[e[25]||(e[25]=u(" Order ",-1)),a(g,{name:k("order"),class:"size-3 inline"},null,8,["name"])]),l("th",{class:"px-4 py-3 font-medium cursor-pointer select-none",onClick:e[13]||(e[13]=n=>t(b)("active"))},[e[26]||(e[26]=u(" Status ",-1)),a(g,{name:k("active"),class:"size-3 inline"},null,8,["name"])]),e[28]||(e[28]=l("th",{class:"px-4 py-3 font-medium text-right"}," Actions ",-1))])]),l("tbody",null,[(c(!0),y(W,null,X(t($),n=>(c(),y("tr",{key:n.id,class:"border-t border-default hover:bg-elevated/40 transition-colors"},[l("td",ke,[l("input",{type:"checkbox",checked:t(o).isSelected(n.id),onChange:J=>t(o).toggle(n.id)},null,40,ge)]),l("td",he,[l("div",_e,[n.pictureKey&&t(V)(n.pictureKey)?(c(),y("img",{key:0,src:t(V)(n.pictureKey),alt:n.name,class:"max-w-full max-h-full object-cover rounded",loading:"lazy"},null,8,$e)):(c(),y("span",Ce,p(M(n.name)),1))])]),l("td",we,[a(A,{to:`/admin/members/${n.id}`,class:"hover:text-brand-500 font-medium"},{default:d(()=>[u(p(n.name),1)]),_:2},1032,["to"]),l("p",Ae,p(n.slug),1)]),l("td",De,[l("span",Se,p(L[n.type]),1)]),l("td",Te,p(n.title?.en||"â"),1),l("td",ze,p(n.order),1),l("td",Ve,[l("span",{class:se(["px-2 py-0.5 rounded-full text-xs",n.active?"bg-brand-50 text-brand-700":"bg-elevated text-muted"])},p(n.active?"Active":"Inactive"),3)]),l("td",Be,[l("div",Ue,[a(A,{to:`/admin/members/${n.id}`},{default:d(()=>[a(r,{icon:"i-lucide-edit",color:"neutral",variant:"ghost",size:"xs","aria-label":"Edit"})]),_:1},8,["to"]),a(r,{icon:"i-lucide-trash-2",color:"error",variant:"ghost",size:"xs","aria-label":"Delete",onClick:J=>O(n)},null,8,["onClick"])])])]))),128))])])])):(c(),y("div",Ne,[l("p",Fe,p(t(v)&&t(v).length?"No members match the current filters.":"No members yet."),1),t(v)&&t(v).length&&(t(_)||t(m).type!=="any"||t(m).status!=="any")?(c(),F(r,{key:0,class:"mt-3",color:"neutral",variant:"ghost",onClick:e[14]||(e[14]=n=>{_.value="",t(m).type="any",t(m).status="any"})},{default:d(()=>[...e[29]||(e[29]=[u(" Reset filters ",-1)])]),_:1})):!t(v)||!t(v).length?(c(),F(A,{key:1,to:"/admin/members/new",class:"inline-block mt-3"},{default:d(()=>[a(r,{color:"primary",variant:"solid",icon:"i-lucide-plus"},{default:d(()=>[...e[30]||(e[30]=[u(" Create the first member ",-1)])]),_:1})]),_:1})):Y("",!0)])),a(N,{open:!!t(f),title:t(f)?`Delete ${t(f).name}?`:"",message:"This cannot be undone.","confirm-label":"Delete",variant:"danger",loading:t(C),"onUpdate:open":e[15]||(e[15]=n=>{n||(f.value=null)}),onConfirm:R},null,8,["open","title","loading"]),a(N,{open:!!t(i),title:t(i)?`${t(i).kind==="delete"?"Delete":t(i).kind==="activate"?"Activate":"Deactivate"} ${t(i).count} member${t(i).count===1?"":"s"}?`:"",message:t(i)?.kind==="delete"?"This cannot be undone.":"This will be reflected on the public site after the next publish.","confirm-label":t(i)?.kind==="delete"?"Delete":t(i)?.kind==="activate"?"Activate":"Deactivate",variant:t(i)?.kind==="delete"?"danger":"default",loading:t(w),"onUpdate:open":e[16]||(e[16]=n=>{n||(i.value=null)}),onConfirm:I},null,8,["open","title","message","confirm-label","variant","loading"])])}}});export{He as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.