This commit is contained in:
Ahmed Bouhuolia
2020-03-16 00:06:15 +02:00
parent 56701951b7
commit 73711384f6
7925 changed files with 18478 additions and 959 deletions

View File

@@ -0,0 +1,31 @@
import {connect} from 'react-redux';
import {
fetchAccountTypes,
fetchAccountsList,
submitAccount,
fetchAccount,
editAccount,
} from 'store/accounts/accounts.actions';
import {getDialogPayload} from 'store/dashboard/dashboard.reducer';
import t from 'store/types';
export const mapStateToProps = (state, props) => {
const dialogPayload = getDialogPayload(state, 'account-form');
return {
accountsTypes: state.accounts.accountsTypes,
accounts: state.accounts.accounts,
name: 'account-form',
payload: {action: 'new', id: null},
editAccount: dialogPayload && dialogPayload.action === 'edit'
? state.accounts.accountsById[dialogPayload.id] : {},
};
};
export const mapDispatchToProps = (dispatch) => ({
submitAccount: ({ form }) => dispatch(submitAccount({ form })),
fetchAccounts: () => dispatch(fetchAccountsList()),
fetchAccountTypes: () => dispatch(fetchAccountTypes()),
fetchAccount: (id) => dispatch(fetchAccount({ id })),
});
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -0,0 +1,39 @@
import { connect } from 'react-redux';
import {useParams} from 'react-router-dom';
import t from 'store/types';
import {
fetchAccountTypes,
fetchAccountsList,
deleteAccount,
inactiveAccount,
} from 'store/accounts/accounts.actions';
import {
getAccountsItems,
} from 'store/accounts/accounts.selectors';
import {
getResourceViews,
} from 'store/customViews/customViews.selectors';
const mapStateToProps = (state, props) => ({
views: getResourceViews(state, 'accounts'),
accounts: getAccountsItems(state, state.accounts.currentViewId),
});
const mapActionsToProps = (dispatch) => ({
fetchAccounts: (query) => dispatch(fetchAccountsList({ query })),
fetchAccountTypes: () => dispatch(fetchAccountTypes()),
deleteAccount: (id) => dispatch(deleteAccount({ id })),
inactiveAccount: (id) => dispatch(inactiveAccount({ id })),
addBulkActionAccount: (id) => dispatch({
type: t.ACCOUNT_BULK_ACTION_ADD, account_id: id
}),
removeBulkActionAccount: (id) => dispatch({
type: t.ACCOUNT_BULK_ACTION_REMOVE, account_id: id,
}),
changeCurrentView: (id) => dispatch({
type: t.ACCOUNTS_SET_CURRENT_VIEW,
currentViewId: parseInt(id, 10),
}),
});
export default connect(mapStateToProps, mapActionsToProps);

View File

@@ -0,0 +1,14 @@
import { connect } from 'react-redux';
import {
fetchResourceViews,
} from 'store/customViews/customViews.actions';
const mapStateToProps = (state) => ({
});
const mapActionsToProps = (dispatch) => ({
fetchResourceViews: (resourceSlug) => dispatch(fetchResourceViews({ resourceSlug })),
});
export default connect(mapStateToProps, mapActionsToProps);

View File

@@ -0,0 +1,25 @@
import { connect } from 'react-redux';
import t from 'store/types';
const mapStateToProps = (state) => ({
});
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,
}),
});
export default connect(mapStateToProps, mapActionsToProps);

View 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(mapStateToProps, mapDispatchToProps);

View File

@@ -0,0 +1,37 @@
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);

View File

@@ -0,0 +1,23 @@
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);

View File

@@ -0,0 +1,17 @@
import {connect} from 'react-redux';
import {
fetchGeneralLedger,
fetchBalanceSheet,
} from 'store/financialStatement/financialStatements.actions';
import t from 'store/types';
export const mapStateToProps = (state, props) => ({
generalLedeger: state.financialStatements.generalLedger,
});
export const mapDispatchToProps = (dispatch) => ({
fetchGeneralLedger: (query = {}) => dispatch(fetchGeneralLedger({ query })),
fetchBalanceSheet: (query = {}) => dispatch(fetchBalanceSheet({ query })),
});
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -0,0 +1,17 @@
import {connect} from 'react-redux';
import {
makeJournalEntries,
} from 'store/accounting/accounting.actions';
import t from 'store/types';
export const mapStateToProps = (state, props) => ({
});
export const mapDispatchToProps = (dispatch) => ({
makeJournalEntries: (form) => dispatch(makeJournalEntries({ form })),
});
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -0,0 +1,21 @@
import {connect} from 'react-redux';
import {
fetchResourceColumns,
fetchResourceFields,
} from 'store/resources/resources.actions';
import {
getResourceColumns,
getResourceFields,
} from 'store/resources/resources.reducer';
export const mapStateToProps = (state, props) => ({
getResourceColumns: (resourceSlug) => getResourceColumns(state, resourceSlug),
getResourceFields: (resourceSlug) => getResourceFields(state, resourceSlug),
});
export const mapDispatchToProps = (dispatch) => ({
fetchResourceFields: (resourceSlug) => dispatch(fetchResourceFields({ resourceSlug })),
fetchResourceColumns: (resourceSlug) => dispatch(fetchResourceColumns({ resourceSlug })),
});
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -0,0 +1,32 @@
import {connect} from 'react-redux';
import {
submitUser,
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 }),
submitUser: (form) => dispatch(submitUser({ form })),
editUser: (id, form) => dispatch(editUser({ form, id })),
fetchUser: (id) => dispatch(fetchUser({ id })),
});
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -0,0 +1,22 @@
import {connect} from 'react-redux';
import {
fetchUsers,
fetchUser,
deleteUser,
} from 'store/users/users.actions';
import t from 'store/types';
export const mapStateToProps = (state, props) => ({
usersList: state.users.list
});
export const mapDispatchToProps = (dispatch) => ({
openDialog: (name, payload) => dispatch({ type: t.OPEN_DIALOG, name, payload }),
closeDialog: (name, payload) => dispatch({ type: t.CLOSE_DIALOG, name, payload }),
fetchUsers: () => dispatch(fetchUsers({ })),
fetchUser: (id) => dispatch(fetchUser({ id })),
deleteUser: (id) => dispatch(deleteUser({ id })),
});
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -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(mapStateToProps, mapDispatchToProps);

View File

@@ -0,0 +1,25 @@
import {connect} from 'react-redux';
import {
fetchView,
submitView,
deleteView,
editView,
} from 'store/customViews/customViews.actions';
import {
getViewMeta,
getViewItem,
} from 'store/customViews/customViews.selectors';
export const mapStateToProps = (state) => ({
getViewMeta: (viewId) => getViewMeta(state, viewId),
getViewItem: (viewId) => getViewItem(state, viewId),
});
export const mapDispatchToProps = (dispatch) => ({
fetchView: (id) => dispatch(fetchView({ id })),
submitView: (form) => dispatch(submitView({ form })),
editView: (id, form) => dispatch(editView({ id, form })),
deleteView: (id) => dispatch(deleteView({ id })),
});
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -0,0 +1,36 @@
import {connect} from 'react-redux';
import {
fetchResourceColumns,
fetchResourceFields,
} from 'store/resources/resources.actions';
import {
getResourceColumns,
getResourceFields,
} from 'store/resources/resources.reducer';
import {
fetchView,
submitView,
editView,
} from 'store/customViews/customViews.actions';
import t from 'store/types';
export const mapStateToProps = (state, props) => {
return {
getResourceColumns: (resourceSlug) => getResourceColumns(state, resourceSlug),
getResourceFields: (resourceSlug) => getResourceFields(state, resourceSlug),
};
};
export const mapDispatchToProps = (dispatch) => ({
changePageTitle: pageTitle => dispatch({
type: t.CHANGE_DASHBOARD_PAGE_TITLE,
pageTitle,
}),
fetchResourceFields: (resourceSlug) => dispatch(fetchResourceFields({ resourceSlug })),
fetchResourceColumns: (resourceSlug) => dispatch(fetchResourceColumns({ resourceSlug })),
fetchView: (id) => dispatch(fetchView({ id })),
submitView: (form) => dispatch(submitView({ form })),
editView: (id, form) => dispatch(editView({ id, form })),
});
export default connect(mapStateToProps, mapDispatchToProps);