mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
61 lines
1.5 KiB
JavaScript
61 lines
1.5 KiB
JavaScript
import React, { useEffect } from 'react';
|
|
|
|
import 'style/pages/Expense/List.scss';
|
|
|
|
import { DashboardContentTable, DashboardPageContent } from 'components';
|
|
|
|
import ExpenseActionsBar from './ExpenseActionsBar';
|
|
import ExpenseViewTabs from './ExpenseViewTabs';
|
|
import ExpenseDataTable from './ExpenseDataTable';
|
|
import ExpensesAlerts from '../ExpensesAlerts';
|
|
|
|
import withExpenses from './withExpenses';
|
|
import withExpensesActions from './withExpensesActions';
|
|
|
|
import { compose, transformTableStateToQuery } from 'utils';
|
|
import { ExpensesListProvider } from './ExpensesListProvider';
|
|
|
|
/**
|
|
* Expenses list.
|
|
*/
|
|
function ExpensesList({
|
|
// #withExpenses
|
|
expensesTableState,
|
|
expensesTableStateChanged,
|
|
|
|
// #withExpensesActions
|
|
resetExpensesTableState,
|
|
}) {
|
|
// Resets the accounts table state once the page unmount.
|
|
useEffect(
|
|
() => () => {
|
|
resetExpensesTableState();
|
|
},
|
|
[resetExpensesTableState],
|
|
);
|
|
|
|
return (
|
|
<ExpensesListProvider
|
|
query={transformTableStateToQuery(expensesTableState)}
|
|
tableStateChanged={expensesTableStateChanged}
|
|
>
|
|
<ExpenseActionsBar />
|
|
|
|
<DashboardPageContent>
|
|
<ExpenseViewTabs />
|
|
<ExpenseDataTable />
|
|
</DashboardPageContent>
|
|
|
|
<ExpensesAlerts />
|
|
</ExpensesListProvider>
|
|
);
|
|
}
|
|
|
|
export default compose(
|
|
withExpenses(({ expensesTableState, expensesTableStateChanged }) => ({
|
|
expensesTableState,
|
|
expensesTableStateChanged,
|
|
})),
|
|
withExpensesActions,
|
|
)(ExpensesList);
|