Merge pull request #19 from bigcapitalhq/BIG-274-duplicated-description-in-payment-receive-details

`BIG-274` Duplicated description in payment receive details.
This commit is contained in:
Ahmed Bouhuolia
2022-01-11 17:29:19 +02:00
committed by GitHub
14 changed files with 116 additions and 68 deletions

View File

@@ -21,5 +21,5 @@ export const CommercialDocEntriesTable = styled(DataTable)`
`; `;
export const CommercialDocFooter = styled.div` export const CommercialDocFooter = styled.div`
margin-top: 25px; margin-top: 28px;
`; `;

View File

@@ -15,9 +15,14 @@ import { useCreditNoteDetailDrawerContext } from './CreditNoteDetailDrawerProvid
*/ */
export default function CreditNoteDetailFooter() { export default function CreditNoteDetailFooter() {
const { creditNote } = useCreditNoteDetailDrawerContext(); const { creditNote } = useCreditNoteDetailDrawerContext();
return ( return (
<CommercialDocFooter> <CommercialDocFooter>
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}> <DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
<If condition={creditNote.terms_conditions}>
<DetailItem label={<T id={'note'} />} children={creditNote.note} />
</If>
<If condition={creditNote.terms_conditions}> <If condition={creditNote.terms_conditions}>
<DetailItem label={<T id={'terms_conditions'} />}> <DetailItem label={<T id={'terms_conditions'} />}>
{creditNote.terms_conditions} {creditNote.terms_conditions}

View File

@@ -42,6 +42,12 @@ export default function CreditNoteDetailHeader() {
<Row> <Row>
<Col xs={6}> <Col xs={6}>
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}> <DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
<DetailItem
label={intl.get('credit_note.drawer.label_credit_note_date')}
>
<FormatDate value={creditNote.formatted_credit_note_date} />
</DetailItem>
<DetailItem <DetailItem
label={intl.get('credit_note.drawer.label_credit_note_no')} label={intl.get('credit_note.drawer.label_credit_note_no')}
> >
@@ -53,12 +59,6 @@ export default function CreditNoteDetailHeader() {
{creditNote.customer?.display_name} {creditNote.customer?.display_name}
</CustomerDrawerLink> </CustomerDrawerLink>
</DetailItem> </DetailItem>
<DetailItem
label={intl.get('credit_note.drawer.label_credit_note_date')}
>
<FormatDate value={creditNote.formatted_credit_note_date} />
</DetailItem>
</DetailsMenu> </DetailsMenu>
</Col> </Col>
@@ -77,11 +77,6 @@ export default function CreditNoteDetailHeader() {
label={intl.get('reference')} label={intl.get('reference')}
children={defaultTo(creditNote.reference_no, '-')} children={defaultTo(creditNote.reference_no, '-')}
/> />
<DetailItem
label={intl.get('note')}
children={defaultTo(creditNote.note, '-')}
/>
<DetailItem <DetailItem
label={<T id={'credit_note.drawer.label_created_at'} />} label={<T id={'credit_note.drawer.label_created_at'} />}
children={<FormatDate value={creditNote.created_at} />} children={<FormatDate value={creditNote.created_at} />}

View File

@@ -1,42 +1,29 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components';
import { import {
T, T,
TotalLines, CommercialDocFooter,
TotalLine, DetailsMenu,
TotalLineBorderStyle, If,
TotalLineTextStyle, DetailItem,
} from 'components'; } from 'components';
import { usePaymentMadeDetailContext } from './PaymentMadeDetailProvider'; import { usePaymentMadeDetailContext } from './PaymentMadeDetailProvider';
/** /**
* Payment made - Details panel - Footer. * Payment made - Details panel - Footer.
*/ */
export default function PaymentMadeDetailFooter() { export function PaymentMadeDetailFooter() {
const { paymentMade } = usePaymentMadeDetailContext(); const { paymentMade } = usePaymentMadeDetailContext();
return ( return (
<PaymentMadeFooterRoot> <CommercialDocFooter>
<PaymentMadeTotalLines labelColWidth={'180px'} amountColWidth={'180px'}> <DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
<TotalLine <If condition={paymentMade.statement}>
title={<T id={'payment_made.details.subtotal'} />} <DetailItem label={<T id={'payment_made.details.statement'} />}>
value={paymentMade.amount} {paymentMade.statement}
borderStyle={TotalLineBorderStyle.SingleDark} </DetailItem>
/> </If>
<TotalLine </DetailsMenu>
title={<T id={'payment_made.details.total'} />} </CommercialDocFooter>
value={paymentMade.formatted_amount}
borderStyle={TotalLineBorderStyle.DoubleDark}
textStyle={TotalLineTextStyle.Bold}
/>
</PaymentMadeTotalLines>
</PaymentMadeFooterRoot>
); );
} }
export const PaymentMadeFooterRoot = styled.div``;
export const PaymentMadeTotalLines = styled(TotalLines)`
margin-left: auto;
`;

View File

@@ -34,6 +34,10 @@ export default function PaymentMadeDetailHeader() {
<Row> <Row>
<Col xs={6}> <Col xs={6}>
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}> <DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
<DetailItem
label={intl.get('payment_date')}
children={<FormatDate value={paymentMade.payment_date} />}
/>
<DetailItem <DetailItem
label={intl.get('payment_made.details.payment_number')} label={intl.get('payment_made.details.payment_number')}
children={defaultTo(paymentMade.payment_number, '-')} children={defaultTo(paymentMade.payment_number, '-')}
@@ -47,11 +51,6 @@ export default function PaymentMadeDetailHeader() {
label={intl.get('payment_account')} label={intl.get('payment_account')}
children={paymentMade.payment_account?.name} children={paymentMade.payment_account?.name}
/> />
<DetailItem
label={intl.get('payment_date')}
children={<FormatDate value={paymentMade.payment_date} />}
/>
</DetailsMenu> </DetailsMenu>
</Col> </Col>
<Col xs={6}> <Col xs={6}>
@@ -61,8 +60,8 @@ export default function PaymentMadeDetailHeader() {
minLabelSize={'180px'} minLabelSize={'180px'}
> >
<DetailItem <DetailItem
label={intl.get('description')} label={intl.get('reference')}
children={defaultTo(paymentMade.statement, '-')} children={defaultTo(paymentMade.reference, '-')}
/> />
<DetailItem <DetailItem
label={intl.get('created_at')} label={intl.get('created_at')}

View File

@@ -20,8 +20,7 @@ function PaymentMadeDetailProvider({ paymentMadeId, ...props }) {
enabled: !!paymentMadeId, enabled: !!paymentMadeId,
}, },
); );
// Provider state.
//provider.
const provider = { const provider = {
paymentMadeId, paymentMadeId,
paymentMade, paymentMade,

View File

@@ -4,7 +4,8 @@ import { CommercialDocBox } from 'components';
import PaymentMadeDetailHeader from './PaymentMadeDetailHeader'; import PaymentMadeDetailHeader from './PaymentMadeDetailHeader';
import PaymentMadeDetailTable from './PaymentMadeDetailTable'; import PaymentMadeDetailTable from './PaymentMadeDetailTable';
import PaymentMadeDetailFooter from './PaymentMadeDetailFooter'; import PaymentMadeDetailTableFooter from './PaymentMadeDetailTableFooter';
import { PaymentMadeDetailFooter } from './PaymentMadeDetailFooter';
/** /**
* Payment made detail tab. * Payment made detail tab.
@@ -15,6 +16,7 @@ export default function PaymentMadeDetailTab() {
<CommercialDocBox> <CommercialDocBox>
<PaymentMadeDetailHeader /> <PaymentMadeDetailHeader />
<PaymentMadeDetailTable /> <PaymentMadeDetailTable />
<PaymentMadeDetailTableFooter />
<PaymentMadeDetailFooter /> <PaymentMadeDetailFooter />
</CommercialDocBox> </CommercialDocBox>
); );

View File

@@ -0,0 +1,42 @@
import React from 'react';
import styled from 'styled-components';
import {
T,
TotalLines,
TotalLine,
TotalLineBorderStyle,
TotalLineTextStyle,
} from 'components';
import { usePaymentMadeDetailContext } from './PaymentMadeDetailProvider';
/**
* Payment made - Details panel - Footer.
*/
export default function PaymentMadeDetailTableFooter() {
const { paymentMade } = usePaymentMadeDetailContext();
return (
<PaymentMadeFooterRoot>
<PaymentMadeTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
<TotalLine
title={<T id={'payment_made.details.subtotal'} />}
value={paymentMade.amount}
borderStyle={TotalLineBorderStyle.SingleDark}
/>
<TotalLine
title={<T id={'payment_made.details.total'} />}
value={paymentMade.formatted_amount}
borderStyle={TotalLineBorderStyle.DoubleDark}
textStyle={TotalLineTextStyle.Bold}
/>
</PaymentMadeTotalLines>
</PaymentMadeFooterRoot>
);
}
export const PaymentMadeFooterRoot = styled.div``;
export const PaymentMadeTotalLines = styled(TotalLines)`
margin-left: auto;
`;

View File

@@ -10,7 +10,6 @@ import {
DetailItem, DetailItem,
CommercialDocHeader, CommercialDocHeader,
CommercialDocTopHeader, CommercialDocTopHeader,
ButtonLink,
CustomerDrawerLink, CustomerDrawerLink,
} from 'components'; } from 'components';
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider'; import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
@@ -34,6 +33,10 @@ export default function PaymentReceiveDetailHeader() {
<Row> <Row>
<Col xs={6}> <Col xs={6}>
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}> <DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
<DetailItem
label={intl.get('payment_date')}
children={<FormatDate value={paymentReceive.payment_date} />}
/>
<DetailItem <DetailItem
label={intl.get('payment_receive.details.payment_number')} label={intl.get('payment_receive.details.payment_number')}
children={defaultTo(paymentReceive.payment_receive_no, '-')} children={defaultTo(paymentReceive.payment_receive_no, '-')}
@@ -48,10 +51,6 @@ export default function PaymentReceiveDetailHeader() {
label={intl.get('deposit_account')} label={intl.get('deposit_account')}
children={paymentReceive.deposit_account?.name} children={paymentReceive.deposit_account?.name}
/> />
<DetailItem
label={intl.get('payment_date')}
children={<FormatDate value={paymentReceive.payment_date} />}
/>
</DetailsMenu> </DetailsMenu>
</Col> </Col>
@@ -62,8 +61,8 @@ export default function PaymentReceiveDetailHeader() {
minLabelSize={'180px'} minLabelSize={'180px'}
> >
<DetailItem <DetailItem
label={intl.get('description')} label={intl.get('reference')}
children={defaultTo(paymentReceive.statement, '')} children={defaultTo(paymentReceive.reference_no, '-')}
/> />
<DetailItem <DetailItem
label={intl.get('created_at')} label={intl.get('created_at')}

View File

@@ -0,0 +1,23 @@
import React from 'react';
import {
CommercialDocFooter,
T,
If,
DetailsMenu,
DetailItem,
} from '../../../components';
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
export function VendorCreditDetailFooter() {
const { vendorCredit } = useVendorCreditDetailDrawerContext();
return (
<CommercialDocFooter>
<DetailsMenu direction={'horizantal'} minLabelSize={'150px'}>
<If condition={vendorCredit.note}>
<DetailItem label={<T id={'note'} />} children={vendorCredit.note} />
</If>
</DetailsMenu>
</CommercialDocFooter>
);
}

View File

@@ -38,6 +38,11 @@ export default function VendorCreditDetailHeader() {
<Row> <Row>
<Col xs={6}> <Col xs={6}>
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}> <DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
<DetailItem
label={intl.get('vendor_credit.drawer.label_vendor_credit_date')}
>
<FormatDate value={vendorCredit.formatted_vendor_credit_date} />
</DetailItem>
<DetailItem <DetailItem
label={intl.get('vendor_credit.drawer.label_vendor_credit_no')} label={intl.get('vendor_credit.drawer.label_vendor_credit_no')}
> >
@@ -49,12 +54,6 @@ export default function VendorCreditDetailHeader() {
{vendorCredit.vendor?.display_name} {vendorCredit.vendor?.display_name}
</VendorDrawerLink> </VendorDrawerLink>
</DetailItem> </DetailItem>
<DetailItem
label={intl.get('vendor_credit.drawer.label_vendor_credit_date')}
>
<FormatDate value={vendorCredit.formatted_vendor_credit_date} />
</DetailItem>
</DetailsMenu> </DetailsMenu>
</Col> </Col>
<Col xs={6}> <Col xs={6}>
@@ -72,10 +71,6 @@ export default function VendorCreditDetailHeader() {
label={intl.get('reference')} label={intl.get('reference')}
children={defaultTo(vendorCredit.reference_no, '-')} children={defaultTo(vendorCredit.reference_no, '-')}
/> />
<DetailItem
label={intl.get('note')}
children={defaultTo(vendorCredit.note, '-')}
/>
<DetailItem <DetailItem
label={<T id={'vendor_credit.drawer.label_created_at'} />} label={<T id={'vendor_credit.drawer.label_created_at'} />}
children={<FormatDate value={vendorCredit.created_at} />} children={<FormatDate value={vendorCredit.created_at} />}

View File

@@ -5,6 +5,7 @@ import { CommercialDocBox } from 'components';
import VendorCreditDetailHeader from './VendorCreditDetailHeader'; import VendorCreditDetailHeader from './VendorCreditDetailHeader';
import VendorCreditDetailTable from './VendorCreditDetailTable'; import VendorCreditDetailTable from './VendorCreditDetailTable';
import VendorCreditDetailDrawerFooter from './VendorCreditDetailDrawerFooter'; import VendorCreditDetailDrawerFooter from './VendorCreditDetailDrawerFooter';
import { VendorCreditDetailFooter } from './VendorCreditDetailFooter';
/** /**
* Vendor credit details panel. * Vendor credit details panel.
@@ -16,6 +17,7 @@ export default function VendorCreditDetailPanel() {
<VendorCreditDetailHeader /> <VendorCreditDetailHeader />
<VendorCreditDetailTable /> <VendorCreditDetailTable />
<VendorCreditDetailDrawerFooter /> <VendorCreditDetailDrawerFooter />
<VendorCreditDetailFooter />
</CommercialDocBox> </CommercialDocBox>
); );
} }

View File

@@ -11,12 +11,11 @@ const InvoicesDrawerContent = lazy(() => import('./InvoiceDrawerContent'));
*/ */
function InvoiceDrawer({ function InvoiceDrawer({
name, name,
//#withDrawer //#withDrawer
isOpen, isOpen,
payload: { invoiceId }, payload: { invoiceId },
}) { }) {
return ( return (
<Drawer isOpen={isOpen} name={name}> <Drawer isOpen={isOpen} name={name}>
<DrawerSuspense> <DrawerSuspense>

View File

@@ -1193,6 +1193,7 @@
"payment_made.details.payment_number": "Payment #", "payment_made.details.payment_number": "Payment #",
"payment_made.details.subtotal": "Subtotal", "payment_made.details.subtotal": "Subtotal",
"payment_made.details.total": "TOTAL", "payment_made.details.total": "TOTAL",
"payment_made.details.statement": "Statement",
"payment_receive.details.payment_number": "Payment #", "payment_receive.details.payment_number": "Payment #",
"payment_receive.details.total": "TOTAL", "payment_receive.details.total": "TOTAL",
"payment_receive.details.subtotal": "Subtotal", "payment_receive.details.subtotal": "Subtotal",