1import{h as i,m as d,l as e,L as r,P as p,z as u}from"./index-BGrBqgX3.js";import{f as b}from"./admin-B071YbXk.js";import{C as f}from"./calendar-days-efn_eVH2.js";import{S as j}from"./star-Cs6pxOYq.js";import{P as g}from"./pencil-C_1obQYi.js";import{T as v}from"./trash-2-w0gCniqn.js";function L(){const[c,n]=i.useState([]),[x,o]=i.useState(!0);i.useEffect(()=>{(async()=>{try{const l=[...await d.entities.Event.list("-start_date",500)||[]].sort((a,s)=>new Date(s.start_date||0)-new Date(a.start_date||0));n(l)}catch{n([])}finally{o(!1)}})()},[]);const m=async t=>{const l=t.status==="published"?"draft":"published";n(a=>a.map(s=>s.id===t.id?{...s,status:l}:s));try{await d.entities.Event.update(t.id,{status:l})}catch{n(a=>a.map(s=>s.id===t.id?{...s,status:t.status}:s)),window.alert("Status konnte nicht geändert werden.")}},h=async t=>{if(window.confirm("Event wirklich löschen?"))try{await d.entities.Event.delete(t),n(l=>l.filter(a=>a.id!==t))}catch{window.alert("Löschen fehlgeschlagen.")}};return e.jsxs("div",{className:"px-6 py-8 lg:px-10 lg:py-10",children:[e.jsxs("div",{className:"mb-8 flex flex-wrap items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-xs font-bold uppercase tracking-[.3em] text-[#E80088]",children:"Redaktion"}),e.jsx("h1",{className:"text-4xl font-black text-black",children:"Events"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(r,{to:"/admin/events/partner",className:"inline-flex min-h-11 items-center gap-2 rounded-full border border-neutral-300 bg-white px-5 text-sm font-bold text-black hover:border-[#E80088] hover:text-[#E80088]",children:[e.jsx(f,{size:16})," Partner-Events"]}),e.jsxs(r,{to:"/admin/events/new",className:"inline-flex min-h-11 items-center gap-2 rounded-full bg-[#E80088] px-5 text-sm font-bold text-white hover:bg-black",children:[e.jsx(p,{size:16})," Neu anlegen"]})]})]}),e.jsx("div",{className:"overflow-hidden rounded-2xl border border-neutral-200 bg-white",children:x?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(u,{className:"animate-spin text-neutral-400",size:24})}):c.length===0?e.jsx("div",{className:"px-6 py-16 text-center text-sm text-neutral-500",children:"Noch keine Events angelegt."}):e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-neutral-200 bg-neutral-50 text-xs uppercase tracking-wide text-neutral-500",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-5 py-3 font-bold",children:"Event"}),e.jsx("th",{className:"hidden px-5 py-3 font-bold md:table-cell",children:"Ort"}),e.jsx("th",{className:"hidden px-5 py-3 font-bold lg:table-cell",children:"Beginn"}),e.jsx("th",{className:"px-5 py-3 font-bold",children:"Status"}),e.jsx("th",{className:"px-5 py-3 text-right font-bold",children:"Aktion"})]})}),e.jsx("tbody",{className:"divide-y divide-neutral-100",children:c.map(t=>e.jsxs("tr",{className:"align-top hover:bg-neutral-50",children:[e.jsxs("td",{className:"px-5 py-4",children:[e.jsxs(r,{to:`/admin/events/${t.id}`,className:"inline-flex items-center gap-2 font-semibold text-black hover:text-[#E80088]",children:[t.featured&&e.jsx(j,{size:13,className:"text-[#E80088]",fill:"currentColor"}),t.title]}),t.category&&e.jsx("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:e.jsx("span",{className:"text-xs text-neutral-400",children:t.category})})]}),e.jsx("td",{className:"hidden px-5 py-4 text-neutral-600 md:table-cell",children:t.location||"â"}),e.jsx("td",{className:"hidden px-5 py-4 text-neutral-600 lg:table-cell",children:b(t.start_date)}),e.jsx("td",{className:"px-5 py-4",children:e.jsx("button",{onClick:()=>m(t),title:t.status==="published"?"Auf Entwurf setzen":"Freigeben",className:`rounded-full px-2.5 py-0.5 text-xs font-bold transition-opacity hover:opacity-80 ${t.status==="published"?"bg-emerald-100 text-emerald-700":"bg-amber-100 text-amber-700"}`,children:t.status==="published"?"Live":"Entwurf"})}),e.jsx("td",{className:"px-5 py-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(r,{to:`/admin/events/${t.id}`,className:"grid h-9 w-9 place-items-center rounded-full text-neutral-600 hover:bg-neutral-200 hover:text-black","aria-label":"Bearbeiten",children:e.jsx(g,{size:15})}),e.jsx("button",{onClick:()=>h(t.id),className:"grid h-9 w-9 place-items-center rounded-full text-neutral-600 hover:bg-[#
1E80088] hover:text-white","aria-label":"Löschen",children:e.jsx(v,{size:15})})]})})]},t.id))})]})})]})}export{L 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.