feat: export dialog on resource table

This commit is contained in:
Ahmed Bouhuolia
2024-05-01 16:26:10 +02:00
parent fab71d2b65
commit 00a1e070c6
26 changed files with 398 additions and 16 deletions

View File

@@ -33,6 +33,8 @@ import { useRefreshPaymentMades } from '@/hooks/query/paymentMades';
import { PaymentMadeAction, AbilitySubject } from '@/constants/abilityOption';
import { compose } from '@/utils';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import { DialogsName } from '@/constants/dialogs';
/**
* Payment made actions bar.
@@ -47,6 +49,9 @@ function PaymentMadeActionsBar({
// #withSettings
paymentMadesTableSize,
// #withDialogActions
openDialog,
// #withSettingsActions
addSetting,
}) {
@@ -81,7 +86,12 @@ function PaymentMadeActionsBar({
// Handle the import button click.
const handleImportBtnClick = () => {
history.push('/payment-mades/import');
}
};
// Handle the export button click.
const handleExportBtnClick = () => {
openDialog(DialogsName.Export, { resource: 'bill_payment' });
};
return (
<DashboardActionsBar>
@@ -139,6 +149,7 @@ function PaymentMadeActionsBar({
className={Classes.MINIMAL}
icon={<Icon icon={'file-export-16'} iconSize={'16'} />}
text={<T id={'export'} />}
onClick={handleExportBtnClick}
/>
<NavbarDivider />
@@ -168,4 +179,5 @@ export default compose(
withSettings(({ billPaymentSettings }) => ({
paymentMadesTableSize: billPaymentSettings?.tableSize,
})),
withDialogActions,
)(PaymentMadeActionsBar);