diff --git a/src/components/clients/client-form-dialog.tsx b/src/components/clients/client-form-dialog.tsx index f255bb3..024bbef 100644 --- a/src/components/clients/client-form-dialog.tsx +++ b/src/components/clients/client-form-dialog.tsx @@ -21,7 +21,7 @@ const boardMember = z.object({ }); const schema = z.object({ - client_type: z.enum(["hoa", "individual", "business"]), + client_type: z.enum(["hoa", "condo"]), name: z.string().trim().min(1, "Required").max(200), primary_contact_name: z.string().trim().max(120).optional().or(z.literal("")), primary_contact_email: z.string().trim().email("Invalid email").max(255).optional().or(z.literal("")), @@ -95,6 +95,7 @@ export function ClientFormDialog({ }, [open, client, form]); const clientType = form.watch("client_type"); + const isAssociation = clientType === "hoa" || clientType === "condo"; const board = form.watch("board_members"); const addBoardMember = () => { @@ -163,8 +164,7 @@ export function ClientFormDialog({ HOA / Association - Business - Individual + Condominium @@ -176,7 +176,7 @@ export function ClientFormDialog({ name="name" render={({ field }) => ( - {clientType === "hoa" ? "Association name" : "Name"} + {isAssociation ? "Association name" : "Name"} @@ -184,7 +184,7 @@ export function ClientFormDialog({ /> - {clientType === "hoa" && ( + {isAssociation && (
- {clientType === "hoa" && ( + {isAssociation && (
diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index 2d612e2..fd008f6 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -808,7 +808,7 @@ export type Database = { | "closed_won" | "closed_lost" | "closed" - client_type: "hoa" | "individual" | "business" + client_type: "hoa" | "individual" | "business" | "condo" invoice_status: "draft" | "sent" | "paid" | "overdue" | "void" } CompositeTypes: { @@ -946,7 +946,7 @@ export const Constants = { "closed_lost", "closed", ], - client_type: ["hoa", "individual", "business"], + client_type: ["hoa", "individual", "business", "condo"], invoice_status: ["draft", "sent", "paid", "overdue", "void"], }, }, diff --git a/src/routes/cases.$caseId.tsx b/src/routes/cases.$caseId.tsx index 6382c77..09d6cbe 100644 --- a/src/routes/cases.$caseId.tsx +++ b/src/routes/cases.$caseId.tsx @@ -145,7 +145,7 @@ function CaseDetail() { Time Expenses Invoices - {data.client?.client_type === "hoa" && ( + {(data.client?.client_type === "hoa" || data.client?.client_type === "condo") && ( Collections )} @@ -155,7 +155,7 @@ function CaseDetail() { - {data.client?.client_type === "hoa" && ( + {(data.client?.client_type === "hoa" || data.client?.client_type === "condo") && ( )} diff --git a/src/routes/clients.$clientId.tsx b/src/routes/clients.$clientId.tsx index 1932322..2b99d7c 100644 --- a/src/routes/clients.$clientId.tsx +++ b/src/routes/clients.$clientId.tsx @@ -81,7 +81,7 @@ function ClientDetail() { } const Icon = - client.client_type === "hoa" ? Building2 : client.client_type === "business" ? Building : User; + client.client_type === "hoa" || client.client_type === "condo" ? Building2 : User; const canEdit = isAdmin || client.created_by === user?.id; return ( @@ -117,7 +117,7 @@ function ClientDetail() {
- {client.client_type === "hoa" && ( + {(client.client_type === "hoa" || client.client_type === "condo") && ( <> @@ -153,7 +153,7 @@ function ClientDetail() { - {client.client_type === "hoa" && client.board_members?.length > 0 && ( + {(client.client_type === "hoa" || client.client_type === "condo") && client.board_members?.length > 0 && (
diff --git a/src/routes/clients.index.tsx b/src/routes/clients.index.tsx index 5ad5774..6a697d7 100644 --- a/src/routes/clients.index.tsx +++ b/src/routes/clients.index.tsx @@ -45,7 +45,7 @@ function ClientsList() { ); const typeIcon = (t: string) => - t === "hoa" ? Building2 : t === "business" ? Building : User; + t === "hoa" || t === "condo" ? Building2 : User; return ( diff --git a/supabase/migrations/20260417005650_5b36b216-3458-4ecb-adaf-606b27333bac.sql b/supabase/migrations/20260417005650_5b36b216-3458-4ecb-adaf-606b27333bac.sql new file mode 100644 index 0000000..dd829de --- /dev/null +++ b/supabase/migrations/20260417005650_5b36b216-3458-4ecb-adaf-606b27333bac.sql @@ -0,0 +1 @@ +ALTER TYPE public.client_type ADD VALUE IF NOT EXISTS 'condo'; \ No newline at end of file