mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
feat: print action when click on print button
This commit is contained in:
@@ -30,6 +30,7 @@ import withSettings from '@/containers/Settings/withSettings';
|
||||
import withSettingsActions from '@/containers/Settings/withSettingsActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
|
||||
import { useResourceExportPdf } from '@/hooks/query/FinancialReports/use-export-pdf';
|
||||
import { compose } from '@/utils';
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
|
||||
@@ -50,7 +51,7 @@ function ManualJournalActionsBar({
|
||||
addSetting,
|
||||
|
||||
// #withDialogActions
|
||||
openDialog
|
||||
openDialog,
|
||||
}) {
|
||||
// History context.
|
||||
const history = useHistory();
|
||||
@@ -58,6 +59,10 @@ function ManualJournalActionsBar({
|
||||
// Manual journals context.
|
||||
const { journalsViews, fields } = useManualJournalsContext();
|
||||
|
||||
// Exports the given resource into pdf.
|
||||
const { mutateAsync: exportPdf, isLoading: isExportPdfLoading } =
|
||||
useResourceExportPdf();
|
||||
|
||||
// Manual journals refresh action.
|
||||
const { refresh } = useRefreshJournals();
|
||||
|
||||
@@ -91,6 +96,11 @@ function ManualJournalActionsBar({
|
||||
openDialog(DialogsName.Export, { resource: 'manual_journal' });
|
||||
};
|
||||
|
||||
// Handle the pdf print button click.
|
||||
const handlePdfPrintBtnSubmit = () => {
|
||||
exportPdf({ resource: 'ManualJournal' });
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
<NavbarGroup>
|
||||
@@ -134,10 +144,13 @@ function ManualJournalActionsBar({
|
||||
/>
|
||||
</If>
|
||||
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="print-16" iconSize={16} />}
|
||||
text={<T id={'print'} />}
|
||||
onClick={handlePdfPrintBtnSubmit}
|
||||
disabled={isExportPdfLoading}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
|
||||
Reference in New Issue
Block a user