mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
BC-4: feat: base currency withCurrentOrganization
This commit is contained in:
@@ -20,6 +20,7 @@ import EstimateFormFooter from './EstimateFormFooter';
|
||||
import EstimateFormDialogs from './EstimateFormDialogs';
|
||||
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
|
||||
|
||||
import { AppToaster } from 'components';
|
||||
import { ERROR } from 'common/errors';
|
||||
@@ -35,7 +36,9 @@ function EstimateForm({
|
||||
estimateNextNumber,
|
||||
estimateNumberPrefix,
|
||||
estimateIncrementMode,
|
||||
baseCurrency,
|
||||
|
||||
// #withCurrentOrganization
|
||||
organization: { base_currency },
|
||||
}) {
|
||||
const history = useHistory();
|
||||
const {
|
||||
@@ -55,14 +58,14 @@ function EstimateForm({
|
||||
const initialValues = useMemo(
|
||||
() => ({
|
||||
...(!isEmpty(estimate)
|
||||
? { ...transformToEditForm(estimate), currency_code: baseCurrency }
|
||||
? { ...transformToEditForm(estimate), currency_code: base_currency }
|
||||
: {
|
||||
...defaultEstimate,
|
||||
...(estimateIncrementMode && {
|
||||
estimate_number: estimateNumber,
|
||||
}),
|
||||
entries: orderingLinesIndexes(defaultEstimate.entries),
|
||||
currency_code: baseCurrency,
|
||||
currency_code: base_currency,
|
||||
}),
|
||||
}),
|
||||
[estimate, estimateNumber, estimateIncrementMode],
|
||||
@@ -172,10 +175,10 @@ function EstimateForm({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withSettings(({ estimatesSettings, organizationSettings }) => ({
|
||||
withSettings(({ estimatesSettings }) => ({
|
||||
estimateNextNumber: estimatesSettings?.nextNumber,
|
||||
estimateNumberPrefix: estimatesSettings?.numberPrefix,
|
||||
estimateIncrementMode: estimatesSettings?.autoIncrement,
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
withCurrentOrganization(),
|
||||
)(EstimateForm);
|
||||
|
||||
@@ -6,7 +6,7 @@ import intl from 'react-intl-universal';
|
||||
import { CLASSES } from 'common/classes';
|
||||
import EstimateFormHeaderFields from './EstimateFormHeaderFields';
|
||||
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
|
||||
|
||||
import { getEntriesTotal } from 'containers/Entries/utils';
|
||||
import { PageFormBigNumber } from 'components';
|
||||
@@ -14,8 +14,8 @@ import { compose } from 'utils';
|
||||
|
||||
// Estimate form top header.
|
||||
function EstimateFormHeader({
|
||||
// #withSettings
|
||||
baseCurrency,
|
||||
// #withCurrentOrganization
|
||||
organization: { base_currency },
|
||||
}) {
|
||||
const { values } = useFormikContext();
|
||||
|
||||
@@ -32,14 +32,10 @@ function EstimateFormHeader({
|
||||
<PageFormBigNumber
|
||||
label={intl.get('amount')}
|
||||
amount={totalDueAmount}
|
||||
currencyCode={baseCurrency}
|
||||
currencyCode={base_currency}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
)(EstimateFormHeader);
|
||||
export default compose(withCurrentOrganization())(EstimateFormHeader);
|
||||
|
||||
@@ -9,7 +9,6 @@ import TableSkeletonRows from 'components/Datatable/TableSkeletonRows';
|
||||
import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
|
||||
|
||||
import withEstimatesActions from './withEstimatesActions';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
@@ -146,7 +145,4 @@ export default compose(
|
||||
withAlertsActions,
|
||||
withDrawerActions,
|
||||
withDialogActions,
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
)(EstimatesDataTable);
|
||||
|
||||
Reference in New Issue
Block a user