(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8427],{4322:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(65531);/**
 * @license lucide-react v0.446.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let n=(0,s.Z)("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]])},93505:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(65531);/**
 * @license lucide-react v0.446.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let n=(0,s.Z)("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]])},25750:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(65531);/**
 * @license lucide-react v0.446.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let n=(0,s.Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},66547:function(e,t,r){Promise.resolve().then(r.bind(r,30276))},30276:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return x}});var s=r(57437),n=r(2265),a=r(93505),l=r(65531);/**
 * @license lucide-react v0.446.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let d=(0,l.Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);var o=r(4322),i=r(25750),c=r(86110),u=r(29155);let f={new:"bg-blue-100 text-blue-800",processing:"bg-yellow-100 text-yellow-800",in_transit:"bg-orange-100 text-orange-800",delivered:"bg-green-100 text-green-800"};function x(){let[e,t]=(0,n.useState)([]),[r,l]=(0,n.useState)(0);(0,n.useEffect)(()=>{let e=async()=>{try{let[e,r]=await Promise.all([fetch("/api/orders"),fetch("/api/products")]),s=await e.json(),n=await r.json();t(s),l(n.length)}catch(e){console.error("Failed to fetch dashboard data",e)}};e()},[]);let x=e.filter(e=>"new"===e.status).length,m=[{title:"Total Orders",value:e.length,icon:a.Z,description:"All time orders"},{title:"New Orders",value:x,icon:d,description:"Pending review"},{title:"Total Products",value:r,icon:o.Z,description:"In catalog"},{title:"Active Customers",value:new Set(e.map(e=>e.email)).size,icon:i.Z,description:"Unique customers"}];return(0,s.jsxs)("div",{className:"space-y-8",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:"Dashboard"}),(0,s.jsx)("p",{className:"text-muted-foreground",children:"Welcome back to Musa Foods admin panel"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:m.map(e=>(0,s.jsxs)(c.Zb,{children:[(0,s.jsxs)(c.Ol,{className:"flex flex-row items-center justify-between pb-2",children:[(0,s.jsx)(c.ll,{className:"text-sm font-medium text-muted-foreground",children:e.title}),(0,s.jsx)(e.icon,{className:"w-4 h-4 text-muted-foreground"})]}),(0,s.jsxs)(c.aY,{children:[(0,s.jsx)("div",{className:"text-3xl font-bold",children:e.value}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:e.description})]})]},e.title))}),(0,s.jsxs)(c.Zb,{children:[(0,s.jsxs)(c.Ol,{children:[(0,s.jsx)(c.ll,{children:"Recent Orders"}),(0,s.jsx)(c.SZ,{children:"Latest quote requests from customers"})]}),(0,s.jsx)(c.aY,{children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b border-border",children:[(0,s.jsx)("th",{className:"text-left py-3 px-4 text-sm font-medium text-muted-foreground",children:"Order ID"}),(0,s.jsx)("th",{className:"text-left py-3 px-4 text-sm font-medium text-muted-foreground",children:"Customer"}),(0,s.jsx)("th",{className:"text-left py-3 px-4 text-sm font-medium text-muted-foreground",children:"Country"}),(0,s.jsx)("th",{className:"text-left py-3 px-4 text-sm font-medium text-muted-foreground",children:"Status"})]})}),(0,s.jsx)("tbody",{children:e.slice(0,5).map(e=>(0,s.jsxs)("tr",{className:"border-b border-border last:border-0",children:[(0,s.jsx)("td",{className:"py-3 px-4 font-mono text-sm",children:e.id}),(0,s.jsx)("td",{className:"py-3 px-4",children:e.customerName}),(0,s.jsx)("td",{className:"py-3 px-4 text-muted-foreground",children:e.country}),(0,s.jsx)("td",{className:"py-3 px-4",children:(0,s.jsx)(u.C,{className:f[e.status],children:e.status.replace("_"," ")})})]},e.id))})]})})})]})]})}},29155:function(e,t,r){"use strict";r.d(t,{C:function(){return d}});var s=r(57437);r(2265);var n=r(96061),a=r(39311);let l=(0,n.j)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function d(e){let{className:t,variant:r,...n}=e;return(0,s.jsx)("div",{className:(0,a.cn)(l({variant:r}),t),...n})}},86110:function(e,t,r){"use strict";r.d(t,{Ol:function(){return d},SZ:function(){return i},Zb:function(){return l},aY:function(){return c},ll:function(){return o}});var s=r(57437),n=r(2265),a=r(39311);let l=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,a.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",r),...n})});l.displayName="Card";let d=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,a.cn)("flex flex-col space-y-1.5 p-6",r),...n})});d.displayName="CardHeader";let o=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("h3",{ref:t,className:(0,a.cn)("text-2xl font-semibold leading-none tracking-tight",r),...n})});o.displayName="CardTitle";let i=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("p",{ref:t,className:(0,a.cn)("text-sm text-muted-foreground",r),...n})});i.displayName="CardDescription";let c=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,a.cn)("p-6 pt-0",r),...n})});c.displayName="CardContent";let u=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,a.cn)("flex items-center p-6 pt-0",r),...n})});u.displayName="CardFooter"},39311:function(e,t,r){"use strict";r.d(t,{cn:function(){return a}});var s=r(57042),n=r(74769);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.m6)((0,s.W)(t))}}},function(e){e.O(0,[6207,2971,7864,1744],function(){return e(e.s=66547)}),_N_E=e.O()}]);