mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: add terms and conditions to invoice details.
This commit is contained in:
@@ -1,52 +1,33 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import {
|
||||
T,
|
||||
TotalLines,
|
||||
FormatNumber,
|
||||
TotalLine,
|
||||
TotalLineBorderStyle,
|
||||
TotalLineTextStyle,
|
||||
} from 'components';
|
||||
import { CommercialDocFooter, If, DetailsMenu, DetailItem } from 'components';
|
||||
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
||||
|
||||
/**
|
||||
* Invoice details footer.
|
||||
* @returns {React.JSX}
|
||||
*/
|
||||
export function InvoiceDetailFooter() {
|
||||
const { invoice } = useInvoiceDetailDrawerContext();
|
||||
|
||||
if (!invoice.terms_conditions && !invoice.invoice_message) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<InvoiceDetailsFooterRoot>
|
||||
<InvoiceTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.subtotal'} />}
|
||||
value={<FormatNumber value={invoice.balance} />}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.total'} />}
|
||||
value={invoice.formatted_amount}
|
||||
borderStyle={TotalLineBorderStyle.DoubleDark}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.payment_amount'} />}
|
||||
value={invoice.formatted_payment_amount}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.due_amount'} />}
|
||||
value={invoice.formatted_due_amount}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
</InvoiceTotalLines>
|
||||
</InvoiceDetailsFooterRoot>
|
||||
<CommercialDocFooter>
|
||||
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
|
||||
<If condition={invoice.terms_conditions}>
|
||||
<DetailItem label={'Terms & Conditions'}>
|
||||
{invoice.terms_conditions}
|
||||
</DetailItem>
|
||||
</If>
|
||||
|
||||
<If condition={invoice.invoice_message}>
|
||||
<DetailItem label={'Invoice Message'}>
|
||||
{invoice.invoice_message}
|
||||
</DetailItem>
|
||||
</If>
|
||||
</DetailsMenu>
|
||||
</CommercialDocFooter>
|
||||
);
|
||||
}
|
||||
|
||||
const InvoiceDetailsFooterRoot = styled.div``;
|
||||
|
||||
const InvoiceTotalLines = styled(TotalLines)`
|
||||
margin-left: auto;
|
||||
`;
|
||||
|
||||
@@ -4,6 +4,7 @@ import { CommercialDocBox } from 'components';
|
||||
|
||||
import InvoiceDetailHeader from './InvoiceDetailHeader';
|
||||
import InvoiceDetailTable from './InvoiceDetailTable';
|
||||
import { InvoiceDetailTableFooter } from './InvoiceDetailTableFooter';
|
||||
import { InvoiceDetailFooter } from './InvoiceDetailFooter';
|
||||
|
||||
/**
|
||||
@@ -14,6 +15,7 @@ export default function InvoiceDetailTab() {
|
||||
<CommercialDocBox>
|
||||
<InvoiceDetailHeader />
|
||||
<InvoiceDetailTable />
|
||||
<InvoiceDetailTableFooter />
|
||||
<InvoiceDetailFooter />
|
||||
</CommercialDocBox>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import {
|
||||
T,
|
||||
TotalLines,
|
||||
FormatNumber,
|
||||
TotalLine,
|
||||
TotalLineBorderStyle,
|
||||
TotalLineTextStyle,
|
||||
} from 'components';
|
||||
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
||||
|
||||
/**
|
||||
* Invoice details footer.
|
||||
*/
|
||||
export function InvoiceDetailTableFooter() {
|
||||
const { invoice } = useInvoiceDetailDrawerContext();
|
||||
|
||||
return (
|
||||
<InvoiceDetailsFooterRoot>
|
||||
<InvoiceTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.subtotal'} />}
|
||||
value={<FormatNumber value={invoice.balance} />}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.total'} />}
|
||||
value={invoice.formatted_amount}
|
||||
borderStyle={TotalLineBorderStyle.DoubleDark}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.payment_amount'} />}
|
||||
value={invoice.formatted_payment_amount}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.due_amount'} />}
|
||||
value={invoice.formatted_due_amount}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
</InvoiceTotalLines>
|
||||
</InvoiceDetailsFooterRoot>
|
||||
);
|
||||
}
|
||||
|
||||
const InvoiceDetailsFooterRoot = styled.div``;
|
||||
|
||||
const InvoiceTotalLines = styled(TotalLines)`
|
||||
margin-left: auto;
|
||||
`;
|
||||
Reference in New Issue
Block a user