From c10750cbf42b1403cd952ba1277dcf34b3f2f1e2 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 00:55:50 +0000 Subject: [PATCH 1/3] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/clients.$clientId.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/clients.$clientId.tsx b/src/routes/clients.$clientId.tsx index fead7d7..5ae32ad 100644 --- a/src/routes/clients.$clientId.tsx +++ b/src/routes/clients.$clientId.tsx @@ -9,7 +9,7 @@ import { supabase } from "@/integrations/supabase/client"; import { ClientFormDialog } from "@/components/clients/client-form-dialog"; import { useAuth } from "@/lib/auth"; import { ArrowLeft, Edit, Plus, Building2, User, Briefcase as Building, MapPin, Mail, Phone, Users } from "lucide-react"; -import { formatDate, statusBadgeClass } from "@/lib/format"; +import { formatCurrency, formatDate, statusBadgeClass } from "@/lib/format"; import { toast } from "sonner"; export const Route = createFileRoute("/clients/$clientId")({ From 7f5add321f81141c95731bc262c007c8b19ba60a Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 00:56:01 +0000 Subject: [PATCH 2/3] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/clients.$clientId.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/routes/clients.$clientId.tsx b/src/routes/clients.$clientId.tsx index 5ae32ad..387b579 100644 --- a/src/routes/clients.$clientId.tsx +++ b/src/routes/clients.$clientId.tsx @@ -36,8 +36,24 @@ function ClientDetail() { supabase.from("cases").select("id, case_number, title, status, opened_at").eq("client_id", clientId).order("opened_at", { ascending: false }), ]); if (ce) toast.error("Failed to load client", { description: ce.message }); + const caseIds = (cs ?? []).map((x: any) => x.id); + let totals: Record = {}; + if (caseIds.length) { + const { data: te } = await supabase + .from("time_entries") + .select("case_id, hours, hourly_rate, billable") + .in("case_id", caseIds) + .eq("billable", true); + (te ?? []).forEach((t: any) => { + const h = Number(t.hours) || 0; + const r = Number(t.hourly_rate) || 0; + if (!totals[t.case_id]) totals[t.case_id] = { hours: 0, amount: 0 }; + totals[t.case_id].hours += h; + totals[t.case_id].amount += h * r; + }); + } setClient(c); - setCases(cs ?? []); + setCases((cs ?? []).map((x: any) => ({ ...x, billed: totals[x.id] ?? { hours: 0, amount: 0 } }))); setLoading(false); }; From 676339ab5993e4a8d35b84b56427f71157dbbb58 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 00:56:11 +0000 Subject: [PATCH 3/3] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/clients.$clientId.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/routes/clients.$clientId.tsx b/src/routes/clients.$clientId.tsx index 387b579..1932322 100644 --- a/src/routes/clients.$clientId.tsx +++ b/src/routes/clients.$clientId.tsx @@ -196,6 +196,9 @@ function ClientDetail() {
{c.case_number} · opened {formatDate(c.opened_at)}
+
+ Billed: {c.billed.hours.toFixed(1)} hr · {formatCurrency(c.billed.amount)} +
))}