add bill summary section
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import type { ComputedBill } from "../types";
|
||||
import { formatCurrency } from "../utils";
|
||||
|
||||
interface BillSummaryProps {
|
||||
bill: ComputedBill;
|
||||
}
|
||||
|
||||
export function BillSummary({ bill }: BillSummaryProps) {
|
||||
if (bill.items.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div className="p-4 rounded-2xl bg-white shadow-sm">
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex justify-between text-sm text-gray-500">
|
||||
<span>Subtotal</span>
|
||||
<span>{formatCurrency(bill.subtotal, bill.currency)}</span>
|
||||
</div>
|
||||
|
||||
{bill.taxPercent > 0 && (
|
||||
<div className="flex justify-between text-sm text-gray-500">
|
||||
<span>
|
||||
{bill.taxType} {bill.taxPercent}%
|
||||
</span>
|
||||
<span>{formatCurrency(bill.taxAmount, bill.currency)}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="border-t border-gray-100 mt-1 pt-2 flex justify-between items-center">
|
||||
<span className="font-bold text-gray-800">Total</span>
|
||||
<span className="font-bold text-indigo-600 text-lg">
|
||||
{formatCurrency(bill.total, bill.currency)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user