mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
refactor: HOCs named imports
This commit is contained in:
@@ -27,7 +27,7 @@ import {
|
||||
transformFormValuesToRequest,
|
||||
handleErrors,
|
||||
} from './utils';
|
||||
import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization';
|
||||
import { withCurrentOrganization } from '@/containers/Organization/withCurrentOrganization';
|
||||
import { BillFormEntriesActions } from './BillFormEntriesActions';
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
BillProjectSelectButton,
|
||||
} from './components';
|
||||
import { ProjectsSelect } from '@/containers/Projects/components';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { withDialogActions } from '@/containers/Dialog/withDialogActions';
|
||||
import {
|
||||
momentFormatter,
|
||||
compose,
|
||||
|
||||
@@ -8,7 +8,7 @@ import { T, Icon, Choose, If } from '@/components';
|
||||
|
||||
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
|
||||
import { AbilitySubject, BillAction } from '@/constants/abilityOption';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import { withDrawerActions } from '@/containers/Drawer/withDrawerActions';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,11 +24,11 @@ import {
|
||||
} from '@/components';
|
||||
import { BillAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
|
||||
import withBills from './withBills';
|
||||
import withBillsActions from './withBillsActions';
|
||||
import withSettings from '@/containers/Settings/withSettings';
|
||||
import withSettingsActions from '@/containers/Settings/withSettingsActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { withBills } from './withBills';
|
||||
import { withBillsActions } from './withBillsActions';
|
||||
import { withSettings } from '@/containers/Settings/withSettings';
|
||||
import { withSettingsActions } from '@/containers/Settings/withSettingsActions';
|
||||
import { withDialogActions } from '@/containers/Dialog/withDialogActions';
|
||||
|
||||
import { useBillsListContext } from './BillsListProvider';
|
||||
import {
|
||||
|
||||
@@ -9,8 +9,8 @@ import { BillsListProvider } from './BillsListProvider';
|
||||
import BillsActionsBar from './BillsActionsBar';
|
||||
import BillsTable from './BillsTable';
|
||||
|
||||
import withBills from './withBills';
|
||||
import withBillsActions from './withBillsActions';
|
||||
import { withBills } from './withBills';
|
||||
import { withBillsActions } from './withBillsActions';
|
||||
|
||||
import { transformTableStateToQuery, compose } from '@/utils';
|
||||
|
||||
|
||||
@@ -12,12 +12,12 @@ import {
|
||||
|
||||
import BillsEmptyStatus from './BillsEmptyStatus';
|
||||
|
||||
import withBills from './withBills';
|
||||
import withBillActions from './withBillsActions';
|
||||
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import withSettings from '@/containers/Settings/withSettings';
|
||||
import { withBills } from './withBills';
|
||||
import { withBillActions } from './withBillsActions';
|
||||
import { withAlertActions } from '@/containers/Alert/withAlertActions';
|
||||
import { withDialogActions } from '@/containers/Dialog/withDialogActions';
|
||||
import { withDrawerActions } from '@/containers/Drawer/withDrawerActions';
|
||||
import { withSettings } from '@/containers/Settings/withSettings';
|
||||
|
||||
import { useBillsTableColumns, ActionsMenu } from './components';
|
||||
import { useBillsListContext } from './BillsListProvider';
|
||||
@@ -164,7 +164,7 @@ function BillsDataTable({
|
||||
export default compose(
|
||||
withBills(({ billsTableState }) => ({ billsTableState })),
|
||||
withBillActions,
|
||||
withAlertsActions,
|
||||
withAlertActions,
|
||||
withDrawerActions,
|
||||
withDialogActions,
|
||||
withSettings(({ billsettings }) => ({
|
||||
|
||||
@@ -5,8 +5,8 @@ import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
|
||||
import { DashboardViewsTabs } from '@/components';
|
||||
import { useBillsListContext } from './BillsListProvider';
|
||||
|
||||
import withBills from './withBills';
|
||||
import withBillActions from './withBillsActions';
|
||||
import { withBills } from './withBills';
|
||||
import { withBillActions } from './withBillsActions';
|
||||
|
||||
import { compose, transfromViewsToTabs } from '@/utils';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
getBillsSelectedRowsFactory,
|
||||
} from '@/store/Bills/bills.selectors';
|
||||
|
||||
export default (mapState) => {
|
||||
export const withBills = (mapState) => {
|
||||
const getBillsTableState = getBillsTableStateFactory();
|
||||
const billsTableStateChanged = billsTableStateChangedFactory();
|
||||
const getBillsSelectedRows = getBillsSelectedRowsFactory();
|
||||
|
||||
@@ -13,4 +13,4 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
dispatch(setBillsSelectedRows(selectedRows)),
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps);
|
||||
export const withBillsActions = connect(null, mapDispatchToProps);
|
||||
|
||||
@@ -32,8 +32,8 @@ import {
|
||||
transformFormValuesToRequest,
|
||||
} from './utils';
|
||||
|
||||
import withSettings from '@/containers/Settings/withSettings';
|
||||
import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization';
|
||||
import { withSettings } from '@/containers/Settings/withSettings';
|
||||
import { withCurrentOrganization } from '@/containers/Organization/withCurrentOrganization';
|
||||
|
||||
/**
|
||||
* Vendor Credit note form.
|
||||
|
||||
@@ -40,8 +40,8 @@ import {
|
||||
handleDateChange,
|
||||
} from '@/utils';
|
||||
|
||||
import withSettings from '@/containers/Settings/withSettings';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { withSettings } from '@/containers/Settings/withSettings';
|
||||
import { withDialogActions } from '@/containers/Dialog/withDialogActions';
|
||||
|
||||
const getFieldsStyle = (theme: Theme) => css`
|
||||
.${theme.bpPrefix}-form-group {
|
||||
|
||||
@@ -30,17 +30,17 @@ import { useVendorsCreditNoteListContext } from './VendorsCreditNoteListProvider
|
||||
import { useDownloadExportPdf } from '@/hooks/query/FinancialReports/use-export-pdf';
|
||||
import { VendorCreditAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
|
||||
import withVendorsCreditNotesActions from './withVendorsCreditNotesActions';
|
||||
import withSettings from '@/containers/Settings/withSettings';
|
||||
import withSettingsActions from '@/containers/Settings/withSettingsActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import withVendorActions from './withVendorActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import { withVendorsCreditNotesActions } from './withVendorsCreditNotesActions';
|
||||
import { withSettings } from '@/containers/Settings/withSettings';
|
||||
import { withSettingsActions } from '@/containers/Settings/withSettingsActions';
|
||||
import { withDialogActions } from '@/containers/Dialog/withDialogActions';
|
||||
import { withVendorActions } from './withVendorActions';
|
||||
import { withDrawerActions } from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
import withVendorsCreditNotes from './withVendorsCreditNotes';
|
||||
import { withVendorsCreditNotes } from './withVendorsCreditNotes';
|
||||
import { useBulkDeleteVendorCreditsDialog } from './hooks/use-bulk-delete-vendor-credits-dialog';
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,13 +12,13 @@ import {
|
||||
import { TABLES } from '@/constants/tables';
|
||||
import { useMemorizedColumnsWidths } from '@/hooks';
|
||||
|
||||
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
||||
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import withVendorsCreditNotesActions from './withVendorsCreditNotesActions';
|
||||
import withVendorsCreditNotes from './withVendorsCreditNotes';
|
||||
import withSettings from '@/containers/Settings/withSettings';
|
||||
import { withDashboardActions } from '@/containers/Dashboard/withDashboardActions';
|
||||
import { withAlertActions } from '@/containers/Alert/withAlertActions';
|
||||
import { withDrawerActions } from '@/containers/Drawer/withDrawerActions';
|
||||
import { withDialogActions } from '@/containers/Dialog/withDialogActions';
|
||||
import { withVendorsCreditNotesActions } from './withVendorsCreditNotesActions';
|
||||
import { withVendorsCreditNotes } from './withVendorsCreditNotes';
|
||||
import { withSettings } from '@/containers/Settings/withSettings';
|
||||
|
||||
import { useVendorsCreditNoteTableColumns, ActionsMenu } from './components';
|
||||
import { useVendorsCreditNoteListContext } from './VendorsCreditNoteListProvider';
|
||||
@@ -37,7 +37,7 @@ function VendorsCreditNoteDataTable({
|
||||
// #withVendorCredits
|
||||
vendorsCreditNoteTableState,
|
||||
|
||||
// #withAlertsActions
|
||||
// #withAlertActions
|
||||
openAlert,
|
||||
|
||||
// #withDrawerActions
|
||||
@@ -165,7 +165,7 @@ function VendorsCreditNoteDataTable({
|
||||
export default compose(
|
||||
withDashboardActions,
|
||||
withVendorsCreditNotesActions,
|
||||
withAlertsActions,
|
||||
withAlertActions,
|
||||
withDrawerActions,
|
||||
withDialogActions,
|
||||
withSettings(({ vendorsCreditNoteSetting }) => ({
|
||||
|
||||
@@ -4,8 +4,8 @@ import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
|
||||
|
||||
import { DashboardViewsTabs } from '@/components';
|
||||
|
||||
import withVendorsCreditNotes from './withVendorsCreditNotes';
|
||||
import withVendorsCreditNotesActions from './withVendorsCreditNotesActions';
|
||||
import { withVendorsCreditNotes } from './withVendorsCreditNotes';
|
||||
import { withVendorsCreditNotesActions } from './withVendorsCreditNotesActions';
|
||||
|
||||
import { compose, transfromViewsToTabs } from '@/utils';
|
||||
import { useVendorsCreditNoteListContext } from './VendorsCreditNoteListProvider';
|
||||
|
||||
@@ -7,8 +7,8 @@ import { DashboardPageContent } from '@/components';
|
||||
import VendorsCreditNoteActionsBar from './VendorsCreditNoteActionsBar';
|
||||
import VendorsCreditNoteDataTable from './VendorsCreditNoteDataTable';
|
||||
|
||||
import withVendorsCreditNotes from './withVendorsCreditNotes';
|
||||
import withVendorsCreditNotesActions from './withVendorsCreditNotesActions';
|
||||
import { withVendorsCreditNotes } from './withVendorsCreditNotes';
|
||||
import { withVendorsCreditNotesActions } from './withVendorsCreditNotesActions';
|
||||
|
||||
import { VendorsCreditNoteListProvider } from './VendorsCreditNoteListProvider';
|
||||
import { transformTableStateToQuery, compose } from '@/utils';
|
||||
|
||||
@@ -11,4 +11,4 @@ const mapDipatchToProps = (dispatch) => ({
|
||||
resetVendorCreditsTableState: () => dispatch(resetVendorCreditTableState()),
|
||||
});
|
||||
|
||||
export default connect(null, mapDipatchToProps);
|
||||
export const withVendorActions = connect(null, mapDipatchToProps);
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
getVendorsCreditNoteSelectedRowsFactory,
|
||||
} from '@/store/VendorCredit/vendorCredit.selector';
|
||||
|
||||
export default (mapState) => {
|
||||
export const withVendorsCreditNotes = (mapState) => {
|
||||
const getVendorsCreditNoteTableState = getVendorCreditTableStateFactory();
|
||||
const isVendorsCreditNoteTableChanged =
|
||||
isVendorCreditTableStateChangedFactory();
|
||||
|
||||
@@ -15,4 +15,4 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
dispatch(setVendorCreditsSelectedRows(selectedRows)),
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps);
|
||||
export const withVendorsCreditNotesActions = connect(null, mapDispatchToProps);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { TextStatus, Icon, Choose, T } from '@/components';
|
||||
import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
|
||||
import { AbilitySubject, VendorCreditAction } from '@/constants/abilityOption';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import { withDrawerActions } from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
/**
|
||||
* Vendor credit universal search item select action.
|
||||
|
||||
@@ -21,9 +21,9 @@ import { PaymentMadeInnerProvider } from './PaymentMadeInnerProvider';
|
||||
import { usePaymentMadeFormContext } from './PaymentMadeFormProvider';
|
||||
import { compose, orderingLinesIndexes } from '@/utils';
|
||||
|
||||
import withSettings from '@/containers/Settings/withSettings';
|
||||
import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { withSettings } from '@/containers/Settings/withSettings';
|
||||
import { withCurrentOrganization } from '@/containers/Organization/withCurrentOrganization';
|
||||
import { withDialogActions } from '@/containers/Dialog/withDialogActions';
|
||||
import { PageForm } from '@/components/PageForm';
|
||||
|
||||
import {
|
||||
|
||||
@@ -36,7 +36,7 @@ import {
|
||||
Icon,
|
||||
VendorDrawerLink,
|
||||
} from '@/components';
|
||||
import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization';
|
||||
import { withCurrentOrganization } from '@/containers/Organization/withCurrentOrganization';
|
||||
import { usePaymentMadeFormContext } from './PaymentMadeFormProvider';
|
||||
import { ACCOUNT_TYPE } from '@/constants/accountTypes';
|
||||
import { PaymentMadeExchangeRateInputField } from './components';
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Button, Classes, Intent } from '@blueprintjs/core';
|
||||
import { Form, Formik, FormikHelpers, useFormikContext } from 'formik';
|
||||
import { FormatNumber } from '@/components';
|
||||
import { usePaymentMadeFormContext } from '../../PaymentMadeFormProvider';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { withDialogActions } from '@/containers/Dialog/withDialogActions';
|
||||
import { usePaymentMadeExcessAmount } from '../../utils';
|
||||
|
||||
interface ExcessPaymentValues {}
|
||||
|
||||
@@ -23,11 +23,11 @@ import {
|
||||
} from '@/components';
|
||||
import { PaymentMadeAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
|
||||
import withPaymentMade from './withPaymentMade';
|
||||
import withPaymentMadeActions from './withPaymentMadeActions';
|
||||
import withSettings from '@/containers/Settings/withSettings';
|
||||
import withSettingsActions from '@/containers/Settings/withSettingsActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { withPaymentMade } from './withPaymentMade';
|
||||
import { withPaymentMadeActions } from './withPaymentMadeActions';
|
||||
import { withSettings } from '@/containers/Settings/withSettings';
|
||||
import { withSettingsActions } from '@/containers/Settings/withSettingsActions';
|
||||
import { withDialogActions } from '@/containers/Dialog/withDialogActions';
|
||||
|
||||
import { usePaymentMadesListContext } from './PaymentMadesListProvider';
|
||||
import { useRefreshPaymentMades } from '@/hooks/query/paymentMades';
|
||||
|
||||
@@ -8,8 +8,8 @@ import { PaymentMadesListProvider } from './PaymentMadesListProvider';
|
||||
import PaymentMadeActionsBar from './PaymentMadeActionsBar';
|
||||
import PaymentMadesTable from './PaymentMadesTable';
|
||||
|
||||
import withPaymentMades from './withPaymentMade';
|
||||
import withPaymentMadeActions from './withPaymentMadeActions';
|
||||
import { withPaymentMades } from './withPaymentMade';
|
||||
import { withPaymentMadeActions } from './withPaymentMadeActions';
|
||||
|
||||
import { compose, transformTableStateToQuery } from '@/utils';
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import { compose } from '@/utils';
|
||||
import { usePaymentMadesListContext } from './PaymentMadesListProvider';
|
||||
import { transformPaymentViewsToTabs } from './utils';
|
||||
|
||||
import withPaymentMade from './withPaymentMade';
|
||||
import withPaymentMadeActions from './withPaymentMadeActions';
|
||||
import { withPaymentMade } from './withPaymentMade';
|
||||
import { withPaymentMadeActions } from './withPaymentMadeActions';
|
||||
|
||||
/**
|
||||
* Payment made views tabs.
|
||||
|
||||
@@ -13,12 +13,12 @@ import {
|
||||
|
||||
import PaymentMadesEmptyStatus from './PaymentMadesEmptyStatus';
|
||||
|
||||
import withPaymentMade from './withPaymentMade';
|
||||
import withPaymentMadeActions from './withPaymentMadeActions';
|
||||
import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization';
|
||||
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import withSettings from '@/containers/Settings/withSettings';
|
||||
import { withPaymentMade } from './withPaymentMade';
|
||||
import { withPaymentMadeActions } from './withPaymentMadeActions';
|
||||
import { withCurrentOrganization } from '@/containers/Organization/withCurrentOrganization';
|
||||
import { withAlertActions } from '@/containers/Alert/withAlertActions';
|
||||
import { withDrawerActions } from '@/containers/Drawer/withDrawerActions';
|
||||
import { withSettings } from '@/containers/Settings/withSettings';
|
||||
|
||||
import { usePaymentMadesTableColumns, ActionsMenu } from './components';
|
||||
import { usePaymentMadesListContext } from './PaymentMadesListProvider';
|
||||
@@ -136,7 +136,7 @@ function PaymentMadesTable({
|
||||
export default compose(
|
||||
withPaymentMadeActions,
|
||||
withPaymentMade(({ paymentMadesTableState }) => ({ paymentMadesTableState })),
|
||||
withAlertsActions,
|
||||
withAlertActions,
|
||||
withDrawerActions,
|
||||
withCurrentOrganization(),
|
||||
withSettings(({ billPaymentSettings }) => ({
|
||||
|
||||
@@ -4,8 +4,8 @@ import { Switch, Route } from 'react-router-dom';
|
||||
|
||||
import PaymentMadeViewTabs from './PaymentMadeViewTabs';
|
||||
|
||||
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { withAlertActions } from '@/containers/Alert/withAlertActions';
|
||||
import { withDialogActions } from '@/containers/Dialog/withDialogActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
|
||||
@@ -22,7 +22,7 @@ function PaymentMadesViewPage({
|
||||
exact={true}
|
||||
path={['/payments-made/:custom_view_id/custom_view', '/payments-made']}
|
||||
>
|
||||
|
||||
|
||||
{/* <PaymentMadeDataTable
|
||||
onDeletePaymentMade={handleDeletePaymentMade}
|
||||
onEditPaymentMade={handleEditPaymentMade}
|
||||
@@ -34,6 +34,6 @@ function PaymentMadesViewPage({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withAlertsActions,
|
||||
withAlertActions,
|
||||
withDialogActions,
|
||||
)(PaymentMadesViewPage);
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
paymentsTableStateChangedFactory,
|
||||
} from '@/store/PaymentMades/paymentMades.selector';
|
||||
|
||||
export default (mapState) => {
|
||||
export const withPaymentMade = (mapState) => {
|
||||
const getPaymentMadesTableState = getPaymentMadesTableStateFactory();
|
||||
const paymentsTableStateChanged = paymentsTableStateChangedFactory();
|
||||
|
||||
|
||||
@@ -11,4 +11,4 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
|
||||
resetPaymentMadesTableState: () => dispatch(resetPaymentMadesTableState()),
|
||||
});
|
||||
export default connect(null, mapDispatchToProps);
|
||||
export const withPaymentMadeActions = connect(null, mapDispatchToProps);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { getPaymentMadeByIdFactory } from '@/store/PaymentMades/paymentMade.selector';
|
||||
|
||||
export default () => {
|
||||
export const withPaymentMadeDetail = () => {
|
||||
const getPaymentMadeById = getPaymentMadeByIdFactory();
|
||||
|
||||
const mapStateToProps = (state, props) => ({
|
||||
|
||||
@@ -8,7 +8,7 @@ import { RESOURCES_TYPES } from '@/constants/resourcesTypes';
|
||||
import { highlightText } from '@/utils';
|
||||
import { AbilitySubject, PaymentMadeAction } from '@/constants/abilityOption';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import { withDrawerActions } from '@/containers/Drawer/withDrawerActions';
|
||||
|
||||
/**
|
||||
* Universal search bill item select action.
|
||||
|
||||
Reference in New Issue
Block a user