import{r as e,t}from"./jsx-runtime-BbTa8W_M-1776590214964.js";import{n,r}from"./app-CXDQ5oEH-1776590214964.js";import{t as i}from"./useTranslation-D1etqd9u-1776590214964.js";import{t as a}from"./DashboardLayout-CKvr2qsf-1776590214964.js";import{t as o}from"./clock-DUm1_ul1-1776590214964.js";import{t as s}from"./eye-eOgRHIou-1776590214964.js";import{t as c}from"./heart-OtgZ3Q5d-1776590214964.js";import{t as l}from"./message-square-text-DTgawhbp-1776590214964.js";import{t as u}from"./shopping-bag-DWQqpg3Q-1776590214964.js";import{t as d}from"./button-WiAFyHfP-1776590214964.js";import{a as f,n as p,o as m,r as h,t as g}from"./card-Cby8flFO-1776590214964.js";import{t as _}from"./badge-DIenkY-h-1776590214964.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./table-Bnz265cb-1776590214964.js";e();var w=t();function T({stats:e,recentOrders:t}){let{t:T}=i(),E=e=>{let t={pending:`bg-zinc-500/10 text-zinc-600`,processing:`bg-blue-500/10 text-blue-600`,shipped:`bg-amber-500/10 text-amber-600`,completed:`bg-green-500/10 text-green-600`,cancelled:`bg-red-500/10 text-red-600`,refunded:`bg-purple-500/10 text-purple-600`},n={pending:T(`Unpaid`),processing:T(`To Ship`),shipped:T(`To Receive`),completed:T(`Completed`),cancelled:T(`Cancelled`),refunded:T(`Refunded`)};return(0,w.jsx)(_,{variant:`secondary`,className:`${t[e]||`bg-muted`} uppercase text-[10px] tracking-wider font-bold`,children:n[e]||e})};return(0,w.jsxs)(a,{mode:`buyer`,children:[(0,w.jsx)(n,{title:T(`Buyer Dashboard`)}),(0,w.jsxs)(`div`,{className:`mb-6`,children:[(0,w.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:T(`Overview`)}),(0,w.jsx)(`p`,{className:`text-muted-foreground`,children:T(`Welcome back! Here is a summary of your buying activity.`)})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4 mb-8`,children:[(0,w.jsx)(g,{children:(0,w.jsxs)(p,{className:`p-6 flex flex-col gap-2`,children:[(0,w.jsx)(u,{className:`w-6 h-6 text-primary mb-2`}),(0,w.jsx)(`div`,{className:`text-2xl font-bold`,children:e.total_orders}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:T(`Total Orders`)})]})}),(0,w.jsx)(g,{children:(0,w.jsxs)(p,{className:`p-6 flex flex-col gap-2`,children:[(0,w.jsx)(o,{className:`w-6 h-6 text-orange-500 mb-2`}),(0,w.jsx)(`div`,{className:`text-2xl font-bold`,children:e.awaiting_shipment}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:T(`Awaiting Shipment`)})]})}),(0,w.jsx)(g,{children:(0,w.jsxs)(p,{className:`p-6 flex flex-col gap-2`,children:[(0,w.jsx)(l,{className:`w-6 h-6 text-blue-500 mb-2`}),(0,w.jsx)(`div`,{className:`text-2xl font-bold`,children:e.unread_messages}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:T(`Unread Messages`)})]})}),(0,w.jsx)(g,{children:(0,w.jsxs)(p,{className:`p-6 flex flex-col gap-2`,children:[(0,w.jsx)(c,{className:`w-6 h-6 text-red-500 mb-2`}),(0,w.jsx)(`div`,{className:`text-2xl font-bold`,children:e.saved_products}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:T(`Saved Products`)})]})})]}),(0,w.jsxs)(g,{children:[(0,w.jsxs)(f,{className:`flex flex-row items-center justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(m,{children:T(`Recent Orders`)}),(0,w.jsx)(h,{children:T(`Your most recent purchases`)})]}),(0,w.jsx)(d,{variant:`outline`,size:`sm`,asChild:!0,children:(0,w.jsx)(r,{href:route(`buyer.orders.index`),children:T(`View All Orders`)})})]}),(0,w.jsx)(p,{className:`overflow-x-auto`,children:(0,w.jsxs)(C,{children:[(0,w.jsx)(v,{children:(0,w.jsxs)(x,{children:[(0,w.jsx)(y,{children:T(`Order ID`)}),(0,w.jsx)(y,{children:T(`Product`)}),(0,w.jsx)(y,{children:T(`Supplier`)}),(0,w.jsx)(y,{children:T(`Date`)}),(0,w.jsx)(y,{children:T(`Total`)}),(0,w.jsx)(y,{children:T(`Status`)}),(0,w.jsx)(y,{className:`text-right`,children:T(`Action`)})]})}),(0,w.jsxs)(b,{children:[t.map(e=>(0,w.jsxs)(x,{children:[(0,w.jsx)(S,{className:`font-mono text-xs`,children:e.order_number}),(0,w.jsx)(S,{className:`font-medium max-w-[200px] truncate`,title:e.product_names,children:e.product_names||T(`Product Removed`)}),(0,w.jsx)(S,{className:`text-muted-foreground`,children:e.supplier_name}),(0,w.jsx)(S,{children:e.date}),(0,w.jsx)(S,{className:`font-bold`,children:e.total}),(0,w.jsx)(S,{children:E(e.status)}),(0,w.jsx)(S,{className:`text-right`,children:(0,w.jsx)(d,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,w.jsx)(r,{href:route(`buyer.orders.index`,{search:e.order_number}),children:(0,w.jsx)(s,{className:`w-4 h-4`})})})})]},e.id)),t.length===0&&(0,w.jsx)(x,{children:(0,w.jsx)(S,{colSpan:`7`,className:`text-center py-8 text-muted-foreground`,children:T(`No recent orders found.`)})})]})]})})]})]})}export{T as default};