diff --git a/client/src/app/app.component.html b/client/src/app/app.component.html
index 6659729..ab8a3a0 100644
--- a/client/src/app/app.component.html
+++ b/client/src/app/app.component.html
@@ -1,2 +1,2 @@
-
+
diff --git a/client/src/app/app.component.spec.ts b/client/src/app/app.component.spec.ts
deleted file mode 100644
index 36f4316..0000000
--- a/client/src/app/app.component.spec.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { TestBed } from '@angular/core/testing';
-import { AppComponent } from './app.component';
-
-describe('AppComponent', () => {
- beforeEach(async () => {
- await TestBed.configureTestingModule({
- imports: [AppComponent],
- }).compileComponents();
- });
-
- it('should create the app', () => {
- const fixture = TestBed.createComponent(AppComponent);
- const app = fixture.componentInstance;
- expect(app).toBeTruthy();
- });
-
- it(`should have the 'client' title`, () => {
- const fixture = TestBed.createComponent(AppComponent);
- const app = fixture.componentInstance;
- expect(app.title).toEqual('client');
- });
-
- it('should render title', () => {
- const fixture = TestBed.createComponent(AppComponent);
- fixture.detectChanges();
- const compiled = fixture.nativeElement as HTMLElement;
- expect(compiled.querySelector('h1')?.textContent).toContain('Hello, client');
- });
-});
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 33285ac..03410b1 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,11 +1,11 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
-import {NavbarComponent} from './components/navbar/navbar.component';
+import {MainNavbarComponent} from './components/navbar/main-navbar/main-navbar.component';
@Component({
selector: 'app-root',
standalone: true,
- imports: [RouterOutlet, NavbarComponent],
+ imports: [RouterOutlet, MainNavbarComponent],
templateUrl: './app.component.html',
styleUrl: './app.component.css'
})
diff --git a/client/src/app/app.routes.ts b/client/src/app/app.routes.ts
index c40560e..064ceea 100644
--- a/client/src/app/app.routes.ts
+++ b/client/src/app/app.routes.ts
@@ -1,4 +1,4 @@
-import { Routes } from '@angular/router';
+import {Routes} from '@angular/router';
import {HomeComponent} from './pages/home/home.component';
import {RegisterComponent} from './pages/register/register.component';
import {LoginComponent} from './pages/login/login.component';
@@ -7,19 +7,18 @@ import {guestOnlyCanActivate, guestOnlyCanMatch} from './guards/guest-only.guard
import {authOnlyCanActivate, authOnlyCanMatch} from './guards/auth-only.guard';
import {AdminComponent} from './pages/admin/admin.component';
import {adminOnlyCanActivate, adminOnlyCanMatch} from './guards/admin-only.guard';
-import {AddProductComponent} from './pages/add-product/add-product.component';
import {ProductsComponent} from './pages/products/products.component';
export const routes: Routes = [
{
- path : '',
+ path: '',
children: [
{
- path : '',
+ path: '',
component: HomeComponent
},
{
- path : 'home',
+ path: 'home',
component: HomeComponent
}
]
@@ -31,38 +30,32 @@ export const routes: Routes = [
canActivate: [guestOnlyCanActivate]
},
{
- path : 'login',
+ path: 'login',
component: LoginComponent,
canMatch: [guestOnlyCanMatch],
canActivate: [guestOnlyCanActivate]
},
{
- path : 'profile',
+ path: 'profile',
component: ProfileComponent,
canMatch: [authOnlyCanMatch],
canActivate: [authOnlyCanMatch]
},
{
- path : 'admin',
+ path: 'admin',
component: AdminComponent,
canMatch: [adminOnlyCanMatch],
canActivate: [adminOnlyCanActivate]
},
{
- path : 'products',
+ path: 'products',
component: ProductsComponent,
canMatch: [authOnlyCanMatch],
- canActivate: [authOnlyCanActivate]
+ canActivate: [authOnlyCanActivate],
},
{
- path : 'add-product',
- component: AddProductComponent,
- canMatch: [authOnlyCanMatch],
- canActivate: [authOnlyCanActivate]
- },
- {
- path : '**',
+ path: '**',
redirectTo: ''
}
];
diff --git a/client/src/app/components/brand-list/brand-list.component.html b/client/src/app/components/brand-list/brand-list.component.html
deleted file mode 100644
index d2e8ec9..0000000
--- a/client/src/app/components/brand-list/brand-list.component.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
diff --git a/client/src/app/components/category-list/category-list.component.html b/client/src/app/components/category-list/category-list.component.html
deleted file mode 100644
index 3783ce7..0000000
--- a/client/src/app/components/category-list/category-list.component.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
diff --git a/client/src/app/components/admin-navbar/admin-navbar.component.css b/client/src/app/components/dialog/confirm-dialog/confirm-dialog.component.css
similarity index 100%
rename from client/src/app/components/admin-navbar/admin-navbar.component.css
rename to client/src/app/components/dialog/confirm-dialog/confirm-dialog.component.css
diff --git a/client/src/app/components/dialog/confirm-dialog/confirm-dialog.component.html b/client/src/app/components/dialog/confirm-dialog/confirm-dialog.component.html
new file mode 100644
index 0000000..76403eb
--- /dev/null
+++ b/client/src/app/components/dialog/confirm-dialog/confirm-dialog.component.html
@@ -0,0 +1,8 @@
+
{{ data.title ?? 'Confirmation' }}
+
+ {{ data.message ?? 'Êtes-vous sûr·e ?' }}
+
+
+
+
+
diff --git a/client/src/app/components/dialog/confirm-dialog/confirm-dialog.component.ts b/client/src/app/components/dialog/confirm-dialog/confirm-dialog.component.ts
new file mode 100644
index 0000000..a65c0d1
--- /dev/null
+++ b/client/src/app/components/dialog/confirm-dialog/confirm-dialog.component.ts
@@ -0,0 +1,21 @@
+import { Component, Inject } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
+import { MatButtonModule } from '@angular/material/button';
+
+@Component({
+ selector: 'app-confirm-dialog',
+ standalone: true,
+ imports: [CommonModule, MatDialogModule, MatButtonModule],
+ templateUrl: './confirm-dialog.component.html',
+})
+export class ConfirmDialogComponent {
+ constructor(
+ private readonly dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data: { title?: string; message?: string }
+ ) {}
+
+ close(result: boolean) {
+ this.dialogRef.close(result);
+ }
+}
diff --git a/client/src/app/components/generic-dialog/generic-dialog.component.css b/client/src/app/components/dialog/generic-dialog/generic-dialog.component.css
similarity index 100%
rename from client/src/app/components/generic-dialog/generic-dialog.component.css
rename to client/src/app/components/dialog/generic-dialog/generic-dialog.component.css
diff --git a/client/src/app/components/generic-dialog/generic-dialog.component.html b/client/src/app/components/dialog/generic-dialog/generic-dialog.component.html
similarity index 95%
rename from client/src/app/components/generic-dialog/generic-dialog.component.html
rename to client/src/app/components/dialog/generic-dialog/generic-dialog.component.html
index 0a49caa..f13a2e3 100644
--- a/client/src/app/components/generic-dialog/generic-dialog.component.html
+++ b/client/src/app/components/dialog/generic-dialog/generic-dialog.component.html
@@ -13,7 +13,7 @@
{{ f.label }}
- @let opts = (f.options$ | async) ?? f.options ?? [];
+ @let opts = (f.options ?? (f.options$ | async) ?? []);
@for (opt of opts; track $index) {
diff --git a/client/src/app/components/generic-dialog/generic-dialog.component.ts b/client/src/app/components/dialog/generic-dialog/generic-dialog.component.ts
similarity index 94%
rename from client/src/app/components/generic-dialog/generic-dialog.component.ts
rename to client/src/app/components/dialog/generic-dialog/generic-dialog.component.ts
index 66b19b5..ebea0cd 100644
--- a/client/src/app/components/generic-dialog/generic-dialog.component.ts
+++ b/client/src/app/components/dialog/generic-dialog/generic-dialog.component.ts
@@ -36,12 +36,12 @@ type Field = {
})
export class GenericDialogComponent implements OnInit {
form!: FormGroup;
- fields: Field[] = [];
+ fields?: Field[];
constructor(
private readonly fb: FormBuilder,
private readonly dialogRef: MatDialogRef,
- @Inject(MAT_DIALOG_DATA) public data: { item?: any; fields?: Field[]; title?: string }
+ @Inject(MAT_DIALOG_DATA) public data?: { item?: any; fields?: Field[]; title?: string }
) {
}
diff --git a/client/src/app/components/brand-list/brand-list.component.css b/client/src/app/components/list/brand-list/brand-list.component.css
similarity index 100%
rename from client/src/app/components/brand-list/brand-list.component.css
rename to client/src/app/components/list/brand-list/brand-list.component.css
diff --git a/client/src/app/components/list/brand-list/brand-list.component.html b/client/src/app/components/list/brand-list/brand-list.component.html
new file mode 100644
index 0000000..1dd9dd7
--- /dev/null
+++ b/client/src/app/components/list/brand-list/brand-list.component.html
@@ -0,0 +1,9 @@
+
+
diff --git a/client/src/app/components/brand-list/brand-list.component.ts b/client/src/app/components/list/brand-list/brand-list.component.ts
similarity index 88%
rename from client/src/app/components/brand-list/brand-list.component.ts
rename to client/src/app/components/list/brand-list/brand-list.component.ts
index bd70479..98e6acc 100644
--- a/client/src/app/components/brand-list/brand-list.component.ts
+++ b/client/src/app/components/list/brand-list/brand-list.component.ts
@@ -1,7 +1,7 @@
import {
Component, inject
} from '@angular/core';
-import {BrandService} from '../../services/app/brand.service';
+import {BrandService} from '../../../services/app/brand.service';
import {GenericListComponent} from '../generic-list/generic-list.component';
@Component({
diff --git a/client/src/app/components/list/category-list/category-list.component.html b/client/src/app/components/list/category-list/category-list.component.html
new file mode 100644
index 0000000..69a9f5e
--- /dev/null
+++ b/client/src/app/components/list/category-list/category-list.component.html
@@ -0,0 +1,9 @@
+
+
diff --git a/client/src/app/components/category-list/category-list.component.ts b/client/src/app/components/list/category-list/category-list.component.ts
similarity index 87%
rename from client/src/app/components/category-list/category-list.component.ts
rename to client/src/app/components/list/category-list/category-list.component.ts
index ea41bf4..09387e5 100644
--- a/client/src/app/components/category-list/category-list.component.ts
+++ b/client/src/app/components/list/category-list/category-list.component.ts
@@ -2,7 +2,7 @@ import {
Component, inject
} from '@angular/core';
import {GenericListComponent} from '../generic-list/generic-list.component';
-import {CategoryService} from '../../services/app/category.service';
+import {CategoryService} from '../../../services/app/category.service';
@Component({
selector: 'app-category-list',
diff --git a/client/src/app/components/category-list/category.component.css b/client/src/app/components/list/category-list/category.component.css
similarity index 100%
rename from client/src/app/components/category-list/category.component.css
rename to client/src/app/components/list/category-list/category.component.css
diff --git a/client/src/app/components/generic-list/generic-list.component.css b/client/src/app/components/list/generic-list/generic-list.component.css
similarity index 57%
rename from client/src/app/components/generic-list/generic-list.component.css
rename to client/src/app/components/list/generic-list/generic-list.component.css
index 1175006..2324320 100644
--- a/client/src/app/components/generic-list/generic-list.component.css
+++ b/client/src/app/components/list/generic-list/generic-list.component.css
@@ -15,7 +15,7 @@
justify-content: space-between;
gap: 1rem;
flex-wrap: wrap;
- border-bottom: 1px solid rgba(0,0,0,.08);
+ border-bottom: 1px solid rgba(0, 0, 0, .08);
padding-bottom: .75rem;
}
@@ -27,12 +27,11 @@
/* ===== Cartes (filtre, tableau, pagination) partagent le même style ===== */
.gl-block {
- border: 1px solid rgba(0,0,0,.08);
+ border: 1px solid rgba(0, 0, 0, .08);
border-radius: 12px;
background: var(--gl-surface, #fff);
- box-shadow:
- 0 1px 2px rgba(0,0,0,.04),
- 0 2px 8px rgba(0,0,0,.06);
+ box-shadow: 0 1px 2px rgba(0, 0, 0, .04),
+ 0 2px 8px rgba(0, 0, 0, .06);
}
/* ===== Barre de filtre ===== */
@@ -66,7 +65,7 @@
top: 0;
z-index: 2;
background: inherit;
- box-shadow: inset 0 -1px 0 rgba(0,0,0,.08);
+ box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .08);
}
/* Cellules */
@@ -80,8 +79,13 @@
}
/* Zebra + hover */
-.gl-table tr.mat-mdc-row:nth-child(odd) td[mat-cell] { background: rgba(0,0,0,.015); }
-.gl-table tr.mat-mdc-row:hover td[mat-cell] { background: rgba(0,0,0,.035); }
+.gl-table tr.mat-mdc-row:nth-child(odd) td[mat-cell] {
+ background: rgba(0, 0, 0, .015);
+}
+
+.gl-table tr.mat-mdc-row:hover td[mat-cell] {
+ background: rgba(0, 0, 0, .035);
+}
/* Actions */
.actions-cell {
@@ -90,42 +94,78 @@
justify-content: center;
gap: .4rem;
}
-.actions-cell .mat-mdc-icon-button { width: 40px; height: 40px; }
+
+.actions-cell .mat-mdc-icon-button {
+ width: 40px;
+ height: 40px;
+}
/* ===== Pagination ===== */
.gl-paginator-wrap {
padding: .25rem .5rem;
}
+
.gl-paginator {
margin-top: .25rem;
padding-top: .5rem;
- border-top: 1px solid rgba(0,0,0,.08);
+ border-top: 1px solid rgba(0, 0, 0, .08);
display: flex;
justify-content: flex-end;
}
/* ===== Responsive ===== */
@media (max-width: 799px) {
- .generic-list { padding: 0.75rem 1rem; }
- .gl-header { flex-direction: column; align-items: stretch; gap: 0.75rem; }
- .gl-table { min-width: 0; }
+ .generic-list {
+ padding: 0.75rem 1rem;
+ }
+
+ .gl-header {
+ flex-direction: column;
+ align-items: stretch;
+ gap: 0.75rem;
+ }
+
+ .gl-table {
+ min-width: 0;
+ }
+
.gl-table th[mat-header-cell],
- .gl-table td[mat-cell] { white-space: normal; padding: 10px 12px; }
- .actions-cell { justify-content: flex-start; }
+ .gl-table td[mat-cell] {
+ white-space: normal;
+ padding: 10px 12px;
+ }
+
+ .actions-cell {
+ justify-content: flex-start;
+ }
}
/* ===== Dark mode ===== */
@media (prefers-color-scheme: dark) {
.gl-block {
background: #1b1b1b;
- border-color: rgba(255,255,255,.08);
- box-shadow:
- 0 1px 2px rgba(0,0,0,.6),
- 0 2px 8px rgba(0,0,0,.45);
+ border-color: rgba(255, 255, 255, .08);
+ box-shadow: 0 1px 2px rgba(0, 0, 0, .6),
+ 0 2px 8px rgba(0, 0, 0, .45);
+ }
+
+ .gl-header {
+ border-bottom-color: rgba(255, 255, 255, .08);
+ }
+
+ .gl-table th[mat-header-cell] {
+ box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .08);
+ }
+
+ .gl-table tr.mat-mdc-row:nth-child(odd) td[mat-cell] {
+ background: rgba(255, 255, 255, .025);
+ }
+
+ .gl-table tr.mat-mdc-row:hover td[mat-cell] {
+ background: rgba(255, 255, 255, .06);
+ }
+
+ .gl-paginator {
+ border-top-color: rgba(255, 255, 255, .08);
}
- .gl-header { border-bottom-color: rgba(255,255,255,.08); }
- .gl-table th[mat-header-cell] { box-shadow: inset 0 -1px 0 rgba(255,255,255,.08); }
- .gl-table tr.mat-mdc-row:nth-child(odd) td[mat-cell] { background: rgba(255,255,255,.025); }
- .gl-table tr.mat-mdc-row:hover td[mat-cell] { background: rgba(255,255,255,.06); }
- .gl-paginator { border-top-color: rgba(255,255,255,.08); }
}
diff --git a/client/src/app/components/generic-list/generic-list.component.html b/client/src/app/components/list/generic-list/generic-list.component.html
similarity index 95%
rename from client/src/app/components/generic-list/generic-list.component.html
rename to client/src/app/components/list/generic-list/generic-list.component.html
index 0bb8c80..b490c2e 100644
--- a/client/src/app/components/generic-list/generic-list.component.html
+++ b/client/src/app/components/list/generic-list/generic-list.component.html
@@ -4,17 +4,16 @@
- Filtrer
+ Rechercher
@@ -57,6 +56,7 @@
aria-label="Modifier"
>
edit
+
-