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