mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
Merge remote-tracking branch 'origin/fix_connectors'
This commit is contained in:
@@ -11,9 +11,9 @@ import { FormattedMessage as T } from 'react-intl';
|
||||
|
||||
import DashboardTopbarUser from 'components/Dashboard/TopbarUser';
|
||||
import DashboardBreadcrumbs from 'components/Dashboard/DashboardBreadcrumbs';
|
||||
import SearchConnect from 'connectors/Search.connect';
|
||||
import Icon from 'components/Icon';
|
||||
|
||||
import withSearch from 'containers/GeneralSearch/withSearch'
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withDashboard from 'containers/Dashboard/withDashboard';
|
||||
|
||||
@@ -120,7 +120,7 @@ function DashboardTopbar({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
SearchConnect,
|
||||
withSearch,
|
||||
withDashboard(({ pageTitle, pageSubtitle, editViewId }) => ({
|
||||
pageTitle, pageSubtitle, editViewId
|
||||
})),
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import t from 'store/types';
|
||||
import {
|
||||
fetchAccountTypes,
|
||||
fetchAccountsList,
|
||||
deleteAccount,
|
||||
inactiveAccount,
|
||||
fetchAccountsTable,
|
||||
submitAccount,
|
||||
fetchAccount,
|
||||
deleteBulkAccounts,
|
||||
} from 'store/accounts/accounts.actions';
|
||||
import {
|
||||
getAccountsItems,
|
||||
} from 'store/accounts/accounts.selectors';
|
||||
import {
|
||||
getResourceViews,
|
||||
} from 'store/customViews/customViews.selectors';
|
||||
import {
|
||||
getItemById
|
||||
} from 'store/selectors';
|
||||
|
||||
const mapStateToProps = (state, props) => ({
|
||||
views: getResourceViews(state, 'accounts'),
|
||||
accounts: getAccountsItems(state, state.accounts.currentViewId),
|
||||
accountsTypes: state.accounts.accountsTypes,
|
||||
|
||||
tableQuery: state.accounts.tableQuery,
|
||||
accountsLoading: state.accounts.loading,
|
||||
accountErrors: state.accounts.errors,
|
||||
|
||||
getAccountById: (id) => getItemById(state.accounts.items, id),
|
||||
});
|
||||
|
||||
const mapActionsToProps = (dispatch) => ({
|
||||
requestFetchAccounts: (query) => dispatch(fetchAccountsList({ query })),
|
||||
requestFetchAccountTypes: () => dispatch(fetchAccountTypes()),
|
||||
requestSubmitAccount: ({ form }) => dispatch(submitAccount({ form })),
|
||||
requestDeleteAccount: (id) => dispatch(deleteAccount({ id })),
|
||||
requestInactiveAccount: (id) => dispatch(inactiveAccount({ id })),
|
||||
requestFetchAccount: (id) => dispatch(fetchAccount({ id })),
|
||||
requestFetchAccountsTable: (query = {}) => dispatch(fetchAccountsTable({ query: { ...query } })),
|
||||
requestDeleteBulkAccounts: (ids) => dispatch(deleteBulkAccounts({ ids })),
|
||||
|
||||
changeCurrentView: (id) => dispatch({
|
||||
type: t.ACCOUNTS_SET_CURRENT_VIEW,
|
||||
currentViewId: parseInt(id, 10),
|
||||
}),
|
||||
setAccountsTableQuery: (key, value) => dispatch({
|
||||
type: 'ACCOUNTS_TABLE_QUERY_SET', key, value,
|
||||
}),
|
||||
addAccountsTableQueries: (queries) => dispatch({
|
||||
type: 'ACCOUNTS_TABLE_QUERIES_ADD', queries,
|
||||
}),
|
||||
setSelectedRowsAccounts: (ids) => dispatch({
|
||||
type: t.ACCOUNTS_SELECTED_ROWS_SET, payload: { ids },
|
||||
}),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapActionsToProps);
|
||||
@@ -1,34 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import t from 'store/types';
|
||||
|
||||
const mapActionsToProps = (dispatch) => ({
|
||||
changePageTitle: (pageTitle) =>
|
||||
dispatch({
|
||||
type: t.CHANGE_DASHBOARD_PAGE_TITLE,
|
||||
pageTitle,
|
||||
}),
|
||||
|
||||
changePageSubtitle: (pageSubtitle) =>
|
||||
dispatch({
|
||||
type: t.ALTER_DASHBOARD_PAGE_SUBTITLE,
|
||||
pageSubtitle,
|
||||
}),
|
||||
|
||||
setTopbarEditView: (id) =>
|
||||
dispatch({
|
||||
type: t.SET_TOPBAR_EDIT_VIEW,
|
||||
id,
|
||||
}),
|
||||
|
||||
setDashboardRequestLoading: () =>
|
||||
dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_LOADING,
|
||||
}),
|
||||
|
||||
setDashboardRequestCompleted: () =>
|
||||
dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||
}),
|
||||
});
|
||||
|
||||
export default connect(null, mapActionsToProps);
|
||||
@@ -1,37 +0,0 @@
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
fetchExpense,
|
||||
submitExpense,
|
||||
editExpense,
|
||||
deleteExpense,
|
||||
} from 'store/expenses/expenses.actions';
|
||||
import {
|
||||
fetchAccountsList,
|
||||
} from 'store/accounts/accounts.actions';
|
||||
import {
|
||||
fetchCurrencies,
|
||||
} from 'store/currencies/currencies.actions';
|
||||
import t from 'store/types';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
return {
|
||||
expenseDetails: {},
|
||||
accounts: state.accounts.accounts,
|
||||
currencies: state.currencies.registered,
|
||||
};
|
||||
};
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
changePageTitle: pageTitle => dispatch({
|
||||
type: t.CHANGE_DASHBOARD_PAGE_TITLE,
|
||||
pageTitle,
|
||||
}),
|
||||
fetchCurrencies: () => dispatch(fetchCurrencies()),
|
||||
fetchExpense: (id) => dispatch(fetchExpense({ id })),
|
||||
submitExpense: (form) => dispatch(submitExpense({ form })),
|
||||
editExpense: (id, form) => dispatch(editExpense({ id, form })),
|
||||
fetchAccounts: () => dispatch(fetchAccountsList()),
|
||||
deleteExpense: (id) => dispatch(deleteExpense({ id })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,23 +0,0 @@
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
fetchExpensesList,
|
||||
deleteExpense,
|
||||
} from 'store/expenses/expenses.actions';
|
||||
import t from 'store/types';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
return {
|
||||
expenses: state.expenses.list,
|
||||
};
|
||||
};
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
changePageTitle: pageTitle => dispatch({
|
||||
type: t.CHANGE_DASHBOARD_PAGE_TITLE,
|
||||
pageTitle,
|
||||
}),
|
||||
fetchExpenses: (id) => dispatch(fetchExpensesList({ id })),
|
||||
deleteExpense: (id) => dispatch(deleteExpense({ id })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,20 +0,0 @@
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
fetchGeneralLedger,
|
||||
} from 'store/financialStatement/financialStatements.actions';
|
||||
import {
|
||||
getFinancialSheetIndexByQuery,
|
||||
getFinancialSheet,
|
||||
} from 'store/financialStatement/financialStatements.selectors';
|
||||
|
||||
export const mapStateToProps = (state, props) => ({
|
||||
getGeneralLedgerSheetIndex: (query) => getFinancialSheetIndexByQuery(state.financialStatements.generalLedger.sheets, query),
|
||||
getGeneralLedgerSheet: (index) => getFinancialSheet(state.financialStatements.generalLedger.sheets, index),
|
||||
generalLedgerSheetLoading: state.financialStatements.generalLedger.loading,
|
||||
});
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
fetchGeneralLedger: (query = {}) => dispatch(fetchGeneralLedger({ query })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,24 +0,0 @@
|
||||
//FIXME: FIX Later Need More Work
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
submitItemCategory,
|
||||
submitCategory,
|
||||
fetchCategory
|
||||
} from 'store/itemCategories/itemsCategory.actions';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
return {
|
||||
category: state.category,
|
||||
name: 'item-form',
|
||||
payload: { action: 'new', id: null }
|
||||
};
|
||||
};
|
||||
|
||||
export const mapDispatchToProps = dispatch => ({
|
||||
submitItemCategory: form => dispatch(submitItemCategory({ form })),
|
||||
submitCategory: form => dispatch(submitCategory({ form })),
|
||||
fetchCategory: () => dispatch(fetchCategory())
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,53 +0,0 @@
|
||||
|
||||
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
fetchItems,
|
||||
deleteItem,
|
||||
submitItem,
|
||||
} from 'store/items/items.actions';
|
||||
import {
|
||||
getResourceViews,
|
||||
getViewPages,
|
||||
} from 'store/customViews/customViews.selectors'
|
||||
import {
|
||||
getCurrentPageResults
|
||||
} from 'store/selectors';
|
||||
import t from 'store/types';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
const viewPages = getViewPages(state.items.views, state.items.currentViewId);
|
||||
|
||||
return {
|
||||
views: getResourceViews(state, 'items'),
|
||||
currentPageItems: getCurrentPageResults(
|
||||
state.items.items,
|
||||
viewPages,
|
||||
state.items.currentPage,
|
||||
),
|
||||
bulkSelected: state.items.bulkActions,
|
||||
itemsTableLoading: state.items.loading,
|
||||
};
|
||||
};
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
requestFetchItems: (query) => dispatch(fetchItems({ query })),
|
||||
requestDeleteItem: (id) => dispatch(deleteItem({ id })),
|
||||
requestSubmitItem: (form) => dispatch(submitItem({ form })),
|
||||
addBulkActionItem: (id) => dispatch({
|
||||
type: t.ITEM_BULK_ACTION_ADD, itemId: id
|
||||
}),
|
||||
removeBulkActionItem: (id) => dispatch({
|
||||
type: t.ITEM_BULK_ACTION_REMOVE, itemId: id,
|
||||
}),
|
||||
|
||||
setItemsTableQuery: (key, value) => dispatch({
|
||||
type: t.ITEMS_TABLE_QUERY_SET, key, value,
|
||||
}),
|
||||
addItemsTableQueries: (queries) =>
|
||||
dispatch({
|
||||
type: t.ITEMS_TABLE_QUERIES_ADD, queries,
|
||||
}),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,32 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
fetchItemCategories,
|
||||
submitItemCategory,
|
||||
deleteItemCategory,
|
||||
editItemCategory,
|
||||
} from 'store/itemCategories/itemsCategory.actions';
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
import { getCategoryId } from 'store/itemCategories/itemsCategory.reducer';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
const dialogPayload = getDialogPayload(state, 'item-form');
|
||||
|
||||
return {
|
||||
categories: Object.values(state.itemCategories.categories),
|
||||
name: 'item-form',
|
||||
payload: { action: 'new', id: null },
|
||||
editItemCategory:
|
||||
dialogPayload && dialogPayload.action === 'edit'
|
||||
? state.itemCategories.categories[dialogPayload.id]
|
||||
: {},
|
||||
getCategoryId: (id) => getCategoryId(state, id),
|
||||
};
|
||||
};
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
requestSubmitItemCategory: (form) => dispatch(submitItemCategory({ form })),
|
||||
requestFetchItemCategories: () => dispatch(fetchItemCategories()),
|
||||
requestDeleteItemCategory: (id) => dispatch(deleteItemCategory(id)),
|
||||
requestEditItemCategory: (id, form) => dispatch(editItemCategory(id, form)),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,16 +0,0 @@
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
submitMedia,
|
||||
deleteMedia,
|
||||
} from 'store/media/media.actions';
|
||||
|
||||
export const mapStateToProps = (state, props) => ({
|
||||
|
||||
});
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
requestSubmitMedia: (form, config) => dispatch(submitMedia({ form, config })),
|
||||
requestDeleteMedia: (ids) => dispatch(deleteMedia({ ids })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,28 +0,0 @@
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
fetchResourceColumns,
|
||||
fetchResourceFields,
|
||||
} from 'store/resources/resources.actions';
|
||||
import {
|
||||
getResourceColumns,
|
||||
getResourceFields,
|
||||
getResourceColumn,
|
||||
getResourceField,
|
||||
getResourceMetadata,
|
||||
} from 'store/resources/resources.reducer';
|
||||
|
||||
export const mapStateToProps = (state, props) => ({
|
||||
// getResourceColumns: (resourceSlug) => getResourceColumns(state, resourceSlug),
|
||||
// getResourceFields: (resourceSlug) => getResourceFields(state, resourceSlug),
|
||||
// getResourceMetadata: (resourceSlug) => getResourceMetadata(state, resourceSlug),
|
||||
|
||||
// getResourceColumn: (columnId) => getResourceColumn(state, columnId),
|
||||
// getResourceField: (fieldId) => getResourceField(state, fieldId),
|
||||
});
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
requestFetchResourceFields: (resourceSlug) => dispatch(fetchResourceFields({ resourceSlug })),
|
||||
requestFetchResourceColumns: (resourceSlug) => dispatch(fetchResourceColumns({ resourceSlug })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,19 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
FetchOptions,
|
||||
submitOptions,
|
||||
} from 'store/settings/settings.actions';
|
||||
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
return {
|
||||
organizationSettings: state.settings.data.organization,
|
||||
};
|
||||
};
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
requestSubmitOptions: (form) => dispatch(submitOptions({ form })),
|
||||
requestFetchOptions: () => dispatch(FetchOptions({})),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,24 +0,0 @@
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
fetchTrialBalanceSheet
|
||||
} from 'store/financialStatement/financialStatements.actions';
|
||||
import {
|
||||
getFinancialSheetIndexByQuery,
|
||||
getFinancialSheetAccounts,
|
||||
getFinancialSheetQuery,
|
||||
} from 'store/financialStatement/financialStatements.selectors';
|
||||
|
||||
|
||||
export const mapStateToProps = (state, props) => ({
|
||||
getTrialBalanceSheetIndex: (query) => getFinancialSheetIndexByQuery(state.financialStatements.trialBalance.sheets, query),
|
||||
getTrialBalanceAccounts: (sheetIndex) => getFinancialSheetAccounts(state.financialStatements.trialBalance.sheets, sheetIndex),
|
||||
getTrialBalanceQuery: (sheetIndex) => getFinancialSheetQuery(state.financialStatements.trialBalance.sheets, sheetIndex),
|
||||
|
||||
trialBalanceSheetLoading: state.financialStatements.trialBalance.loading,
|
||||
});
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
fetchTrialBalanceSheet: (query = {}) => dispatch(fetchTrialBalanceSheet({ query })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,30 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { submitInvite, editUser, fetchUser } from 'store/users/users.actions';
|
||||
import { getUserDetails } from 'store/users/users.reducer';
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
const dialogPayload = getDialogPayload(state, 'user-form');
|
||||
|
||||
return {
|
||||
name: 'user-form',
|
||||
payload: { action: 'new', id: null },
|
||||
userDetails:
|
||||
dialogPayload.action === 'edit'
|
||||
? getUserDetails(state, dialogPayload.user.id)
|
||||
: {},
|
||||
};
|
||||
};
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
openDialog: (name, payload) =>
|
||||
dispatch({ type: t.OPEN_DIALOG, name, payload }),
|
||||
closeDialog: (name, payload) =>
|
||||
dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
requestSubmitInvite: (form) => dispatch(submitInvite({ form })),
|
||||
requestEditUser: (id, form) => dispatch(editUser({ form, id })),
|
||||
requestFetchUser: (id) => dispatch(fetchUser({ id })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,44 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
fetchUsers,
|
||||
fetchUser,
|
||||
deleteUser,
|
||||
inactiveUser,
|
||||
editUser,
|
||||
} from 'store/users/users.actions';
|
||||
import t from 'store/types';
|
||||
import { getUserDetails } from 'store/users/users.reducer';
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
const dialogPayload = getDialogPayload(state, 'userList-form');
|
||||
|
||||
return {
|
||||
name: 'userList-form',
|
||||
payload: { action: 'new', id: null },
|
||||
userDetails:
|
||||
dialogPayload.action === 'edit'
|
||||
? getUserDetails(state, dialogPayload.user.id)
|
||||
: {},
|
||||
editUser:
|
||||
dialogPayload && dialogPayload.action === 'edit'
|
||||
? state.users.list.results[dialogPayload.user.id]
|
||||
: {},
|
||||
usersList: state.users.list.results,
|
||||
};
|
||||
};
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
openDialog: (name, payload) =>
|
||||
dispatch({ type: t.OPEN_DIALOG, name, payload }),
|
||||
closeDialog: (name, payload) =>
|
||||
dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
|
||||
requestFetchUsers: () => dispatch(fetchUsers({})),
|
||||
requestFetchUser: (id) => dispatch(fetchUser({ id })),
|
||||
requestDeleteUser: (id) => dispatch(deleteUser({ id })),
|
||||
requestInactiveUser: (id) => dispatch(inactiveUser({ id })),
|
||||
requestEditUser: (id, form) => dispatch(editUser({ form, id })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -23,7 +23,7 @@ import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
|
||||
import AppToaster from 'components/AppToaster';
|
||||
import Dragzone from 'components/Dragzone';
|
||||
import MediaConnect from 'connectors/Media.connect';
|
||||
import withMediaActions from 'containers/Media/withMediaActions';
|
||||
|
||||
import useMedia from 'hooks/useMedia';
|
||||
import { compose } from 'utils';
|
||||
@@ -321,5 +321,5 @@ export default compose(
|
||||
withManualJournalDetail,
|
||||
withAccountsActions,
|
||||
withDashboardActions,
|
||||
MediaConnect,
|
||||
withMediaActions,
|
||||
)(MakeJournalEntriesForm);
|
||||
|
||||
@@ -16,10 +16,10 @@ import classNames from 'classnames';
|
||||
import { useRouteMatch, useHistory } from 'react-router-dom';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
|
||||
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
|
||||
import { If } from 'components';
|
||||
|
||||
import withResourceDetail from 'containers/Resources/withResourceDetails';
|
||||
@@ -137,7 +137,7 @@ function ManualJournalActionsBar({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
withResourceDetail(({ resourceFields }) => ({
|
||||
resourceFields,
|
||||
})),
|
||||
|
||||
@@ -13,23 +13,22 @@ import {
|
||||
} from '@blueprintjs/core';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import moment from 'moment';
|
||||
|
||||
import Icon from 'components/Icon';
|
||||
import { compose } from 'utils';
|
||||
import moment from 'moment';
|
||||
import { useUpdateEffect } from 'hooks';
|
||||
|
||||
import LoadingIndicator from 'components/LoadingIndicator';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
|
||||
import { useUpdateEffect } from 'hooks';
|
||||
import { If, Money } from 'components';
|
||||
import DataTable from 'components/DataTable';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withViewDetails from 'containers/Views/withViewDetails';
|
||||
import withManualJournals from 'containers/Accounting/withManualJournals';
|
||||
import withManualJournalsActions from 'containers/Accounting/withManualJournalsActions';
|
||||
|
||||
import { If, Money } from 'components';
|
||||
|
||||
function ManualJournalsDataTable({
|
||||
loading,
|
||||
@@ -272,7 +271,7 @@ function ManualJournalsDataTable({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
withDashboardActions,
|
||||
withManualJournalsActions,
|
||||
withManualJournals(({ manualJournals, manualJournalsLoading }) => ({
|
||||
|
||||
@@ -19,16 +19,14 @@ import { FormattedMessage as T } from 'react-intl';
|
||||
import { If } from 'components';
|
||||
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withResourceDetail from 'containers/Resources/withResourceDetails';
|
||||
import withAccountsTableActions from 'containers/Accounts/withAccountsTableActions';
|
||||
import withAccounts from 'containers/Accounts/withAccounts';
|
||||
|
||||
import {compose} from 'utils';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
function AccountsActionsBar({
|
||||
openDialog,
|
||||
@@ -45,28 +43,31 @@ function AccountsActionsBar({
|
||||
onBulkDelete,
|
||||
onBulkArchive,
|
||||
onBulkActivate,
|
||||
onBulkInactive
|
||||
onBulkInactive,
|
||||
}) {
|
||||
const history = useHistory();
|
||||
const [filterCount, setFilterCount] = useState(0);
|
||||
|
||||
const onClickNewAccount = () => { openDialog('account-form', {}); };
|
||||
const onClickNewAccount = () => {
|
||||
openDialog('account-form', {});
|
||||
};
|
||||
const onClickViewItem = (view) => {
|
||||
history.push(view
|
||||
? `/accounts/${view.id}/custom_view` : '/accounts');
|
||||
history.push(view ? `/accounts/${view.id}/custom_view` : '/accounts');
|
||||
};
|
||||
|
||||
const viewsMenuItems = accountsViews.map((view) => {
|
||||
return (<MenuItem onClick={() => onClickViewItem(view)} text={view.name} />);
|
||||
return <MenuItem onClick={() => onClickViewItem(view)} text={view.name} />;
|
||||
});
|
||||
const hasSelectedRows = useMemo(() => selectedRows.length > 0, [selectedRows]);
|
||||
|
||||
const hasSelectedRows = useMemo(() => selectedRows.length > 0, [
|
||||
selectedRows,
|
||||
]);
|
||||
|
||||
const filterDropdown = FilterDropdown({
|
||||
fields: resourceFields,
|
||||
onFilterChange: (filterConditions) => {
|
||||
setFilterCount(filterConditions.length || 0);
|
||||
addAccountsTableQueries({
|
||||
filter_roles: filterConditions || '',
|
||||
filter_roles: filterConditions || '',
|
||||
});
|
||||
onFilterChanged && onFilterChanged(filterConditions);
|
||||
},
|
||||
@@ -77,19 +78,16 @@ function AccountsActionsBar({
|
||||
// }, [onBulkArchive, selectedRows]);
|
||||
|
||||
const handleBulkDelete = useCallback(() => {
|
||||
onBulkDelete && onBulkDelete(selectedRows.map(r => r.id));
|
||||
onBulkDelete && onBulkDelete(selectedRows.map((r) => r.id));
|
||||
}, [onBulkDelete, selectedRows]);
|
||||
|
||||
const handelBulkActivate =useCallback(()=>{
|
||||
const handelBulkActivate = useCallback(() => {
|
||||
onBulkActivate && onBulkActivate(selectedRows.map((r) => r.id));
|
||||
}, [onBulkActivate, selectedRows]);
|
||||
|
||||
onBulkActivate && onBulkActivate(selectedRows.map(r=>r.id))
|
||||
},[onBulkActivate,selectedRows])
|
||||
|
||||
const handelBulkInactive =useCallback(()=>{
|
||||
|
||||
onBulkInactive && onBulkInactive(selectedRows.map(r=>r.id))
|
||||
|
||||
},[onBulkInactive,selectedRows])
|
||||
const handelBulkInactive = useCallback(() => {
|
||||
onBulkInactive && onBulkInactive(selectedRows.map((r) => r.id));
|
||||
}, [onBulkInactive, selectedRows]);
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
@@ -112,16 +110,16 @@ onBulkInactive && onBulkInactive(selectedRows.map(r=>r.id))
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='plus' />}
|
||||
text={<T id={'new_account'}/>}
|
||||
icon={<Icon icon="plus" />}
|
||||
text={<T id={'new_account'} />}
|
||||
onClick={onClickNewAccount}
|
||||
/>
|
||||
<Popover
|
||||
minimal={true}
|
||||
content={filterDropdown}
|
||||
interactionKind={PopoverInteractionKind.CLICK}
|
||||
position={Position.BOTTOM_LEFT}>
|
||||
|
||||
position={Position.BOTTOM_LEFT}
|
||||
>
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--filter')}
|
||||
text={filterCount <= 0 ? <T id={'filter'}/> : `${filterCount} filters applied`}
|
||||
@@ -149,7 +147,7 @@ onBulkInactive && onBulkInactive(selectedRows.map(r=>r.id))
|
||||
onClick={handleBulkDelete}
|
||||
/>
|
||||
</If>
|
||||
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='print-16' iconSize={16} />}
|
||||
@@ -178,7 +176,7 @@ const withAccountsActionsBar = connect(mapStateToProps);
|
||||
|
||||
export default compose(
|
||||
withAccountsActionsBar,
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
withAccounts(({ accountsViews }) => ({
|
||||
accountsViews,
|
||||
})),
|
||||
|
||||
@@ -13,7 +13,7 @@ import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
import Icon from 'components/Icon';
|
||||
import { compose } from 'utils';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
|
||||
import LoadingIndicator from 'components/LoadingIndicator';
|
||||
import DataTable from 'components/DataTable';
|
||||
import Money from 'components/Money';
|
||||
@@ -22,6 +22,7 @@ import { useUpdateEffect } from 'hooks';
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withAccountsActions from 'containers/Accounts/withAccountsActions';
|
||||
import withAccounts from 'containers/Accounts/withAccounts';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
|
||||
import { If } from 'components';
|
||||
|
||||
@@ -202,7 +203,7 @@ function AccountsDataTable({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
withDashboardActions,
|
||||
withAccountsActions,
|
||||
withAccounts(({ accountsLoading, accounts }) => ({
|
||||
|
||||
@@ -10,4 +10,4 @@ export const mapDispatchToProps = (dispatch) => ({
|
||||
closeDialog: (name, payload) => dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
export default connect(null, mapDispatchToProps);
|
||||
@@ -1,8 +1,8 @@
|
||||
import {connect} from 'react-redux';
|
||||
import { connect } from 'react-redux';
|
||||
import { compose } from 'utils';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import DialogReduxConnect from 'components/DialogReduxConnect';
|
||||
import {getDialogPayload} from 'store/dashboard/dashboard.reducer';
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
import withAccountsActions from 'containers/Accounts/withAccountsActions';
|
||||
import withAccountDetail from 'containers/Accounts/withAccountDetail';
|
||||
import withAccounts from 'containers/Accounts/withAccounts';
|
||||
@@ -12,12 +12,11 @@ export const mapStateToProps = (state, props) => {
|
||||
|
||||
return {
|
||||
name: 'account-form',
|
||||
payload: {action: 'new', id: null, ...dialogPayload},
|
||||
payload: { action: 'new', id: null, ...dialogPayload },
|
||||
|
||||
accountId: dialogPayload?.id || null,
|
||||
};
|
||||
};
|
||||
|
||||
const AccountFormDialogConnect = connect(mapStateToProps);
|
||||
|
||||
export default compose(
|
||||
@@ -29,5 +28,5 @@ export default compose(
|
||||
accounts,
|
||||
})),
|
||||
DialogReduxConnect,
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
);
|
||||
|
||||
@@ -18,7 +18,7 @@ import Dialog from 'components/Dialog';
|
||||
import DialogReduxConnect from 'components/DialogReduxConnect';
|
||||
import ErrorMessage from 'components/ErrorMessage';
|
||||
import classNames from 'classnames';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
|
||||
import withCurrency from 'containers/Currencies/withCurrency';
|
||||
@@ -31,7 +31,7 @@ function CurrencyDialog({
|
||||
payload,
|
||||
isOpen,
|
||||
|
||||
// #withDialog
|
||||
// #withDialogActions
|
||||
closeDialog,
|
||||
|
||||
// #withCurrency
|
||||
@@ -44,8 +44,7 @@ function CurrencyDialog({
|
||||
requestEditCurrency,
|
||||
}) {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
const fetchCurrencies = useQuery('currencies', () =>
|
||||
const fetchCurrencies = useQuery('currencies', () =>
|
||||
requestFetchCurrencies(),
|
||||
);
|
||||
|
||||
@@ -236,7 +235,7 @@ const withCurrencyFormDialog = connect(mapStateToProps);
|
||||
|
||||
export default compose(
|
||||
withCurrencyFormDialog,
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
DialogReduxConnect,
|
||||
withCurrenciesActions,
|
||||
withCurrency,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { connect } from 'react-redux';
|
||||
import { compose } from 'utils';
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import DialogReduxConnect from 'components/DialogReduxConnect';
|
||||
|
||||
import withExchangeRatesActions from 'containers/ExchangeRates/withExchangeRatesActions';
|
||||
@@ -31,5 +31,5 @@ export default compose(
|
||||
exchangeRatesList,
|
||||
})),
|
||||
DialogReduxConnect,
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
);
|
||||
@@ -10,19 +10,20 @@ import {
|
||||
Intent,
|
||||
Classes,
|
||||
} from '@blueprintjs/core';
|
||||
import { objectKeysTransform } from 'utils';
|
||||
import classNames from 'classnames';
|
||||
import { pick, snakeCase } from 'lodash';
|
||||
import { queryCache } from 'react-query';
|
||||
|
||||
import AppToaster from 'components/AppToaster';
|
||||
|
||||
import DialogReduxConnect from 'components/DialogReduxConnect';
|
||||
import UserListDialogConnect from 'connectors/UsersList.connector';
|
||||
|
||||
import UserListDialogConnect from 'containers/Dialogs/UsersListDialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withUsersActions from 'containers/Users/withUsersActions';
|
||||
import ErrorMessage from 'components/ErrorMessage';
|
||||
import useAsync from 'hooks/async';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { compose } from 'utils';
|
||||
import { compose, objectKeysTransform } from 'utils';
|
||||
|
||||
function InviteUserDialog({
|
||||
name,
|
||||
@@ -210,6 +211,8 @@ function InviteUserDialog({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withDialogActions,
|
||||
UserListDialogConnect,
|
||||
withUsersActions,
|
||||
DialogReduxConnect,
|
||||
)(InviteUserDialog);
|
||||
|
||||
@@ -23,7 +23,7 @@ import ErrorMessage from 'components/ErrorMessage';
|
||||
import { ListSelect } from 'components';
|
||||
|
||||
import Dialog from 'components/Dialog';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import DialogReduxConnect from 'components/DialogReduxConnect';
|
||||
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
@@ -317,7 +317,7 @@ const withItemCategoryDialog = connect(mapStateToProps);
|
||||
|
||||
export default compose(
|
||||
withItemCategoryDialog,
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
DialogReduxConnect,
|
||||
withItemCategoryDetail,
|
||||
withItemCategories(({ categoriesList }) => ({
|
||||
|
||||
@@ -1,138 +1,138 @@
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Button,
|
||||
Classes,
|
||||
FormGroup,
|
||||
InputGroup,
|
||||
Intent,
|
||||
TextArea,
|
||||
} from '@blueprintjs/core';
|
||||
import * as Yup from 'yup';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import { useFormik } from 'formik';
|
||||
import { compose } from 'utils';
|
||||
import Dialog from 'components/Dialog';
|
||||
import useAsync from 'hooks/async';
|
||||
import AppToaster from 'components/AppToaster';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import DialogReduxConnect from 'components/DialogReduxConnect';
|
||||
import ItemFormDialogConnect from 'connectors/ItemFormDialog.connect';
|
||||
// import React, { useState } from 'react';
|
||||
// import {
|
||||
// Button,
|
||||
// Classes,
|
||||
// FormGroup,
|
||||
// InputGroup,
|
||||
// Intent,
|
||||
// TextArea,
|
||||
// } from '@blueprintjs/core';
|
||||
// import * as Yup from 'yup';
|
||||
// import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
// import { useFormik } from 'formik';
|
||||
// import { compose } from 'utils';
|
||||
// import Dialog from 'components/Dialog';
|
||||
// import useAsync from 'hooks/async';
|
||||
// import AppToaster from 'components/AppToaster';
|
||||
// import withDialog from 'containers/Dialogs/withDialog';
|
||||
// import DialogReduxConnect from 'components/DialogReduxConnect';
|
||||
// // import ItemFormDialogConnect from 'connectors/ItemFormDialog.connect';
|
||||
|
||||
function ItemFromDialog({
|
||||
name,
|
||||
payload,
|
||||
isOpen,
|
||||
submitItemCategory,
|
||||
fetchCategory,
|
||||
openDialog,
|
||||
closeDialog,
|
||||
}) {
|
||||
const [state, setState] = useState({});
|
||||
const { formatMessage } = useIntl();
|
||||
const ValidationSchema = Yup.object().shape({
|
||||
name: Yup.string().required().label(formatMessage({id:'category_name_'})),
|
||||
description: Yup.string().trim(),
|
||||
});
|
||||
// function ItemFromDialog({
|
||||
// name,
|
||||
// payload,
|
||||
// isOpen,
|
||||
// submitItemCategory,
|
||||
// fetchCategory,
|
||||
// openDialog,
|
||||
// closeDialog,
|
||||
// }) {
|
||||
// const [state, setState] = useState({});
|
||||
// const { formatMessage } = useIntl();
|
||||
// const ValidationSchema = Yup.object().shape({
|
||||
// name: Yup.string().required().label(formatMessage({id:'category_name_'})),
|
||||
// description: Yup.string().trim(),
|
||||
// });
|
||||
|
||||
const formik = useFormik({
|
||||
enableReinitialize: true,
|
||||
initialValues: {},
|
||||
validationSchema: ValidationSchema,
|
||||
onSubmit: (values) => {
|
||||
submitItemCategory({ values })
|
||||
.then((response) => {
|
||||
AppToaster.show({
|
||||
message: formatMessage({id:'the_category_has_been_successfully_created'}),
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
alert(error.message);
|
||||
});
|
||||
},
|
||||
});
|
||||
// const formik = useFormik({
|
||||
// enableReinitialize: true,
|
||||
// initialValues: {},
|
||||
// validationSchema: ValidationSchema,
|
||||
// onSubmit: (values) => {
|
||||
// submitItemCategory({ values })
|
||||
// .then((response) => {
|
||||
// AppToaster.show({
|
||||
// message: formatMessage({id:'the_category_has_been_successfully_created'}),
|
||||
// });
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// alert(error.message);
|
||||
// });
|
||||
// },
|
||||
// });
|
||||
|
||||
const fetchHook = useAsync(async () => {
|
||||
await Promise.all([submitItemCategory]);
|
||||
});
|
||||
// const fetchHook = useAsync(async () => {
|
||||
// await Promise.all([submitItemCategory]);
|
||||
// });
|
||||
|
||||
const handleClose = () => {
|
||||
closeDialog(name);
|
||||
};
|
||||
// const handleClose = () => {
|
||||
// closeDialog(name);
|
||||
// };
|
||||
|
||||
const onDialogOpening = () => {
|
||||
fetchHook.execute();
|
||||
openDialog(name);
|
||||
};
|
||||
const onDialogClosed = () => {
|
||||
// formik.resetForm();
|
||||
closeDialog(name);
|
||||
};
|
||||
// const onDialogOpening = () => {
|
||||
// fetchHook.execute();
|
||||
// openDialog(name);
|
||||
// };
|
||||
// const onDialogClosed = () => {
|
||||
// // formik.resetForm();
|
||||
// closeDialog(name);
|
||||
// };
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
name={name}
|
||||
title={
|
||||
payload.action === 'new' ? <T id={'new'} /> : <T id={'new_category'} />
|
||||
}
|
||||
className={{
|
||||
'dialog--loading': state.isLoading,
|
||||
'dialog--item-form': true,
|
||||
}}
|
||||
isOpen={isOpen}
|
||||
onClosed={onDialogClosed}
|
||||
onOpening={onDialogOpening}
|
||||
isLoading={fetchHook.pending}
|
||||
>
|
||||
<form onSubmit={formik.handleSubmit}>
|
||||
<div className={Classes.DIALOG_BODY}>
|
||||
<FormGroup
|
||||
label={<T id={'category_name'} />}
|
||||
className={'form-group--category-name'}
|
||||
intent={formik.errors.name && Intent.DANGER}
|
||||
helperText={formik.errors.name && formik.errors.name}
|
||||
inline={true}
|
||||
>
|
||||
<InputGroup
|
||||
medium={formik.values.toString()}
|
||||
intent={formik.errors.name && Intent.DANGER}
|
||||
{...formik.getFieldProps('name')}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup
|
||||
label={<T id={'description'} />}
|
||||
className={'form-group--description'}
|
||||
intent={formik.errors.description && Intent.DANGER}
|
||||
helperText={formik.errors.description && formik.errors.credential}
|
||||
inline={true}
|
||||
>
|
||||
<TextArea
|
||||
growVertically={true}
|
||||
large={true}
|
||||
{...formik.getFieldProps('description')}
|
||||
/>
|
||||
</FormGroup>
|
||||
</div>
|
||||
<div className={Classes.DIALOG_FOOTER}>
|
||||
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
|
||||
<Button onClick={handleClose}>
|
||||
<T id={'close'} />
|
||||
</Button>
|
||||
<Button intent={Intent.PRIMARY} type='submit'>
|
||||
{payload.action === 'new' ? (
|
||||
<T id={'new'} />
|
||||
) : (
|
||||
<T id={'submit'} />
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
// return (
|
||||
// <Dialog
|
||||
// name={name}
|
||||
// title={
|
||||
// payload.action === 'new' ? <T id={'new'} /> : <T id={'new_category'} />
|
||||
// }
|
||||
// className={{
|
||||
// 'dialog--loading': state.isLoading,
|
||||
// 'dialog--item-form': true,
|
||||
// }}
|
||||
// isOpen={isOpen}
|
||||
// onClosed={onDialogClosed}
|
||||
// onOpening={onDialogOpening}
|
||||
// isLoading={fetchHook.pending}
|
||||
// >
|
||||
// <form onSubmit={formik.handleSubmit}>
|
||||
// <div className={Classes.DIALOG_BODY}>
|
||||
// <FormGroup
|
||||
// label={<T id={'category_name'} />}
|
||||
// className={'form-group--category-name'}
|
||||
// intent={formik.errors.name && Intent.DANGER}
|
||||
// helperText={formik.errors.name && formik.errors.name}
|
||||
// inline={true}
|
||||
// >
|
||||
// <InputGroup
|
||||
// medium={formik.values.toString()}
|
||||
// intent={formik.errors.name && Intent.DANGER}
|
||||
// {...formik.getFieldProps('name')}
|
||||
// />
|
||||
// </FormGroup>
|
||||
// <FormGroup
|
||||
// label={<T id={'description'} />}
|
||||
// className={'form-group--description'}
|
||||
// intent={formik.errors.description && Intent.DANGER}
|
||||
// helperText={formik.errors.description && formik.errors.credential}
|
||||
// inline={true}
|
||||
// >
|
||||
// <TextArea
|
||||
// growVertically={true}
|
||||
// large={true}
|
||||
// {...formik.getFieldProps('description')}
|
||||
// />
|
||||
// </FormGroup>
|
||||
// </div>
|
||||
// <div className={Classes.DIALOG_FOOTER}>
|
||||
// <div className={Classes.DIALOG_FOOTER_ACTIONS}>
|
||||
// <Button onClick={handleClose}>
|
||||
// <T id={'close'} />
|
||||
// </Button>
|
||||
// <Button intent={Intent.PRIMARY} type='submit'>
|
||||
// {payload.action === 'new' ? (
|
||||
// <T id={'new'} />
|
||||
// ) : (
|
||||
// <T id={'submit'} />
|
||||
// )}
|
||||
// </Button>
|
||||
// </div>
|
||||
// </div>
|
||||
// </form>
|
||||
// </Dialog>
|
||||
// );
|
||||
// }
|
||||
|
||||
export default compose(
|
||||
ItemFormDialogConnect,
|
||||
DialogConnect,
|
||||
DialogReduxConnect
|
||||
)(ItemFromDialog);
|
||||
// export default compose(
|
||||
// // ItemFormDialogConnect,
|
||||
// withDialog,
|
||||
// DialogReduxConnect
|
||||
// )(ItemFromDialog);
|
||||
|
||||
19
client/src/containers/Dialogs/UserFormDialog.connector.js
Normal file
19
client/src/containers/Dialogs/UserFormDialog.connector.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { getUserDetails } from 'store/users/users.reducer';
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
import t from 'store/types';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
const dialogPayload = getDialogPayload(state, 'user-form');
|
||||
|
||||
return {
|
||||
name: 'user-form',
|
||||
payload: { action: 'new', id: null },
|
||||
userDetails:
|
||||
dialogPayload.action === 'edit'
|
||||
? getUserDetails(state, dialogPayload.user.id)
|
||||
: {},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, null);
|
||||
@@ -18,7 +18,11 @@ import { queryCache, useQuery } from 'react-query';
|
||||
import AppToaster from 'components/AppToaster';
|
||||
import DialogReduxConnect from 'components/DialogReduxConnect';
|
||||
import ErrorMessage from 'components/ErrorMessage';
|
||||
import UserFormDialogConnect from 'connectors/UserFormDialog.connector';
|
||||
|
||||
import UserFormDialogConnect from 'containers/Dialogs/UserFormDialog.connector';
|
||||
import withUsersActions from 'containers/Users/withUsersActions';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
function UserFormDialog({
|
||||
@@ -167,5 +171,7 @@ function UserFormDialog({
|
||||
|
||||
export default compose(
|
||||
UserFormDialogConnect,
|
||||
withUsersActions,
|
||||
withDialogActions,
|
||||
DialogReduxConnect,
|
||||
)(UserFormDialog);
|
||||
|
||||
22
client/src/containers/Dialogs/UsersListDialog.connector.js
Normal file
22
client/src/containers/Dialogs/UsersListDialog.connector.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { getUserDetails } from 'store/users/users.reducer';
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
const dialogPayload = getDialogPayload(state, 'userList-form');
|
||||
|
||||
return {
|
||||
name: 'userList-form',
|
||||
payload: { action: 'new', id: null },
|
||||
userDetails:
|
||||
dialogPayload.action === 'edit'
|
||||
? getUserDetails(state, dialogPayload.user.id)
|
||||
: {},
|
||||
editUser:
|
||||
dialogPayload && dialogPayload.action === 'edit'
|
||||
? state.users.list.results[dialogPayload.user.id]
|
||||
: {},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, null);
|
||||
@@ -14,7 +14,7 @@ import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
||||
import ExchangeRateTable from './ExchangeRateTable';
|
||||
import ExchangeRateActionsBar from './ExchangeRateActionsBar';
|
||||
|
||||
import withDialog from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withResourceActions from 'containers/Resources/withResourcesActions';
|
||||
import withExchangeRatesActions from 'containers/ExchangeRates/withExchangeRatesActions';
|
||||
@@ -200,5 +200,5 @@ export default compose(
|
||||
withExchangeRatesActions,
|
||||
withResourceActions,
|
||||
withDashboardActions,
|
||||
withDialog,
|
||||
withDialogActions,
|
||||
)(ExchangeRate);
|
||||
|
||||
@@ -11,16 +11,15 @@ import {
|
||||
} from '@blueprintjs/core';
|
||||
import classNames from 'classnames';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { If } from 'components';
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
import Icon from 'components/Icon';
|
||||
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withResourceDetail from 'containers/Resources/withResourceDetails';
|
||||
import withDialog from 'connectors/Dialog.connector';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
@@ -28,7 +27,7 @@ import { compose } from 'utils';
|
||||
* Exchange rate actions bar.
|
||||
*/
|
||||
function ExchangeRateActionsBar({
|
||||
// #withDialog.
|
||||
// #withDialogActions.
|
||||
openDialog,
|
||||
|
||||
// #withResourceDetail
|
||||
@@ -125,7 +124,7 @@ const withExchangeRateActionBar = connect(mapStateToProps);
|
||||
|
||||
export default compose(
|
||||
withExchangeRateActionBar,
|
||||
withDialog,
|
||||
withDialogActions,
|
||||
withResourceDetail(({ resourceFields }) => ({
|
||||
resourceFields,
|
||||
})),
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import React, { useCallback, useMemo, useState, useEffect } from 'react';
|
||||
import Icon from 'components/Icon';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import DataTable from 'components/DataTable';
|
||||
import { Button, Popover, Menu, MenuItem, Position,Intent } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
import Icon from 'components/Icon';
|
||||
import DataTable from 'components/DataTable';
|
||||
import LoadingIndicator from 'components/LoadingIndicator';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withExchangeRatesActions from 'containers/ExchangeRates/withExchangeRatesActions';
|
||||
import withExchangeRates from 'containers/ExchangeRates/withExchangeRates';
|
||||
|
||||
@@ -14,7 +16,8 @@ function ExchangeRateTable({
|
||||
// #withExchangeRates
|
||||
exchangeRatesList,
|
||||
exchangeRatesLoading,
|
||||
// #withDialog.
|
||||
|
||||
// #withDialogActions.
|
||||
openDialog,
|
||||
|
||||
// own properties
|
||||
@@ -134,7 +137,7 @@ function ExchangeRateTable({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
withExchangeRatesActions,
|
||||
withExchangeRates(({ exchangeRatesList, exchangeRatesLoading }) => ({
|
||||
exchangeRatesList,
|
||||
|
||||
@@ -6,7 +6,7 @@ import Money from 'components/Money';
|
||||
import FinancialSheet from 'components/FinancialSheet';
|
||||
import DataTable from 'components/DataTable';
|
||||
|
||||
import SettingsConnect from 'connectors/Settings.connect';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
import withBalanceSheetDetail from './withBalanceSheetDetail';
|
||||
import { getFinancialSheetIndexByQuery } from 'store/financialStatement/financialStatements.selectors';
|
||||
|
||||
@@ -130,5 +130,5 @@ export default compose(
|
||||
balanceSheetQuery,
|
||||
}),
|
||||
),
|
||||
SettingsConnect,
|
||||
withSettings,
|
||||
)(BalanceSheetTable);
|
||||
|
||||
@@ -1,26 +1,22 @@
|
||||
import React, { useCallback} from 'react';
|
||||
import {
|
||||
Button,
|
||||
FormGroup,
|
||||
Classes,
|
||||
} from '@blueprintjs/core';
|
||||
import {Row, Col} from 'react-grid-system';
|
||||
import React, { useCallback } from 'react';
|
||||
import { Button, FormGroup, Classes } from '@blueprintjs/core';
|
||||
import { Row, Col } from 'react-grid-system';
|
||||
import moment from 'moment';
|
||||
import * as Yup from 'yup';
|
||||
import {useFormik} from 'formik';
|
||||
import { useFormik } from 'formik';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
|
||||
import AccountsMultiSelect from 'components/AccountsMultiSelect';
|
||||
import FinancialStatementHeader from 'containers/FinancialStatements/FinancialStatementHeader';
|
||||
import AccountsConnect from 'connectors/Accounts.connector'
|
||||
import withAccounts from 'containers/Accounts/withAccounts';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import FinancialStatementDateRange from 'containers/FinancialStatements/FinancialStatementDateRange';
|
||||
import RadiosAccountingBasis from '../RadiosAccountingBasis';
|
||||
import {compose} from 'utils';
|
||||
import { compose } from 'utils';
|
||||
|
||||
import withGeneralLedger from './withGeneralLedger';
|
||||
|
||||
|
||||
function GeneralLedgerHeader({
|
||||
onSubmitFilter,
|
||||
pageFilter,
|
||||
@@ -36,7 +32,7 @@ function GeneralLedgerHeader({
|
||||
initialValues: {
|
||||
...pageFilter,
|
||||
from_date: moment(pageFilter.from_date).toDate(),
|
||||
to_date: moment(pageFilter.to_date).toDate()
|
||||
to_date: moment(pageFilter.to_date).toDate(),
|
||||
},
|
||||
validationSchema: Yup.object().shape({
|
||||
from_date: Yup.date().required(),
|
||||
@@ -57,10 +53,13 @@ function GeneralLedgerHeader({
|
||||
console.log(selectedAccounts);
|
||||
}, []);
|
||||
|
||||
const handleAccountingBasisChange = useCallback((value) => {
|
||||
formik.setFieldValue('basis', value);
|
||||
}, [formik]);
|
||||
|
||||
const handleAccountingBasisChange = useCallback(
|
||||
(value) => {
|
||||
formik.setFieldValue('basis', value);
|
||||
},
|
||||
[formik],
|
||||
);
|
||||
|
||||
return (
|
||||
<FinancialStatementHeader show={generalLedgerSheetFilter}>
|
||||
<FinancialStatementDateRange formik={formik} />
|
||||
@@ -68,18 +67,20 @@ function GeneralLedgerHeader({
|
||||
<Row>
|
||||
<Col sm={3}>
|
||||
<FormGroup
|
||||
label={<T id={'specific_accounts'}/>}
|
||||
label={<T id={'specific_accounts'} />}
|
||||
className={classNames('form-group--select-list', Classes.FILL)}
|
||||
>
|
||||
<AccountsMultiSelect
|
||||
accounts={accounts}
|
||||
onAccountSelected={onAccountSelected} />
|
||||
onAccountSelected={onAccountSelected}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
<Col sm={3}>
|
||||
<RadiosAccountingBasis
|
||||
onChange={handleAccountingBasisChange}
|
||||
selectedValue={formik.values.basis} />
|
||||
selectedValue={formik.values.basis}
|
||||
/>
|
||||
</Col>
|
||||
|
||||
<Col sm={3}>
|
||||
@@ -87,16 +88,21 @@ function GeneralLedgerHeader({
|
||||
type="submit"
|
||||
onClick={handleSubmitClick}
|
||||
disabled={formik.isSubmitting}
|
||||
className={'button--submit-filter mt2'}>
|
||||
<T id={'calculate_report'}/>
|
||||
className={'button--submit-filter mt2'}
|
||||
>
|
||||
<T id={'calculate_report'} />
|
||||
</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
</FinancialStatementHeader>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
AccountsConnect,
|
||||
withGeneralLedger(({ generalLedgerSheetFilter }) => ({ generalLedgerSheetFilter })),
|
||||
)(GeneralLedgerHeader);
|
||||
withAccounts(({ accounts }) => ({
|
||||
accounts,
|
||||
})),
|
||||
withGeneralLedger(({ generalLedgerSheetFilter }) => ({
|
||||
generalLedgerSheetFilter,
|
||||
})),
|
||||
)(GeneralLedgerHeader);
|
||||
|
||||
@@ -10,7 +10,8 @@ import JournalHeader from './JournalHeader';
|
||||
import JournalActionsBar from './JournalActionsBar';
|
||||
import DashboardPageContent from 'components/Dashboard/DashboardPageContent';
|
||||
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
||||
import SettingsConnect from 'connectors/Settings.connect';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
|
||||
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withJournalActions from './withJournalActions';
|
||||
@@ -95,5 +96,5 @@ function Journal({
|
||||
export default compose(
|
||||
withDashboardActions,
|
||||
withJournalActions,
|
||||
SettingsConnect,
|
||||
withSettings,
|
||||
)(Journal);
|
||||
|
||||
@@ -13,7 +13,8 @@ import DashboardPageContent from 'components/Dashboard/DashboardPageContent'
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withProfitLossActions from './withProfitLossActions';
|
||||
import withProfitLoss from './withProfitLoss';
|
||||
import SettingsConnect from 'connectors/Settings.connect';
|
||||
// import SettingsConnect from 'connectors/Settings.connect';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
|
||||
|
||||
function ProfitLossSheet({
|
||||
@@ -90,5 +91,5 @@ export default compose(
|
||||
withProfitLoss(({ profitLossSheetLoading }) => ({
|
||||
profitLossSheetLoading,
|
||||
})),
|
||||
SettingsConnect,
|
||||
withSettings,
|
||||
)(ProfitLossSheet);
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { Omnibar } from '@blueprintjs/select';
|
||||
import { MenuItem } from '@blueprintjs/core';
|
||||
import { compose } from 'utils';
|
||||
import SearchConnect from 'connectors/Search.connect';
|
||||
import withSearch from 'containers/GeneralSearch/withSearch';
|
||||
|
||||
function Search({
|
||||
resultSearch,
|
||||
@@ -30,7 +30,7 @@ function Search({
|
||||
<Omnibar
|
||||
className={'navbar-omnibar'}
|
||||
isOpen={globalSearchShow}
|
||||
noResults={<MenuItem disabled={true} text='No results.' />}
|
||||
noResults={<MenuItem disabled={true} text="No results." />}
|
||||
onClose={() => closeGlobalSearch(false)}
|
||||
resetOnSelect={true}
|
||||
itemRenderer={renderSearch}
|
||||
@@ -41,4 +41,4 @@ function Search({
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(SearchConnect)(Search);
|
||||
export default compose(withSearch)(Search);
|
||||
|
||||
@@ -12,3 +12,4 @@ export const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
@@ -13,10 +13,9 @@ import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
||||
import ItemCategoriesDataTable from 'containers/Items/ItemCategoriesTable';
|
||||
import ItemsCategoryActionsBar from 'containers/Items/ItemsCategoryActionsBar';
|
||||
|
||||
import withDialog from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withItemCategoriesActions from 'containers/Items/withItemCategoriesActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
/**
|
||||
@@ -35,6 +34,7 @@ const ItemCategoryList = ({
|
||||
openDialog,
|
||||
}) => {
|
||||
const { id } = useParams();
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
const [selectedRows, setSelectedRows] = useState([]);
|
||||
const [filter, setFilter] = useState({});
|
||||
@@ -42,8 +42,6 @@ const ItemCategoryList = ({
|
||||
const [bulkDelete, setBulkDelete] = useState(false);
|
||||
const [tableLoading, setTableLoading] = useState(false);
|
||||
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
useEffect(() => {
|
||||
id
|
||||
? changePageTitle(formatMessage({ id: 'edit_category_details' }))
|
||||
@@ -185,7 +183,7 @@ const ItemCategoryList = ({
|
||||
>
|
||||
<p>
|
||||
<FormattedHTMLMessage
|
||||
id={'once_delete_these_items_you_will_not_able_restore_them'}
|
||||
id={'once_delete_these_item_categories_you_will_not_able_restore_them'}
|
||||
/>
|
||||
</p>
|
||||
</Alert>
|
||||
@@ -196,5 +194,5 @@ const ItemCategoryList = ({
|
||||
export default compose(
|
||||
withItemCategoriesActions,
|
||||
withDashboardActions,
|
||||
withDialog,
|
||||
withDialogActions,
|
||||
)(ItemCategoryList);
|
||||
|
||||
@@ -13,15 +13,19 @@ import {
|
||||
Classes,
|
||||
Intent,
|
||||
} from '@blueprintjs/core';
|
||||
import { compose } from 'utils';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
import Icon from 'components/Icon';
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
import withDialog from 'connectors/Dialog.connector';
|
||||
import { If } from 'components';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withResourceDetail from 'containers/Resources/withResourceDetails';
|
||||
import withItems from 'containers/Items/withItems';
|
||||
import { If } from 'components';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
|
||||
const ItemsActionsBar = ({
|
||||
openDialog,
|
||||
@@ -137,7 +141,7 @@ const ItemsActionsBar = ({
|
||||
};
|
||||
|
||||
export default compose(
|
||||
withDialog,
|
||||
withDialogActions,
|
||||
withItems(({ itemsViews }) => ({
|
||||
itemsViews,
|
||||
})),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useMemo,useState } from 'react';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import {
|
||||
NavbarGroup,
|
||||
NavbarDivider,
|
||||
@@ -12,14 +12,14 @@ import {
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import classNames from 'classnames';
|
||||
import { connect } from 'react-redux';
|
||||
import { If } from 'components';
|
||||
import Icon from 'components/Icon';
|
||||
|
||||
import Icon from 'components/Icon';
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
import { If } from 'components';
|
||||
|
||||
import withResourceDetail from 'containers/Resources/withResourceDetails';
|
||||
import withDialog from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
@@ -27,29 +27,29 @@ import { compose } from 'utils';
|
||||
const ItemsCategoryActionsBar = ({
|
||||
// #withResourceDetail
|
||||
resourceFields,
|
||||
|
||||
|
||||
// #withDialog
|
||||
openDialog,
|
||||
|
||||
// #ownProps
|
||||
selectedRows=[],
|
||||
selectedRows = [],
|
||||
onFilterChanged,
|
||||
onBulkDelete
|
||||
onBulkDelete,
|
||||
}) => {
|
||||
|
||||
const [filterCount, setFilterCount] = useState(0);
|
||||
|
||||
const onClickNewCategory = useCallback(() => {
|
||||
openDialog('item-category-form', {});
|
||||
}, [openDialog]);
|
||||
|
||||
const hasSelectedRows = useMemo(() => selectedRows.length > 0, [selectedRows]);
|
||||
const hasSelectedRows = useMemo(() => selectedRows.length > 0, [
|
||||
selectedRows,
|
||||
]);
|
||||
|
||||
// const handleDeleteCategory = useCallback((category) => {
|
||||
// onDeleteCategory(selectedRows);
|
||||
// }, [selectedRows, onDeleteCategory]);
|
||||
|
||||
|
||||
const filterDropdown = FilterDropdown({
|
||||
fields: resourceFields,
|
||||
onFilterChange: (filterConditions) => {
|
||||
@@ -58,17 +58,17 @@ const ItemsCategoryActionsBar = ({
|
||||
},
|
||||
});
|
||||
|
||||
const handelBulkDelete =useCallback(()=>{
|
||||
onBulkDelete && onBulkDelete(selectedRows.map(r=>r.id));
|
||||
},[onBulkDelete,selectedRows])
|
||||
const handelBulkDelete = useCallback(() => {
|
||||
onBulkDelete && onBulkDelete(selectedRows.map((r) => r.id));
|
||||
}, [onBulkDelete, selectedRows]);
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
<NavbarGroup>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='plus' />}
|
||||
text={<T id={'new_category'}/>}
|
||||
icon={<Icon icon="plus" />}
|
||||
text={<T id={'new_category'} />}
|
||||
onClick={onClickNewCategory}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
@@ -119,9 +119,9 @@ const withItemsCategoriesActionsBar = connect(mapStateToProps);
|
||||
|
||||
export default compose(
|
||||
withItemsCategoriesActionsBar,
|
||||
withDialog,
|
||||
withDialogActions,
|
||||
withDashboardActions,
|
||||
withResourceDetail(({ resourceFields }) => ({
|
||||
resourceFields,
|
||||
}))
|
||||
})),
|
||||
)(ItemsCategoryActionsBar);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { Button, Intent } from '@blueprintjs/core';
|
||||
import { compose } from 'utils';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import CurrencyFromDialogConnect from 'connectors/CurrencyFromDialog.connect';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
|
||||
function Currencies({ openDialog }) {
|
||||
const onClickNewCurrency = () => {
|
||||
openDialog('currency-form',{});
|
||||
@@ -17,4 +17,4 @@ function Currencies({ openDialog }) {
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(DialogConnect, CurrencyFromDialogConnect)(Currencies);
|
||||
export default compose(withDialogActions)(Currencies);
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
Intent,
|
||||
} from '@blueprintjs/core';
|
||||
import Icon from 'components/Icon';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import {compose} from 'utils';
|
||||
|
||||
function CurrenciesActions({
|
||||
@@ -27,5 +27,5 @@ function CurrenciesActions({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
)(CurrenciesActions);
|
||||
@@ -23,7 +23,7 @@ import AppToaster from 'components/AppToaster';
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withCurrencies from 'containers/Currencies/withCurrencies';
|
||||
import withCurrenciesActions from 'containers/Currencies/withCurrenciesActions';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
@@ -36,7 +36,7 @@ function CurrenciesList({
|
||||
requestDeleteCurrency,
|
||||
requestFetchCurrencies,
|
||||
|
||||
// #withDialog
|
||||
// #withDialogActions
|
||||
openDialog,
|
||||
|
||||
// #withDashboardActions
|
||||
@@ -178,10 +178,10 @@ function CurrenciesList({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDashboardActions,
|
||||
withCurrencies(({ currenciesList }) => ({
|
||||
currenciesList,
|
||||
})),
|
||||
withCurrenciesActions,
|
||||
withDialogActions,
|
||||
)(CurrenciesList);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Tabs, Tab } from '@blueprintjs/core';
|
||||
import PreferencesSubContent from 'components/Preferences/PreferencesSubContent';
|
||||
import connector from 'connectors/UsersPreferences.connector';
|
||||
import withUserPreferences from 'containers/Preferences/Users/withUserPreferences'
|
||||
|
||||
function UsersPreferences({ openDialog }) {
|
||||
const onChangeTabs = (currentTabId) => {};
|
||||
@@ -19,4 +19,4 @@ function UsersPreferences({ openDialog }) {
|
||||
);
|
||||
}
|
||||
|
||||
export default connector(UsersPreferences);
|
||||
export default withUserPreferences(UsersPreferences);
|
||||
|
||||
@@ -3,8 +3,10 @@ import {
|
||||
Button,
|
||||
Intent,
|
||||
} from '@blueprintjs/core';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
import Icon from 'components/Icon';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import {compose} from 'utils';
|
||||
|
||||
function UsersActions({
|
||||
@@ -21,18 +23,18 @@ function UsersActions({
|
||||
icon={<Icon icon='plus' iconSize={12} />}
|
||||
onClick={onClickNewUser}
|
||||
intent={Intent.PRIMARY}>
|
||||
Invite User
|
||||
<T id={'invite_user'} />
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
icon={<Icon icon='plus' iconSize={12} />}
|
||||
onClick={onClickNewUser}>
|
||||
New Role
|
||||
<T id={'new_role'} />
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
)(UsersActions);
|
||||
@@ -25,13 +25,14 @@ import { If } from 'components';
|
||||
|
||||
import AppToaster from 'components/AppToaster';
|
||||
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withUsers from 'containers/Users/withUsers';
|
||||
import withUsersActions from 'containers/Users/withUsersActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
|
||||
function UsersListPreferences({
|
||||
// #withDialog
|
||||
openDialog,
|
||||
@@ -258,7 +259,7 @@ function UsersListPreferences({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialogActions,
|
||||
withDashboardActions,
|
||||
withUsers,
|
||||
withUsersActions,
|
||||
|
||||
@@ -10,4 +10,4 @@ export const mapDispatchToProps = (dispatch) => ({
|
||||
closeDialog: (name, payload) => dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
export default connect(null, mapDispatchToProps);
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
deleteUser,
|
||||
inactiveUser,
|
||||
editUser,
|
||||
submitInvite
|
||||
} from 'store/users/users.actions';
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
@@ -13,6 +14,8 @@ export const mapDispatchToProps = (dispatch) => ({
|
||||
requestDeleteUser: (id) => dispatch(deleteUser({ id })),
|
||||
requestInactiveUser: (id) => dispatch(inactiveUser({ id })),
|
||||
requestEditUser: (id, form) => dispatch(editUser({ form, id })),
|
||||
requestSubmitInvite: (form) => dispatch(submitInvite({ form })),
|
||||
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps);
|
||||
|
||||
@@ -400,4 +400,5 @@ export default {
|
||||
'The email is already used in another account',
|
||||
hide_filter: 'Hide filter',
|
||||
show_filter: 'Show filter',
|
||||
new_role: 'New Role',
|
||||
};
|
||||
|
||||
@@ -37,22 +37,6 @@ export default [
|
||||
breadcrumb: 'Edit',
|
||||
},
|
||||
|
||||
// Expenses.
|
||||
{
|
||||
path: `/expenses/new`,
|
||||
component: LazyLoader({
|
||||
loader: () => import('containers/Expenses/ExpenseForm'),
|
||||
}),
|
||||
breadcrumb: 'New Expense',
|
||||
},
|
||||
{
|
||||
path: `/expenses`,
|
||||
component: LazyLoader({
|
||||
loader: () => import('containers/Expenses/ExpensesList'),
|
||||
}),
|
||||
breadcrumb: 'Expenses',
|
||||
},
|
||||
|
||||
// Accounting
|
||||
{
|
||||
path: `/make-journal-entry`,
|
||||
|
||||
Reference in New Issue
Block a user