mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: multi-tariff filter shows all users when >1 tariffs selected
Server only supports single tariff_id filter. When multiple tariffs are selected, apply client-side filtering to hide users who have no subscriptions matching any of the selected tariffs.
This commit is contained in:
@@ -1977,8 +1977,18 @@ export default function AdminBulkActions() {
|
||||
[t, formatWithCurrency, expandedRows, toggleExpandRow, getFilteredSubs],
|
||||
);
|
||||
|
||||
// When multiple tariffs are selected, filter users client-side
|
||||
// (server only supports single tariff_id filter)
|
||||
const filteredUsers = useMemo(() => {
|
||||
if (tariffFilter.length <= 1) return users;
|
||||
return users.filter((u) => {
|
||||
const subs = u.subscriptions ?? [];
|
||||
return subs.some((s) => s.tariff_id !== null && tariffFilter.includes(s.tariff_id));
|
||||
});
|
||||
}, [users, tariffFilter]);
|
||||
|
||||
const table = useReactTable({
|
||||
data: users,
|
||||
data: filteredUsers,
|
||||
columns,
|
||||
state: { rowSelection },
|
||||
onRowSelectionChange: setRowSelection,
|
||||
|
||||
Reference in New Issue
Block a user