mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
feat: optmize style of payment receive details.
This commit is contained in:
@@ -40,10 +40,6 @@ export default function InvoiceGLEntriesTable() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const InvoiceGLEntriesDatatable = styled(JournalEntriesTable)`
|
const InvoiceGLEntriesDatatable = styled(JournalEntriesTable)``;
|
||||||
.table .tbody .tr:last-child .td {
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const InvoiceGLEntriesRoot = styled(Card)``;
|
const InvoiceGLEntriesRoot = styled(Card)``;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
NavbarGroup,
|
NavbarGroup,
|
||||||
@@ -8,7 +7,6 @@ import {
|
|||||||
NavbarDivider,
|
NavbarDivider,
|
||||||
Intent,
|
Intent,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
|
||||||
|
|
||||||
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
||||||
|
|
||||||
@@ -16,7 +14,13 @@ import withDialogActions from 'containers/Dialog/withDialogActions';
|
|||||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
import { Can, Icon, FormattedMessage as T, MoreMenuItems } from 'components';
|
import {
|
||||||
|
Can,
|
||||||
|
Icon,
|
||||||
|
FormattedMessage as T,
|
||||||
|
MoreMenuItems,
|
||||||
|
DrawerActionsBar,
|
||||||
|
} from 'components';
|
||||||
import {
|
import {
|
||||||
PaymentReceiveAction,
|
PaymentReceiveAction,
|
||||||
AbilitySubject,
|
AbilitySubject,
|
||||||
@@ -59,7 +63,7 @@ function PaymentReceiveActionsBar({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardActionsBar>
|
<DrawerActionsBar>
|
||||||
<NavbarGroup>
|
<NavbarGroup>
|
||||||
<Can I={PaymentReceiveAction.Edit} a={AbilitySubject.PaymentReceive}>
|
<Can I={PaymentReceiveAction.Edit} a={AbilitySubject.PaymentReceive}>
|
||||||
<Button
|
<Button
|
||||||
@@ -80,7 +84,10 @@ function PaymentReceiveActionsBar({
|
|||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
</Can>
|
</Can>
|
||||||
<Can I={PaymentReceiveAction.NotifyBySms} a={AbilitySubject.PaymentReceive}>
|
<Can
|
||||||
|
I={PaymentReceiveAction.NotifyBySms}
|
||||||
|
a={AbilitySubject.PaymentReceive}
|
||||||
|
>
|
||||||
<MoreMenuItems
|
<MoreMenuItems
|
||||||
payload={{
|
payload={{
|
||||||
onNotifyViaSMS: handleNotifyViaSMS,
|
onNotifyViaSMS: handleNotifyViaSMS,
|
||||||
@@ -88,7 +95,7 @@ function PaymentReceiveActionsBar({
|
|||||||
/>
|
/>
|
||||||
</Can>
|
</Can>
|
||||||
</NavbarGroup>
|
</NavbarGroup>
|
||||||
</DashboardActionsBar>
|
</DrawerActionsBar>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,20 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Tab } from '@blueprintjs/core';
|
import { Tab } from '@blueprintjs/core';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import clsx from 'classnames';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { DrawerMainTabs } from 'components';
|
import { DrawerMainTabs } from 'components';
|
||||||
|
|
||||||
import PaymentReceiveDetailTab from './PaymentReceiveDetailTab';
|
import PaymentReceiveDetailTab from './PaymentReceiveDetailTab';
|
||||||
|
import PaymentReceiveActionsBar from './PaymentReceiveActionsBar';
|
||||||
import JournalEntriesTable from '../../JournalEntriesTable/JournalEntriesTable';
|
import { PaymentReceiveGLEntriesPanel } from './PaymentReceiveGLEntriesPanel';
|
||||||
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
|
||||||
|
|
||||||
import PaymentDrawerCls from './PaymentReceiveDrawer.module.scss';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment receive view detail.
|
* Payment receive details tabs.
|
||||||
|
* @returns {React.JSX}
|
||||||
*/
|
*/
|
||||||
export default function PaymentReceiveDetail() {
|
function PaymentReceiveDetailsTabs() {
|
||||||
const { transactions } = usePaymentReceiveDetailContext();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={clsx(PaymentDrawerCls.root)}>
|
|
||||||
<DrawerMainTabs defaultSelectedTabId="details">
|
<DrawerMainTabs defaultSelectedTabId="details">
|
||||||
<Tab
|
<Tab
|
||||||
id={'details'}
|
id={'details'}
|
||||||
@@ -28,9 +24,23 @@ export default function PaymentReceiveDetail() {
|
|||||||
<Tab
|
<Tab
|
||||||
id={'journal_entries'}
|
id={'journal_entries'}
|
||||||
title={intl.get('journal_entries')}
|
title={intl.get('journal_entries')}
|
||||||
panel={<JournalEntriesTable transactions={transactions} />}
|
panel={<PaymentReceiveGLEntriesPanel />}
|
||||||
/>
|
/>
|
||||||
</DrawerMainTabs>
|
</DrawerMainTabs>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Payment receive view detail.
|
||||||
|
* @returns {React.JSX}
|
||||||
|
*/
|
||||||
|
export default function PaymentReceiveDetail() {
|
||||||
|
return (
|
||||||
|
<PaymentReceiveDetailsRoot>
|
||||||
|
<PaymentReceiveActionsBar />
|
||||||
|
<PaymentReceiveDetailsTabs />
|
||||||
|
</PaymentReceiveDetailsRoot>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const PaymentReceiveDetailsRoot = styled.div``;
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import clsx from 'classnames';
|
|
||||||
import { defaultTo } from 'lodash';
|
import { defaultTo } from 'lodash';
|
||||||
|
|
||||||
import { FormatDate, DetailsMenu, DetailItem } from 'components';
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
FormatDate,
|
||||||
|
DetailsMenu,
|
||||||
|
DetailItem,
|
||||||
|
CommercialDocHeader,
|
||||||
|
CommercialDocTopHeader,
|
||||||
|
ButtonLink,
|
||||||
|
} from 'components';
|
||||||
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
||||||
|
|
||||||
import PaymentDrawerCls from './PaymentReceiveDrawer.module.scss';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment receive detail header.
|
* Payment receive detail header.
|
||||||
*/
|
*/
|
||||||
@@ -15,22 +21,26 @@ export default function PaymentReceiveDetailHeader() {
|
|||||||
const { paymentReceive } = usePaymentReceiveDetailContext();
|
const { paymentReceive } = usePaymentReceiveDetailContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={clsx(PaymentDrawerCls.detail_panel_header)}>
|
<CommercialDocHeader>
|
||||||
|
<CommercialDocTopHeader>
|
||||||
<DetailsMenu>
|
<DetailsMenu>
|
||||||
<DetailItem
|
<DetailItem label={intl.get('amount')}>
|
||||||
label={intl.get('amount')}
|
|
||||||
children={
|
|
||||||
<h3 class="big-number">{paymentReceive.formatted_amount}</h3>
|
<h3 class="big-number">{paymentReceive.formatted_amount}</h3>
|
||||||
}
|
</DetailItem>
|
||||||
/>
|
</DetailsMenu>
|
||||||
|
</CommercialDocTopHeader>
|
||||||
|
|
||||||
|
<Row>
|
||||||
|
<Col xs={6}>
|
||||||
|
<DetailsMenu direction={'horizantal'} minLabelSize={'180px'}>
|
||||||
<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, '-')}
|
||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem label={intl.get('customer_name')}>
|
||||||
label={intl.get('customer_name')}
|
<ButtonLink>{paymentReceive.customer?.display_name}</ButtonLink>
|
||||||
children={paymentReceive.customer?.display_name}
|
</DetailItem>
|
||||||
/>
|
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('deposit_account')}
|
label={intl.get('deposit_account')}
|
||||||
children={paymentReceive.deposit_account?.name}
|
children={paymentReceive.deposit_account?.name}
|
||||||
@@ -40,8 +50,14 @@ export default function PaymentReceiveDetailHeader() {
|
|||||||
children={<FormatDate value={paymentReceive.payment_date} />}
|
children={<FormatDate value={paymentReceive.payment_date} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
|
</Col>
|
||||||
|
|
||||||
<DetailsMenu direction={'horizantal'} minLabelSize={'140px'}>
|
<Col xs={6}>
|
||||||
|
<DetailsMenu
|
||||||
|
textAlign={'right'}
|
||||||
|
direction={'horizantal'}
|
||||||
|
minLabelSize={'180px'}
|
||||||
|
>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('description')}
|
label={intl.get('description')}
|
||||||
children={defaultTo(paymentReceive.statement, '—')}
|
children={defaultTo(paymentReceive.statement, '—')}
|
||||||
@@ -51,6 +67,8 @@ export default function PaymentReceiveDetailHeader() {
|
|||||||
children={<FormatDate value={paymentReceive.created_at} />}
|
children={<FormatDate value={paymentReceive.created_at} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
</div>
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</CommercialDocHeader>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import { DrawerHeaderContent, DrawerLoading } from 'components';
|
import { DrawerHeaderContent, DrawerLoading } from 'components';
|
||||||
import { useTransactionsByReference, usePaymentReceive } from 'hooks/query';
|
import { usePaymentReceive } from 'hooks/query';
|
||||||
|
|
||||||
const PaymentReceiveDetailContext = React.createContext();
|
const PaymentReceiveDetailContext = React.createContext();
|
||||||
|
|
||||||
@@ -9,6 +9,7 @@ const PaymentReceiveDetailContext = React.createContext();
|
|||||||
* Payment receive detail provider.
|
* Payment receive detail provider.
|
||||||
*/
|
*/
|
||||||
function PaymentReceiveDetailProvider({ paymentReceiveId, ...props }) {
|
function PaymentReceiveDetailProvider({ paymentReceiveId, ...props }) {
|
||||||
|
// Fetches specific payment receive details.
|
||||||
const {
|
const {
|
||||||
data: paymentReceive,
|
data: paymentReceive,
|
||||||
isLoading: isPaymentLoading,
|
isLoading: isPaymentLoading,
|
||||||
@@ -17,28 +18,15 @@ function PaymentReceiveDetailProvider({ paymentReceiveId, ...props }) {
|
|||||||
enabled: !!paymentReceiveId,
|
enabled: !!paymentReceiveId,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle fetch transaction by reference.
|
|
||||||
const {
|
|
||||||
data: { transactions },
|
|
||||||
isLoading: isTransactionLoading,
|
|
||||||
} = useTransactionsByReference(
|
|
||||||
{
|
|
||||||
reference_id: paymentReceiveId,
|
|
||||||
reference_type: 'paymentReceive',
|
|
||||||
},
|
|
||||||
{ enabled: !!paymentReceiveId },
|
|
||||||
);
|
|
||||||
|
|
||||||
// Provider.
|
// Provider.
|
||||||
const provider = {
|
const provider = {
|
||||||
isPaymentFetching,
|
isPaymentFetching,
|
||||||
transactions,
|
|
||||||
paymentReceive,
|
paymentReceive,
|
||||||
paymentReceiveId,
|
paymentReceiveId,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DrawerLoading loading={isTransactionLoading || isPaymentLoading}>
|
<DrawerLoading loading={isPaymentLoading}>
|
||||||
<DrawerHeaderContent
|
<DrawerHeaderContent
|
||||||
name="payment-receive-detail-drawer"
|
name="payment-receive-detail-drawer"
|
||||||
title={intl.get('payment_receive_details')}
|
title={intl.get('payment_receive_details')}
|
||||||
|
|||||||
@@ -1,25 +1,26 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import clsx from 'classnames';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { Card } from 'components';
|
import { CommercialDocBox } from 'components';
|
||||||
|
|
||||||
import PaymentReceiveActionsBar from './PaymentReceiveActionsBar';
|
|
||||||
import PaymentReceiveDetailHeader from './PaymentReceiveDetailHeader';
|
import PaymentReceiveDetailHeader from './PaymentReceiveDetailHeader';
|
||||||
import PaymentReceiveDetailTable from './PaymentReceiveDetailTable';
|
import PaymentReceiveDetailTable from './PaymentReceiveDetailTable';
|
||||||
import PaymentReceiveDetailFooter from './PaymentReceiveDetailFooter';
|
import PaymentReceiveDetailFooter from './PaymentReceiveDetailFooter';
|
||||||
|
|
||||||
import PaymentDrawerCls from './PaymentReceiveDrawer.module.scss';
|
/**
|
||||||
|
* Payment receive - overview panel.
|
||||||
|
* @returns {React.JSX}
|
||||||
|
*/
|
||||||
export default function PaymentReceiveDetailTab() {
|
export default function PaymentReceiveDetailTab() {
|
||||||
return (
|
return (
|
||||||
<div className={clsx(PaymentDrawerCls.detail_panel)}>
|
<PaymentReceiveDetailsTabPanelRoot>
|
||||||
<PaymentReceiveActionsBar />
|
<CommercialDocBox>
|
||||||
|
|
||||||
<Card>
|
|
||||||
<PaymentReceiveDetailHeader />
|
<PaymentReceiveDetailHeader />
|
||||||
<PaymentReceiveDetailTable />
|
<PaymentReceiveDetailTable />
|
||||||
<PaymentReceiveDetailFooter />
|
<PaymentReceiveDetailFooter />
|
||||||
</Card>
|
</CommercialDocBox>
|
||||||
</div>
|
</PaymentReceiveDetailsTabPanelRoot>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const PaymentReceiveDetailsTabPanelRoot = styled.div``;
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import clsx from 'classnames';
|
|
||||||
|
import { CommercialDocEntriesTable } from 'components';
|
||||||
|
|
||||||
import { usePaymentReceiveEntriesColumns } from './utils';
|
import { usePaymentReceiveEntriesColumns } from './utils';
|
||||||
import { DataTable } from 'components';
|
|
||||||
|
|
||||||
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
||||||
|
|
||||||
import PaymentDrawerCls from './PaymentReceiveDrawer.module.scss';
|
import { TableStyle } from 'common';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment receive readonly details table.
|
* Payment receive readonly details table.
|
||||||
@@ -19,12 +18,10 @@ export default function PaymentReceiveDetailTable() {
|
|||||||
} = usePaymentReceiveDetailContext();
|
} = usePaymentReceiveDetailContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={clsx(PaymentDrawerCls.detail_panel_table)}>
|
<CommercialDocEntriesTable
|
||||||
<DataTable
|
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={entries}
|
data={entries}
|
||||||
className={'table-constrant'}
|
styleName={TableStyle.Constrant}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
import { Card } from 'components';
|
||||||
|
import JournalEntriesTable, {
|
||||||
|
AmountDisplayedBaseCurrencyMessage,
|
||||||
|
} from '../../JournalEntriesTable/JournalEntriesTable';
|
||||||
|
|
||||||
|
import { useTransactionsByReference } from 'hooks/query';
|
||||||
|
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Payment receive GL entries table panel.
|
||||||
|
* @returns {React.JSX}
|
||||||
|
*/
|
||||||
|
export function PaymentReceiveGLEntriesPanel() {
|
||||||
|
const { paymentReceiveId } = usePaymentReceiveDetailContext();
|
||||||
|
|
||||||
|
// Handle fetch transaction by reference.
|
||||||
|
const {
|
||||||
|
data: { transactions },
|
||||||
|
isLoading: isTransactionsLoading,
|
||||||
|
} = useTransactionsByReference(
|
||||||
|
{
|
||||||
|
reference_id: paymentReceiveId,
|
||||||
|
reference_type: 'paymentReceive',
|
||||||
|
},
|
||||||
|
{ enabled: !!paymentReceiveId },
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PaymentReceiveGLEntriesRoot>
|
||||||
|
<AmountDisplayedBaseCurrencyMessage />
|
||||||
|
<JournalEntriesTable
|
||||||
|
loading={isTransactionsLoading}
|
||||||
|
transactions={transactions}
|
||||||
|
/>
|
||||||
|
</PaymentReceiveGLEntriesRoot>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const PaymentReceiveGLEntriesRoot = styled(Card)``;
|
||||||
Reference in New Issue
Block a user