= {};
+ for (const r of collectionsRes.data ?? []) {
+ const cid = (r as any).case_id as string | null;
+ if (!cid) continue;
+ const cur = flagMap[cid] ?? { bk: false, pp: false };
+ if ((r as any).in_bankruptcy) cur.bk = true;
+ if ((r as any).on_payment_plan) cur.pp = true;
+ flagMap[cid] = cur;
+ }
+
// Fallback to the case's own updated_at if no child activity found.
const enriched = baseRows.map((c: any) => {
const childTs = latest[c.id];
const lastActivity = childTs && (!c.updated_at || childTs > c.updated_at) ? childTs : c.updated_at;
- return { ...c, last_activity: lastActivity };
+ const flags = flagMap[c.id];
+ return { ...c, last_activity: lastActivity, in_bankruptcy: !!flags?.bk, on_payment_plan: !!flags?.pp };
});
setCases(enriched);
@@ -457,14 +471,17 @@ function CasesList() {
/>
|
- e.stopPropagation()}
- >
- {c.title}
-
+
+ e.stopPropagation()}
+ >
+ {c.title}
+
+
+
{c.case_number}
|
{c.client?.name ?? "—"} |
diff --git a/src/routes/collections.$collectionId.tsx b/src/routes/collections.$collectionId.tsx
index a8665e3..7e62441 100644
--- a/src/routes/collections.$collectionId.tsx
+++ b/src/routes/collections.$collectionId.tsx
@@ -67,6 +67,7 @@ import { SearchableSelect } from "@/components/ui/searchable-select";
import { toast } from "sonner";
import { spawnNextCollectionWorkflowTask } from "@/lib/workflow-chain";
import { ApplyCollectionWorkflowDialog } from "@/components/collections/apply-collection-workflow-dialog";
+import { StatusFlagBadges } from "@/components/collections/status-flag-badges";
export const Route = createFileRoute("/collections/$collectionId")({
component: CollectionDetailRoute,
@@ -356,8 +357,49 @@ function CollectionDetailRoute() {
Closed{collection.closed_at ? ` · ${formatDate(collection.closed_at)}` : ""}
)}
+
+
+