mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
Fix & connectors folder
This commit is contained in:
@@ -9,7 +9,6 @@ import PrivateRoute from 'components/PrivateRoute';
|
||||
import Authentication from 'components/Authentication';
|
||||
import Dashboard from 'components/Dashboard/Dashboard';
|
||||
import GlobalErrors from 'containers/GlobalErrors/GlobalErrors';
|
||||
import AuthenticationDialogs from 'containers/Authentication/AuthenticationDialogs';
|
||||
|
||||
import messages from 'lang/en';
|
||||
import 'style/App.scss';
|
||||
@@ -30,7 +29,6 @@ function App({ locale }) {
|
||||
<Switch>
|
||||
<Route path={'/auth'}>
|
||||
<Authentication />
|
||||
<AuthenticationDialogs />
|
||||
</Route>
|
||||
|
||||
<Route path={'/'}>
|
||||
|
||||
@@ -11,7 +11,7 @@ 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 withSearch from 'containers/GeneralSearch/withSearch'
|
||||
import Icon from 'components/Icon';
|
||||
|
||||
import { compose } from 'utils';
|
||||
@@ -113,6 +113,6 @@ const mapStateToProps = (state) => ({
|
||||
});
|
||||
|
||||
export default compose(
|
||||
SearchConnect,
|
||||
withSearch,
|
||||
connect(mapStateToProps)
|
||||
)(DashboardTopbar);
|
||||
|
||||
@@ -1,60 +1,60 @@
|
||||
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';
|
||||
// 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,
|
||||
// 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,
|
||||
// tableQuery: state.accounts.tableQuery,
|
||||
// accountsLoading: state.accounts.loading,
|
||||
// accountErrors: state.accounts.errors,
|
||||
|
||||
getAccountById: (id) => getItemById(state.accounts.items, id),
|
||||
});
|
||||
// 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 })),
|
||||
// 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 },
|
||||
}),
|
||||
});
|
||||
// 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);
|
||||
// export default connect(mapStateToProps, mapActionsToProps);
|
||||
@@ -1,27 +1,27 @@
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
import t from 'store/types';
|
||||
// import { connect } from 'react-redux';
|
||||
// import t from 'store/types';
|
||||
|
||||
const mapActionsToProps = (dispatch) => ({
|
||||
changePageTitle: (pageTitle) => dispatch({
|
||||
type: t.CHANGE_DASHBOARD_PAGE_TITLE, pageTitle
|
||||
}),
|
||||
// const mapActionsToProps = (dispatch) => ({
|
||||
// changePageTitle: (pageTitle) => dispatch({
|
||||
// type: t.CHANGE_DASHBOARD_PAGE_TITLE, pageTitle
|
||||
// }),
|
||||
|
||||
changePageSubtitle: (pageSubtitle) => dispatch({
|
||||
type: t.ALTER_DASHBOARD_PAGE_SUBTITLE, pageSubtitle,
|
||||
}),
|
||||
// changePageSubtitle: (pageSubtitle) => dispatch({
|
||||
// type: t.ALTER_DASHBOARD_PAGE_SUBTITLE, pageSubtitle,
|
||||
// }),
|
||||
|
||||
setTopbarEditView: (id) => dispatch({
|
||||
type: t.SET_TOPBAR_EDIT_VIEW, id,
|
||||
}),
|
||||
// setTopbarEditView: (id) => dispatch({
|
||||
// type: t.SET_TOPBAR_EDIT_VIEW, id,
|
||||
// }),
|
||||
|
||||
setDashboardRequestLoading: () => dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_LOADING,
|
||||
}),
|
||||
// setDashboardRequestLoading: () => dispatch({
|
||||
// type: t.SET_DASHBOARD_REQUEST_LOADING,
|
||||
// }),
|
||||
|
||||
setDashboardRequestCompleted: () => dispatch({
|
||||
type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||
}),
|
||||
});
|
||||
// setDashboardRequestCompleted: () => dispatch({
|
||||
// type: t.SET_DASHBOARD_REQUEST_COMPLETED,
|
||||
// }),
|
||||
// });
|
||||
|
||||
export default connect(null, mapActionsToProps);
|
||||
// export default connect(null, mapActionsToProps);
|
||||
@@ -1,13 +1,13 @@
|
||||
import { connect } from 'react-redux';
|
||||
import t from 'store/types';
|
||||
// import { connect } from 'react-redux';
|
||||
// import t from 'store/types';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
return {};
|
||||
};
|
||||
// export const mapStateToProps = (state, props) => {
|
||||
// return {};
|
||||
// };
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
openDialog: (name, payload) => dispatch({ type: t.OPEN_DIALOG, name, payload }),
|
||||
closeDialog: (name, payload) => dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
});
|
||||
// export const mapDispatchToProps = (dispatch) => ({
|
||||
// openDialog: (name, payload) => dispatch({ type: t.OPEN_DIALOG, name, payload }),
|
||||
// closeDialog: (name, payload) => dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
// });
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
// export default connect(null, mapDispatchToProps);
|
||||
@@ -1,20 +1,20 @@
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
fetchGeneralLedger,
|
||||
} from 'store/financialStatement/financialStatements.actions';
|
||||
import {
|
||||
getFinancialSheetIndexByQuery,
|
||||
getFinancialSheet,
|
||||
} from 'store/financialStatement/financialStatements.selectors';
|
||||
// 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 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 const mapDispatchToProps = (dispatch) => ({
|
||||
// fetchGeneralLedger: (query = {}) => dispatch(fetchGeneralLedger({ query })),
|
||||
// });
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
// export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,24 +1,23 @@
|
||||
//FIXME: FIX Later Need More Work
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
submitItemCategory,
|
||||
submitCategory,
|
||||
fetchCategory
|
||||
} from 'store/itemCategories/itemsCategory.actions';
|
||||
// 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 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 const mapDispatchToProps = dispatch => ({
|
||||
// submitItemCategory: form => dispatch(submitItemCategory({ form })),
|
||||
// submitCategory: form => dispatch(submitCategory({ form })),
|
||||
// fetchCategory: () => dispatch(fetchCategory())
|
||||
// });
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
// export default connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
@@ -1,53 +1,51 @@
|
||||
// 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);
|
||||
|
||||
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';
|
||||
// return {
|
||||
// views: getResourceViews(state, 'items'),
|
||||
// currentPageItems: getCurrentPageResults(
|
||||
// state.items.items,
|
||||
// viewPages,
|
||||
// state.items.currentPage,
|
||||
// ),
|
||||
// bulkSelected: state.items.bulkActions,
|
||||
// itemsTableLoading: state.items.loading,
|
||||
// };
|
||||
// };
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
const viewPages = getViewPages(state.items.views, state.items.currentViewId);
|
||||
// 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,
|
||||
// }),
|
||||
|
||||
return {
|
||||
views: getResourceViews(state, 'items'),
|
||||
currentPageItems: getCurrentPageResults(
|
||||
state.items.items,
|
||||
viewPages,
|
||||
state.items.currentPage,
|
||||
),
|
||||
bulkSelected: state.items.bulkActions,
|
||||
itemsTableLoading: state.items.loading,
|
||||
};
|
||||
};
|
||||
// setItemsTableQuery: (key, value) => dispatch({
|
||||
// type: t.ITEMS_TABLE_QUERY_SET, key, value,
|
||||
// }),
|
||||
// addItemsTableQueries: (queries) =>
|
||||
// dispatch({
|
||||
// type: t.ITEMS_TABLE_QUERIES_ADD, queries,
|
||||
// }),
|
||||
// });
|
||||
|
||||
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);
|
||||
// export default connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
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';
|
||||
// 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');
|
||||
// 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)),
|
||||
});
|
||||
// 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);
|
||||
// export default connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
submitMedia,
|
||||
deleteMedia,
|
||||
} from 'store/media/media.actions';
|
||||
// import {connect} from 'react-redux';
|
||||
// import {
|
||||
// submitMedia,
|
||||
// deleteMedia,
|
||||
// } from 'store/media/media.actions';
|
||||
|
||||
export const mapStateToProps = (state, props) => ({
|
||||
// export const mapStateToProps = (state, props) => ({
|
||||
|
||||
});
|
||||
// });
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
requestSubmitMedia: (form, config) => dispatch(submitMedia({ form, config })),
|
||||
requestDeleteMedia: (ids) => dispatch(deleteMedia({ ids })),
|
||||
});
|
||||
// export const mapDispatchToProps = (dispatch) => ({
|
||||
// requestSubmitMedia: (form, config) => dispatch(submitMedia({ form, config })),
|
||||
// requestDeleteMedia: (ids) => dispatch(deleteMedia({ ids })),
|
||||
// });
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
// export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,28 +1,28 @@
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
fetchResourceColumns,
|
||||
fetchResourceFields,
|
||||
} from 'store/resources/resources.actions';
|
||||
import {
|
||||
getResourceColumns,
|
||||
getResourceFields,
|
||||
getResourceColumn,
|
||||
getResourceField,
|
||||
getResourceMetadata,
|
||||
} from 'store/resources/resources.reducer';
|
||||
// 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) => ({
|
||||
// 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 const mapDispatchToProps = (dispatch) => ({
|
||||
// requestFetchResourceFields: (resourceSlug) => dispatch(fetchResourceFields({ resourceSlug })),
|
||||
// requestFetchResourceColumns: (resourceSlug) => dispatch(fetchResourceColumns({ resourceSlug })),
|
||||
// });
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
// export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -1,14 +1,14 @@
|
||||
import { connect } from 'react-redux';
|
||||
import t from 'store/types';
|
||||
// import { connect } from 'react-redux';
|
||||
// import t from 'store/types';
|
||||
|
||||
export const mapStateToProps = (state, props) => ({
|
||||
resultSearch: state.globalSearch.searches,
|
||||
globalSearchShow: state.globalSearch.isOpen,
|
||||
});
|
||||
// export const mapStateToProps = (state, props) => ({
|
||||
// resultSearch: state.globalSearch.searches,
|
||||
// globalSearchShow: state.globalSearch.isOpen,
|
||||
// });
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
openGlobalSearch: (result) => dispatch({ type: t.OPEN_SEARCH, }),
|
||||
closeGlobalSearch: (result) => dispatch({ type: t.CLOSE_SEARCH }),
|
||||
});
|
||||
// export const mapDispatchToProps = (dispatch) => ({
|
||||
// openGlobalSearch: (result) => dispatch({ type: t.OPEN_SEARCH, }),
|
||||
// closeGlobalSearch: (result) => dispatch({ type: t.CLOSE_SEARCH }),
|
||||
// });
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
// export default connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
FetchOptions,
|
||||
submitOptions,
|
||||
} from 'store/settings/settings.actions';
|
||||
// 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 mapStateToProps = (state, props) => {
|
||||
// return {
|
||||
// organizationSettings: state.settings.data.organization,
|
||||
// };
|
||||
// };
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
requestSubmitOptions: (form) => dispatch(submitOptions({ form })),
|
||||
requestFetchOptions: () => dispatch(FetchOptions({})),
|
||||
});
|
||||
// export const mapDispatchToProps = (dispatch) => ({
|
||||
// requestSubmitOptions: (form) => dispatch(submitOptions({ form })),
|
||||
// requestFetchOptions: () => dispatch(FetchOptions({})),
|
||||
// });
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
// export default connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
fetchTrialBalanceSheet
|
||||
} from 'store/financialStatement/financialStatements.actions';
|
||||
import {
|
||||
getFinancialSheetIndexByQuery,
|
||||
getFinancialSheetAccounts,
|
||||
getFinancialSheetQuery,
|
||||
} from 'store/financialStatement/financialStatements.selectors';
|
||||
// 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),
|
||||
// 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,
|
||||
});
|
||||
// trialBalanceSheetLoading: state.financialStatements.trialBalance.loading,
|
||||
// });
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
fetchTrialBalanceSheet: (query = {}) => dispatch(fetchTrialBalanceSheet({ query })),
|
||||
});
|
||||
// export const mapDispatchToProps = (dispatch) => ({
|
||||
// fetchTrialBalanceSheet: (query = {}) => dispatch(fetchTrialBalanceSheet({ query })),
|
||||
// });
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
// 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);
|
||||
@@ -1,13 +1,13 @@
|
||||
import {connect} from 'react-redux';
|
||||
import t from 'store/types';
|
||||
// import {connect} from 'react-redux';
|
||||
// import t from 'store/types';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
// export const mapStateToProps = (state, props) => {
|
||||
|
||||
};
|
||||
// };
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
openDialog: (name, payload) => dispatch({ type: t.OPEN_DIALOG, name, payload }),
|
||||
closeDialog: (name, payload) => dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
});
|
||||
// export const mapDispatchToProps = (dispatch) => ({
|
||||
// openDialog: (name, payload) => dispatch({ type: t.OPEN_DIALOG, name, payload }),
|
||||
// closeDialog: (name, payload) => dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
// });
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
// export default connect(mapStateToProps, mapDispatchToProps);
|
||||
@@ -17,7 +17,7 @@ import withDashboardActions from 'containers/Dashboard/withDashboard';
|
||||
|
||||
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';
|
||||
@@ -271,5 +271,5 @@ export default compose(
|
||||
withManualJournalDetail,
|
||||
withAccountsActions,
|
||||
withDashboardActions,
|
||||
MediaConnect,
|
||||
withMediaActions,
|
||||
)(MakeJournalEntriesForm);
|
||||
@@ -19,7 +19,8 @@ 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 withDialog from 'containers/Dialogs/withDialog';
|
||||
|
||||
import { If } from 'components';
|
||||
|
||||
import withResourceDetail from 'containers/Resources/withResourceDetails';
|
||||
@@ -137,7 +138,7 @@ function ManualJournalActionsBar({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
withResourceDetail(({ resourceFields }) => ({
|
||||
resourceFields,
|
||||
})),
|
||||
|
||||
@@ -19,7 +19,7 @@ import { compose } from 'utils';
|
||||
import moment from 'moment';
|
||||
|
||||
import LoadingIndicator from 'components/LoadingIndicator';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
|
||||
import { useUpdateEffect } from 'hooks';
|
||||
import DataTable from 'components/DataTable';
|
||||
@@ -251,7 +251,7 @@ function ManualJournalsDataTable({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
withDashboardActions,
|
||||
withManualJournalsActions,
|
||||
withManualJournals(({ manualJournals, manualJournalsLoading, }) => ({
|
||||
|
||||
@@ -19,7 +19,7 @@ import { FormattedMessage as T } from 'react-intl';
|
||||
import { If } from 'components';
|
||||
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
|
||||
@@ -27,8 +27,7 @@ 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 +44,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 +79,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>
|
||||
@@ -102,8 +101,8 @@ onBulkInactive && onBulkInactive(selectedRows.map(r=>r.id))
|
||||
>
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--table-views')}
|
||||
icon={<Icon icon='table' />}
|
||||
text={<T id={'table_views'}/>}
|
||||
icon={<Icon icon="table" />}
|
||||
text={<T id={'table_views'} />}
|
||||
rightIcon={'caret-down'}
|
||||
/>
|
||||
</Popover>
|
||||
@@ -112,54 +111,60 @@ 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`}
|
||||
icon={ <Icon icon="filter" /> }/>
|
||||
text={
|
||||
filterCount <= 0 ? (
|
||||
<T id={'filter'} />
|
||||
) : (
|
||||
`${filterCount} filters applied`
|
||||
)
|
||||
}
|
||||
icon={<Icon icon="filter" />}
|
||||
/>
|
||||
</Popover>
|
||||
|
||||
<If condition={hasSelectedRows}>
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='multi-select' iconSize={15} />}
|
||||
text={<T id={'activate'}/>}
|
||||
icon={<Icon icon="multi-select" iconSize={15} />}
|
||||
text={<T id={'activate'} />}
|
||||
onClick={handelBulkActivate}
|
||||
/>
|
||||
<Button
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='archive' iconSize={15} />}
|
||||
text={<T id={'inactivate'}/>}
|
||||
icon={<Icon icon="archive" iconSize={15} />}
|
||||
text={<T id={'inactivate'} />}
|
||||
onClick={handelBulkInactive}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='trash' iconSize={15} />}
|
||||
text={<T id={'delete'}/>}
|
||||
icon={<Icon icon="trash" iconSize={15} />}
|
||||
text={<T id={'delete'} />}
|
||||
intent={Intent.DANGER}
|
||||
onClick={handleBulkDelete}
|
||||
/>
|
||||
</If>
|
||||
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='file-import' />}
|
||||
text={<T id={'import'}/>}
|
||||
icon={<Icon icon="file-import" />}
|
||||
text={<T id={'import'} />}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='file-export' />}
|
||||
text={<T id={'export'}/>}
|
||||
icon={<Icon icon="file-export" />}
|
||||
text={<T id={'export'} />}
|
||||
/>
|
||||
</NavbarGroup>
|
||||
</DashboardActionsBar>
|
||||
@@ -174,7 +179,7 @@ const withAccountsActionsBar = connect(mapStateToProps);
|
||||
|
||||
export default compose(
|
||||
withAccountsActionsBar,
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
withAccounts(({ accountsViews }) => ({
|
||||
accountsViews,
|
||||
})),
|
||||
|
||||
@@ -13,7 +13,8 @@ import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
import Icon from 'components/Icon';
|
||||
import { compose } from 'utils';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
|
||||
import LoadingIndicator from 'components/LoadingIndicator';
|
||||
import DataTable from 'components/DataTable';
|
||||
import Money from 'components/Money';
|
||||
@@ -201,7 +202,7 @@ function AccountsDataTable({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
withDashboardActions,
|
||||
withAccountsActions,
|
||||
withAccounts(({ accountsLoading, accounts }) => ({
|
||||
|
||||
@@ -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 withDialog from 'containers/Dialogs/withDialog';
|
||||
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,
|
||||
withDialog,
|
||||
);
|
||||
|
||||
@@ -19,7 +19,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 withDialog from 'containers/Dialogs/withDialog';
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
|
||||
import withCurrency from 'containers/Currencies/withCurrency';
|
||||
@@ -29,6 +29,7 @@ import { compose } from 'utils';
|
||||
|
||||
|
||||
|
||||
|
||||
function CurrencyDialog({
|
||||
name,
|
||||
payload,
|
||||
@@ -197,7 +198,7 @@ const withCurrencyFormDialog = connect(mapStateToProps);
|
||||
|
||||
export default compose(
|
||||
withCurrencyFormDialog,
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
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 withDialog from 'containers/Dialogs/withDialog';
|
||||
import DialogReduxConnect from 'components/DialogReduxConnect';
|
||||
|
||||
import withExchangeRatesActions from 'containers/ExchangeRates/withExchangeRatesActions';
|
||||
@@ -31,5 +31,5 @@ export default compose(
|
||||
exchangeRatesList,
|
||||
})),
|
||||
DialogReduxConnect,
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
);
|
||||
@@ -17,7 +17,9 @@ 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 withDialog from 'containers/Dialogs/withDialog';
|
||||
import withUsersActions from 'containers/Users/withUsersActions';
|
||||
import ErrorMessage from 'components/ErrorMessage';
|
||||
import useAsync from 'hooks/async';
|
||||
import classNames from 'classnames';
|
||||
@@ -194,6 +196,8 @@ function InviteUserDialog({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withDialog,
|
||||
UserListDialogConnect,
|
||||
withUsersActions,
|
||||
DialogReduxConnect
|
||||
)(InviteUserDialog);
|
||||
|
||||
@@ -22,7 +22,7 @@ import AppToaster from 'components/AppToaster';
|
||||
import ErrorMessage from 'components/ErrorMessage';
|
||||
|
||||
import Dialog from 'components/Dialog';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
import DialogReduxConnect from 'components/DialogReduxConnect';
|
||||
|
||||
import { getDialogPayload } from 'store/dashboard/dashboard.reducer';
|
||||
@@ -263,7 +263,7 @@ const withItemCategoryDialog = connect(mapStateToProps);
|
||||
|
||||
export default compose(
|
||||
withItemCategoryDialog,
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
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,10 @@ import AppToaster from 'components/AppToaster';
|
||||
import DialogReduxConnect from 'components/DialogReduxConnect';
|
||||
import ErrorMessage from 'components/ErrorMessage';
|
||||
import useAsync from 'hooks/async';
|
||||
import UserFormDialogConnect from 'connectors/UserFormDialog.connector';
|
||||
import UserFormDialogConnect from 'containers/Dialogs/UserFormDialog.connector';
|
||||
import withUsersActions from 'containers/Users/withUsersActions';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
function UserFormDialog({
|
||||
@@ -158,5 +161,7 @@ function UserFormDialog({
|
||||
|
||||
export default compose(
|
||||
UserFormDialogConnect,
|
||||
withUsersActions,
|
||||
withDialog,
|
||||
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);
|
||||
13
client/src/containers/Dialogs/withDialog.js
Normal file
13
client/src/containers/Dialogs/withDialog.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { connect } from 'react-redux';
|
||||
import t from 'store/types';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
return {};
|
||||
};
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
openDialog: (name, payload) => dispatch({ type: t.OPEN_DIALOG, name, payload }),
|
||||
closeDialog: (name, payload) => dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
});
|
||||
|
||||
export default connect(null, mapDispatchToProps);
|
||||
@@ -13,7 +13,7 @@ import Icon from 'components/Icon';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
import withDialog from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
import withResourceDetail from 'containers/Resources/withResourceDetails';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useCallback, useMemo,useState } from 'react';
|
||||
import Icon from 'components/Icon';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
import DataTable from 'components/DataTable';
|
||||
import { Button, Popover, Menu, MenuItem, Position } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
@@ -126,7 +126,7 @@ function ExchangeRateTable({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
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';
|
||||
|
||||
@@ -129,5 +129,5 @@ export default compose(
|
||||
balanceSheetQuery,
|
||||
}),
|
||||
),
|
||||
SettingsConnect,
|
||||
withSettings,
|
||||
)(BalanceSheetTable);
|
||||
|
||||
@@ -12,7 +12,8 @@ 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';
|
||||
@@ -97,6 +98,6 @@ function GeneralLedgerHeader({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
AccountsConnect,
|
||||
withAccounts,
|
||||
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 withDashboard from 'containers/Dashboard/withDashboard';
|
||||
import withJournalActions from './withJournalActions';
|
||||
@@ -95,5 +96,5 @@ function Journal({
|
||||
export default compose(
|
||||
withDashboard,
|
||||
withJournalActions,
|
||||
SettingsConnect,
|
||||
withSettings,
|
||||
)(Journal);
|
||||
|
||||
@@ -13,7 +13,10 @@ import DashboardPageContent from 'components/Dashboard/DashboardPageContent'
|
||||
import withDashboard from 'containers/Dashboard/withDashboard';
|
||||
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 +93,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);
|
||||
|
||||
15
client/src/containers/GeneralSearch/withSearch.js
Normal file
15
client/src/containers/GeneralSearch/withSearch.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import t from 'store/types';
|
||||
|
||||
export const mapStateToProps = (state, props) => ({
|
||||
resultSearch: state.globalSearch.searches,
|
||||
globalSearchShow: state.globalSearch.isOpen,
|
||||
});
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
openGlobalSearch: (result) => dispatch({ type: t.OPEN_SEARCH, }),
|
||||
closeGlobalSearch: (result) => dispatch({ type: t.CLOSE_SEARCH }),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState, useCallback,useMemo } from 'react';
|
||||
import React, { useEffect, useState, useCallback, useMemo } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useQuery } from 'react-query';
|
||||
import { Alert, Intent } from '@blueprintjs/core';
|
||||
@@ -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 withDialog from 'containers/Dialogs/withDialog';
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboard';
|
||||
import withItemCategoriesActions from 'containers/Items/withItemCategoriesActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
const ItemCategoryList = ({
|
||||
@@ -45,11 +44,11 @@ const ItemCategoryList = ({
|
||||
id
|
||||
? changePageTitle(formatMessage({ id: 'edit_category_details' }))
|
||||
: changePageTitle(formatMessage({ id: 'category_list' }));
|
||||
}, [id,changePageTitle,formatMessage]);
|
||||
}, [id, changePageTitle, formatMessage]);
|
||||
|
||||
const fetchCategories = useQuery(
|
||||
['items-categories-table', filter],
|
||||
(key, query) => requestFetchItemCategories(query)
|
||||
(key, query) => requestFetchItemCategories(query),
|
||||
);
|
||||
|
||||
const handleFilterChanged = useCallback(() => {}, []);
|
||||
@@ -59,7 +58,7 @@ const ItemCategoryList = ({
|
||||
(itemCategories) => {
|
||||
setSelectedRows(itemCategories);
|
||||
},
|
||||
[setSelectedRows]
|
||||
[setSelectedRows],
|
||||
);
|
||||
|
||||
// Handle fetch data of accounts datatable.
|
||||
@@ -107,7 +106,7 @@ const ItemCategoryList = ({
|
||||
(itemsCategoriesIds) => {
|
||||
setBulkDelete(itemsCategoriesIds);
|
||||
},
|
||||
[setBulkDelete]
|
||||
[setBulkDelete],
|
||||
);
|
||||
|
||||
// handle confirm itemCategories bulk delete.
|
||||
@@ -125,22 +124,20 @@ const ItemCategoryList = ({
|
||||
.catch((errors) => {
|
||||
setBulkDelete(false);
|
||||
});
|
||||
}, [requestDeleteBulkItemCategories, bulkDelete,formatMessage]);
|
||||
|
||||
}, [requestDeleteBulkItemCategories, bulkDelete, formatMessage]);
|
||||
|
||||
//Handel cancel itemCategories bulk delete.
|
||||
const handleCancelBulkDelete =useCallback(()=>{
|
||||
setBulkDelete(false)
|
||||
},[])
|
||||
|
||||
|
||||
// Calculates the data table selected rows count.
|
||||
const selectedRowsCount = useMemo(() => Object.values(selectedRows).length, [selectedRows]);
|
||||
const handleCancelBulkDelete = useCallback(() => {
|
||||
setBulkDelete(false);
|
||||
}, []);
|
||||
|
||||
// Calculates the data table selected rows count.
|
||||
const selectedRowsCount = useMemo(() => Object.values(selectedRows).length, [
|
||||
selectedRows,
|
||||
]);
|
||||
|
||||
return (
|
||||
<DashboardInsider name={'item-category-list'}>
|
||||
|
||||
<ItemsCategoryActionsBar
|
||||
selectedRows={selectedRows}
|
||||
onFilterChanged={handleFilterChanged}
|
||||
@@ -153,13 +150,12 @@ const ItemCategoryList = ({
|
||||
onSelectedRowsChange={handleSelectedRowsChange}
|
||||
onDeleteCategory={handleDeleteCategory}
|
||||
loading={tableLoading}
|
||||
|
||||
/>
|
||||
|
||||
<Alert
|
||||
cancelButtonText={<T id={'cancel'} />}
|
||||
confirmButtonText={<T id={'delete'} />}
|
||||
icon='trash'
|
||||
icon="trash"
|
||||
intent={Intent.DANGER}
|
||||
isOpen={deleteCategory}
|
||||
onCancel={handleCancelItemDelete}
|
||||
@@ -174,8 +170,10 @@ const ItemCategoryList = ({
|
||||
|
||||
<Alert
|
||||
cancelButtonText={<T id={'cancel'} />}
|
||||
confirmButtonText={`${formatMessage({id:'delete'})} (${selectedRowsCount})`}
|
||||
icon='trash'
|
||||
confirmButtonText={`${formatMessage({
|
||||
id: 'delete',
|
||||
})} (${selectedRowsCount})`}
|
||||
icon="trash"
|
||||
intent={Intent.DANGER}
|
||||
isOpen={bulkDelete}
|
||||
onCancel={handleCancelBulkDelete}
|
||||
@@ -183,11 +181,12 @@ const ItemCategoryList = ({
|
||||
>
|
||||
<p>
|
||||
<FormattedHTMLMessage
|
||||
id={'once_delete_these_item_categories_you_will_not_able_restore_them'}
|
||||
id={
|
||||
'once_delete_these_item_categories_you_will_not_able_restore_them'
|
||||
}
|
||||
/>
|
||||
</p>
|
||||
</Alert>
|
||||
|
||||
</DashboardInsider>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ import { compose } from 'utils';
|
||||
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
import Icon from 'components/Icon';
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
import withDialog from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
import withResourceDetail from 'containers/Resources/withResourceDetails';
|
||||
import withItems from 'containers/Items/withItems';
|
||||
import { If } from 'components';
|
||||
@@ -62,7 +62,7 @@ const ItemsActionsBar = ({
|
||||
});
|
||||
|
||||
const onClickNewCategory = useCallback(() => {
|
||||
openDialog('item-form', {});
|
||||
openDialog('item-category-form', {});
|
||||
}, [openDialog]);
|
||||
|
||||
const handleBulkDelete = useCallback(() => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useMemo,useState } from 'react';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import {
|
||||
NavbarGroup,
|
||||
Button,
|
||||
@@ -18,7 +18,7 @@ import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||
import FilterDropdown from 'components/FilterDropdown';
|
||||
|
||||
import withResourceDetail from 'containers/Resources/withResourceDetails';
|
||||
import withDialog from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
import withDashboard from 'containers/Dashboard/withDashboard';
|
||||
|
||||
import { compose } from 'utils';
|
||||
@@ -26,29 +26,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) => {
|
||||
@@ -57,17 +57,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}
|
||||
/>
|
||||
<Popover
|
||||
@@ -78,16 +78,22 @@ const ItemsCategoryActionsBar = ({
|
||||
>
|
||||
<Button
|
||||
className={classNames(Classes.MINIMAL, 'button--filter')}
|
||||
text={ filterCount <= 0 ? <T id={'filter'}/> : `${filterCount} filters applied`}
|
||||
icon={<Icon icon='filter' />}
|
||||
text={
|
||||
filterCount <= 0 ? (
|
||||
<T id={'filter'} />
|
||||
) : (
|
||||
`${filterCount} filters applied`
|
||||
)
|
||||
}
|
||||
icon={<Icon icon="filter" />}
|
||||
/>
|
||||
</Popover>
|
||||
|
||||
<If condition={hasSelectedRows}>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='trash' iconSize={15} />}
|
||||
text={<T id={'delete'}/>}
|
||||
icon={<Icon icon="trash" iconSize={15} />}
|
||||
text={<T id={'delete'} />}
|
||||
intent={Intent.DANGER}
|
||||
onClick={handelBulkDelete}
|
||||
/>
|
||||
@@ -95,13 +101,13 @@ const ItemsCategoryActionsBar = ({
|
||||
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='file-import' />}
|
||||
text={<T id={'import'}/>}
|
||||
icon={<Icon icon="file-import" />}
|
||||
text={<T id={'import'} />}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='file-export' />}
|
||||
text={<T id={'export'}/>}
|
||||
icon={<Icon icon="file-export" />}
|
||||
text={<T id={'export'} />}
|
||||
/>
|
||||
</NavbarGroup>
|
||||
</DashboardActionsBar>
|
||||
@@ -120,5 +126,5 @@ export default compose(
|
||||
withDashboard,
|
||||
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 withDialog from 'containers/Dialogs/withDialog';
|
||||
|
||||
function Currencies({ openDialog }) {
|
||||
const onClickNewCurrency = () => {
|
||||
openDialog('currency-form',{});
|
||||
@@ -17,4 +17,4 @@ function Currencies({ openDialog }) {
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(DialogConnect, CurrencyFromDialogConnect)(Currencies);
|
||||
export default compose(withDialog)(Currencies);
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
Intent,
|
||||
} from '@blueprintjs/core';
|
||||
import Icon from 'components/Icon';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
import {compose} from 'utils';
|
||||
|
||||
function CurrenciesActions({
|
||||
@@ -27,5 +27,5 @@ function CurrenciesActions({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
)(CurrenciesActions);
|
||||
@@ -12,13 +12,13 @@ import { useQuery } from 'react-query';
|
||||
|
||||
import Icon from 'components/Icon';
|
||||
import { compose } from 'utils';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
|
||||
import LoadingIndicator from 'components/LoadingIndicator';
|
||||
import DataTable from 'components/DataTable';
|
||||
import AppToaster from 'components/AppToaster';
|
||||
|
||||
import withDashboard from 'connectors/Dashboard.connector';
|
||||
import withDashboard from 'containers/Dashboard/withDashboard';
|
||||
import withCurrencies from 'containers/Currencies/withCurrencies';
|
||||
import withCurrenciesActions from 'containers/Currencies/withCurrenciesActions';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
@@ -156,6 +156,6 @@ export default compose(
|
||||
currenciesList,
|
||||
})),
|
||||
withCurrenciesActions,
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
withDashboard
|
||||
)(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);
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
Intent,
|
||||
} from '@blueprintjs/core';
|
||||
import Icon from 'components/Icon';
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
import {compose} from 'utils';
|
||||
|
||||
function UsersActions({
|
||||
@@ -34,5 +34,5 @@ function UsersActions({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
)(UsersActions);
|
||||
@@ -24,11 +24,12 @@ import LoadingIndicator from 'components/LoadingIndicator';
|
||||
|
||||
import AppToaster from 'components/AppToaster';
|
||||
|
||||
import DialogConnect from 'connectors/Dialog.connector';
|
||||
import withDialog from 'containers/Dialogs/withDialog';
|
||||
import withDashboard from 'containers/Dashboard/withDashboard';
|
||||
import withUsers from 'containers/Users/withUsers';
|
||||
import withUsersActions from 'containers/Users/withUsersActions';
|
||||
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
function UsersListPreferences({
|
||||
@@ -239,7 +240,7 @@ function UsersListPreferences({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
DialogConnect,
|
||||
withDialog,
|
||||
withDashboard,
|
||||
withUsers,
|
||||
withUsersActions,
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import {connect} from 'react-redux';
|
||||
import t from 'store/types';
|
||||
|
||||
export const mapStateToProps = (state, props) => {
|
||||
|
||||
};
|
||||
|
||||
export const mapDispatchToProps = (dispatch) => ({
|
||||
openDialog: (name, payload) => dispatch({ type: t.OPEN_DIALOG, name, payload }),
|
||||
closeDialog: (name, payload) => dispatch({ type: t.CLOSE_DIALOG, name, payload }),
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user