import { Banknote, CircleDollarSign, FileText, Minus, Percent, TrendingUp, } from 'lucide-react'; import { Card, CardContent } from '@/components/ui/card'; import { formatCurrency } from '@/lib/utils'; type Summary = { total_orders: number; total_amount: number; total_discount: number; total_deduction: number; net_total: number; }; type TransactionSummaryCardProps = { summary: Summary; }; const summaryItems = [ { key: 'total_orders', label: 'Total Pesanan', icon: FileText, color: 'bg-blue-100', iconColor: 'text-blue-600', format: (value: number) => value.toLocaleString('id-ID'), }, { key: 'total_amount', label: 'Total', icon: Banknote, color: 'bg-emerald-100', iconColor: 'text-emerald-600', format: formatCurrency, }, { key: 'total_discount', label: 'Diskon', icon: Percent, color: 'bg-amber-100', iconColor: 'text-amber-600', format: formatCurrency, }, { key: 'total_deduction', label: 'Potongan', icon: Minus, color: 'bg-orange-100', iconColor: 'text-orange-600', format: formatCurrency, }, { key: 'net_total', label: 'Total Bersih', icon: TrendingUp, color: 'bg-sky-100', iconColor: 'text-sky-600', format: formatCurrency, }, ] as const; export function TransactionSummaryCard({ summary }: TransactionSummaryCardProps) { return (
{item.label}
{item.format(summary[item.key] as number)}