1import{r as w,b as _,j as e,am as S}from"./vendor-react-core-_0sZDOLQ.js";import{B as C,b as D}from"./index-j07E1qHv.js";import{C as q,a as A}from"./card-DHmBnTdH.js";import{B as L}from"./badge-BXqwvh8U.js";import{T as I,a as R,b as n}from"./tabs-BUF6w8PE.js";import{D as V,b as z,c as E,d as K}from"./dialog-C9ty4md6.js";import{h as o}from"./vendor-utils-BRu4i-LD.js";import{m as T}from"./vendor-framer-motion-C1oRD-X5.js";import{T as B,a4 as O,a3 as P,l as F,Z as G,aN as U,bb as X}from"./vendor-lucide-Ddz0eB7N.js";import"./vendor-radix-CFmJ1img.js";import"./vendor-supabase-Ca6cp8v2.js";const Z={pending:{label:"Pagamento Pendente",icon:F,color:"bg-yellow-100 text-yellow-800"},paid:{label:"Pago",icon:P,color:"bg-green-100 text-green-800"},validated:{label:"Validado",icon:P,color:"bg-blue-100 text-blue-800"},cancelled:{label:"Cancelado",icon:O,color:"bg-red-100 text-red-800"}},k={vip:"VIP",bancada:"Bancada",geral:"Geral"};function de(){var x,h,g,p,j,b;const[s,c]=w.useState(null),[i,Y]=w.useState("all"),{data:r}=_({queryKey:["current-user"],queryFn:()=>D.auth.me()}),{data:M,isLoading:H}=_({queryKey:["my-tickets"],queryFn:()=>D.entities.TicketPurchase.filter({buyer_email:r==null?void 0:r.email}),initialData:[],enabled:!!r}),m=M.filter(a=>{var t,l;return i==="all"?!0:i==="upcoming"?new Date((t=a.match_details)==null?void 0:t.match_date)>new Date&&a.status!=="cancelled":i==="past"?new Date((l=a.match_details)==null?void 0:l.match_date)<new Date||a.status==="validated":!0});return e.jsxs("main",{className:"min-h-screen bg-gray-50",children:[e.jsx("section",{className:"bg-gradient-to-br from-faf-blue via-faf-blue-light to-faf-blue-dark py-20",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs(T.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"text-center text-white",children:[e.jsx(B,{className:"w-16 h-16 mx-auto mb-4"}),e.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4",children:"Os Meus Bilhetes"}),e.jsx("p",{className:"text-xl text-white/90",children:"Gerencie todos os seus bilhetes digitais"})]})})}),e.jsx("section",{className:"py-8 bg-white border-b sticky top-20 z-30",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsx(I,{value:i,onValueChange:Y,children:e.jsxs(R,{className:"grid w-full max-w-md mx-auto grid-cols-3",children:[e.jsx(n,{value:"all",children:"Todos"}),e.jsx(n,{value:"upcoming",children:"Próximos"}),e.jsx(n,{value:"past",children:"Anteriores"})]})})})}),e.jsx("section",{className:"py-12",children:e.jsx("div",{className:"container mx-auto px-4",children:H?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((a,t)=>e.jsx("div",{className:"bg-white rounded-xl h-64 animate-pulse"},t))}):m.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:m.map((a,t)=>{var u,N,y,f,v;const l=Z[a.status],d=l.icon;return e.jsx(T.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:t*.05},children:e.jsxs(q,{className:"overflow-hidden hover:shadow-xl transition-shadow cursor-pointer",onClick:()=>c(a),children:[e.jsxs("div",{className:"bg-gradient-to-br from-red-600 to-yellow-600 p-6 text-white",children:[e.jsxs(L,{className:`${l.color} mb-3`,children:[e.jsx(d,{className:"w-3 h-3 mr-1"}),l.label]}),e.jsxs("h3",{className:"text-xl font-bold mb-2",children:[(u=a.match_details)==null?void 0:u.home_team," vs ",(N=a.match_details)==null?void 0:N.away_team]}),e.jsx("p",{className:"text-white/80 text-sm",children:(y=a.match_details)==null?void 0:y.competition})]}),e.jsxs(A,{className:"p-6 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[e.jsx(G,{className:"w-4 h-4"}),o((f=a.match_details)==null?void 0:f.match_date).format("DD/MM/YYYY HH:mm")]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[e.jsx(U,{className:"w-4 h-4"}
1),(v=a.match_details)==null?void 0:v.venue]}),e.jsxs("div",{className:"pt-3 border-t flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Tipo"}),e.jsx("p",{className:"font-bold text-gray-900",children:k[a.ticket_type]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Preço"}),e.jsxs("p",{className:"font-bold text-red-600",children:[a.price.toLocaleString("pt-AO")," Kz"]})]})]}),e.jsxs(C,{className:"w-full bg-red-600 hover:bg-red-700",onClick:Q=>{Q.stopPropagation(),c(a)},children:[e.jsx(X,{className:"w-4 h-4 mr-2"}),"Ver QR Code"]})]})]})},a.id)})}):e.jsxs("div",{className:"text-center py-20",children:[e.jsx(B,{className:"w-20 h-20 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Nenhum bilhete encontrado"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"Compre bilhetes para os próximos jogos"}),e.jsx(C,{className:"bg-red-600 hover:bg-red-700",onClick:()=>window.location.href=createPageUrl("Ticketing"),children:"Ir para Bilheteira"})]})})}),s&&e.jsx(V,{open:!!s,onOpenChange:()=>c(null),children:e.jsxs(z,{className:"max-w-md",children:[e.jsx(E,{children:e.jsx(K,{children:"Bilhete Digital"})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gradient-to-br from-red-600 to-yellow-600 p-6 text-white rounded-lg text-center",children:[e.jsxs("h3",{className:"text-xl font-bold mb-1",children:[(x=s.match_details)==null?void 0:x.home_team," vs ",(h=s.match_details)==null?void 0:h.away_team]}),e.jsx("p",{className:"text-white/80 text-sm",children:(g=s.match_details)==null?void 0:g.competition})]}),e.jsxs("div",{className:"bg-white p-6 rounded-lg border-2 border-dashed border-gray-300",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(S,{value:s.ticket_code,size:200})}),e.jsx("p",{className:"text-center text-sm text-gray-600 mb-2",children:"Código do Bilhete"}),e.jsx("p",{className:"text-center font-mono text-lg font-bold text-gray-900",children:s.ticket_code})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-600",children:"Data"}),e.jsx("p",{className:"font-bold text-gray-900",children:o((p=s.match_details)==null?void 0:p.match_date).format("DD/MM/YYYY")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-600",children:"Hora"}),e.jsx("p",{className:"font-bold text-gray-900",children:o((j=s.match_details)==null?void 0:j.match_date).format("HH:mm")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-600",children:"Local"}),e.jsx("p",{className:"font-bold text-gray-900",children:(b=s.match_details)==null?void 0:b.venue})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-600",children:"Tipo"}),e.jsx("p",{className:"font-bold text-gray-900",children:k[s.ticket_type]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-600",children:"Setor"}),e.jsx("p",{className:"font-bold text-gray-900",children:s.sector})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-600",children:"Quantidade"}),e.jsx("p",{className:"font-bold text-gray-900",children:s.quantity})]})]}),e.jsxs("div",{className:"bg-blue-50 p-4 rounded-lg text-sm text-blue-900",children:[e.jsx("p",{className:"font-semibold mb-1",children:"Instruções"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsx("li",{children:"Apresente este QR code na entrada do estádio"}),e.jsx("li",{children:"Chegue com antecedência para evitar filas"}),e.jsx("li",{children:"Este bilhete é válido apenas para o jogo especificado"})]})]})]})]})})]})}export{de 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.