mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat: add payment receive & bill detail footer.
This commit is contained in:
@@ -1,51 +1,27 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import {
|
||||
TotalLineBorderStyle,
|
||||
TotalLineTextStyle,
|
||||
FormatNumber,
|
||||
CommercialDocFooter,
|
||||
T,
|
||||
TotalLines,
|
||||
TotalLine,
|
||||
} from '../../../components';
|
||||
If,
|
||||
DetailsMenu,
|
||||
DetailItem,
|
||||
} from 'components';
|
||||
|
||||
import { useBillDrawerContext } from './BillDrawerProvider';
|
||||
|
||||
/**
|
||||
* Bill read-only details footer.
|
||||
* Bill detail footer.
|
||||
* @returns {React.JSX}
|
||||
*/
|
||||
export function BillDetailFooter() {
|
||||
export default function BillDetailFooter() {
|
||||
const { bill } = useBillDrawerContext();
|
||||
|
||||
return (
|
||||
<BillDetailsFooterRoot>
|
||||
<BillTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||
<TotalLine
|
||||
title={<T id={'bill.details.subtotal'} />}
|
||||
value={<FormatNumber value={bill.amont} />}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'bill.details.total'} />}
|
||||
value={bill.formatted_amount}
|
||||
borderStyle={TotalLineBorderStyle.DoubleDark}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'bill.details.payment_amount'} />}
|
||||
value={bill.formatted_payment_amount}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'bill.details.due_amount'} />}
|
||||
value={bill.formatted_due_amount}
|
||||
/>
|
||||
</BillTotalLines>
|
||||
</BillDetailsFooterRoot>
|
||||
<CommercialDocFooter>
|
||||
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
|
||||
<If condition={bill.note}>
|
||||
<DetailItem label={<T id={'note'} />}>{bill.note}</DetailItem>
|
||||
</If>
|
||||
</DetailsMenu>
|
||||
</CommercialDocFooter>
|
||||
);
|
||||
}
|
||||
|
||||
export const BillDetailsFooterRoot = styled.div``;
|
||||
|
||||
export const BillTotalLines = styled(TotalLines)`
|
||||
margin-left: auto;
|
||||
`;
|
||||
|
||||
@@ -4,8 +4,8 @@ import { CommercialDocBox } from 'components';
|
||||
|
||||
import BillDetailHeader from './BillDetailHeader';
|
||||
import BillDetailTable from './BillDetailTable';
|
||||
import { BillDetailFooter } from './BillDetailFooter';
|
||||
|
||||
import { BillDetailTableFooter } from './BillDetailTableFooter';
|
||||
import BillDetailFooter from './BillDetailFooter';
|
||||
|
||||
/**
|
||||
* Bill detail panel tab.
|
||||
@@ -15,6 +15,7 @@ export default function BillDetailTab() {
|
||||
<CommercialDocBox>
|
||||
<BillDetailHeader />
|
||||
<BillDetailTable />
|
||||
<BillDetailTableFooter />
|
||||
<BillDetailFooter />
|
||||
</CommercialDocBox>
|
||||
);
|
||||
|
||||
51
src/containers/Drawers/BillDrawer/BillDetailTableFooter.js
Normal file
51
src/containers/Drawers/BillDrawer/BillDetailTableFooter.js
Normal file
@@ -0,0 +1,51 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import {
|
||||
TotalLineBorderStyle,
|
||||
TotalLineTextStyle,
|
||||
FormatNumber,
|
||||
T,
|
||||
TotalLines,
|
||||
TotalLine,
|
||||
} from '../../../components';
|
||||
import { useBillDrawerContext } from './BillDrawerProvider';
|
||||
|
||||
/**
|
||||
* Bill read-only details table footer.
|
||||
*/
|
||||
export function BillDetailTableFooter() {
|
||||
const { bill } = useBillDrawerContext();
|
||||
|
||||
return (
|
||||
<BillDetailsFooterRoot>
|
||||
<BillTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||
<TotalLine
|
||||
title={<T id={'bill.details.subtotal'} />}
|
||||
value={<FormatNumber value={bill.amont} />}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'bill.details.total'} />}
|
||||
value={bill.formatted_amount}
|
||||
borderStyle={TotalLineBorderStyle.DoubleDark}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'bill.details.payment_amount'} />}
|
||||
value={bill.formatted_payment_amount}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'bill.details.due_amount'} />}
|
||||
value={bill.formatted_due_amount}
|
||||
/>
|
||||
</BillTotalLines>
|
||||
</BillDetailsFooterRoot>
|
||||
);
|
||||
}
|
||||
|
||||
export const BillDetailsFooterRoot = styled.div``;
|
||||
|
||||
export const BillTotalLines = styled(TotalLines)`
|
||||
margin-left: auto;
|
||||
`;
|
||||
@@ -1,13 +1,11 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import {
|
||||
FormatNumber,
|
||||
TotalLineTextStyle,
|
||||
TotalLineBorderStyle,
|
||||
CommercialDocFooter,
|
||||
T,
|
||||
TotalLine,
|
||||
TotalLines,
|
||||
If,
|
||||
DetailsMenu,
|
||||
DetailItem,
|
||||
} from 'components';
|
||||
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
||||
|
||||
@@ -17,30 +15,16 @@ import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
||||
*/
|
||||
export default function PaymentReceiveDetailFooter() {
|
||||
const { paymentReceive } = usePaymentReceiveDetailContext();
|
||||
|
||||
|
||||
return (
|
||||
<PaymentReceiveDetailsFooterRoot>
|
||||
<PaymentReceiveTotalLines
|
||||
labelColWidth={'180px'}
|
||||
amountColWidth={'180px'}
|
||||
>
|
||||
<TotalLine
|
||||
title={<T id={'payment_receive.details.subtotal'} />}
|
||||
value={<FormatNumber value={paymentReceive.amount} />}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'payment_receive.details.total'} />}
|
||||
value={paymentReceive.formatted_amount}
|
||||
borderStyle={TotalLineBorderStyle.DoubleDark}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
</PaymentReceiveTotalLines>
|
||||
</PaymentReceiveDetailsFooterRoot>
|
||||
<CommercialDocFooter>
|
||||
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
|
||||
<If condition={paymentReceive.statement}>
|
||||
<DetailItem label={<T id={'payment_receive.details.statement'} />}>
|
||||
{paymentReceive.statement}
|
||||
</DetailItem>
|
||||
</If>
|
||||
</DetailsMenu>
|
||||
</CommercialDocFooter>
|
||||
);
|
||||
}
|
||||
|
||||
export const PaymentReceiveDetailsFooterRoot = styled.div``;
|
||||
|
||||
export const PaymentReceiveTotalLines = styled(TotalLines)`
|
||||
margin-left: auto;
|
||||
`;
|
||||
|
||||
@@ -5,6 +5,7 @@ import { CommercialDocBox } from 'components';
|
||||
|
||||
import PaymentReceiveDetailHeader from './PaymentReceiveDetailHeader';
|
||||
import PaymentReceiveDetailTable from './PaymentReceiveDetailTable';
|
||||
import PaymentReceiveDetailTableFooter from './PaymentReceiveDetailTableFooter';
|
||||
import PaymentReceiveDetailFooter from './PaymentReceiveDetailFooter';
|
||||
|
||||
/**
|
||||
@@ -17,6 +18,7 @@ export default function PaymentReceiveDetailTab() {
|
||||
<CommercialDocBox>
|
||||
<PaymentReceiveDetailHeader />
|
||||
<PaymentReceiveDetailTable />
|
||||
<PaymentReceiveDetailTableFooter />
|
||||
<PaymentReceiveDetailFooter />
|
||||
</CommercialDocBox>
|
||||
</PaymentReceiveDetailsTabPanelRoot>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import {
|
||||
FormatNumber,
|
||||
TotalLineTextStyle,
|
||||
TotalLineBorderStyle,
|
||||
T,
|
||||
TotalLine,
|
||||
TotalLines,
|
||||
} from 'components';
|
||||
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
||||
|
||||
/**
|
||||
* Payment receive detail table footer.
|
||||
* @returns {React.JSX}
|
||||
*/
|
||||
export default function PaymentReceiveDetailTableFooter() {
|
||||
const { paymentReceive } = usePaymentReceiveDetailContext();
|
||||
|
||||
return (
|
||||
<PaymentReceiveDetailsFooterRoot>
|
||||
<PaymentReceiveTotalLines
|
||||
labelColWidth={'180px'}
|
||||
amountColWidth={'180px'}
|
||||
>
|
||||
<TotalLine
|
||||
title={<T id={'payment_receive.details.subtotal'} />}
|
||||
value={<FormatNumber value={paymentReceive.amount} />}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'payment_receive.details.total'} />}
|
||||
value={paymentReceive.formatted_amount}
|
||||
borderStyle={TotalLineBorderStyle.DoubleDark}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
</PaymentReceiveTotalLines>
|
||||
</PaymentReceiveDetailsFooterRoot>
|
||||
);
|
||||
}
|
||||
|
||||
export const PaymentReceiveDetailsFooterRoot = styled.div``;
|
||||
|
||||
export const PaymentReceiveTotalLines = styled(TotalLines)`
|
||||
margin-left: auto;
|
||||
`;
|
||||
Reference in New Issue
Block a user