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

@@ -85,6 +85,11 @@ function InvoicesDataTable({
openDrawer('invoice-detail-drawer', { invoiceId: id });
};
// Handle print invoices.
const handlePrintInvoice = ({ id }) => {
openDialog('invoice-pdf-preview', { invoiceId: id });
};
// Handles fetch data once the table state change.
const handleDataTableFetchData = useCallback(
({ pageSize, pageIndex, sortBy }) => {
@@ -130,6 +135,7 @@ function InvoicesDataTable({
onDrawer: handleDrawerInvoice,
onQuick: handleQuickPaymentReceive,
onViewDetails: handleViewDetailInvoice,
onPrint: handlePrintInvoice,
baseCurrency,
}}
/>

View File

@@ -93,7 +93,15 @@ export const handleDeleteErrors = (errors) => {
};
export function ActionsMenu({
payload: { onEdit, onDeliver, onDelete, onDrawer, onQuick, onViewDetails },
payload: {
onEdit,
onDeliver,
onDelete,
onDrawer,
onQuick,
onViewDetails,
onPrint,
},
row: { original },
}) {
return (
@@ -128,6 +136,11 @@ export function ActionsMenu({
text={intl.get('invoice_paper')}
onClick={safeCallback(onDrawer, original)}
/>
<MenuItem
icon={<Icon icon={'print-16'} iconSize={16} />}
text={intl.get('print')}
onClick={safeCallback(onPrint, original)}
/>
<MenuItem
text={intl.get('delete_invoice')}
intent={Intent.DANGER}