mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-23 08:10:32 +00:00
fix(webapp): update condition of customer opening balance
This commit is contained in:
@@ -141,6 +141,7 @@ function CustomerOpeningBalanceField() {
|
|||||||
inline={true}
|
inline={true}
|
||||||
shouldUpdate={openingBalanceFieldShouldUpdate}
|
shouldUpdate={openingBalanceFieldShouldUpdate}
|
||||||
shouldUpdateDeps={{ currencyCode: values.currency_code }}
|
shouldUpdateDeps={{ currencyCode: values.currency_code }}
|
||||||
|
fastField={true}
|
||||||
>
|
>
|
||||||
<ControlGroup>
|
<ControlGroup>
|
||||||
<InputPrependText text={values.currency_code} />
|
<InputPrependText text={values.currency_code} />
|
||||||
|
|||||||
@@ -18,7 +18,11 @@ import {
|
|||||||
ExchangeRateInputGroup,
|
ExchangeRateInputGroup,
|
||||||
FDateInput,
|
FDateInput,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { useIsVendorForeignCurrency, useSetPrimaryBranchToForm } from './utils';
|
import {
|
||||||
|
openingBalanceFieldShouldUpdate,
|
||||||
|
useIsVendorForeignCurrency,
|
||||||
|
useSetPrimaryBranchToForm,
|
||||||
|
} from './utils';
|
||||||
import { useVendorFormContext } from './VendorFormProvider';
|
import { useVendorFormContext } from './VendorFormProvider';
|
||||||
import { useCurrentOrganization } from '@/hooks/state';
|
import { useCurrentOrganization } from '@/hooks/state';
|
||||||
|
|
||||||
@@ -87,6 +91,10 @@ export default function VendorFinanicalPanelTab() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vendor opening balance field.
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
function VendorOpeningBalanceField() {
|
function VendorOpeningBalanceField() {
|
||||||
const { vendorId } = useVendorFormContext();
|
const { vendorId } = useVendorFormContext();
|
||||||
const { values } = useFormikContext();
|
const { values } = useFormikContext();
|
||||||
@@ -99,6 +107,9 @@ function VendorOpeningBalanceField() {
|
|||||||
name={'opening_balance'}
|
name={'opening_balance'}
|
||||||
label={<T id={'opening_balance'} />}
|
label={<T id={'opening_balance'} />}
|
||||||
inline={true}
|
inline={true}
|
||||||
|
shouldUpdate={openingBalanceFieldShouldUpdate}
|
||||||
|
shouldUpdateDeps={{ currencyCode: values.currency_code }}
|
||||||
|
FastField={true}
|
||||||
>
|
>
|
||||||
<ControlGroup>
|
<ControlGroup>
|
||||||
<InputPrependText text={values.currency_code} />
|
<InputPrependText text={values.currency_code} />
|
||||||
@@ -111,6 +122,10 @@ function VendorOpeningBalanceField() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vendor opening balance at date field.
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
function VendorOpeningBalanceAtField() {
|
function VendorOpeningBalanceAtField() {
|
||||||
const { vendorId } = useVendorFormContext();
|
const { vendorId } = useVendorFormContext();
|
||||||
|
|
||||||
@@ -136,6 +151,10 @@ function VendorOpeningBalanceAtField() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vendor opening balance exchange rate field if the vendor has foreign currency.
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
function VendorOpeningBalanceExchangeRateField() {
|
function VendorOpeningBalanceExchangeRateField() {
|
||||||
const { values } = useFormikContext();
|
const { values } = useFormikContext();
|
||||||
const { vendorId } = useVendorFormContext();
|
const { vendorId } = useVendorFormContext();
|
||||||
@@ -146,7 +165,6 @@ function VendorOpeningBalanceExchangeRateField() {
|
|||||||
if (!isForeignVendor || vendorId) {
|
if (!isForeignVendor || vendorId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FFormGroup
|
<FFormGroup
|
||||||
label={' '}
|
label={' '}
|
||||||
|
|||||||
Reference in New Issue
Block a user