mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
feat: print action when click on print button
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
|
||||
import { useCustomersListContext } from './CustomersListProvider';
|
||||
import { useRefreshCustomers } from '@/hooks/query/customers';
|
||||
import { useResourceExportPdf } from '@/hooks/query/FinancialReports/use-export-pdf';
|
||||
|
||||
import withCustomers from './withCustomers';
|
||||
import withCustomersActions from './withCustomersActions';
|
||||
@@ -70,6 +71,10 @@ function CustomerActionsBar({
|
||||
// Customers refresh action.
|
||||
const { refresh } = useRefreshCustomers();
|
||||
|
||||
// Exports the given resource into pdf.
|
||||
const { mutateAsync: exportPdf, isLoading: isExportPdfLoading } =
|
||||
useResourceExportPdf();
|
||||
|
||||
const onClickNewCustomer = () => {
|
||||
history.push('/customers/new');
|
||||
};
|
||||
@@ -109,6 +114,10 @@ function CustomerActionsBar({
|
||||
const handleExportBtnClick = () => {
|
||||
openDialog(DialogsName.Export, { resource: 'customer' });
|
||||
};
|
||||
// Handle the print button click.
|
||||
const handlePrintBtnClick = () => {
|
||||
exportPdf({ resource: 'Customer' });
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
@@ -154,6 +163,14 @@ function CustomerActionsBar({
|
||||
onClick={handleBulkDelete}
|
||||
/>
|
||||
</If>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="print-16" iconSize={16} />}
|
||||
text={<T id={'print'} />}
|
||||
disabled={isExportPdfLoading}
|
||||
onClick={handlePrintBtnClick}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="file-import-16" iconSize={16} />}
|
||||
|
||||
Reference in New Issue
Block a user