import React from "react";
|
import { FilterButton, SelectColumnsButton, TopToolbar } from "react-admin";
|
import MyExportButton from "@/page/components/MyExportButton";
|
import MyPrintButton from "./MyPrintButton";
|
|
export const ListReportActions = ({
|
reportConfig,
|
loading = false,
|
onExport,
|
onPrintPreview,
|
showFilterButton = true,
|
showSelectColumnsButton = true,
|
children,
|
}) => (
|
<TopToolbar>
|
{showFilterButton && <FilterButton />}
|
{showSelectColumnsButton && reportConfig?.preferenceKey && (
|
<SelectColumnsButton preferenceKey={reportConfig.preferenceKey} />
|
)}
|
{reportConfig?.enablePrint && (
|
<MyPrintButton
|
reportConfig={reportConfig}
|
onPrintPreview={onPrintPreview}
|
loading={loading}
|
/>
|
)}
|
<MyExportButton
|
reportConfig={reportConfig}
|
onExport={onExport}
|
loading={loading}
|
/>
|
{children}
|
</TopToolbar>
|
);
|
|
export const ListReportBulkActions = ({
|
reportConfig,
|
loading = false,
|
onExport,
|
onPrintPreview,
|
}) => (
|
<>
|
{reportConfig?.enablePrint && (
|
<MyPrintButton
|
reportConfig={reportConfig}
|
onPrintPreview={onPrintPreview}
|
loading={loading}
|
/>
|
)}
|
<MyExportButton
|
reportConfig={reportConfig}
|
onExport={onExport}
|
loading={loading}
|
/>
|
</>
|
);
|
|
export default ListReportActions;
|