1import{j as e}from"./vendor-ui-CRQIGnoB.js";import{u as w,r as o}from"./vendor-react--DiKkAFz.js";import{supabase as u}from"./client-D7mlWhIv.js";import{u as b}from"./useAdminRole-CHXnWkJv.js";import{u as l}from"./index-rh__xJsb.js";import{L as g}from"./loader-circle-_eZHlf3P.js";import{A as k}from"./arrow-left-CgsGrqs4.js";import{C as p}from"./calendar-D8VBoCoj.js";import{U as F}from"./user-BTW-69R4.js";import{M as y}from"./mail-TrW3aJzW.js";import{T as _}from"./trash-2-B15HZ70d.js";import{B as L}from"./briefcase-DMsuGxE4.js";import{T as S}from"./target-Cdg_rrt0.js";import{M as B}from"./message-square-BbhJeTrn.js";import{f as A}from"./formatDistanceToNow-CsdTfblx.js";import"./vendor-supabase-ClyXdaUN.js";import"./AuthContext-Bw19ogwi.js";import"./index-DKzuHz-e.js";import"./vendor-three-DHH5iuE3.js";import"./vendor-query-CUxQGtou.js";import"./vendor-meta-Ci6Y53GW.js";import"./getRoundingMethod-DYkx5ZA_.js";import"./format-CoscEkXf.js";import"./compareAsc-CRQVCqaw.js";import"./endOfMonth-Cskn1pDQ.js";const C={solo:"Solo founder or creator",small_team:"Small team (2-10)",growing:"Growing company (10+)",agency:"Agency or freelance"},D={leads:"Finding qualified leads",outreach:"Writing personalized outreach",inbox:"Inbox & follow-up management",workspaces:"Team workspaces & collaboration",crm:"CRM & pipeline tracking",other:"Other"};function oe(){const{isAdmin:r,loading:i}=b(),n=w(),[a,d]=o.useState([]),[h,c]=o.useState(!0),[m,x]=o.useState(null);o.useEffect(()=>{!i&&!r&&n("/")},[r,i,n]);const f=async()=>{c(!0);const{data:s,error:t}=await u.from("demo_bookings").select("*").order("created_at",{ascending:!1});t?(l.error("Failed to load bookings"),console.error(t)):d(s??[]),c(!1)};o.useEffect(()=>{r&&f()},[r]);const j=async s=>{if(!confirm("Delete this booking? This cannot be undone."))return;x(s);const{error:t}=await u.from("demo_bookings").delete().eq("id",s);if(x(null),t){l.error("Failed to delete");return}d(N=>N.filter(v=>v.id!==s)),l.success("Booking deleted")};return i||h?e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(g,{className:"w-8 h-8 animate-spin text-primary"})}):r?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>n("/admin"),className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-2 transition-colors",children:[e.jsx(k,{className:"w-4 h-4"})," Back to admin"]}),e.jsxs("h1",{className:"text-3xl font-bold text-foreground flex items-center gap-3",children:[e.jsx(p,{className:"w-8 h-8 text-[#5271FF]"}),"Demo bookings"]}),e.jsxs("p",{className:"text-muted-foreground mt-1",children:[a.length," ",a.length===1?"booking":"bookings"," received"]})]}),e.jsx("button",{onClick:f,className:"px-4 py-2 rounded-lg border border-border bg-background hover:bg-accent text-sm transition-colors",children:"Refresh"})]}),a.length===0?e.jsxs("div",{className:"rounded-2xl border border-dashed border-border p-16 text-center",children:[e.jsx(p,{className:"w-12 h-12 mx-auto text-muted-foreground/40 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No demo bookings yet."})]}):e.jsx("div",{className:"space-y-4",children:a.map(s=>e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-6 hover:border-[#5271FF]/40 transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(F,{className:"w-4 h-4 text-[#5271FF]"}),s.first_name," ",s.last_name,e.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground uppercase tracking-wide",children:s.language})]}),e.jsxs("a",{href:`mailto:${s.email}`,className:"mt-1 inline-flex items-center gap-2 text-sm text-[#5271FF] hover:underline",children:[e.jsx(y,{className:"w-3.5 h-3.5"}),s.email]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:A(new Date(s.created_at),{addSuffix:!0})}),e.jsx("button",{onClick:()=>j(s.id),disabled:m===s.id,className:"p-2 rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-40",title:"Delete booking",children:m===s.id?e.jsx(g,{className:"w-4 h-4 animate-spin"}):e.jsx(_,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[s.role&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(L,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Role"}),e.jsx("div",{className:"text-foreground",children:C[s.role]??s.role})]})]}),s.focus.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(S,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Focus"}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:s.focus.map(t=>e.jsx("span",{className:"inline-flex items-center rounded-full bg-[#5271FF]/10 border border-[#5271FF]/30 px-2.5 py-0.5 text-xs text-foreground",children:D[t]??t},t))})]})]}),s.other_text&&e.jsxs("div",{className:"flex items-start gap-2 md:col-span-2",children:[e.jsx(B,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Notes"}),e.jsx("div",{className:"text-foreground whitespace-pre-wrap",children:s.other_text})]})]})]})]},s.id))})]}):null}export{oe 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.