From 9ffaa62e0ff0f1e143dc4ea45bd69497ee90a65b Mon Sep 17 00:00:00 2001 From: HarmandI Date: Mon, 21 Mar 2022 13:04:19 +0100 Subject: [PATCH] composant plantForm + model --- .../formulaire/formulaire.component.html | 127 +++++++++++++++++- .../formulaire/formulaire.component.ts | 12 +- src/app/modules/admin/models/category.spec.ts | 7 + src/app/modules/admin/models/category.ts | 3 + src/app/modules/admin/models/plant.spec.ts | 7 + src/app/modules/admin/models/plant.ts | 14 ++ 6 files changed, 164 insertions(+), 6 deletions(-) create mode 100644 src/app/modules/admin/models/category.spec.ts create mode 100644 src/app/modules/admin/models/category.ts create mode 100644 src/app/modules/admin/models/plant.spec.ts create mode 100644 src/app/modules/admin/models/plant.ts diff --git a/src/app/modules/admin/components/formulaire/formulaire.component.html b/src/app/modules/admin/components/formulaire/formulaire.component.html index a68eae0..0b8b45e 100644 --- a/src/app/modules/admin/components/formulaire/formulaire.component.html +++ b/src/app/modules/admin/components/formulaire/formulaire.component.html @@ -1 +1,126 @@ -

formulaire works!

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + + +
diff --git a/src/app/modules/admin/components/formulaire/formulaire.component.ts b/src/app/modules/admin/components/formulaire/formulaire.component.ts index 034de40..d3730f6 100644 --- a/src/app/modules/admin/components/formulaire/formulaire.component.ts +++ b/src/app/modules/admin/components/formulaire/formulaire.component.ts @@ -1,15 +1,17 @@ import { Component, OnInit } from '@angular/core'; +import { FormGroup } from '@angular/forms'; @Component({ selector: 'app-formulaire', templateUrl: './formulaire.component.html', - styleUrls: ['./formulaire.component.scss'] + styleUrls: ['./formulaire.component.scss'], }) export class FormulaireComponent implements OnInit { + plantForm!: FormGroup; + constructor() {} - constructor() { } - - ngOnInit(): void { - } + ngOnInit(): void {} + onSubmit(){} } + diff --git a/src/app/modules/admin/models/category.spec.ts b/src/app/modules/admin/models/category.spec.ts new file mode 100644 index 0000000..484f29f --- /dev/null +++ b/src/app/modules/admin/models/category.spec.ts @@ -0,0 +1,7 @@ +import { Category } from './category'; + +describe('Category', () => { + it('should create an instance', () => { + expect(new Category()).toBeTruthy(); + }); +}); diff --git a/src/app/modules/admin/models/category.ts b/src/app/modules/admin/models/category.ts new file mode 100644 index 0000000..29df5ac --- /dev/null +++ b/src/app/modules/admin/models/category.ts @@ -0,0 +1,3 @@ +export class Category { + name: string[]=['plantes vertes']; +} diff --git a/src/app/modules/admin/models/plant.spec.ts b/src/app/modules/admin/models/plant.spec.ts new file mode 100644 index 0000000..37ee9d8 --- /dev/null +++ b/src/app/modules/admin/models/plant.spec.ts @@ -0,0 +1,7 @@ +import { Plant } from './plant'; + +describe('Plant', () => { + it('should create an instance', () => { + expect(new Plant()).toBeTruthy(); + }); +}); diff --git a/src/app/modules/admin/models/plant.ts b/src/app/modules/admin/models/plant.ts new file mode 100644 index 0000000..e334571 --- /dev/null +++ b/src/app/modules/admin/models/plant.ts @@ -0,0 +1,14 @@ +import { Category } from "./category"; + +export class Plant { + constructor( + public name: string='', + public price: number =1, + public quantity: number= 0, + public instock: boolean= true, + public category:Category, + public urlPicture: string = "https//picsum.photos/id/18/200/300", + public rating: number = 0, + public id?: number + ){} +}