mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
fix: accountant.
This commit is contained in:
@@ -4,9 +4,9 @@ const Schema = Yup.object().shape({
|
||||
accounting_basis: Yup.string().required(),
|
||||
account_code_required: Yup.boolean().nullable(),
|
||||
account_code_unique: Yup.boolean().nullable(),
|
||||
deposit_account: Yup.number().nullable(),
|
||||
withdrawal_account: Yup.number().nullable(),
|
||||
advance_deposit: Yup.number().nullable(),
|
||||
preferred_deposit_account: Yup.number().nullable(),
|
||||
preferred_advance_deposit: Yup.number().nullable(),
|
||||
});
|
||||
|
||||
export const AccountantSchema = Schema;
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
FieldRequiredHint,
|
||||
} from 'components';
|
||||
import { handleStringChange, inputIntent } from 'utils';
|
||||
import { ACCOUNT_TYPE } from 'common/accountTypes';
|
||||
|
||||
import { useAccountantFormContext } from './AccountantFormProvider';
|
||||
|
||||
@@ -113,7 +114,7 @@ export default function AccountantForm() {
|
||||
</FastField>
|
||||
|
||||
{/* ----------- Deposit customer account ----------- */}
|
||||
<FastField name={'deposit_account'}>
|
||||
<FastField name={'preferred_deposit_account'}>
|
||||
{({
|
||||
form: { values, setFieldValue },
|
||||
field: { value },
|
||||
@@ -138,11 +139,15 @@ export default function AccountantForm() {
|
||||
<AccountsSelectList
|
||||
accounts={accounts}
|
||||
onAccountSelected={({ id }) => {
|
||||
setFieldValue('deposit_account', id);
|
||||
setFieldValue('preferred_deposit_account', id);
|
||||
}}
|
||||
selectedAccountId={value}
|
||||
defaultSelectText={<T id={'select_payment_account'} />}
|
||||
// filterByParentTypes={[ACCOUNT_PARENT_TYPE.CURRENT_ASSET]}
|
||||
filterByTypes={[
|
||||
ACCOUNT_TYPE.CASH,
|
||||
ACCOUNT_TYPE.BANK,
|
||||
ACCOUNT_TYPE.OTHER_CURRENT_ASSET,
|
||||
]}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
@@ -178,13 +183,18 @@ export default function AccountantForm() {
|
||||
}}
|
||||
selectedAccountId={value}
|
||||
defaultSelectText={<T id={'select_payment_account'} />}
|
||||
filterByTypes={[
|
||||
ACCOUNT_TYPE.CASH,
|
||||
ACCOUNT_TYPE.BANK,
|
||||
ACCOUNT_TYPE.OTHER_CURRENT_ASSET,
|
||||
]}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
{/* ----------- Withdrawal customer account ----------- */}
|
||||
<FastField name={'advance_deposit'}>
|
||||
<FastField name={'preferred_advance_deposit'}>
|
||||
{({
|
||||
form: { values, setFieldValue },
|
||||
field: { value },
|
||||
@@ -209,7 +219,7 @@ export default function AccountantForm() {
|
||||
<AccountsSelectList
|
||||
accounts={accounts}
|
||||
onAccountSelected={({ id }) => {
|
||||
setFieldValue('advance_deposit', id);
|
||||
setFieldValue('preferred_advance_deposit', id);
|
||||
}}
|
||||
selectedAccountId={value}
|
||||
defaultSelectText={<T id={'select_payment_account'} />}
|
||||
|
||||
@@ -28,15 +28,13 @@ function AccountantFormPage({
|
||||
accountsSettings,
|
||||
billPaymentSettings,
|
||||
}) {
|
||||
|
||||
|
||||
const { saveSettingMutate } = useAccountantFormContext();
|
||||
|
||||
const accountantSettings = {
|
||||
...billPaymentSettings,
|
||||
...accountsSettings,
|
||||
...pick(organizationSettings, ['accountingBasis']),
|
||||
...pick(paymentReceiveSettings, ['depositAccount', 'advanceDeposit']),
|
||||
...pick(paymentReceiveSettings, ['preferredDepositAccount', 'preferredAdvanceDeposit']),
|
||||
};
|
||||
|
||||
const initialValues = {
|
||||
|
||||
@@ -11,13 +11,13 @@ export const transformToOptions = (option) => {
|
||||
group: 'bill_payments',
|
||||
},
|
||||
{
|
||||
key: 'deposit_account',
|
||||
value: option.deposit_account,
|
||||
key: 'preferred_deposit_account',
|
||||
value: option.preferred_deposit_account,
|
||||
group: 'payment_receives',
|
||||
},
|
||||
{
|
||||
key: 'advance_deposit',
|
||||
value: option.advance_deposit,
|
||||
key: 'preferred_advance_deposit',
|
||||
value: option.preferred_advance_deposit,
|
||||
group: 'payment_receives',
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user