mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
44 lines
1.4 KiB
React
44 lines
1.4 KiB
React
// config/advertisements/archive/selection.config.jsx
|
|
import { Download, ArchiveRestore, Trash2 } from "lucide-react";
|
|
import { exportTableToExcel } from "@/utils/excel.util";
|
|
|
|
export function buildSelectionActions({ exportConfig, onSingleRestore, onBulkRestore, onSingleDelete, onBulkDelete, getTableInstance }) {
|
|
return [
|
|
{
|
|
key: "export-selected",
|
|
label: "Export",
|
|
icon: <Download className="h-3.5 w-3.5" />,
|
|
onClick: (rows, table) =>
|
|
exportTableToExcel({
|
|
...exportConfig,
|
|
selectedRows: rows,
|
|
tableInstance: table ?? getTableInstance(),
|
|
}),
|
|
},
|
|
{
|
|
key: "restore-selected",
|
|
label: "Restore",
|
|
icon: <ArchiveRestore className="h-3.5 w-3.5" />,
|
|
className: "text-emerald-600 border-emerald-600/40 hover:bg-emerald-600/10 hover:text-emerald-700",
|
|
onClick: (rows) => {
|
|
const ids = rows.map((r) => r.advertisement_id);
|
|
ids.length === 1
|
|
? onSingleRestore(rows[0])
|
|
: onBulkRestore(ids);
|
|
},
|
|
},
|
|
{
|
|
key: "delete-selected",
|
|
label: "Delete",
|
|
icon: <Trash2 className="h-3.5 w-3.5" />,
|
|
className: "text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive",
|
|
onClick: (rows) => {
|
|
const ids = rows.map((r) => r.advertisement_id);
|
|
ids.length === 1
|
|
? onSingleDelete(rows[0])
|
|
: onBulkDelete(ids);
|
|
},
|
|
},
|
|
];
|
|
}
|