From 3db798a9058c20fb4fd34fe4688efe4b6c6504c0 Mon Sep 17 00:00:00 2001 From: Mouad Lahlal Date: Wed, 22 Oct 2025 14:50:03 +0200 Subject: [PATCH] refactor: /client/[client] --- src/app/client/[client]/page.tsx | 231 +------------------------------ src/components/client-card.tsx | 96 +++++++++++++ src/components/device-card.tsx | 168 ++++++++++++++++++++++ 3 files changed, 268 insertions(+), 227 deletions(-) create mode 100644 src/components/client-card.tsx create mode 100644 src/components/device-card.tsx diff --git a/src/app/client/[client]/page.tsx b/src/app/client/[client]/page.tsx index 5d3c307..d01bd4b 100644 --- a/src/app/client/[client]/page.tsx +++ b/src/app/client/[client]/page.tsx @@ -1,33 +1,9 @@ "use client"; import { AppSidebar } from "@/components/app-sidebar"; -import { Button } from "@/components/ui/button"; -import { Edit, Plus } from "lucide-react"; -import { - Card, - CardAction, - CardContent, - CardFooter, - CardHeader, - CardTitle, -} from "@/components/ui/card"; import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"; -import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from "@/components/ui/tooltip"; -import { - Table, - TableBody, - TableCaption, - TableCell, - TableHead, - TableHeader, - TableRow, -} from "@/components/ui/table"; -import { cn } from "@/lib/utils"; -import { Checkbox } from "@/components/ui/checkbox"; +import ClientCard from "@/components/client-card"; +import DeviceCard from "@/components/device-card"; import { useSearchParams, useParams } from "next/navigation"; export default function Page() { @@ -123,210 +99,11 @@ export default function Page() { > - {/* -
- - - - - - All Inboxes - - - - Inbox - - - -
- */}
- - - - {client} - - - - - - - -

Modifica dettagli

-
-
- - - - - -

Aggiungi registratore

-
-
-
-
- -
-
Ragione Sociale
-
- Acconciature Uomo -
-
-
-
Partita IVA
-
- 13407520172 -
-
-
-
- Numero di Telefono -
-
- 0301547854 -
-
- -
-
Contratto
- -
-
-
- - - - - FORM 100 - - - - - - - -

Modifica dettagli

-
-
- - - - - -

Aggiungi intervento

-
-
-
-
- -
-
-
Seriale
-
- 80E100548745 -
-
-
-
Data acquisto
-
- 15/10/2019 -
-
-
-
Ultima verifica
-
- 15/10/2025 -
-
-
-
- Prossima verifica -
-
- 15/10/2026 -
-
-
-
- - - Lista interventi - - - - Data - Lavoro - Fattura - - - - {clienti - .find( - (cliente) => - cliente.name == searchParams.get("cliente"), - ) - ?.registratori[0].interventi.map((intervento) => ( - - - {intervento.data} - - {intervento.lavoro} - - - - - ))} - -
-
-
- - - - -
+ +
diff --git a/src/components/client-card.tsx b/src/components/client-card.tsx new file mode 100644 index 0000000..6bc560c --- /dev/null +++ b/src/components/client-card.tsx @@ -0,0 +1,96 @@ +import { + Card, + CardAction, + CardContent, + CardHeader, + CardTitle, +} from "@/components/ui/card"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { Button } from "@/components/ui/button"; +import { Edit, Plus } from "lucide-react"; + +const ClientCard = ({client}: {client: any}) => { + return ( + + + + {client} + + + + + + + +

Modifica dettagli

+
+
+ + + + + +

Aggiungi registratore

+
+
+
+
+ +
+
Ragione Sociale
+
+ Acconciature Uomo +
+
+
+
Partita IVA
+
+ 13407520172 +
+
+
+
+ Numero di Telefono +
+
+ 0301547854 +
+
+
+
Sede
+ +
+
+
Contratto
+ +
+
+
+ ) +} + +export default ClientCard; \ No newline at end of file diff --git a/src/components/device-card.tsx b/src/components/device-card.tsx new file mode 100644 index 0000000..cf0d1cb --- /dev/null +++ b/src/components/device-card.tsx @@ -0,0 +1,168 @@ +import { + Card, + CardAction, + CardContent, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { + Table, + TableBody, + TableCaption, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table"; +import { Button } from "@/components/ui/button"; +import { Edit, Plus } from "lucide-react"; +import { Checkbox } from "@/components/ui/checkbox"; +import { cn } from "@/lib/utils"; +import { useParams } from "next/navigation"; + +type Invervento = { + id: string, + data: string, + lavoro: string, + fattura: boolean +} + +type Registratore = { + seriale: string, + acquisto: string, + ultima_verifica: string, + prossima_verifica: string, + interventi: Array +} + +type Cliente = { + name: string, + email: string, + ragione_sociale: string, + p_iva: string, + telefono: string, + sede: string, + sede_url: string, + contratto: string, + registratori: Array +} + +const DeviceCard = ({clienti}: {clienti:Array}) => { + const { client } = useParams(); + + return ( + + + + FORM 100 + + + + + + + +

Modifica dettagli

+
+
+ + + + + +

Aggiungi intervento

+
+
+
+
+ +
+
+
Seriale
+
+ 80E100548745 +
+
+
+
Data acquisto
+
+ 15/10/2019 +
+
+
+
Ultima verifica
+
+ 15/10/2025 +
+
+
+
+ Prossima verifica +
+
+ 15/10/2026 +
+
+
+
+ + + Lista interventi + + + + Data + Lavoro + Fattura + + + + {clienti + .find( + (cliente) => + cliente.name == decodeURIComponent(client?.toString() || ""), + ) + ?.registratori[0].interventi.map((intervento) => ( + + + {intervento.data} + + {intervento.lavoro} + + + + + ))} + +
+
+
+ + + + +
+ ) +} + +export default DeviceCard; \ No newline at end of file