1import{r as o,g as m,s as L,j as e,C as $,d as z,e as G,i as H,k as K,N as u,O as h,Q as f,V as j,W as n,B as Q,a3 as W,a as Y,a0 as Z,I as J,M as w,Z as C,F as E,K as R,G as r,a5 as X}from"./index-DnJAoyDB.js";function se(){const[T,B]=o.useState([]),[x,b]=m("board:confRegs:conferenceId",""),[l,F]=o.useState([]),[M,g]=o.useState(!0),[S,V]=m("board:confRegs:search",""),[_,O]=m("board:confRegs:payment","all"),[y,I]=m("board:confRegs:tier","all"),[v,A]=m("board:confRegs:event","all");o.useEffect(()=>{L.from("conferences").select("id, title").order("start_date",{ascending:!1}).then(({data:s})=>{s&&(B(s),b(a=>a&&s.some(i=>i.id===a)?a:s.length>0?s[0].id:"")),g(!1)})},[]),o.useEffect(()=>{x&&(g(!0),L.from("conference_registrations").select("id, email, first_name, last_name, tier_type, event_type, price_paid, payment_status, payment_method, created_at").eq("conference_id",x).eq("is_demo",!1).order("created_at",{ascending:!1}).then(({data:s})=>{s&&F(s),g(!1)}))},[x]);const c=l.filter(s=>{const a=S.toLowerCase(),i=!a||s.email.toLowerCase().includes(a)||s.first_name.toLowerCase().includes(a)||s.last_name.toLowerCase().includes(a),N=_==="all"||s.payment_status===_,d=y==="all"||s.tier_type===y,t=v==="all"||s.event_type===v;return i&&N&&d&&t}),D=[...new Set(l.map(s=>s.tier_type).filter(Boolean))].sort(),P=[...new Set(l.map(s=>s.event_type).filter(Boolean))].sort(),p={total:l.length,paid:l.filter(s=>s.payment_status==="paid").length,revenue:l.filter(s=>s.payment_status==="paid").reduce((s,a)=>s+a.price_paid,0)},k=()=>{const s=["Îνομα","ÎÏÏÎ½Ï Î¼Î¿","Email","ÎαÏηγοÏία","ÎκδήλÏÏη","Τιμή","ΠληÏÏμή","Îμ/νία"],a=c.map(t=>[t.first_name,t.last_name,t.email,w[t.tier_type]||t.tier_type,C[t.event_type]||t.event_type,t.price_paid.toString(),X[t.payment_status]||t.payment_status,E(new Date(t.created_at),"d/M/yyyy",{locale:R})]),i=[s,...a].map(t=>t.map(U=>`"${U.replace(/"/g,'""')}"`).join(",")).join(` 2`),N=new Blob(["\uFEFF"+i],{type:"text/csv;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(N),d.download=`registrations-${E(new Date,"yyyy-MM-dd")}.csv`,d.click()},q=s=>{switch(s){case"paid":return e.jsx(r,{className:"bg-success text-success-foreground text-xs",children:"ΠληÏÏμÎνη"});case"pending_transfer":return e.jsx(r,{className:"bg-warning text-warning-foreground text-xs",children:"Îναμονή"});case"cancelled":return e.jsx(r,{variant:"destructive",className:"text-xs",children:"ÎÎºÏ ÏÏμÎνη"});default:return e.jsx(r,{variant:"secondary",className:"text-xs",children:"ÎκκÏεμήÏ"})}};return e.jsxs($,{children:[e.jsx(z,{className:"pb-3",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsxs(G,{className:"flex items-center gap-2 text-lg",children:[e.jsx(H,{className:"h-5 w-5"}),"ÎγγÏαÏÎÏ Î£Ï Î½ÎµÎ´ÏÎ¯Î¿Ï "]}),e.jsxs(K,{children:["ΣÏνολο: ",p.total," | ΦιλÏÏαÏιÏμÎνεÏ: ",c.length," | ΠληÏÏμÎνεÏ: ",p.paid," | ÎÏοδα: ",p.revenue,"â¬"]})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(u,{value:x,onValueChange:b,children:[e.jsx(h,{className:"w-full sm:w-[200px]",children:e.jsx(f,{placeholder:"Î£Ï Î½ÎδÏιο"})}),e.jsx(j,{children:T.map(s=>e.jsx(n,{value:s.id,children:s.title},s.id))})]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:k,children:[e.jsx(W,{className:"h-4 w-4 mr-1"}),"CSV"]})]})]})}),e.jsxs(Y,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(Z,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(J,{placeholder:"ÎναζήÏηÏη...",value:S,onChange:s=>V(s.target.value),className:"pl-9"})]}),e.jsxs(u,{value:y,onValueChange:I,children:[e.jsx(h,{className:"w-full sm:w-[180px]",children:e.jsx(f,{placeholder:"ÎαÏηγοÏία"})}),e.jsxs(j,{children:[e.jsx(n,{value:"all",children:"ÎÎ»ÎµÏ Î¿Î¹ καÏηγοÏίεÏ"}),D.map(s=>e.jsx(n,{value:s,children:w[s]||s},s))]})]}),e.jsxs(u,{value:v,onValueChange:A,children:[e.jsx(h,{className:"w-full sm:w-[180px]",children:e.jsx(f,{placeholder:"ÎÎ¯Î´Î¿Ï ÎµÎºÎ´Î®Î»ÏÏηÏ"})}),e.jsxs(j,{children:[e.jsx(n,{value:"all",children:"Îλα Ïα είδη"}),P.map(s=>e.jsx(n,{value:s,children:C[s]||s},s))]})]}),e.jsxs(u,{value:_,onValueChange:O,children:[e.jsx(h,{className:"w-full sm:w-[160px]",children:e.jsx(f,{placeholder:"ΠληÏÏμή"})}),e.jsxs(j,{children:[e.jsx(n,{value:"all",children:"ÎλεÏ"}),e.jsx(n,{value:"pending",children:"ÎκκÏεμείÏ"}),e.jsx(n,{value:"paid",children:"ΠληÏÏμÎνεÏ"}),e.jsx(n,{value:"pending_transfer",children:"Îναμονή μεÏαÏοÏάÏ"})]})]})]}),M?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):c.length===0?e.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Îεν βÏÎθηκαν εγγÏαÏÎÏ."}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["ÎμÏανίζονÏαι ",e.jsx("span",{className:"font-semibold text-foreground",children:c.length})," αÏÏ ",p.total," εγγÏαÏÎÏ"]}),e.jsx("div",{className:"space-y-2",children:c.map(s=>e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 p-3 rounded-lg border bg-card hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"font-medium text-sm",children:[s.last_name," ",s.first_name]}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.email}),e.jsx("p",{className:"text-xs text-muted-foreground",children:E(new Date(s.created_at),"d MMM yyyy",{locale:R})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(r,{variant:"outline",className:"text-xs",children:w[s.tier_type]||s.tier_type}),e.jsx(r,{variant:"outline",className:"text-xs",children:C[s.event_type]||s.event_type}),e.jsxs("span",{className:"text-xs font-medium",children:[s.price_paid,"â¬"]}),q(s.payment_status)]})]},s.id))})]})]})]})}export{se as BoardConferenceRegistrations};
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.