mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
fix: persist checkbox selection across page changes and filter switches
Selection (both user and subscription checkboxes) now persists when: - Switching pages (prev/next) - Changing filters (status, tariff, promo group, trial) - Changing per-page limit - Searching - Refreshing data Selection is only cleared after a successful bulk action execution (modal close with result).
This commit is contained in:
@@ -1503,7 +1503,6 @@ export default function AdminBulkActions() {
|
|||||||
searchTimerRef.current = setTimeout(() => {
|
searchTimerRef.current = setTimeout(() => {
|
||||||
setOffset(0);
|
setOffset(0);
|
||||||
setCommittedSearch(value);
|
setCommittedSearch(value);
|
||||||
clearAllSelections();
|
|
||||||
}, 400);
|
}, 400);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1517,29 +1516,24 @@ export default function AdminBulkActions() {
|
|||||||
clearTimeout(searchTimerRef.current);
|
clearTimeout(searchTimerRef.current);
|
||||||
setOffset(0);
|
setOffset(0);
|
||||||
setCommittedSearch(searchInput);
|
setCommittedSearch(searchInput);
|
||||||
clearAllSelections();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleStatusFilterChange = (v: string) => {
|
const handleStatusFilterChange = (v: string) => {
|
||||||
setStatusFilter(v as SubscriptionStatusFilter);
|
setStatusFilter(v as SubscriptionStatusFilter);
|
||||||
setOffset(0);
|
setOffset(0);
|
||||||
clearAllSelections();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleTariffFilterChange = (ids: number[]) => {
|
const handleTariffFilterChange = (ids: number[]) => {
|
||||||
setTariffFilter(ids);
|
setTariffFilter(ids);
|
||||||
setOffset(0);
|
setOffset(0);
|
||||||
clearAllSelections();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePromoGroupFilterChange = (v: string) => {
|
const handlePromoGroupFilterChange = (v: string) => {
|
||||||
setPromoGroupFilter(v);
|
setPromoGroupFilter(v);
|
||||||
setOffset(0);
|
setOffset(0);
|
||||||
clearAllSelections();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRefresh = () => {
|
const handleRefresh = () => {
|
||||||
clearAllSelections();
|
|
||||||
loadUsers();
|
loadUsers();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2103,7 +2097,6 @@ export default function AdminBulkActions() {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setTrialOnly((prev) => !prev);
|
setTrialOnly((prev) => !prev);
|
||||||
setOffset(0);
|
setOffset(0);
|
||||||
clearAllSelections();
|
|
||||||
}}
|
}}
|
||||||
className={cn(
|
className={cn(
|
||||||
'flex h-5 w-5 items-center justify-center rounded-md border-2 transition-all duration-150',
|
'flex h-5 w-5 items-center justify-center rounded-md border-2 transition-all duration-150',
|
||||||
@@ -2225,7 +2218,6 @@ export default function AdminBulkActions() {
|
|||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setLimit(Number(e.target.value));
|
setLimit(Number(e.target.value));
|
||||||
setOffset(0);
|
setOffset(0);
|
||||||
clearAllSelections();
|
|
||||||
}}
|
}}
|
||||||
className="rounded-lg border border-dark-700 bg-dark-800 px-2 py-1.5 text-xs text-dark-200 outline-none transition-colors focus:border-accent-500/40"
|
className="rounded-lg border border-dark-700 bg-dark-800 px-2 py-1.5 text-xs text-dark-200 outline-none transition-colors focus:border-accent-500/40"
|
||||||
>
|
>
|
||||||
@@ -2242,7 +2234,6 @@ export default function AdminBulkActions() {
|
|||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOffset(Math.max(0, offset - limit));
|
setOffset(Math.max(0, offset - limit));
|
||||||
clearAllSelections();
|
|
||||||
}}
|
}}
|
||||||
disabled={offset === 0}
|
disabled={offset === 0}
|
||||||
className="rounded-lg border border-dark-700 bg-dark-800 p-2 transition-colors hover:bg-dark-700 disabled:opacity-50"
|
className="rounded-lg border border-dark-700 bg-dark-800 p-2 transition-colors hover:bg-dark-700 disabled:opacity-50"
|
||||||
@@ -2256,7 +2247,6 @@ export default function AdminBulkActions() {
|
|||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOffset(offset + limit);
|
setOffset(offset + limit);
|
||||||
clearAllSelections();
|
|
||||||
}}
|
}}
|
||||||
disabled={offset + limit >= total}
|
disabled={offset + limit >= total}
|
||||||
className="rounded-lg border border-dark-700 bg-dark-800 p-2 transition-colors hover:bg-dark-700 disabled:opacity-50"
|
className="rounded-lg border border-dark-700 bg-dark-800 p-2 transition-colors hover:bg-dark-700 disabled:opacity-50"
|
||||||
|
|||||||
Reference in New Issue
Block a user