(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,3116,e=>{"use strict";let t=(0,e.i(75254).default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);e.s(["Clock",()=>t],3116)},83371,e=>{"use strict";var t=e.i(43476),r=e.i(71645),s=e.i(7471),a=e.i(75254);let l=(0,a.default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),d=(0,a.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var c=e.i(3116);let i={pending:"text-yellow-400 bg-yellow-400/10",fulfilled:"text-green-400 bg-green-400/10",cancelled:"text-red-400 bg-red-400/10"};function x(){let[e,a]=(0,r.useState)([]),[x,n]=(0,r.useState)(!0),o=async()=>{let{data:e}=await s.supabase.from("orders").select("*").order("created_at",{ascending:!1});a(e||[]),n(!1)};(0,r.useEffect)(()=>{o()},[]);let g=async(e,t)=>{await s.supabase.from("orders").update({status:t}).eq("id",e),o()};return(0,t.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-gray-900 tracking-tight",children:"Orders"}),(0,t.jsxs)("p",{className:"text-gray-500 text-sm mt-1",children:[e.length," total orders placed"]})]}),(0,t.jsx)("div",{className:"bg-white border border-gray-200 shadow-sm rounded-2xl overflow-hidden",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm min-w-[700px]",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"bg-gray-50/80 border-b border-gray-200",children:[(0,t.jsx)("th",{className:"text-left px-6 py-4 text-gray-500 font-semibold text-xs uppercase tracking-wider",children:"Order ID"}),(0,t.jsx)("th",{className:"text-left px-6 py-4 text-gray-500 font-semibold text-xs uppercase tracking-wider",children:"Date"}),(0,t.jsx)("th",{className:"text-left px-6 py-4 text-gray-500 font-semibold text-xs uppercase tracking-wider",children:"Total"}),(0,t.jsx)("th",{className:"text-left px-6 py-4 text-gray-500 font-semibold text-xs uppercase tracking-wider",children:"Status"}),(0,t.jsx)("th",{className:"text-right px-6 py-4 text-gray-500 font-semibold text-xs uppercase tracking-wider",children:"Actions"})]})}),(0,t.jsx)("tbody",{children:x?(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:5,className:"px-6 py-10 text-center text-gray-500",children:"Loading orders..."})}):0===e.length?(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:5,className:"px-6 py-10 text-center text-gray-500 bg-gray-50/30",children:"No orders yet."})}):e.map(e=>(0,t.jsxs)("tr",{className:"border-b border-gray-100 last:border-0 hover:bg-gray-50 transition-colors",children:[(0,t.jsxs)("td",{className:"px-6 py-4 font-mono text-xs text-gray-500 bg-gray-50/50 rounded-lg mx-2 my-2 inline-block px-3 py-1.5 border border-gray-200",children:[e.id.slice(0,8),"..."]}),(0,t.jsx)("td",{className:"px-6 py-4 text-gray-600 font-medium",children:new Date(e.created_at).toLocaleDateString()}),(0,t.jsxs)("td",{className:"px-6 py-4 text-gray-900 font-bold",children:[e.total,"€"]}),(0,t.jsx)("td",{className:"px-6 py-4",children:(0,t.jsx)("span",{className:`px-3 py-1 rounded-md text-xs font-bold ${i[e.status]||"text-gray-500 bg-gray-100"}`,children:e.status.toUpperCase()})}),(0,t.jsx)("td",{className:"px-6 py-4 text-right",children:(0,t.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,t.jsx)("button",{onClick:()=>g(e.id,"fulfilled"),title:"Mark Fulfilled",className:"p-2 rounded-xl text-gray-400 hover:text-green-600 hover:bg-green-50 transition-colors",children:(0,t.jsx)(l,{className:"w-5 h-5"})}),(0,t.jsx)("button",{onClick:()=>g(e.id,"pending"),title:"Mark Pending",className:"p-2 rounded-xl text-gray-400 hover:text-yellow-600 hover:bg-yellow-50 transition-colors",children:(0,t.jsx)(c.Clock,{className:"w-5 h-5"})}),(0,t.jsx)("button",{onClick:()=>g(e.id,"cancelled"),title:"Cancel",className:"p-2 rounded-xl text-gray-400 hover:text-red-500 hover:bg-red-50 transition-colors",children:(0,t.jsx)(d,{className:"w-5 h-5"})})]})})]},e.id))})]})})})]})}e.s(["default",()=>x],83371)}]);