+
+
+
);
}
diff --git a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/MoneyOutFormDialog.tsx b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/MoneyOutFormDialog.tsx
index d104fce21..2febd6961 100644
--- a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/MoneyOutFormDialog.tsx
+++ b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/MoneyOutFormDialog.tsx
@@ -17,6 +17,7 @@ export default function MoneyOutFormDialog() {
setFieldValue('transaction_number', incrementNumber || '');
setFieldValue('transaction_number_manually', manually);
};
+
return (
-
-
-
-
+
+
);
}
diff --git a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/OtherExpense/OtherExpnseFormFields.tsx b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/OtherExpense/OtherExpnseFormFields.tsx
index bfbdf845c..36373c84a 100644
--- a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/OtherExpense/OtherExpnseFormFields.tsx
+++ b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/OtherExpense/OtherExpnseFormFields.tsx
@@ -1,33 +1,25 @@
// @ts-nocheck
import React from 'react';
-import { FastField, Field, ErrorMessage, useFormikContext } from 'formik';
-import {
- Classes,
- FormGroup,
- InputGroup,
- TextArea,
- Position,
- ControlGroup,
-} from '@blueprintjs/core';
+import { FastField, ErrorMessage } from 'formik';
+import { FormGroup, Position, ControlGroup } from '@blueprintjs/core';
import classNames from 'classnames';
import {
FormattedMessage as T,
AccountsSuggestField,
InputPrependText,
- MoneyInputGroup,
FieldRequiredHint,
Col,
Row,
- If,
FeatureCan,
BranchSelect,
BranchSelectButton,
- ExchangeRateMutedField,
+ FTextArea,
+ FFormGroup,
+ FInputGroup,
+ FMoneyInputGroup,
} from '@/components';
import { DateInput } from '@blueprintjs/datetime';
-import { useAutofocus } from '@/hooks';
import { Features, ACCOUNT_TYPE } from '@/constants';
-
import {
inputIntent,
momentFormatter,
@@ -36,25 +28,18 @@ import {
} from '@/utils';
import { CLASSES } from '@/constants/classes';
import { useMoneyOutDialogContext } from '../MoneyOutDialogProvider';
-import {
- useSetPrimaryBranchToForm,
- useForeignAccount,
- BranchRowDivider,
-} from '../utils';
-
+import { useSetPrimaryBranchToForm, BranchRowDivider } from '../utils';
import { MoneyInOutTransactionNoField } from '../../_components';
+import { MoneyOutExchangeRateField } from '../MoneyOutExchangeRateField';
+import { useMoneyOutFieldsContext } from '../MoneyOutFieldsProvider';
/**
* Other expense form fields.
*/
export default function OtherExpnseFormFields() {
// Money in dialog context.
- const { accounts, account, branches } = useMoneyOutDialogContext();
-
- const isForeigAccount = useForeignAccount();
- const { values } = useFormikContext();
-
- const amountFieldRef = useAutofocus();
+ const { accounts, branches } = useMoneyOutDialogContext();
+ const { account } = useMoneyOutFieldsContext();
// Sets the primary branch to form.
useSetPrimaryBranchToForm();
@@ -64,21 +49,19 @@ export default function OtherExpnseFormFields() {
- }
- className={classNames('form-group--select-list', Classes.FILL)}
- >
+ }>
-
+
+
{/*------------ Date -----------*/}
@@ -113,47 +96,27 @@ export default function OtherExpnseFormFields() {
+
{/*------------ amount -----------*/}
-
- {({
- form: { values, setFieldValue },
- field: { value },
- meta: { error, touched },
- }) => (
-
+
+ }
labelInfo={}
- intent={inputIntent({ error, touched })}
- helperText={}
- className={'form-group--amount'}
>
-
- {
- setFieldValue('amount', amount);
- }}
- inputRef={(ref) => (amountFieldRef.current = ref)}
- intent={inputIntent({ error, touched })}
- />
+
-
- )}
-
-
- {/*------------ exchange rate -----------*/}
-
-
+
+
+
+
+ {/*------------ Exchange rate -----------*/}
+
+
{/*------------ other expense account -----------*/}
@@ -183,44 +146,24 @@ export default function OtherExpnseFormFields() {
)}
+
{/*------------ Reference -----------*/}
-
- {({ form, field, meta: { error, touched } }) => (
- }
- intent={inputIntent({ error, touched })}
- helperText={}
- className={'form-group--reference-no'}
- >
-
-
- )}
-
+ }>
+
+
{/*------------ description -----------*/}
-
- {({ field, meta: { error, touched } }) => (
- }
- className={'form-group--description'}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
-
-
- )}
-
+
}>
+
+
);
}
diff --git a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/OwnerDrawings/OwnerDrawingsFormFields.tsx b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/OwnerDrawings/OwnerDrawingsFormFields.tsx
index 8630c5b03..ffb944f90 100644
--- a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/OwnerDrawings/OwnerDrawingsFormFields.tsx
+++ b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/OwnerDrawings/OwnerDrawingsFormFields.tsx
@@ -1,31 +1,24 @@
// @ts-nocheck
import React from 'react';
-import { FastField, Field, ErrorMessage, useFormikContext } from 'formik';
+import { FastField, ErrorMessage } from 'formik';
import { DateInput } from '@blueprintjs/datetime';
-import {
- Classes,
- FormGroup,
- InputGroup,
- TextArea,
- Position,
- ControlGroup,
-} from '@blueprintjs/core';
+import { FormGroup, Position, ControlGroup } from '@blueprintjs/core';
import classNames from 'classnames';
import {
FormattedMessage as T,
AccountsSuggestField,
InputPrependText,
- MoneyInputGroup,
FieldRequiredHint,
- If,
Col,
Row,
FeatureCan,
BranchSelect,
BranchSelectButton,
- ExchangeRateMutedField,
+ FFormGroup,
+ FTextArea,
+ FInputGroup,
+ FMoneyInputGroup,
} from '@/components';
-import { useAutofocus } from '@/hooks';
import { CLASSES, Features, ACCOUNT_TYPE } from '@/constants';
import {
inputIntent,
@@ -36,21 +29,19 @@ import {
import { useMoneyOutDialogContext } from '../MoneyOutDialogProvider';
import {
useSetPrimaryBranchToForm,
- useForeignAccount,
BranchRowDivider,
} from '../../MoneyOutDialog/utils';
import { MoneyInOutTransactionNoField } from '../../_components';
+import { useMoneyOutFieldsContext } from '../MoneyOutFieldsProvider';
+import { MoneyOutExchangeRateField } from '../MoneyOutExchangeRateField';
/**
* Owner drawings form fields.
*/
export default function OwnerDrawingsFormFields() {
// Money out dialog context.
- const { accounts, account, branches } = useMoneyOutDialogContext();
- const { values } = useFormikContext();
- const isForeigAccount = useForeignAccount();
-
- const amountFieldRef = useAutofocus();
+ const { accounts, branches } = useMoneyOutDialogContext();
+ const { account } = useMoneyOutFieldsContext();
// Sets the primary branch to form.
useSetPrimaryBranchToForm();
@@ -60,21 +51,19 @@ export default function OwnerDrawingsFormFields() {
- }
- className={classNames('form-group--select-list', Classes.FILL)}
- >
+ } name={'branch_id'}>
-
+
+
{/*------------ Date -----------*/}
@@ -109,48 +98,27 @@ export default function OwnerDrawingsFormFields() {
- {/*------------ amount -----------*/}
-
- {({
- form: { values, setFieldValue },
- field: { value },
- meta: { error, touched },
- }) => (
+
+ {/*------------ Amount -----------*/}
+
+
+
}
labelInfo={}
- intent={inputIntent({ error, touched })}
- helperText={}
- className={'form-group--amount'}
>
-
- {
- setFieldValue('amount', amount);
- }}
- inputRef={(ref) => (amountFieldRef.current = ref)}
- intent={inputIntent({ error, touched })}
- />
+
- )}
-
+
+
+
+ {/*------------ Exchange rate -----------*/}
+
-
- {/*------------ exchange rate -----------*/}
-
-
{/*------------ equitty account -----------*/}
@@ -177,44 +145,24 @@ export default function OwnerDrawingsFormFields() {
)}
+
{/*------------ Reference -----------*/}
-
- {({ form, field, meta: { error, touched } }) => (
- }
- intent={inputIntent({ error, touched })}
- helperText={}
- className={'form-group--reference-no'}
- >
-
-
- )}
-
+ }>
+
+
{/*------------ description -----------*/}
-
- {({ field, meta: { error, touched } }) => (
- }
- className={'form-group--description'}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
-
-
- )}
-
+
}>
+
+
);
}
diff --git a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/TransactionTypeFields.tsx b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/TransactionTypeFields.tsx
index da51489b8..97ffa963e 100644
--- a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/TransactionTypeFields.tsx
+++ b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/TransactionTypeFields.tsx
@@ -1,22 +1,21 @@
// @ts-nocheck
import React, { useMemo } from 'react';
-import { FastField, Field, ErrorMessage } from 'formik';
+import { FastField, ErrorMessage } from 'formik';
import { FormGroup } from '@blueprintjs/core';
import classNames from 'classnames';
import {
FormattedMessage as T,
AccountsSuggestField,
FieldRequiredHint,
- ListSelect,
Col,
Row,
+ FSelect,
+ FFormGroup,
} from '@/components';
-
import { inputIntent } from '@/utils';
-import { CLASSES } from '@/constants/classes';
import { getAddMoneyOutOptions } from '@/constants/cashflowOptions';
-
import { useMoneyOutDialogContext } from './MoneyOutDialogProvider';
+import { CLASSES } from '@/constants/classes';
/**
* Transaction type fields.
@@ -27,9 +26,32 @@ function TransactionTypeFields() {
const addMoneyOutOptions = useMemo(() => getAddMoneyOutOptions(), []);
+ // Money in dialog context.
+ const { defaultAccountId, setAccountId } = useMoneyOutDialogContext();
+
+ // Cannot continue if the default account id is defined.
+ if (defaultAccountId) return null;
+
return (
+ {/*------------ Transaction type -----------*/}
+
+ }
+ labelInfo={}
+ >
+
+
+
+
{/*------------ Current account -----------*/}
@@ -47,9 +69,10 @@ function TransactionTypeFields() {
>
- form.setFieldValue('cashflow_account_id', id)
- }
+ onAccountSelected={({ id }) => {
+ form.setFieldValue('cashflow_account_id', id);
+ setAccountId(id);
+ }}
inputProps={{
intent: inputIntent({ error, touched }),
}}
@@ -57,39 +80,6 @@ function TransactionTypeFields() {
)}
- {/*------------ Transaction type -----------*/}
-
-
-
- {({
- form: { values, setFieldValue },
- field: { value },
- meta: { error, touched },
- }) => (
- }
- labelInfo={}
- helperText={}
- intent={inputIntent({ error, touched })}
- className={classNames(
- CLASSES.FILL,
- 'form-group--transaction_type',
- )}
- >
- {
- setFieldValue('transaction_type', type.value);
- }}
- filterable={false}
- selectedItem={value}
- selectedItemProp={'value'}
- textProp={'name'}
- popoverProps={{ minimal: true }}
- />
-
- )}
-
diff --git a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/TransferToAccount/TransferToAccountFormFields.tsx b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/TransferToAccount/TransferToAccountFormFields.tsx
index ff8a986e8..504a9c8b8 100644
--- a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/TransferToAccount/TransferToAccountFormFields.tsx
+++ b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/TransferToAccount/TransferToAccountFormFields.tsx
@@ -1,65 +1,46 @@
// @ts-nocheck
import React from 'react';
-import { FastField, Field, ErrorMessage, useFormikContext } from 'formik';
-import {
- Classes,
- FormGroup,
- InputGroup,
- TextArea,
- Position,
- ControlGroup,
-} from '@blueprintjs/core';
+import { FastField, ErrorMessage } from 'formik';
+import { FormGroup, Position, ControlGroup } from '@blueprintjs/core';
import classNames from 'classnames';
import {
FormattedMessage as T,
AccountsSuggestField,
InputPrependText,
- MoneyInputGroup,
FieldRequiredHint,
- Icon,
Col,
Row,
- If,
- InputPrependButton,
FeatureCan,
BranchSelect,
BranchSelectButton,
- ExchangeRateMutedField,
+ FFormGroup,
+ FTextArea,
+ FMoneyInputGroup,
+ FInputGroup,
} from '@/components';
import { DateInput } from '@blueprintjs/datetime';
-import { useAutofocus } from '@/hooks';
import { ACCOUNT_TYPE } from '@/constants/accountTypes';
-
import {
inputIntent,
momentFormatter,
tansformDateValue,
handleDateChange,
- compose,
} from '@/utils';
import { Features } from '@/constants';
import { CLASSES } from '@/constants/classes';
import { useMoneyOutDialogContext } from '../MoneyOutDialogProvider';
-import {
- useObserveTransactionNoSettings,
- useSetPrimaryBranchToForm,
- useForeignAccount,
- BranchRowDivider,
-} from '../utils';
-import withSettings from '@/containers/Settings/withSettings';
-import withDialogActions from '@/containers/Dialog/withDialogActions';
+import { useSetPrimaryBranchToForm, BranchRowDivider } from '../utils';
import { MoneyInOutTransactionNoField } from '../../_components';
+import { MoneyOutExchangeRateField } from '../MoneyOutExchangeRateField';
+import { useMoneyOutFieldsContext } from '../MoneyOutFieldsProvider';
/**
* Transfer to account form fields.
*/
export default function TransferToAccountFormFields() {
// Money in dialog context.
- const { accounts, account, branches } = useMoneyOutDialogContext();
- const { values } = useFormikContext();
- const isForeigAccount = useForeignAccount();
-
- const accountRef = useAutofocus();
+ const { accounts, branches } = useMoneyOutDialogContext();
+ const { account } = useMoneyOutFieldsContext();
// Sets the primary branch to form.
useSetPrimaryBranchToForm();
@@ -69,21 +50,19 @@ export default function TransferToAccountFormFields() {
- }
- className={classNames('form-group--select-list', Classes.FILL)}
- >
+ } name={'branch_id'}>
-
+
+
{/*------------ Date -----------*/}
@@ -113,52 +92,32 @@ export default function TransferToAccountFormFields() {
)}
+
{/*------------ Transaction number -----------*/}
- {/*------------ amount -----------*/}
-
- {({
- form: { values, setFieldValue },
- field: { value },
- meta: { error, touched },
- }) => (
-
+
+ }
labelInfo={}
- intent={inputIntent({ error, touched })}
- helperText={}
- className={'form-group--amount'}
>
-
- {
- setFieldValue('amount', amount);
- }}
- inputRef={accountRef}
- intent={inputIntent({ error, touched })}
- />
+
-
- )}
-
-
- {/*------------ exchange rate -----------*/}
-
-
+
+
+
+
+ {/*------------ Exchange rate -----------*/}
+
+
{/*------------ transfer from account -----------*/}
@@ -191,43 +150,24 @@ export default function TransferToAccountFormFields() {
)}
+
{/*------------ Reference -----------*/}
-
- {({ form, field, meta: { error, touched } }) => (
- }
- intent={inputIntent({ error, touched })}
- helperText={}
- className={'form-group--reference-no'}
- >
-
-
- )}
-
+ }>
+
+
- {/*------------ description -----------*/}
-
- {({ field, meta: { error, touched } }) => (
- }
- className={'form-group--description'}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
-
-
- )}
-
+
+ {/*------------ Description -----------*/}
+
}>
+
+
);
}
diff --git a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/utils.tsx b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/utils.tsx
index f661b6557..7cb3d244c 100644
--- a/packages/webapp/src/containers/CashFlow/MoneyOutDialog/utils.tsx
+++ b/packages/webapp/src/containers/CashFlow/MoneyOutDialog/utils.tsx
@@ -6,6 +6,7 @@ import { transactionNumber } from '@/utils';
import { first, isEqual, isNull } from 'lodash';
import { useMoneyOutDialogContext } from './MoneyOutDialogProvider';
+import { useMoneyOutFieldsContext } from './MoneyOutFieldsProvider';
export const useObserveTransactionNoSettings = (prefix, nextNumber) => {
const { setFieldValue } = useFormikContext();
@@ -33,7 +34,7 @@ export const useSetPrimaryBranchToForm = () => {
export const useForeignAccount = () => {
const { values } = useFormikContext();
- const { account } = useMoneyOutDialogContext();
+ const { account } = useMoneyOutFieldsContext();
return (
!isEqual(account.currency_code, values.currency_code) &&
diff --git a/packages/webapp/src/containers/CashFlow/_components.tsx b/packages/webapp/src/containers/CashFlow/_components.tsx
index 4b9e7ca86..0195b298f 100644
--- a/packages/webapp/src/containers/CashFlow/_components.tsx
+++ b/packages/webapp/src/containers/CashFlow/_components.tsx
@@ -38,11 +38,11 @@ export const MoneyInOutSyncIncrementSettingsToForm = R.compose(
// Do not update if the invoice auto-increment is disabled.
if (!transactionAutoIncrement) return null;
- const transactionNumber = transactionNumber(
+ const newTransactionNumber = transactionNumber(
transactionNumberPrefix,
transactionNextNumber,
);
- setFieldValue('transaction_number', transactionNumber);
+ setFieldValue('transaction_number', newTransactionNumber);
}, [setFieldValue, transactionNumberPrefix, transactionNextNumber]);
return null;
diff --git a/packages/webapp/src/containers/Customers/CustomerForm/CustomerFinancialPanel.tsx b/packages/webapp/src/containers/Customers/CustomerForm/CustomerFinancialPanel.tsx
index 8de4eb45c..f6104ae44 100644
--- a/packages/webapp/src/containers/Customers/CustomerForm/CustomerFinancialPanel.tsx
+++ b/packages/webapp/src/containers/Customers/CustomerForm/CustomerFinancialPanel.tsx
@@ -10,7 +10,6 @@ import {
InputPrependText,
CurrencySelectList,
BranchSelect,
- BranchSelectButton,
FeatureCan,
Row,
Col,
@@ -78,12 +77,10 @@ export default function CustomerFinancialPanel() {
label={
}
name={'opening_balance_branch_id'}
inline={true}
- className={classNames('form-group--select-list', Classes.FILL)}
>
diff --git a/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerDetails.tsx b/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerDetails.tsx
index 4dec0dae4..22544b57b 100644
--- a/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerDetails.tsx
+++ b/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerDetails.tsx
@@ -1,12 +1,13 @@
// @ts-nocheck
import React from 'react';
-import { Card } from '@/components';
+import { Card, CommercialDocBox } from '@/components';
import CashflowTransactionDrawerActionBar from './CashflowTransactionDrawerActionBar';
import CashflowTransactionDrawerHeader from './CashflowTransactionDrawerHeader';
import CashflowTransactionDrawerTable from './CashflowTransactionDrawerTable';
-import CashflowTransactionDrawerFooter from './CashflowTransactionDrawerFooter';
+import CashflowTransactionDrawerTableFooter from './CashflowTransactionDrawerTableFooter';
+import { CashflowTransactionDrawerFooter } from './CashflowTransactionDrawerFooter';
/**
* Cashflow transaction view details.
*/
@@ -16,11 +17,12 @@ export default function CashflowTransactionDrawerDetails() {
-
+
+
-
+
);
diff --git a/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerFooter.tsx b/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerFooter.tsx
index 79c6a0706..b3a7ea58f 100644
--- a/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerFooter.tsx
+++ b/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerFooter.tsx
@@ -1,35 +1,18 @@
// @ts-nocheck
import React from 'react';
+import { CommercialDocFooter, DetailsMenu, DetailItem, T } from '@/components';
import { useCashflowTransactionDrawerContext } from './CashflowTransactionDrawerProvider';
-import { T, FormatNumber } from '@/components';
-export default function CashflowTransactionDrawerFooter() {
- const {
- cashflowTransaction: { formatted_amount },
- } = useCashflowTransactionDrawerContext();
+export function CashflowTransactionDrawerFooter() {
+ const { cashflowTransaction } = useCashflowTransactionDrawerContext();
return (
-
);
}
diff --git a/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerTableFooter.tsx b/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerTableFooter.tsx
new file mode 100644
index 000000000..b46f6c0fe
--- /dev/null
+++ b/packages/webapp/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerTableFooter.tsx
@@ -0,0 +1,35 @@
+// @ts-nocheck
+import React from 'react';
+import { useCashflowTransactionDrawerContext } from './CashflowTransactionDrawerProvider';
+import { T, FormatNumber } from '@/components';
+
+export default function CashflowTransactionDrawerTableFooter() {
+ const {
+ cashflowTransaction: { formatted_amount },
+ } = useCashflowTransactionDrawerContext();
+
+ return (
+
+ );
+}
diff --git a/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailFooter.tsx b/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailFooter.tsx
index fb1360c6d..237254652 100644
--- a/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailFooter.tsx
+++ b/packages/webapp/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailFooter.tsx
@@ -1,6 +1,5 @@
// @ts-nocheck
import React from 'react';
-
import {
CommercialDocFooter,
T,
diff --git a/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormTopBar.tsx b/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormTopBar.tsx
index 9d7d4561b..20f00eecb 100644
--- a/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormTopBar.tsx
+++ b/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormTopBar.tsx
@@ -1,16 +1,15 @@
// @ts-nocheck
import React from 'react';
-import intl from 'react-intl-universal';
-import { Button, Alignment, NavbarGroup, Classes } from '@blueprintjs/core';
+import { Alignment, NavbarGroup, Classes } from '@blueprintjs/core';
import { useSetPrimaryBranchToForm } from './utils';
import { useFeatureCan } from '@/hooks/state';
import { Features } from '@/constants';
import {
- Icon,
BranchSelect,
FeatureCan,
FormTopbar,
DetailsBarSkeletonBase,
+ FormBranchSelectButton,
} from '@/components';
import { useExpenseFormContext } from './ExpenseFormPageProvider';
@@ -51,19 +50,9 @@ function ExpenseFormSelectBranch() {
}
+ fill={false}
/>
);
}
diff --git a/packages/webapp/src/containers/FinancialStatements/APAgingSummary/APAgingSummary.tsx b/packages/webapp/src/containers/FinancialStatements/APAgingSummary/APAgingSummary.tsx
index 123b6c418..0e16bac3e 100644
--- a/packages/webapp/src/containers/FinancialStatements/APAgingSummary/APAgingSummary.tsx
+++ b/packages/webapp/src/containers/FinancialStatements/APAgingSummary/APAgingSummary.tsx
@@ -1,8 +1,8 @@
// @ts-nocheck
-import React, { useState, useCallback, useEffect } from 'react';
+import React, { useCallback, useEffect } from 'react';
import moment from 'moment';
-import { getDefaultAPAgingSummaryQuery } from './common';
+import { useAPAgingSummaryQuery } from './common';
import { FinancialStatement, DashboardPageContent } from '@/components';
import APAgingSummaryHeader from './APAgingSummaryHeader';
@@ -26,25 +26,22 @@ function APAgingSummary({
// #withAPAgingSummaryActions
toggleAPAgingSummaryFilterDrawer: toggleDisplayFilterDrawer,
}) {
- const [filter, setFilter] = useState({
- ...getDefaultAPAgingSummaryQuery(),
- });
+ const { query, setLocationQuery } = useAPAgingSummaryQuery();
// Handle filter submit.
- const handleFilterSubmit = useCallback((filter) => {
- const _filter = {
- ...filter,
- asDate: moment(filter.asDate).format('YYYY-MM-DD'),
- };
- setFilter(_filter);
- }, []);
-
+ const handleFilterSubmit = useCallback(
+ (filter) => {
+ const _filter = {
+ ...filter,
+ asDate: moment(filter.asDate).format('YYYY-MM-DD'),
+ };
+ setLocationQuery(_filter);
+ },
+ [setLocationQuery],
+ );
// Handle number format submit.
const handleNumberFormatSubmit = (numberFormat) => {
- setFilter({
- ...filter,
- numberFormat,
- });
+ setLocationQuery({ ...filter, numberFormat });
};
// Hide the report filter drawer once the page unmount.
useEffect(
@@ -55,9 +52,9 @@ function APAgingSummary({
);
return (
-