From e847aefe649db36e27b60203188619ca10a2d270 Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Mon, 13 Apr 2026 12:45:37 +0200 Subject: [PATCH] feat: add support for additional phone numbers and titles in user profiles --- apps/db/migrations/44_telefono_v2.up.sql | 5 ++ .../area-riservata/userViewHeader.tsx | 13 +++- .../src/components/tables/richieste-table.tsx | 55 +++++++++++--- .../src/components/tables/users-table.tsx | 74 ++++++++++++++++--- .../src/forms/FormProfilo_Account.tsx | 66 ++++++++++++++++- apps/infoalloggi/src/i18n/en.ts | 2 + apps/infoalloggi/src/i18n/it.ts | 2 + apps/infoalloggi/src/i18n/locales.ts | 2 + .../admin/user-view/edit-user/[userId].tsx | 2 + .../src/pages/area-riservata/profilo.tsx | 2 + apps/infoalloggi/src/schemas/public/Users.ts | 4 + .../src/server/controllers/user.controller.ts | 12 +++ .../src/server/services/user.service.ts | 2 + 13 files changed, 218 insertions(+), 23 deletions(-) create mode 100644 apps/db/migrations/44_telefono_v2.up.sql diff --git a/apps/db/migrations/44_telefono_v2.up.sql b/apps/db/migrations/44_telefono_v2.up.sql new file mode 100644 index 0000000..db7ee9f --- /dev/null +++ b/apps/db/migrations/44_telefono_v2.up.sql @@ -0,0 +1,5 @@ +ALTER TABLE IF EXISTS public.users + ADD COLUMN IF NOT EXISTS extra_telefono_titolo text; + +ALTER TABLE IF EXISTS public.users + ADD COLUMN IF NOT EXISTS extra_telefono_numero text; \ No newline at end of file diff --git a/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx b/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx index 2234674..74f8c36 100644 --- a/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx +++ b/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx @@ -144,9 +144,20 @@ export const UserViewHeader = () => { + {data.extra_telefono_numero && ( + + + + )} {data.codice_fiscale ? ( ) : ( diff --git a/apps/infoalloggi/src/components/tables/richieste-table.tsx b/apps/infoalloggi/src/components/tables/richieste-table.tsx index ca169a4..85d9035 100644 --- a/apps/infoalloggi/src/components/tables/richieste-table.tsx +++ b/apps/infoalloggi/src/components/tables/richieste-table.tsx @@ -31,6 +31,9 @@ import { ContextMenuContent, ContextMenuItem, ContextMenuLabel, + ContextMenuSub, + ContextMenuSubContent, + ContextMenuSubTrigger, ContextMenuTrigger, } from "~/components/ui/context-menu"; import { DataTable } from "~/components/ui/data-table"; @@ -161,17 +164,47 @@ export const RichiesteTable = ({ data }: RichiesteTableProps) => { Profilo - - - - - WhatsApp - - + {data.extra_telefono_numero ? ( + + + + WhatsApp + + + + + + WhatsApp ({data.nome}) + + + + + + WhatsApp ({data.extra_telefono_titolo}) + + + + + ) : ( + + + + WhatsApp + + + )} ); diff --git a/apps/infoalloggi/src/components/tables/users-table.tsx b/apps/infoalloggi/src/components/tables/users-table.tsx index a3f4c97..2a6fd69 100644 --- a/apps/infoalloggi/src/components/tables/users-table.tsx +++ b/apps/infoalloggi/src/components/tables/users-table.tsx @@ -38,6 +38,9 @@ import { ContextMenuItem, ContextMenuLabel, ContextMenuSeparator, + ContextMenuSub, + ContextMenuSubContent, + ContextMenuSubTrigger, } from "../ui/context-menu"; import { Dialog, @@ -66,10 +69,13 @@ export const UsersTable = (props: { data: UserWChatInfo[] }) => { const tabledata = data.map((user) => { return { + nome: user.nome, chatid: user.chatid, created_at: user.created_at, email: user.email, telefono: user.telefono, + extra_telefono_numero: user.extra_telefono_numero, + extra_telefono_titolo: user.extra_telefono_titolo, note: user.note, id: user.id, isAdmin: user.isAdmin ? "Admin" : "Utente", @@ -190,6 +196,22 @@ export const UsersTable = (props: { data: UserWChatInfo[] }) => { title={columns_titles.telefono} /> ), + cell: ({ row }) => { + const { nome, telefono, extra_telefono_numero, extra_telefono_titolo } = + row.original; + return ( +
+ {telefono} + {extra_telefono_numero && ( + <> + {nome} + {extra_telefono_numero} + {extra_telefono_titolo} + + )} +
+ ); + }, }, { accessorKey: "email", @@ -361,16 +383,48 @@ export const UsersTable = (props: { data: UserWChatInfo[] }) => { Chat - - - - WhatsApp - - + {data.extra_telefono_numero ? ( + + + + WhatsApp + + + + + + WhatsApp ({data.nome}) + + + + + + WhatsApp ({data.extra_telefono_titolo}) + + + + + ) : ( + + + + WhatsApp + + + )} +