module.exports=[41710,a=>{"use strict";let b=(0,a.i(70106).default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);a.s(["Clock",()=>b],41710)},2390,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(10849),e=a.i(70106);let f=(0,e.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"}]]),g=(0,e.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 h=a.i(41710);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 j(){let[a,e]=(0,c.useState)([]),[j,k]=(0,c.useState)(!0),l=async()=>{let{data:a}=await d.supabase.from("orders").select("*").order("created_at",{ascending:!1});e(a||[]),k(!1)};(0,c.useEffect)(()=>{l()},[]);let m=async(a,b)=>{await d.supabase.from("orders").update({status:b}).eq("id",a),l()};return(0,b.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-bold text-gray-900 tracking-tight",children:"Orders"}),(0,b.jsxs)("p",{className:"text-gray-500 text-sm mt-1",children:[a.length," total orders placed"]})]}),(0,b.jsx)("div",{className:"bg-white border border-gray-200 shadow-sm rounded-2xl overflow-hidden",children:(0,b.jsx)("div",{className:"overflow-x-auto",children:(0,b.jsxs)("table",{className:"w-full text-sm min-w-[700px]",children:[(0,b.jsx)("thead",{children:(0,b.jsxs)("tr",{className:"bg-gray-50/80 border-b border-gray-200",children:[(0,b.jsx)("th",{className:"text-left px-6 py-4 text-gray-500 font-semibold text-xs uppercase tracking-wider",children:"Order ID"}),(0,b.jsx)("th",{className:"text-left px-6 py-4 text-gray-500 font-semibold text-xs uppercase tracking-wider",children:"Date"}),(0,b.jsx)("th",{className:"text-left px-6 py-4 text-gray-500 font-semibold text-xs uppercase tracking-wider",children:"Total"}),(0,b.jsx)("th",{className:"text-left px-6 py-4 text-gray-500 font-semibold text-xs uppercase tracking-wider",children:"Status"}),(0,b.jsx)("th",{className:"text-right px-6 py-4 text-gray-500 font-semibold text-xs uppercase tracking-wider",children:"Actions"})]})}),(0,b.jsx)("tbody",{children:j?(0,b.jsx)("tr",{children:(0,b.jsx)("td",{colSpan:5,className:"px-6 py-10 text-center text-gray-500",children:"Loading orders..."})}):0===a.length?(0,b.jsx)("tr",{children:(0,b.jsx)("td",{colSpan:5,className:"px-6 py-10 text-center text-gray-500 bg-gray-50/30",children:"No orders yet."})}):a.map(a=>(0,b.jsxs)("tr",{className:"border-b border-gray-100 last:border-0 hover:bg-gray-50 transition-colors",children:[(0,b.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:[a.id.slice(0,8),"..."]}),(0,b.jsx)("td",{className:"px-6 py-4 text-gray-600 font-medium",children:new Date(a.created_at).toLocaleDateString()}),(0,b.jsxs)("td",{className:"px-6 py-4 text-gray-900 font-bold",children:[a.total,"€"]}),(0,b.jsx)("td",{className:"px-6 py-4",children:(0,b.jsx)("span",{className:`px-3 py-1 rounded-md text-xs font-bold ${i[a.status]||"text-gray-500 bg-gray-100"}`,children:a.status.toUpperCase()})}),(0,b.jsx)("td",{className:"px-6 py-4 text-right",children:(0,b.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,b.jsx)("button",{onClick:()=>m(a.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,b.jsx)(f,{className:"w-5 h-5"})}),(0,b.jsx)("button",{onClick:()=>m(a.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,b.jsx)(h.Clock,{className:"w-5 h-5"})}),(0,b.jsx)("button",{onClick:()=>m(a.id,"cancelled"),title:"Cancel",className:"p-2 rounded-xl text-gray-400 hover:text-red-500 hover:bg-red-50 transition-colors",children:(0,b.jsx)(g,{className:"w-5 h-5"})})]})})]},a.id))})]})})})]})}a.s(["default",()=>j],2390)}];

//# sourceMappingURL=_2b66aa53._.js.map