mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
fix:(item & paymemt receive & made) : preferred values.
This commit is contained in:
@@ -67,7 +67,7 @@ function ItemForm({
|
||||
const history = useHistory();
|
||||
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
|
||||
/**
|
||||
* Initial values in create and edit mode.
|
||||
*/
|
||||
@@ -122,10 +122,9 @@ function ItemForm({
|
||||
AppToaster.show({
|
||||
message: formatMessage(
|
||||
{
|
||||
id:
|
||||
isNewMode
|
||||
? 'the_item_has_been_created_successfully'
|
||||
: 'the_item_has_been_edited_successfully',
|
||||
id: isNewMode
|
||||
? 'the_item_has_been_created_successfully'
|
||||
: 'the_item_has_been_edited_successfully',
|
||||
},
|
||||
{
|
||||
number: itemId,
|
||||
@@ -181,10 +180,8 @@ function ItemForm({
|
||||
|
||||
export default compose(
|
||||
withSettings(({ itemsSettings }) => ({
|
||||
preferredCostAccount: parseInt(itemsSettings?.preferredCostAccount),
|
||||
preferredSellAccount: parseInt(itemsSettings?.preferredSellAccount),
|
||||
preferredInventoryAccount: parseInt(
|
||||
itemsSettings?.preferredInventoryAccount,
|
||||
),
|
||||
preferredCostAccount: parseInt(itemsSettings?.costAccount),
|
||||
preferredSellAccount: parseInt(itemsSettings?.sellAccount),
|
||||
preferredInventoryAccount: parseInt(itemsSettings?.inventoryAccount),
|
||||
})),
|
||||
)(ItemForm);
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
|
||||
import { Formik, Form } from 'formik';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { sumBy, pick } from 'lodash';
|
||||
import { sumBy, pick, defaultTo } from 'lodash';
|
||||
import classNames from 'classnames';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
@@ -26,7 +26,10 @@ import { defaultPaymentMade, transformToEditForm, ERRORS } from './utils';
|
||||
/**
|
||||
* Payment made form component.
|
||||
*/
|
||||
function PaymentMadeForm() {
|
||||
function PaymentMadeForm({
|
||||
// #withSettings
|
||||
preferredPaymentAccount,
|
||||
}) {
|
||||
const history = useHistory();
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
@@ -50,6 +53,7 @@ function PaymentMadeForm() {
|
||||
}
|
||||
: {
|
||||
...defaultPaymentMade,
|
||||
payment_account_id: defaultTo(preferredPaymentAccount),
|
||||
entries: orderingLinesIndexes(defaultPaymentMade.entries),
|
||||
}),
|
||||
}),
|
||||
@@ -156,5 +160,6 @@ export default compose(
|
||||
withSettings(({ billPaymentSettings }) => ({
|
||||
paymentNextNumber: billPaymentSettings?.next_number,
|
||||
paymentNumberPrefix: billPaymentSettings?.number_prefix,
|
||||
preferredPaymentAccount: parseInt(billPaymentSettings?.withdrawalAccount),
|
||||
})),
|
||||
)(PaymentMadeForm);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { Formik, Form } from 'formik';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { omit, sumBy, pick, isEmpty } from 'lodash';
|
||||
import { omit, sumBy, pick, isEmpty, defaultTo } from 'lodash';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import classNames from 'classnames';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
@@ -33,6 +33,7 @@ import { defaultPaymentReceive, transformToEditForm } from './utils';
|
||||
*/
|
||||
function PaymentReceiveForm({
|
||||
// #withSettings
|
||||
preferredDepositAccount,
|
||||
paymentReceiveNextNumber,
|
||||
paymentReceiveNumberPrefix,
|
||||
paymentReceiveAutoIncrement,
|
||||
@@ -65,6 +66,7 @@ function PaymentReceiveForm({
|
||||
...defaultPaymentReceive,
|
||||
...(paymentReceiveAutoIncrement && {
|
||||
payment_receive_no: nextPaymentNumber,
|
||||
deposit_account_id: defaultTo(preferredDepositAccount, ''),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
@@ -161,7 +163,6 @@ function PaymentReceiveForm({
|
||||
createPaymentReceiveMutate(form).then(onSaved).catch(onError);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames(
|
||||
@@ -198,8 +199,10 @@ function PaymentReceiveForm({
|
||||
|
||||
export default compose(
|
||||
withSettings(({ paymentReceiveSettings }) => ({
|
||||
paymentReceiveSettings,
|
||||
paymentReceiveNextNumber: paymentReceiveSettings?.nextNumber,
|
||||
paymentReceiveNumberPrefix: paymentReceiveSettings?.numberPrefix,
|
||||
paymentReceiveAutoIncrement: paymentReceiveSettings?.autoIncrement,
|
||||
preferredDepositAccount: paymentReceiveSettings?.depositAccount,
|
||||
})),
|
||||
)(PaymentReceiveForm);
|
||||
|
||||
Reference in New Issue
Block a user