mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
refactor(PurchaseByItem)
This commit is contained in:
@@ -3,31 +3,30 @@ import moment from 'moment';
|
||||
|
||||
import 'style/pages/FinancialStatements/SalesAndPurchasesSheet.scss';
|
||||
|
||||
import { FinancialStatement } from 'components';
|
||||
|
||||
import { PurchasesByItemsProvider } from './PurchasesByItemsProvider';
|
||||
import PurchasesByItemsActionsBar from './PurchasesByItemsActionsBar';
|
||||
import PurchasesByItemsHeader from './PurchasesByItemsHeader';
|
||||
import PurchasesByItemsTable from './PurchasesByItemsTable';
|
||||
import DashboardPageContent from 'components/Dashboard/DashboardPageContent';
|
||||
import { PurchasesByItemsLoadingBar } from './components';
|
||||
import { PurchasesByItemsBody } from './PurchasesByItemsBody';
|
||||
|
||||
import withPurchasesByItemsActions from './withPurchasesByItemsActions';
|
||||
import withCurrentOrganization from '../../../containers/Organization/withCurrentOrganization';
|
||||
|
||||
import { getDefaultPurchasesByItemsQuery } from './utils';
|
||||
import { compose } from 'utils';
|
||||
|
||||
/**
|
||||
* Purchases by items.
|
||||
*/
|
||||
function PurchasesByItems({
|
||||
// #withPreferences
|
||||
organizationName,
|
||||
|
||||
// #withPurchasesByItemsActions
|
||||
togglePurchasesByItemsFilterDrawer,
|
||||
}) {
|
||||
const [filter, setFilter] = useState({
|
||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
||||
filterByOption: 'with-transactions',
|
||||
...getDefaultPurchasesByItemsQuery(),
|
||||
});
|
||||
|
||||
// Handle filter form submit.
|
||||
@@ -68,23 +67,16 @@ function PurchasesByItems({
|
||||
<PurchasesByItemsLoadingBar />
|
||||
|
||||
<DashboardPageContent>
|
||||
<div className="financial-statement financial-statement--purchases-by-items">
|
||||
<FinancialStatement>
|
||||
<PurchasesByItemsHeader
|
||||
pageFilter={filter}
|
||||
onSubmitFilter={handleFilterSubmit}
|
||||
/>
|
||||
</div>
|
||||
<div className="financial-statement__body">
|
||||
<PurchasesByItemsTable companyName={organizationName} />
|
||||
</div>
|
||||
<PurchasesByItemsBody />
|
||||
</FinancialStatement>
|
||||
</DashboardPageContent>
|
||||
</PurchasesByItemsProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withPurchasesByItemsActions,
|
||||
withCurrentOrganization(({ organization }) => ({
|
||||
organizationName: organization.name,
|
||||
})),
|
||||
)(PurchasesByItems);
|
||||
export default compose(withPurchasesByItemsActions)(PurchasesByItems);
|
||||
|
||||
Reference in New Issue
Block a user