mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -42,10 +42,10 @@ const MIN_LINES_NUMBER = 4;
|
||||
|
||||
const defaultEstimate = {
|
||||
index: 0,
|
||||
item_id: null,
|
||||
rate: null,
|
||||
item_id: '',
|
||||
rate: '',
|
||||
discount: 0,
|
||||
quantity: null,
|
||||
quantity: '',
|
||||
description: '',
|
||||
};
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ function EstimatesDataTable({
|
||||
{
|
||||
id: 'estimate_number',
|
||||
Header: formatMessage({ id: 'estimate_number' }),
|
||||
accessor: (row) => `#${row.estimate_number}`,
|
||||
accessor: (row) => (row.estimate_number ? `#${row.estimate_number}` : null),
|
||||
width: 140,
|
||||
className: 'estimate_number',
|
||||
},
|
||||
|
||||
@@ -42,10 +42,10 @@ const MIN_LINES_NUMBER = 4;
|
||||
|
||||
const defaultInvoice = {
|
||||
index: 0,
|
||||
item_id: null,
|
||||
rate: null,
|
||||
item_id: '',
|
||||
rate: '',
|
||||
discount: 0,
|
||||
quantity: null,
|
||||
quantity: '',
|
||||
description: '',
|
||||
};
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ function InvoicesDataTable({
|
||||
{
|
||||
id: 'invoice_no',
|
||||
Header: formatMessage({ id: 'invoice_no__' }),
|
||||
accessor: (row) => `#${row.invoice_no}`,
|
||||
accessor: (row) => (row.invoice_no ? `#${row.invoice_no}` : null),
|
||||
width: 140,
|
||||
className: 'invoice_no',
|
||||
},
|
||||
|
||||
@@ -109,10 +109,10 @@ function PaymentReceiveForm({
|
||||
|
||||
// Default payment receive entry.
|
||||
const defaultPaymentReceiveEntry = {
|
||||
id: null,
|
||||
payment_amount: null,
|
||||
invoice_id: null,
|
||||
due_amount: null,
|
||||
id: '',
|
||||
payment_amount: '',
|
||||
invoice_id: '',
|
||||
due_amount: '',
|
||||
};
|
||||
|
||||
// Form initial values.
|
||||
|
||||
@@ -21,12 +21,15 @@ import {
|
||||
FieldRequiredHint,
|
||||
Icon,
|
||||
InputPrependButton,
|
||||
MoneyInputGroup,
|
||||
InputPrependText,
|
||||
Hint,
|
||||
Money,
|
||||
} from 'components';
|
||||
|
||||
import withCustomers from 'containers/Customers/withCustomers';
|
||||
import withAccounts from 'containers/Accounts/withAccounts';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
|
||||
function PaymentReceiveFormHeader({
|
||||
@@ -47,6 +50,9 @@ function PaymentReceiveFormHeader({
|
||||
//#withAccouts
|
||||
accountsList,
|
||||
|
||||
//#withSettings
|
||||
baseCurrency,
|
||||
|
||||
// #withInvoices
|
||||
receivableInvoices,
|
||||
// #ownProps
|
||||
@@ -150,15 +156,17 @@ function PaymentReceiveFormHeader({
|
||||
<ErrorMessage name="full_amount" {...{ errors, touched }} />
|
||||
}
|
||||
>
|
||||
<InputGroup
|
||||
intent={
|
||||
errors.full_amount && touched.full_amount && Intent.DANGER
|
||||
}
|
||||
minimal={true}
|
||||
value={values.full_amount}
|
||||
{...getFieldProps('full_amount')}
|
||||
onBlur={handleFullAmountBlur}
|
||||
/>
|
||||
<ControlGroup>
|
||||
<InputPrependText text={baseCurrency} />
|
||||
<MoneyInputGroup
|
||||
value={values.full_amount}
|
||||
inputGroupProps={{
|
||||
medium: true,
|
||||
onBlur: { handleFullAmountBlur },
|
||||
...getFieldProps('full_amount'),
|
||||
}}
|
||||
/>
|
||||
</ControlGroup>
|
||||
|
||||
<a
|
||||
onClick={handleReceiveFullAmountClick}
|
||||
@@ -166,7 +174,7 @@ function PaymentReceiveFormHeader({
|
||||
className={'receive-full-amount'}
|
||||
>
|
||||
Receive full amount (
|
||||
<Money amount={receivableFullAmount} currency={'USD'} />)
|
||||
<Money amount={receivableFullAmount} currency={baseCurrency} />)
|
||||
</a>
|
||||
</FormGroup>
|
||||
|
||||
@@ -270,7 +278,7 @@ function PaymentReceiveFormHeader({
|
||||
<div class="big-amount">
|
||||
<span class="big-amount__label">Amount Received</span>
|
||||
<h1 class="big-amount__number">
|
||||
<Money amount={amountReceived} currency={'USD'} />
|
||||
<Money amount={amountReceived} currency={baseCurrency} />
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
@@ -286,5 +294,8 @@ export default compose(
|
||||
withAccounts(({ accountsList }) => ({
|
||||
accountsList,
|
||||
})),
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
withDialogActions,
|
||||
)(PaymentReceiveFormHeader);
|
||||
|
||||
@@ -26,12 +26,12 @@ const CellRenderer = (content, type) => (props) => {
|
||||
|
||||
const TotalCellRederer = (content, type) => (props) => {
|
||||
if (props.data.length === props.row.index + 1) {
|
||||
return <Money amount={props.cell.row.original[type]} currency={'USD'} />
|
||||
return <Money amount={props.cell.row.original[type]} currency={'USD'} />;
|
||||
}
|
||||
return content(props);
|
||||
};
|
||||
|
||||
export default function PaymentReceiveItemsTableEditor ({
|
||||
export default function PaymentReceiveItemsTableEditor({
|
||||
onClickClearAllLines,
|
||||
onUpdateData,
|
||||
data,
|
||||
@@ -39,12 +39,14 @@ export default function PaymentReceiveItemsTableEditor ({
|
||||
noResultsMessage,
|
||||
}) {
|
||||
const transformedData = useMemo(() => {
|
||||
const rows = [ ...data ];
|
||||
const rows = [...data];
|
||||
const totalRow = {
|
||||
due_amount: sumBy(data, 'due_amount'),
|
||||
payment_amount: sumBy(data, 'payment_amount'),
|
||||
};
|
||||
if (rows.length > 0) { rows.push(totalRow) }
|
||||
if (rows.length > 0) {
|
||||
rows.push(totalRow);
|
||||
}
|
||||
return rows;
|
||||
}, [data]);
|
||||
|
||||
@@ -81,7 +83,7 @@ export default function PaymentReceiveItemsTableEditor ({
|
||||
Header: formatMessage({ id: 'invocie_number' }),
|
||||
accessor: (row) => {
|
||||
const invNumber = row?.invoice_no || row?.id;
|
||||
return `#INV-${invNumber}`;
|
||||
return `#INV-${invNumber || ''}`;
|
||||
},
|
||||
Cell: CellRenderer(EmptyDiv, 'invoice_no'),
|
||||
disableSortBy: true,
|
||||
@@ -121,7 +123,7 @@ export default function PaymentReceiveItemsTableEditor ({
|
||||
};
|
||||
|
||||
const rowClassNames = useCallback(
|
||||
(row) => ({ 'row--total': localData.length === row.index + 1 }),
|
||||
(row) => ({ 'row--total': localData.length === row.index + 1 }),
|
||||
[localData],
|
||||
);
|
||||
|
||||
@@ -144,10 +146,12 @@ export default function PaymentReceiveItemsTableEditor ({
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={classNames(
|
||||
CLASSES.DATATABLE_EDITOR,
|
||||
CLASSES.DATATABLE_EDITOR_ITEMS_ENTRIES,
|
||||
)}>
|
||||
<div
|
||||
className={classNames(
|
||||
CLASSES.DATATABLE_EDITOR,
|
||||
CLASSES.DATATABLE_EDITOR_ITEMS_ENTRIES,
|
||||
)}
|
||||
>
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={localData}
|
||||
@@ -170,5 +174,4 @@ export default function PaymentReceiveItemsTableEditor ({
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ const MIN_LINES_NUMBER = 4;
|
||||
|
||||
const defaultReceipt = {
|
||||
index: 0,
|
||||
item_id: null,
|
||||
rate: null,
|
||||
item_id: '',
|
||||
rate: '',
|
||||
discount: 0,
|
||||
quantity: null,
|
||||
quantity: '',
|
||||
description: '',
|
||||
};
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ function ReceiptsDataTable({
|
||||
{
|
||||
id: 'receipt_number',
|
||||
Header: formatMessage({ id: 'receipt_number' }),
|
||||
accessor: (row) => `#${row.receipt_number}`,
|
||||
accessor: (row) => (row.receipt_number ? `#${row.receipt_number}` : null),
|
||||
width: 140,
|
||||
className: 'receipt_number',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user