From f2279bc977268ffb5fe5fb076e1cfc003ce8b1c9 Mon Sep 17 00:00:00 2001 From: HarmandI Date: Tue, 22 Mar 2022 08:54:41 +0100 Subject: [PATCH] select category et divers --- .../formulaire/formulaire.component.html | 34 ++++++++++--------- .../formulaire/formulaire.component.ts | 21 +++++++++--- src/app/modules/admin/models/plant.ts | 2 +- .../page-ajouter/page-ajouter.component.html | 4 +-- .../page-ajouter/page-ajouter.component.scss | 5 +++ .../page-ajouter/page-ajouter.component.ts | 20 +++++------ .../page-tableau/page-tableau.component.html | 6 ++-- 7 files changed, 54 insertions(+), 38 deletions(-) diff --git a/src/app/modules/admin/components/formulaire/formulaire.component.html b/src/app/modules/admin/components/formulaire/formulaire.component.html index b206b3e..5a6e083 100644 --- a/src/app/modules/admin/components/formulaire/formulaire.component.html +++ b/src/app/modules/admin/components/formulaire/formulaire.component.html @@ -43,22 +43,24 @@ }" /> - -
- - -
+ +
+ + +
Ajouter une plante - +

Ajouter une plante

+ diff --git a/src/app/modules/admin/pages/page-ajouter/page-ajouter.component.scss b/src/app/modules/admin/pages/page-ajouter/page-ajouter.component.scss index e69de29..8a0fa8b 100644 --- a/src/app/modules/admin/pages/page-ajouter/page-ajouter.component.scss +++ b/src/app/modules/admin/pages/page-ajouter/page-ajouter.component.scss @@ -0,0 +1,5 @@ +h1{ + color: rgba(0, 0, 0, 0.658); + font-size: 28px; + margin-top: 20px; +} diff --git a/src/app/modules/admin/pages/page-ajouter/page-ajouter.component.ts b/src/app/modules/admin/pages/page-ajouter/page-ajouter.component.ts index 375853a..bda58f2 100644 --- a/src/app/modules/admin/pages/page-ajouter/page-ajouter.component.ts +++ b/src/app/modules/admin/pages/page-ajouter/page-ajouter.component.ts @@ -20,28 +20,24 @@ import { AdminService } from '../../services/admin.service'; }) export class PageAjouterComponent implements OnInit { public plantForm: FormGroup; + public isAdd: boolean = false; + constructor(private fb: FormBuilder, private router: Router, private adminService: AdminService) { this.plantForm = new FormGroup({}); + this.isAdd = false; } ngOnInit(): void { - this.plantForm = this.fb.group({ - nameFC: new FormControl('', [Validators.required]), - priceFc: new FormControl('', [Validators.required]), - quantityFc: new FormControl('', [Validators.required]), - categoryFc: new FormControl('', [Validators.required]), - ratingFc: new FormControl('', [Validators.required]), - inStockFc: new FormControl('', []), - }); + } public onSubmit(): void { const nameValue = this.plantForm.value['nameFC']; const priceValue = this.plantForm.value['priceFc']; const quantityValue = this.plantForm.value['quantityFc']; - const inStockValue = this.plantForm.value['categoryFc']; - const categoryValue = this.plantForm.value['']; + const inStockValue = this.plantForm.value['inStockFC']; + const categoryValue = this.plantForm.value['categotyFC']; const urlPicture: string = 'https//picsum.photos/id/18/200/300'; const ratingValue = this.plantForm.value['ratingFc']; const idValue = this.plantForm.value['']; @@ -51,12 +47,12 @@ export class PageAjouterComponent implements OnInit { price: priceValue, quantity: quantityValue, inStock: [inStockValue], - category: categoryValue, + category: [categoryValue], urlPicture: 'https//picsum.photos/id/18/200/300', rating: ratingValue, id: idValue, }; - console.log(plant); + console.log("coco",plant); this.adminService.addPlant(plant)?.subscribe((resp)=>{ }) diff --git a/src/app/modules/admin/pages/page-tableau/page-tableau.component.html b/src/app/modules/admin/pages/page-tableau/page-tableau.component.html index 88b408a..f8b61da 100644 --- a/src/app/modules/admin/pages/page-tableau/page-tableau.component.html +++ b/src/app/modules/admin/pages/page-tableau/page-tableau.component.html @@ -19,12 +19,12 @@ {{products.name}} {{products.price}} {{products.quantity}} - {{products.instock}} - + {{products.inStock}} + {{products.category}} {{products.rating}} - +