Add promotion details and modal to orders and promotions

Introduces promotion-related fields to the Order interface and displays promotion discounts in both the order details and order table. Adds a PromotionDetailsModal component for viewing detailed promotion analytics and eligibility, and integrates it into the PromotionsList with a new 'view details' action.
This commit is contained in:
NotII
2025-08-07 17:16:49 +01:00
parent 2c48ecd2b4
commit 3cef1076d0
4 changed files with 458 additions and 2 deletions

View File

@@ -69,6 +69,11 @@ interface Order {
lastBalanceReceived?: number;
cryptoTotal?: number;
paymentAddress?: string;
// Promotion fields
promotion?: string;
promotionCode?: string;
discountAmount?: number;
subtotalBeforeDiscount?: number;
}
interface OrderInList extends Order {
@@ -697,6 +702,17 @@ export default function OrderDetailsPage() {
<TableCell className="text-right font-medium">Shipping ({order?.shippingMethod.type})</TableCell>
<TableCell className="text-right">£{order?.shippingMethod.price.toFixed(2)}</TableCell>
</TableRow>
{order?.promotionCode && order?.discountAmount && order?.discountAmount > 0 && (
<TableRow>
<TableCell colSpan={2} />
<TableCell className="text-right font-medium text-green-600">
Promotion ({order.promotionCode})
</TableCell>
<TableCell className="text-right text-green-600">
-£{order.discountAmount.toFixed(2)}
</TableCell>
</TableRow>
)}
<TableRow>
<TableCell colSpan={2} />
<TableCell className="text-right font-bold">Total</TableCell>