mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 23:30:32 +00:00
Merge pull request #318 from bigcapitalhq/big-120-get-cashflow-transaction-broken-cause-transaction-type
fix: `BIG-120` get cashflow transaction broken cause transaction type
This commit is contained in:
@@ -7,8 +7,12 @@ import {
|
|||||||
} from '@/services/Cashflow/utils';
|
} from '@/services/Cashflow/utils';
|
||||||
import AccountTransaction from './AccountTransaction';
|
import AccountTransaction from './AccountTransaction';
|
||||||
import { CASHFLOW_DIRECTION } from '@/services/Cashflow/constants';
|
import { CASHFLOW_DIRECTION } from '@/services/Cashflow/constants';
|
||||||
|
import { getTransactionTypeLabel } from '@/utils/transactions-types';
|
||||||
export default class CashflowTransaction extends TenantModel {
|
export default class CashflowTransaction extends TenantModel {
|
||||||
|
transactionType: string;
|
||||||
|
amount: number;
|
||||||
|
exchangeRate: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table name.
|
* Table name.
|
||||||
*/
|
*/
|
||||||
@@ -55,9 +59,10 @@ export default class CashflowTransaction extends TenantModel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Transaction type formatted.
|
* Transaction type formatted.
|
||||||
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
get transactionTypeFormatted() {
|
get transactionTypeFormatted() {
|
||||||
return AccountTransaction.getReferenceTypeFormatted(this.transactionType);
|
return getTransactionTypeLabel(this.transactionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
get typeMeta() {
|
get typeMeta() {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
|
||||||
import { MoneyInDialogProvider } from './MoneyInDialogProvider';
|
import { MoneyInDialogProvider } from './MoneyInDialogProvider';
|
||||||
import MoneyInForm from './MoneyInForm';
|
import MoneyInForm from './MoneyInForm';
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ function MoneyInForm({
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Handles the form submit.
|
// Handles the form submit.
|
||||||
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
|
const handleFormSubmit = (values, { setSubmitting }) => {
|
||||||
const form = {
|
const form = {
|
||||||
...omit(values, ['currency_code']),
|
...omit(values, ['currency_code']),
|
||||||
publish: true,
|
publish: true,
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ function MoneyOutForm({
|
|||||||
accountId,
|
accountId,
|
||||||
accountType,
|
accountType,
|
||||||
createCashflowTransactionMutate,
|
createCashflowTransactionMutate,
|
||||||
submitPayload,
|
|
||||||
} = useMoneyOutDialogContext();
|
} = useMoneyOutDialogContext();
|
||||||
|
|
||||||
// transaction number.
|
// transaction number.
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { useUpdateEffect } from '@/hooks';
|
|||||||
|
|
||||||
import withSettings from '@/containers/Settings/withSettings';
|
import withSettings from '@/containers/Settings/withSettings';
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
|
import { transactionNumber } from '@/utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Syncs cashflow auto-increment settings to the form once update.
|
* Syncs cashflow auto-increment settings to the form once update.
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import ReferenceNumberForm from '@/containers/JournalNumber/ReferenceNumberForm'
|
|||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
import withSettings from '@/containers/Settings/withSettings';
|
import withSettings from '@/containers/Settings/withSettings';
|
||||||
import withSettingsActions from '@/containers/Settings/withSettingsActions';
|
import withSettingsActions from '@/containers/Settings/withSettingsActions';
|
||||||
import { compose } from '@/utils';
|
|
||||||
import {
|
import {
|
||||||
transformFormToSettings,
|
transformFormToSettings,
|
||||||
transformSettingsToForm,
|
transformSettingsToForm,
|
||||||
} from '@/containers/JournalNumber/utils';
|
} from '@/containers/JournalNumber/utils';
|
||||||
|
import { compose } from '@/utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transaction number dialog content.
|
* Transaction number dialog content.
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import useApiRequest from '../useRequest';
|
|||||||
import t from './types';
|
import t from './types';
|
||||||
|
|
||||||
const commonInvalidateQueries = (queryClient) => {
|
const commonInvalidateQueries = (queryClient) => {
|
||||||
|
// Invalidate settings.
|
||||||
|
queryClient.invalidateQueries([t.SETTING, t.SETTING_CASHFLOW]);
|
||||||
|
|
||||||
// Invalidate accounts.
|
// Invalidate accounts.
|
||||||
queryClient.invalidateQueries(t.ACCOUNTS);
|
queryClient.invalidateQueries(t.ACCOUNTS);
|
||||||
queryClient.invalidateQueries(t.ACCOUNT);
|
queryClient.invalidateQueries(t.ACCOUNT);
|
||||||
|
|||||||
Reference in New Issue
Block a user