mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
63 lines
1.6 KiB
JavaScript
63 lines
1.6 KiB
JavaScript
import React, { useCallback } from 'react';
|
|
import { useParams, useHistory } from 'react-router-dom';
|
|
import { useQuery } from 'react-query';
|
|
|
|
import BillForm from './BillForm';
|
|
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
|
|
|
import withCustomersActions from 'containers/Customers/withCustomersActions';
|
|
import withAccountsActions from 'containers/Accounts/withAccountsActions';
|
|
import withItemsActions from 'containers/Items/withItemsActions';
|
|
|
|
import { compose } from 'utils';
|
|
|
|
function Bills({
|
|
//#withwithAccountsActions
|
|
requestFetchAccounts,
|
|
|
|
//#withCustomersActions
|
|
requestFetchCustomers,
|
|
|
|
//#withItemsActions
|
|
requestFetchItems,
|
|
}) {
|
|
const history = useHistory();
|
|
|
|
// Handle fetch accounts
|
|
const fetchAccounts = useQuery('accounts-list', (key) =>
|
|
requestFetchAccounts(),
|
|
);
|
|
|
|
// Handle fetch customers data table
|
|
const fetchCustomers = useQuery('customers-table', () =>
|
|
requestFetchCustomers({}),
|
|
);
|
|
|
|
// Handle fetch Items data table or list
|
|
const fetchItems = useQuery('items-table', () => requestFetchItems({}));
|
|
|
|
const handleFormSubmit = useCallback((payload) => {}, [history]);
|
|
|
|
const handleCancel = useCallback(() => {
|
|
history.goBack();
|
|
}, [history]);
|
|
|
|
return (
|
|
<DashboardInsider
|
|
loading={
|
|
fetchCustomers.isFetching ||
|
|
fetchItems.isFetching ||
|
|
fetchAccounts.isFetching
|
|
}
|
|
>
|
|
<BillForm onSubmit={handleFormSubmit} onCancel={handleCancel} />
|
|
</DashboardInsider>
|
|
);
|
|
}
|
|
|
|
export default compose(
|
|
withCustomersActions,
|
|
withItemsActions,
|
|
withAccountsActions,
|
|
)(Bills);
|