mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
fix: customer/vendor opening balance .
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
} from 'hooks/query';
|
||||
import { useFeatureCan } from 'hooks/state';
|
||||
import { Features } from 'common';
|
||||
import { pick } from 'lodash';
|
||||
import { transfromCustomertoForm } from './utils';
|
||||
|
||||
const CustomerOpeningBalanceContext = React.createContext();
|
||||
|
||||
@@ -44,15 +44,7 @@ function CustomerOpeningBalanceFormProvider({
|
||||
// State provider.
|
||||
const provider = {
|
||||
branches,
|
||||
customer: {
|
||||
...pick(customer, [
|
||||
'id',
|
||||
'opening_balance',
|
||||
'opening_balance_exchange_rate',
|
||||
'currency_code',
|
||||
]),
|
||||
// opening_balance_at: customer.formatted_opening_balance_at,
|
||||
},
|
||||
customer: transfromCustomertoForm(customer),
|
||||
|
||||
isBranchesSuccess,
|
||||
isBranchesLoading,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { useFormikContext } from 'formik';
|
||||
import { first } from 'lodash';
|
||||
import { first, pick } from 'lodash';
|
||||
|
||||
import { useCustomerOpeningBalanceContext } from './CustomerOpeningBalanceFormProvider';
|
||||
|
||||
@@ -18,3 +18,14 @@ export const useSetPrimaryBranchToForm = () => {
|
||||
}
|
||||
}, [isBranchesSuccess, setFieldValue, branches]);
|
||||
};
|
||||
|
||||
export function transfromCustomertoForm(values) {
|
||||
return {
|
||||
...pick(values, [
|
||||
'id',
|
||||
'opening_balance',
|
||||
'opening_balance_exchange_rate',
|
||||
'currency_code',
|
||||
]),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from 'hooks/query';
|
||||
import { useFeatureCan } from 'hooks/state';
|
||||
import { Features } from 'common';
|
||||
import { pick, defaultTo } from 'lodash';
|
||||
import { transfromVendorToForm } from './utils';
|
||||
|
||||
const VendorOpeningBalanceContext = React.createContext();
|
||||
|
||||
@@ -43,15 +43,7 @@ function VendorOpeningBalanceFormProvider({
|
||||
// State provider.
|
||||
const provider = {
|
||||
branches,
|
||||
vendor: {
|
||||
...pick(vendor, [
|
||||
'id',
|
||||
'opening_balance',
|
||||
'opening_balance_exchange_rate',
|
||||
'currency_code',
|
||||
]),
|
||||
},
|
||||
|
||||
vendor: transfromVendorToForm(vendor),
|
||||
isBranchesSuccess,
|
||||
isBranchesLoading,
|
||||
dialogName,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { useFormikContext } from 'formik';
|
||||
import { first } from 'lodash';
|
||||
import { first, pick } from 'lodash';
|
||||
|
||||
import { useVendorOpeningBalanceContext } from './VendorOpeningBalanceFormProvider';
|
||||
|
||||
@@ -18,3 +18,14 @@ export const useSetPrimaryBranchToForm = () => {
|
||||
}
|
||||
}, [isBranchesSuccess, setFieldValue, branches]);
|
||||
};
|
||||
|
||||
export function transfromVendorToForm(values) {
|
||||
return {
|
||||
...pick(values, [
|
||||
'id',
|
||||
'opening_balance',
|
||||
'opening_balance_exchange_rate',
|
||||
'currency_code',
|
||||
]),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user