From b5fa0d0d4b969fd1324390771ce03f0b0dfcb40b Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Fri, 14 Nov 2025 00:14:28 +0100 Subject: [PATCH] added user page and create a new modal from use with button and text --- .../components/modal-button/modal-button.css | 0 .../components/modal-button/modal-button.html | 16 ++++ .../components/modal-button/modal-button.ts | 37 ++++++++ .../components/profil-form/profil-form.html | 8 +- src/app/components/profil-form/profil-form.ts | 8 +- src/app/components/user-table/user-table.css | 85 +++++++++++++++++++ src/app/components/user-table/user-table.html | 29 +++++++ src/app/components/user-table/user-table.ts | 57 +++++++++++++ src/app/pages/user/user.html | 8 +- src/app/pages/user/user.ts | 9 +- 10 files changed, 247 insertions(+), 10 deletions(-) create mode 100644 src/app/components/modal-button/modal-button.css create mode 100644 src/app/components/modal-button/modal-button.html create mode 100644 src/app/components/modal-button/modal-button.ts create mode 100644 src/app/components/user-table/user-table.css create mode 100644 src/app/components/user-table/user-table.html create mode 100644 src/app/components/user-table/user-table.ts diff --git a/src/app/components/modal-button/modal-button.css b/src/app/components/modal-button/modal-button.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/modal-button/modal-button.html b/src/app/components/modal-button/modal-button.html new file mode 100644 index 0000000..97e1450 --- /dev/null +++ b/src/app/components/modal-button/modal-button.html @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/src/app/components/modal-button/modal-button.ts b/src/app/components/modal-button/modal-button.ts new file mode 100644 index 0000000..3bcf6da --- /dev/null +++ b/src/app/components/modal-button/modal-button.ts @@ -0,0 +1,37 @@ +import {Component, input, Input} from '@angular/core'; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzModalComponent} from "ng-zorro-antd/modal"; +import {NzButtonComponent} from "ng-zorro-antd/button"; + +@Component({ + selector: 'app-modal-button', + imports: [ + NzModalComponent, + NzButtonComponent, + ], + templateUrl: './modal-button.html', + styleUrl: './modal-button.css', +}) + +export class ModalButton { + name = input.required() + + isVisible = false; + isOkLoading = false; + + showModal(): void { + this.isVisible = true; + } + + handleOk(): void { + this.isOkLoading = true; + setTimeout(() => { + this.isVisible = false; + this.isOkLoading = false; + }, 1000); + } + + handleCancel(): void { + this.isVisible = false; + } +} \ No newline at end of file diff --git a/src/app/components/profil-form/profil-form.html b/src/app/components/profil-form/profil-form.html index 434fe71..c1e0fef 100644 --- a/src/app/components/profil-form/profil-form.html +++ b/src/app/components/profil-form/profil-form.html @@ -5,7 +5,7 @@ - + @@ -14,7 +14,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -32,7 +32,7 @@ - + \ No newline at end of file diff --git a/src/app/components/profil-form/profil-form.ts b/src/app/components/profil-form/profil-form.ts index c6abd55..b82c8e3 100644 --- a/src/app/components/profil-form/profil-form.ts +++ b/src/app/components/profil-form/profil-form.ts @@ -23,10 +23,10 @@ import {NzInputDirective} from "ng-zorro-antd/input"; }) export class ProfilForm { profilForm: FormGroup = new FormGroup({ - newName: new FormControl(null, [Validators.required]), - newEmail: new FormControl(null, [Validators.required]), - newFonction: new FormControl(null, [Validators.required]), - newPassword: new FormControl(null, [Validators.required]) + name: new FormControl(null, [Validators.required]), + email: new FormControl(null, [Validators.required]), + fonction: new FormControl(null, [Validators.required]), + password: new FormControl(null, [Validators.required]) }) submitForm() { diff --git a/src/app/components/user-table/user-table.css b/src/app/components/user-table/user-table.css new file mode 100644 index 0000000..7ae664f --- /dev/null +++ b/src/app/components/user-table/user-table.css @@ -0,0 +1,85 @@ +/* Table globale */ +nz-table { + width: 100%; + border-collapse: separate; + border-spacing: 0 8px; /* espace entre les lignes */ + background: #fff; + border-radius: 8px; + overflow: hidden; + box-shadow: 0 2px 6px rgba(0,0,0,0.1); + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; +} + +/* En-tête */ +nz-table thead tr { + background-color: #f5f5f5; + text-align: left; + font-weight: 600; + color: #333; + border-bottom: 2px solid #e0e0e0; +} + +nz-table thead th { + padding: 12px 16px; +} + +/* Lignes du tableau */ +nz-table tbody tr { + background-color: #fff; + transition: background 0.2s ease; +} + +nz-table tbody tr:nth-child(even) { + background-color: #f9f9f9; +} + +nz-table tbody tr:hover { + background-color: #e6f7ff; /* survol */ +} + +/* Cellules */ +nz-table tbody td { + padding: 12px 16px; + vertical-align: middle; + color: #444; +} + +/* Boutons */ +nz-table button[nz-button] { + margin-right: 8px; +} + +/* Modals dans le tableau */ +nz-table app-modal { + margin-right: 8px; +} + +/* Dates (pour alignement et style) */ +nz-table tbody td p { + margin: 0; + font-size: 14px; + color: #555; +} + +/* Responsive */ +@media (max-width: 768px) { + nz-table thead { + display: none; + } + nz-table tbody tr { + display: block; + margin-bottom: 16px; + box-shadow: 0 1px 3px rgba(0,0,0,0.1); + border-radius: 8px; + padding: 12px; + } + nz-table tbody td { + display: flex; + justify-content: space-between; + padding: 6px 12px; + } + nz-table tbody td::before { + content: attr(data-label); + font-weight: 600; + } +} diff --git a/src/app/components/user-table/user-table.html b/src/app/components/user-table/user-table.html new file mode 100644 index 0000000..fe6993c --- /dev/null +++ b/src/app/components/user-table/user-table.html @@ -0,0 +1,29 @@ + + + + Nom + Email + Fonction + Action + + + + @for (data of basicTable.data; track data) { + + {{data.name}} + {{data.email}} + {{data.fonction}} + +
+ + + +
+ +
+
+ + + } + +
diff --git a/src/app/components/user-table/user-table.ts b/src/app/components/user-table/user-table.ts new file mode 100644 index 0000000..5bb28c4 --- /dev/null +++ b/src/app/components/user-table/user-table.ts @@ -0,0 +1,57 @@ +import { Component } from '@angular/core'; +import {ModalNav} from "../modal-nav/modal-nav"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzTableComponent} from "ng-zorro-antd/table"; +import {StockForm} from "../stock-form/stock-form"; +import {UserInfo} from "../../interfaces/user.interface"; +import {ProfilForm} from "../profil-form/profil-form"; + +@Component({ + selector: 'app-user-table', + imports: [ + ModalNav, + NzIconDirective, + NzTableComponent, + ProfilForm + ], + templateUrl: './user-table.html', + styleUrl: './user-table.css', +}) +export class UserTable { + listOfData: UserInfo[] = [ + { name: 'Alice Martin', email: 'alice.martin@example.com', fonction: 'Responsable Stock' }, + { name: 'Bruno Lefevre', email: 'bruno.lefevre@example.com', fonction: 'Technicien' }, + { name: 'Claire Dupont', email: 'claire.dupont@example.com', fonction: 'Chef d’équipe' }, + { name: 'David Roux', email: 'david.roux@example.com', fonction: 'Opérateur' }, + { name: 'Emma Girard', email: 'emma.girard@example.com', fonction: 'Manager' }, + { name: 'Florian Petit', email: 'florian.petit@example.com', fonction: 'Contrôleur' }, + { name: 'Gabriel Fabre', email: 'gabriel.fabre@example.com', fonction: 'Technicien' }, + { name: 'Hélène Blanchard', email: 'helene.blanchard@example.com', fonction: 'Responsable Qualité' }, + { name: 'Idris Caron', email: 'idris.caron@example.com', fonction: 'Opérateur' }, + { name: 'Julie Laurent', email: 'julie.laurent@example.com', fonction: 'RH' }, + { name: 'Kevin Becker', email: 'kevin.becker@example.com', fonction: 'Chef d’équipe' }, + { name: 'Laura Denis', email: 'laura.denis@example.com', fonction: 'Responsable Stock' }, + { name: 'Maxime Robert', email: 'maxime.robert@example.com', fonction: 'Technicien' }, + { name: 'Nina Lambert', email: 'nina.lambert@example.com', fonction: 'Opérateur' }, + { name: 'Olivier Garnier', email: 'olivier.garnier@example.com', fonction: 'Manager' }, + { name: 'Pauline Henry', email: 'pauline.henry@example.com', fonction: 'Chef de Projet' }, + { name: 'Quentin Millet', email: 'quentin.millet@example.com', fonction: 'Technicien' }, + { name: 'Raphaël Julien', email: 'raphael.julien@example.com', fonction: 'Opérateur' }, + { name: 'Sophie Moreau', email: 'sophie.moreau@example.com', fonction: 'Responsable Qualité' }, + { name: 'Théo Renaud', email: 'theo.renaud@example.com', fonction: 'Technicien' }, + { name: 'Ulysse Berger', email: 'ulysse.berger@example.com', fonction: 'Opérateur' }, + { name: 'Valentine Roche', email: 'valentine.roche@example.com', fonction: 'RH' }, + { name: 'William Arnaud', email: 'william.arnaud@example.com', fonction: 'Chef d’équipe' }, + { name: 'Xavier Colin', email: 'xavier.colin@example.com', fonction: 'Technicien' }, + { name: 'Yasmine Perrot', email: 'yasmine.perrot@example.com', fonction: 'Manager' }, + { name: 'Zack Morel', email: 'zack.morel@example.com', fonction: 'Opérateur' }, + { name: 'Adèle Simon', email: 'adele.simon@example.com', fonction: 'Responsable Stock' }, + { name: 'Bastien Renault', email: 'bastien.renault@example.com', fonction: 'Technicien' }, + { name: 'Cindy Barret', email: 'cindy.barret@example.com', fonction: 'Assistante' }, + { name: 'Dorian Lefort', email: 'dorian.lefort@example.com', fonction: 'Contrôleur' }, + ]; + + delete(){ + return + } +} diff --git a/src/app/pages/user/user.html b/src/app/pages/user/user.html index d039bb7..d52f26a 100644 --- a/src/app/pages/user/user.html +++ b/src/app/pages/user/user.html @@ -1 +1,7 @@ -

user works!

+ + + + +
+ +
diff --git a/src/app/pages/user/user.ts b/src/app/pages/user/user.ts index ad839b1..73456ba 100644 --- a/src/app/pages/user/user.ts +++ b/src/app/pages/user/user.ts @@ -1,8 +1,15 @@ import { Component } from '@angular/core'; +import {UserTable} from "../../components/user-table/user-table"; +import {ModalButton} from "../../components/modal-button/modal-button"; +import {ProfilForm} from "../../components/profil-form/profil-form"; @Component({ selector: 'app-user', - imports: [], + imports: [ + UserTable, + ModalButton, + ProfilForm + ], templateUrl: './user.html', styleUrl: './user.css', })