mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
feat: link discount to mail receipts
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
import React, { createContext, useContext } from 'react';
|
||||
import { Spinner } from '@blueprintjs/core';
|
||||
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
|
||||
import { GetSaleReceiptMailStateResponse, useSaleInvoiceMailState, useSaleReceiptMailState } from '@/hooks/query';
|
||||
import {
|
||||
GetSaleReceiptMailStateResponse,
|
||||
useSaleReceiptMailState,
|
||||
} from '@/hooks/query';
|
||||
|
||||
interface ReceiptSendMailBootValues {
|
||||
receiptId: number;
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
SendMailReceipt,
|
||||
SendMailReceiptProps,
|
||||
} from '../../Estimates/SendMailViewDrawer/SendMailViewReceiptPreview';
|
||||
import { isEmpty } from 'lodash';
|
||||
|
||||
export interface ReceiptSendMailReceiptProps extends SendMailReceiptProps {
|
||||
// # Company name.
|
||||
@@ -14,10 +15,6 @@ export interface ReceiptSendMailReceiptProps extends SendMailReceiptProps {
|
||||
receiptNumberLabel?: string;
|
||||
receiptNumber: string;
|
||||
|
||||
// # Total.
|
||||
total: string;
|
||||
totalLabel?: string;
|
||||
|
||||
// # Message
|
||||
message: string;
|
||||
|
||||
@@ -27,6 +24,18 @@ export interface ReceiptSendMailReceiptProps extends SendMailReceiptProps {
|
||||
// # Subtotal
|
||||
subtotal: string;
|
||||
subtotalLabel?: string;
|
||||
|
||||
// # Discount
|
||||
discount?: string;
|
||||
discountLabel?: string;
|
||||
|
||||
// # Adjustment
|
||||
adjustment?: string;
|
||||
adjustmentLabel?: string;
|
||||
|
||||
// # Total.
|
||||
total: string;
|
||||
totalLabel?: string;
|
||||
}
|
||||
|
||||
export function ReceiptSendMailReceipt({
|
||||
@@ -42,6 +51,14 @@ export function ReceiptSendMailReceipt({
|
||||
total,
|
||||
totalLabel = 'Total',
|
||||
|
||||
// # Discount
|
||||
discount,
|
||||
discountLabel = 'Discount',
|
||||
|
||||
// # Adjustment
|
||||
adjustment,
|
||||
adjustmentLabel = 'Adjustment',
|
||||
|
||||
// # Message
|
||||
message,
|
||||
|
||||
@@ -49,7 +66,6 @@ export function ReceiptSendMailReceipt({
|
||||
items,
|
||||
subtotal,
|
||||
subtotalLabel = 'Subtotal',
|
||||
|
||||
...rest
|
||||
}: ReceiptSendMailReceiptProps) {
|
||||
return (
|
||||
@@ -109,6 +125,36 @@ export function ReceiptSendMailReceipt({
|
||||
</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}>{adjustmentLabel}</x.span>
|
||||
<x.span fontWeight={600} fontSize={15}>
|
||||
{adjustment}
|
||||
</x.span>
|
||||
</Group>
|
||||
)}
|
||||
|
||||
<Group
|
||||
h={'40px'}
|
||||
position={'apart'}
|
||||
|
||||
@@ -37,6 +37,8 @@ export const withReceiptMailReceiptPreviewProps = <
|
||||
total: receiptMailState?.totalFormatted,
|
||||
subtotal: receiptMailState?.subtotalFormatted,
|
||||
receiptNumber: receiptMailState?.receiptNumber,
|
||||
discount: receiptMailState?.discountAmountFormatted,
|
||||
adjustment: receiptMailState?.adjustmentFormatted,
|
||||
items,
|
||||
message,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user