mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-22 07:40:32 +00:00
feat: payment receive/made number optional.
This commit is contained in:
84
client/src/containers/Accounts/components.js
Normal file
84
client/src/containers/Accounts/components.js
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {
|
||||||
|
Position,
|
||||||
|
Classes,
|
||||||
|
Tooltip,
|
||||||
|
} from '@blueprintjs/core';
|
||||||
|
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import { Icon, Money, If, Choose } from 'components';
|
||||||
|
|
||||||
|
export function NormalCell({ cell }) {
|
||||||
|
const { formatMessage } = useIntl();
|
||||||
|
|
||||||
|
const account = cell.row.original;
|
||||||
|
const normal = account?.type?.normal || '';
|
||||||
|
const arrowDirection = normal === 'credit' ? 'down' : 'up';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Tooltip
|
||||||
|
className={Classes.TOOLTIP_INDICATOR}
|
||||||
|
content={formatMessage({ id: normal })}
|
||||||
|
position={Position.RIGHT}
|
||||||
|
hoverOpenDelay={100}
|
||||||
|
>
|
||||||
|
<Icon icon={`arrow-${arrowDirection}`} />
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function BalanceCell({ cell }) {
|
||||||
|
const account = cell.row.original;
|
||||||
|
|
||||||
|
return account.amount ? (
|
||||||
|
<span>
|
||||||
|
<Money amount={account.amount} currency={'USD'} />
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span class="placeholder">—</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function InactiveSemafro() {
|
||||||
|
return (
|
||||||
|
<Tooltip
|
||||||
|
content={<T id="inactive" />}
|
||||||
|
className={classNames(
|
||||||
|
Classes.TOOLTIP_INDICATOR,
|
||||||
|
'bp3-popover-wrapper--inactive-semafro',
|
||||||
|
)}
|
||||||
|
position={Position.TOP}
|
||||||
|
hoverOpenDelay={250}
|
||||||
|
>
|
||||||
|
<div className="inactive-semafro"></div>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AccountNameAccessor(row) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Choose>
|
||||||
|
<Choose.When condition={!!row.description}>
|
||||||
|
<Tooltip
|
||||||
|
className={classNames(
|
||||||
|
Classes.TOOLTIP_INDICATOR,
|
||||||
|
'bp3-popover-wrapper--account-desc',
|
||||||
|
)}
|
||||||
|
content={row.description}
|
||||||
|
position={Position.RIGHT_TOP}
|
||||||
|
hoverOpenDelay={500}
|
||||||
|
>
|
||||||
|
{row.name}
|
||||||
|
</Tooltip>
|
||||||
|
</Choose.When>
|
||||||
|
|
||||||
|
<Choose.Otherwise>{row.name}</Choose.Otherwise>
|
||||||
|
</Choose>
|
||||||
|
|
||||||
|
<If condition={!row.active}>
|
||||||
|
<InactiveSemafro />
|
||||||
|
</If>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -82,7 +82,7 @@ export default class BillsPayments extends BaseController {
|
|||||||
return [
|
return [
|
||||||
check('vendor_id').exists().isNumeric().toInt(),
|
check('vendor_id').exists().isNumeric().toInt(),
|
||||||
check('payment_account_id').exists().isNumeric().toInt(),
|
check('payment_account_id').exists().isNumeric().toInt(),
|
||||||
check('payment_number').exists().trim().escape(),
|
check('payment_number').optional({ nullable: true }).trim().escape(),
|
||||||
check('payment_date').exists(),
|
check('payment_date').exists(),
|
||||||
check('description').optional().trim().escape(),
|
check('description').optional().trim().escape(),
|
||||||
check('reference').optional().trim().escape(),
|
check('reference').optional().trim().escape(),
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export interface IBillPaymentEntryDTO {
|
|||||||
export interface IBillPaymentDTO {
|
export interface IBillPaymentDTO {
|
||||||
vendorId: number,
|
vendorId: number,
|
||||||
paymentAccountId: number,
|
paymentAccountId: number,
|
||||||
paymentNumber: string,
|
paymentNumber?: string,
|
||||||
paymentDate: Date,
|
paymentDate: Date,
|
||||||
description: string,
|
description: string,
|
||||||
reference: string,
|
reference: string,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export interface IPaymentReceiveDTO {
|
|||||||
amount: number,
|
amount: number,
|
||||||
referenceNo: string,
|
referenceNo: string,
|
||||||
depositAccountId: number,
|
depositAccountId: number,
|
||||||
paymentReceiveNo: string,
|
paymentReceiveNo?: string,
|
||||||
description: string,
|
description: string,
|
||||||
entries: IPaymentReceiveEntryDTO[],
|
entries: IPaymentReceiveEntryDTO[],
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user