From c7524e0597dd40cb541afafc211a40df36b69a39 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:29:15 +0000 Subject: [PATCH 1/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index f3e14c7..6447c5f 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -208,7 +208,7 @@ const IMPORTERS: ImporterConfig[] = [ transform: (r, ctx) => { const cid = r._clientext ? ctx.clientByExt.get(String(r._clientext)) : null; const cidByName = r._clientname ? ctx.clientByName.get(String(r._clientname).toLowerCase()) : null; - r.client_id = cid ?? cidByName ?? null; + r.client_id = cid ?? cidByName ?? ctx.defaultClientId ?? null; delete r._clientext; delete r._clientname; if (!r.client_id) return null; if (!r.first_name && r._ownername) { @@ -216,6 +216,10 @@ const IMPORTERS: ImporterConfig[] = [ r.first_name = first_name; r.last_name = last_name; } delete r._ownername; + // Allow address-only rows: synthesize a placeholder owner name from the address + if (!r.first_name) { + r.first_name = r.address || r.unit_number || "Unit"; + } if (!r.last_name) r.last_name = ""; return r; }, From dfe475ee8b7b9a77056dea8a315c64314be81b47 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:29:24 +0000 Subject: [PATCH 2/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 6447c5f..6537c62 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -51,6 +51,8 @@ interface ImportCtx { // Name → uuid lookups (for files that reference by name only) clientByName: Map; caseByNumber: Map; + // Optional fallback client id (e.g. for address-only locations CSV) + defaultClientId?: string | null; } const norm = (s: string) => From d69ab40bc811a0da4b9409d0edf461ceb8c833a5 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:29:36 +0000 Subject: [PATCH 3/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 6537c62..507aa4f 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -1,5 +1,5 @@ import { createFileRoute } from "@tanstack/react-router"; -import { useMemo, useState } from "react"; +import { useEffect, useMemo, useState } from "react"; import Papa from "papaparse"; import { supabase } from "@/integrations/supabase/client"; import { useAuth } from "@/lib/auth"; @@ -7,6 +7,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Alert, AlertDescription } from "@/components/ui/alert"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Upload, CheckCircle2, AlertCircle, Loader2, FileSpreadsheet } from "lucide-react"; import { toast } from "sonner"; From 451b1a21d0a8b04f6af0bd01ca442b94fefea06d Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:29:50 +0000 Subject: [PATCH 4/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 507aa4f..fa14faa 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -516,6 +516,8 @@ interface ImportResult { function ImportPage() { const { user } = useAuth(); const [results, setResults] = useState>({}); + const [clientList, setClientList] = useState<{ id: string; name: string }[]>([]); + const [defaultClientId, setDefaultClientId] = useState(""); const ctx = useMemo(() => ({ userId: user?.id ?? "", clientByExt: new Map(), @@ -525,8 +527,18 @@ function ImportPage() { invoiceByExt: new Map(), clientByName: new Map(), caseByNumber: new Map(), + defaultClientId: null, }), [user?.id]); + useEffect(() => { + void supabase + .from("clients") + .select("id,name") + .is("archived_at", null) + .order("name") + .then(({ data }) => setClientList((data ?? []) as { id: string; name: string }[])); + }, []); + // Pre-load lookup caches from existing rows so subsequent imports can join. // Always reload (and paginate past Supabase's 1000-row default limit) so caches // pick up rows added since the page mounted (e.g., from a prior CSV import). From b4266fbdd4d637937533b5e1b1f4d5bb4284b65d Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:30:01 +0000 Subject: [PATCH 5/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index fa14faa..1a64ae2 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -588,6 +588,7 @@ function ImportPage() { const handleFile = async (cfg: ImporterConfig, file: File) => { if (!user?.id) return; setResults((r) => ({ ...r, [cfg.key]: "running" })); + ctx.defaultClientId = cfg.key === "locations" ? (defaultClientId || null) : null; await ensureLookupsLoaded(); const parsed = await new Promise>>((resolve, reject) => { From 8b7595219ea1c29aebeaafa851044f9c7cbc8552 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:30:17 +0000 Subject: [PATCH 6/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 1a64ae2..00d1060 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -766,7 +766,19 @@ function ImportPage() {

{cfg.description}

-
+
+ {cfg.key === "locations" && ( + + )} -