Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-19 17:28:25 +00:00
co-authored by renee-png
parent 883db4411a
commit 061e2b8ab2
+18 -7
View File
@@ -173,17 +173,28 @@ function CasesList() {
if (selected.size === 0) return;
setBusy(true);
const ids = Array.from(selected);
const { error } = await supabase
const { data, error } = await supabase
.from("cases")
.update({ archived_at: archived ? new Date().toISOString() : null })
.in("id", ids);
.in("id", ids)
.select("id");
setBusy(false);
if (error) toast.error(error.message);
else {
toast.success(`${ids.length} case(s) ${archived ? "archived" : "restored"}`);
setSelected(new Set());
load();
if (error) {
toast.error(error.message);
return;
}
const updatedCount = data?.length ?? 0;
if (updatedCount === 0) {
toast.error("No cases were updated. You may not have permission.");
return;
}
if (updatedCount < ids.length) {
toast.warning(`${updatedCount} of ${ids.length} case(s) ${archived ? "archived" : "restored"} (others skipped due to permissions)`);
} else {
toast.success(`${updatedCount} case(s) ${archived ? "archived" : "restored"}`);
}
setSelected(new Set());
load();
};
const bulkAssignAttorney = async () => {