1import{u as H}from"./eventStore-B0ynicFl.js";import{_ as J,h as K,z as d,A as W,o as r,c as i,a as s,i as X,b as D,p as Z,j as l,t as u,F as ee,r as te,d as O,k as p,l as v,e as w}from"./index-D8GvWgwI.js";import"./useSafeMarked-CFTK_15D.js";import"./marked.esm-C4n1i0vC.js";const ne={class:"flex justify-content-between align-items-center mb-4"},se={class:"flex gap-2"},ae={key:0,class:"flex justify-content-center py-6"},oe={key:1,class:"text-center py-6 surface-ground border-round-lg"},le={key:2},re={class:"flex flex-wrap gap-3 mb-3"},ie={class:"flex align-items-center gap-2 px-3 py-2 surface-ground border-round"},ce={class:"text-sm font-semibold"},de={class:"text-sm"},ue={key:0,class:"flex align-items-center gap-2 px-3 py-2 surface-ground border-round"},pe={class:"text-sm"},me={class:"flex flex-column sm:flex-row flex-wrap gap-2 mb-3"},_e={class:"font-semibold"},ve={class:"text-xs text-500 tw-break-all"},ye={class:"text-600 text-xs"},fe={key:0,class:"font-semibold"},ge={key:1,class:"text-500"},he={key:0,class:"flex align-items-center gap-1"},xe={class:"text-xs text-600"},be={key:1,class:"text-400"},ke={__name:"EventParticipants",props:{eventId:{type:String,required:!0}},setup(R,{expose:U}){const V=R,B=H(),c=v([]),g=v(!0),h=v(""),x=v(null),b=v(null),I=v("registered_at"),T=v(-1),E=[{label:"Confirmed",value:"confirmed"},{label:"Pending",value:"pending"},{label:"Cancelled",value:"cancelled"},{label:"Refunded",value:"refunded"}],N=w(()=>{const t=new Set(c.value.map(e=>e.ticket_type));return Array.from(t).sort().map(e=>({label:e,value:e}))}),A=w(()=>{const t={};for(const e of c.value)t[e.ticket_type]=(t[e.ticket_type]||0)+1;return Object.entries(t).map(([e,a])=>({type:e,count:a}))}),P=w(()=>c.value.filter(t=>t.checked_in).length),L=w(()=>{let t=c.value;if(h.value.trim()){const e=h.value.toLowerCase();t=t.filter(a=>a.name.toLowerCase().includes(e)||a.email.toLowerCase().includes(e))}return x.value&&(t=t.filter(e=>e.status===x.value)),b.value&&(t=t.filter(e=>e.ticket_type===b.value)),t}),q=t=>{I.value=t.sortField,T.value=t.sortOrder},S=async()=>{g.value=!0;try{const t=await B.getEventTickets(V.eventId,null);c.value=(t.items||[]).map(e=>{var y;const a=(y=e.expand)==null?void 0:y.user;return{id:e.id,name:(a==null?void 0:a.name)||(a==null?void 0:a.username)||e.guest_name||"Guest",email:(a==null?void 0:a.email)||e.guest_email||e.customer_email||"â",ticket_type:e.ticket_type,quantity:e.quantity,status:e.status,registered_at:e.purchased_at||e.created,amount_paid:e.amount_paid||0,currency:e.currency||"USD",checked_in:e.checked_in||!1,checked_in_at:e.checked_in_at}})}catch(t){console.error("Error loading participants:",t),c.value=[]}finally{g.value=!1}},k=t=>t?new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}):"â",j=t=>({confirmed:"Confirmed",pending:"Pending",cancelled:"Cancelled",refunded:"Refunded",pending_approval:"Pending Approval",approved:"Approved",rejected:"Rejected"})[t]||t,z=t=>({confirmed:"success",approved:"success",pending:"warning",pending_approval:"warning",cancelled:"danger",rejected:"danger",refunded:"info"})[t]||"secondary",Q=(t,e)=>new Intl.NumberFormat("en-US",{style:"currency",currency:e||"USD"}).format(t),$=()=>{const t=["Name","Email","Ticket Type","Quantity","Status","Registered","Amount Paid","Currency","Checked In","Checked In At"],e=o=>{if(o==null)return"";const m=String(o);return m.includes(",")||m.includes('"')||m.includes(` 2`)?`"${m.replace(/"/g,'""')}"`:m},a=c.value.map(o=>[o.name,o.email,o.ticket_type,o.quantity,j(o.status),k(o.registered_at),o.amount_paid,o.currency,o.checked_in?"Yes":"No",o.checked_in_at?k(o.checked_in_at):""]),y=[t.map(e).join(","),...a.map(o=>o.map(e).join(","))].join(` 3`),C=new Blob([y],{type:"text/csv;charset=utf-8;"}),f=document.createElement("a");f.href=URL.createObjectURL(C),f.download=`participants-${V.eventId}-${new Date().toISOString().split("T")[0]}.csv`,f.click(),URL.revokeObjectURL(f.href)};return K(()=>{S()}),U({refresh:S}),(t,e)=>{const a=d("Button"),y=d("ProgressSpinner"),C=d("InputIcon"),f=d("InputText"),o=d("IconField"),m=d("Select"),_=d("Column"),F=d("Tag"),G=d("Badge"),M=d("DataTable"),Y=W("tooltip");return r(),i("div",null,[s("div",ne,[e[3]||(e[3]=s("h3",{class:"m-0"},"Participants",-1)),s("div",se,[c.value.length>0?(r(),X(a,{key:0,label:"Export CSV",icon:"pi pi-download",severity:"secondary",size:"small",onClick:$})):D("",!0),Z(l(a,{icon:"pi pi-refresh",severity:"secondary",size:"small",onClick:S,loading:g.value},null,8,["loading"]),[[Y,"Refresh",void 0,{top:!0}]])])]),g.value?(r(),i("div",ae,[l(y,{style:{width:"40px",height:"40px"}})])):c.value.length===0?(r(),i("div",oe,[...e[4]||(e[4]=[s("i",{class:"pi pi-users text-4xl mb-3 block text-500"},null,-1),s("p",{class:"text-500 m-0"},"No participants yet",-1)])])):(r(),i("div",le,[s("div",re,[s("div",ie,[e[5]||
3(e[5]=s("i",{class:"pi pi-users text-primary"},null,-1)),s("span",ce,u(c.value.length)+" total",1)]),(r(!0),i(ee,null,te(A.value,n=>(r(),i("div",{key:n.type,class:"flex align-items-center gap-2 px-3 py-2 surface-ground border-round"},[e[6]||(e[6]=s("i",{class:"pi pi-ticket text-500"},null,-1)),s("span",de,[O(u(n.type)+": ",1),s("strong",null,u(n.count),1)])]))),128)),P.value>0?(r(),i("div",ue,[e[8]||(e[8]=s("i",{class:"pi pi-check-circle text-green-500"},null,-1)),s("span",pe,[e[7]||(e[7]=O("Checked in: ",-1)),s("strong",null,u(P.value),1)])])):D("",!0)]),s("div",me,[l(o,{iconPosition:"left",class:"w-full sm:flex-1 sm:tw-max-w-xs"},{default:p(()=>[l(C,{class:"pi pi-search"}),l(f,{modelValue:h.value,"onUpdate:modelValue":e[0]||(e[0]=n=>h.value=n),placeholder:"Search name or email...",class:"w-full"},null,8,["modelValue"])]),_:1}),l(m,{modelValue:x.value,"onUpdate:modelValue":e[1]||(e[1]=n=>x.value=n),options:E,optionLabel:"label",optionValue:"value",placeholder:"All statuses",showClear:"",class:"w-full sm:w-auto"},null,8,["modelValue"]),l(m,{modelValue:b.value,"onUpdate:modelValue":e[2]||(e[2]=n=>b.value=n),options:N.value,optionLabel:"label",optionValue:"value",placeholder:"All ticket types",showClear:"",class:"w-full sm:w-auto"},null,8,["modelValue","options"])]),l(M,{value:L.value,paginator:L.value.length>15,rows:15,rowsPerPageOptions:[10,15,25,50],responsiveLayout:"scroll",class:"text-sm",stripedRows:"",sortField:I.value,sortOrder:T.value,onSort:q},{default:p(()=>[l(_,{field:"name",header:"Name",sortable:!0,style:{"min-width":"150px"}},{body:p(({data:n})=>[s("div",null,[s("div",_e,u(n.name),1),s("div",ve,u(n.email),1)])]),_:1}),l(_,{field:"ticket_type",header:"Ticket Type",sortable:!0,style:{"min-width":"110px"}},{body:p(({data:n})=>[l(F,{value:n.ticket_type,severity:"info"},null,8,["value"])]),_:1}),l(_,{field:"quantity",header:"Qty",sortable:!0,style:{"min-width":"70px","text-align":"center"}},{body:p(({data:n})=>[l(G,{value:n.quantity,severity:"secondary"},null,8,["value"])]),_:1}),l(_,{field:"status",header:"Status",sortable:!0,style:{"min-width":"120px"}},{body:p(({data:n})=>[l(F,{value:j(n.status),severity:z(n.status)},null,8,["value","severity"])]),_:1}),l(_,{field:"registered_at",header:"Registered",sortable:!0,style:{"min-width":"140px"}},{body:p(({data:n})=>[s("span",ye,u(k(n.registered_at)),1)]),_:1}),l(_,{field:"amount_paid",header:"Paid",sortable:!0,style:{"min-width":"90px"}},{body:p(({data:n})=>[n.amount_paid>0?(r(),i("span",fe,u(Q(n.amount_paid,n.currency)),1)):(r(),i("span",ge,"Free"))]),_:1}),l(_,{field:"checked_in",header:"Check-in",sortable:!0,style:{"min-width":"100px"}},{body:p(({data:n})=>[n.checked_in?(r(),i("div",he,[e[9]||(e[9]=s("i",{class:"pi pi-check-circle text-green-500"},null,-1)),s("span",xe,u(k(n.checked_in_at)),1)])):(r(),i("span",be,"â"))]),_:1})]),_:1},8,["value","paginator","sortField","sortOrder"])]))])}}},Ie=J(ke,[["__scopeId","data-v-b5ad2371"]]);export{Ie 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.