feat: sales pdf preview.

This commit is contained in:
elforjani3
2021-08-18 14:45:54 +02:00
parent a7b0f1a8d2
commit 7234bc4757
29 changed files with 664 additions and 20 deletions

View File

@@ -10,6 +10,7 @@ import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import withDialogActions from 'containers/Dialog/withDialogActions';
import withReceipts from './withReceipts';
import withReceiptsActions from './withReceiptsActions';
import withSettings from 'containers/Settings/withSettings';
@@ -35,6 +36,9 @@ function ReceiptsDataTable({
// #withDrawerActions
openDrawer,
// #withDialogAction
openDialog,
}) {
const history = useHistory();
@@ -75,6 +79,11 @@ function ReceiptsDataTable({
openDrawer('receipt-detail-drawer', { receiptId: id });
};
// Handle print receipt.
const handlePrintInvoice = ({ id }) => {
openDialog('receipt-pdf-preview', { receiptId: id });
};
// Handles the datable fetch data once the state changing.
const handleDataTableFetchData = useCallback(
({ sortBy, pageIndex, pageSize }) => {
@@ -118,6 +127,7 @@ function ReceiptsDataTable({
onClose: handleCloseReceipt,
onDrawer: handleDrawerReceipt,
onViewDetails: handleViewDetailReceipt,
onPrint: handlePrintInvoice,
baseCurrency,
}}
/>
@@ -128,6 +138,7 @@ export default compose(
withAlertsActions,
withReceiptsActions,
withDrawerActions,
withDialogActions,
withReceipts(({ receiptTableState }) => ({
receiptTableState,
})),