feat: improve UI experience of resource priting

This commit is contained in:
Ahmed Bouhuolia
2024-05-31 15:30:49 +02:00
parent ba77351e44
commit 958f78e7a4
18 changed files with 184 additions and 101 deletions

View File

@@ -25,7 +25,7 @@ import {
import { useCustomersListContext } from './CustomersListProvider';
import { useRefreshCustomers } from '@/hooks/query/customers';
import { useResourceExportPdf } from '@/hooks/query/FinancialReports/use-export-pdf';
import { useDownloadExportPdf } from '@/hooks/query/FinancialReports/use-export-pdf';
import withCustomers from './withCustomers';
import withCustomersActions from './withCustomersActions';
@@ -71,9 +71,8 @@ function CustomerActionsBar({
// Customers refresh action.
const { refresh } = useRefreshCustomers();
// Exports the given resource into pdf.
const { mutateAsync: exportPdf, isLoading: isExportPdfLoading } =
useResourceExportPdf();
// Exports pdf document.
const { downloadAsync: downloadExportPdf } = useDownloadExportPdf();
const onClickNewCustomer = () => {
history.push('/customers/new');
@@ -116,7 +115,7 @@ function CustomerActionsBar({
};
// Handle the print button click.
const handlePrintBtnClick = () => {
exportPdf({ resource: 'Customer' });
downloadExportPdf({ resource: 'Customer' });
};
return (
@@ -168,7 +167,6 @@ function CustomerActionsBar({
className={Classes.MINIMAL}
icon={<Icon icon="print-16" iconSize={16} />}
text={<T id={'print'} />}
disabled={isExportPdfLoading}
onClick={handlePrintBtnClick}
/>
<Button