import NavMenu from "@/components/NavMenu";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Order } from "@/hooks/useOrder";
import { loadOrder } from "@/lib/db";
function StatItem({title, value}: {title: string, value: string}) {
return
}
function sum (...args: number[]) {
return args.reduce((acc, cur) => acc + cur, 0);
}
function ordersSum(orders: Order[]){
return orders.reduce((acc, cur) => acc + cur.price * cur.quantity * 1000, 0);
}
export default async function Stat() {
const orders = await loadOrder();
const completed_order= orders.filter(order => order.completed === 1);
const cash_order = completed_order.filter(order => order.payment === "cash");
const account_order = completed_order.filter(order => order.payment === "account");
return
주문통계
ordersSum(order.orders)))
.toLocaleString("ko-KR", {
style: "currency",
currency: "KRW",
})
} />
ordersSum(order.orders)))
.toLocaleString("ko-KR", {
style: "currency",
currency: "KRW",
})
} />
ordersSum(order.orders)))
.toLocaleString("ko-KR", {
style: "currency",
currency: "KRW",
})
} />
}