1import{r as a,j as e}from"./vendor-react-Ca1Y_V7A.js";import{e as i,s as m,L as n}from"./index-BfnJTNAL.js";import{C as o,E as x}from"./CompteLayout-5BGLlb2y.js";import"./log-out-C0YwZZcg.js";const p={unpaid:"En attente",partial:"Acompte réglé",paid:"Réglé",refunded:"Remboursé"};function g(){const{user:s}=i(),[r,d]=a.useState([]),[l,c]=a.useState(!0);return a.useEffect(()=>{s&&(async()=>{const{data:t}=await m.from("ec_orders").select("id, reference, created_at, total_amount, payment_status, status").eq("user_id",s.id).order("created_at",{ascending:!1});d(t??[]),c(!1)})()},[s]),e.jsx(o,{kicker:"Historique",title:"Mes commandes",children:l?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Chargementâ¦"}):r.length===0?e.jsxs(x,{children:["Aucune commande pour l'instant."," ",e.jsx(n,{to:"/prepas",className:"underline underline-offset-4 text-foreground",children:"Explorer les stages"}),"."]}):e.jsx("div",{className:"border border-border/60 rounded-xl overflow-hidden bg-background",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/40 text-[11px] uppercase tracking-widest text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-5 py-3",children:"Référence"}),e.jsx("th",{className:"text-left px-5 py-3",children:"Date"}),e.jsx("th",{className:"text-left px-5 py-3",children:"Paiement"}),e.jsx("th",{className:"text-right px-5 py-3",children:"Total"}),e.jsx("th",{className:"px-5 py-3"})]})}),e.jsx("tbody",{children:r.map(t=>e.jsxs("tr",{className:"border-t border-border/60",children:[e.jsx("td",{className:"px-5 py-4 font-medium",children:t.reference??t.id.slice(0,8)}),e.jsx("td",{className:"px-5 py-4 text-muted-foreground",children:new Date(t.created_at).toLocaleDateString("fr-FR")}),e.jsx("td",{className:"px-5 py-4",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${t.payment_status==="paid"?"bg-emerald-500":"bg-amber-500"}`}),p[t.payment_status]??t.payment_status]})}),e.jsx("td",{className:"px-5 py-4 text-right font-medium",children:new Intl.NumberFormat("fr-FR",{style:"currency",currency:"EUR"}).format(t.total_amount)}),e.jsx("td",{className:"px-5 py-4 text-right",children:e.jsx(n,{to:`/prepas/confirmation/${t.id}`,className:"text-xs underline underline-offset-4",children:"Détails"})})]},t.id))})]})})})}export{g 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.