feat: link discount to mail receipts

This commit is contained in:
Ahmed Bouhuolia
2024-12-02 18:45:16 +02:00
parent 05cf94940e
commit 5b75fa9286
14 changed files with 294 additions and 18 deletions

View File

@@ -1,4 +1,5 @@
import { x } from '@xstyled/emotion';
import { isEmpty } from 'lodash';
import { Group, Stack } from '@/components';
import {
SendMailReceipt,
@@ -14,6 +15,14 @@ export interface EstimateSendMailReceiptProps extends SendMailReceiptProps {
estimateNumberLabel?: string;
estimateNumber: string;
// # Discount
discount?: string;
discountLabel?: string;
// # Adjustment
adjustment?: string;
adjsutmentLabel?: string;
// # Total.
total: string;
totalLabel?: string;
@@ -47,10 +56,6 @@ export function EstimateSendMailReceipt({
estimateNumberLabel = 'Estimate #',
estimateNumber,
// # Total.
total,
totalLabel = 'Total',
// # Expiration date.
expirationDateLabel = 'Expiration Date',
expirationDate,
@@ -65,6 +70,18 @@ export function EstimateSendMailReceipt({
subtotal,
subtotalLabel = 'Subtotal',
// # Discount
discount,
discountLabel = 'Discount',
// # Adjustment
adjustment,
adjsutmentLabel = 'Adjustment',
// # Total.
total,
totalLabel = 'Total',
// # View estimate button
showViewEstimateButton = true,
viewEstimateButtonLabel = 'View Estimate',
@@ -142,6 +159,36 @@ export function EstimateSendMailReceipt({
</x.span>
</Group>
{!isEmpty(discount) && (
<Group
h={'40px'}
position={'apart'}
borderBottomStyle="solid"
borderBottomWidth={'1px'}
borderBottomColor={'#D9D9D9'}
>
<x.span fontWeight={500}>{discountLabel}</x.span>
<x.span fontWeight={600} fontSize={15}>
{discount}
</x.span>
</Group>
)}
{!isEmpty(adjustment) && (
<Group
h={'40px'}
position={'apart'}
borderBottomStyle="solid"
borderBottomWidth={'1px'}
borderBottomColor={'#D9D9D9'}
>
<x.span fontWeight={500}>{adjsutmentLabel}</x.span>
<x.span fontWeight={600} fontSize={15}>
{adjustment}
</x.span>
</Group>
)}
<Group
h={'40px'}
position={'apart'}

View File

@@ -35,6 +35,9 @@ export const withEstimateMailReceiptPreviewProps = <
expirationDate: estimateMailState?.expirationDateFormatted,
estimateNumber: estimateMailState?.estimateNumber,
estimateDate: estimateMailState?.estimateDateFormatted,
subtotal: estimateMailState?.subtotalFormatted,
discount: estimateMailState?.discountFormatted,
adjustment: estimateMailState?.adjustmentFormatted,
items,
message,
};