diff --git a/src/app/components/stock-form/stock-form.css b/src/app/components/stock-form/stock-form.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/stock-form/stock-form.html b/src/app/components/stock-form/stock-form.html new file mode 100644 index 0000000..d9bcb69 --- /dev/null +++ b/src/app/components/stock-form/stock-form.html @@ -0,0 +1,12 @@ +
+ + + + Quantité minimale du produit + + + + + + +
\ No newline at end of file diff --git a/src/app/components/stock-form/stock-form.ts b/src/app/components/stock-form/stock-form.ts new file mode 100644 index 0000000..c378450 --- /dev/null +++ b/src/app/components/stock-form/stock-form.ts @@ -0,0 +1,38 @@ +import { Component } from '@angular/core'; +import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms"; +import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; +import {NzInputDirective} from "ng-zorro-antd/input"; +import {NzColDirective} from "ng-zorro-antd/grid"; +import {NzFlexDirective} from "ng-zorro-antd/flex"; + +@Component({ + selector: 'app-stock-form', + imports: [ + NzFormItemComponent, + NzFormLabelComponent, + NzFormControlComponent, + NzInputDirective, + NzColDirective, + NzFormDirective, + ReactiveFormsModule, + NzFlexDirective + ], + templateUrl: './stock-form.html', + styleUrl: './stock-form.css', +}) +export class StockForm { + stockForm = new FormGroup({ + minQuantity: new FormControl(null, [Validators.required]) + }) + + submitForm() { + // Pour annuler si le formulaire est invalide + if (this.stockForm.invalid) return; + + // Pour obtenir la valeur du formulaire + console.log(this.stockForm.getRawValue()) + + // Pour vider le formulaire + this.stockForm.reset() + } +} \ No newline at end of file diff --git a/src/app/compontents/stock-table/stock-table.css b/src/app/components/stock-table/stock-table.css similarity index 100% rename from src/app/compontents/stock-table/stock-table.css rename to src/app/components/stock-table/stock-table.css diff --git a/src/app/compontents/stock-table/stock-table.html b/src/app/components/stock-table/stock-table.html similarity index 88% rename from src/app/compontents/stock-table/stock-table.html rename to src/app/components/stock-table/stock-table.html index 1f3da5f..ab29132 100644 --- a/src/app/compontents/stock-table/stock-table.html +++ b/src/app/components/stock-table/stock-table.html @@ -23,7 +23,9 @@ {{data.minimalQuantity}}
- + + +
diff --git a/src/app/compontents/stock-table/stock-table.ts b/src/app/components/stock-table/stock-table.ts similarity index 86% rename from src/app/compontents/stock-table/stock-table.ts rename to src/app/components/stock-table/stock-table.ts index c7bc3dc..2edec1b 100644 --- a/src/app/compontents/stock-table/stock-table.ts +++ b/src/app/components/stock-table/stock-table.ts @@ -1,15 +1,17 @@ import { Component } from '@angular/core'; import {StockInfo} from "../../interfaces/stock.interface"; import {NzTableComponent} from "ng-zorro-antd/table"; -import {ModalNav} from "../../components/modalNav/modalNav"; +import {ModalNav} from "../modalNav/modalNav"; import {NzIconDirective} from "ng-zorro-antd/icon"; +import {StockForm} from "../stock-form/stock-form"; @Component({ selector: 'app-stock-table', imports: [ NzTableComponent, ModalNav, - NzIconDirective + NzIconDirective, + StockForm ], templateUrl: './stock-table.html', styleUrl: './stock-table.css', diff --git a/src/app/pages/stock/stock.ts b/src/app/pages/stock/stock.ts index 4e6ca6e..829cc3b 100644 --- a/src/app/pages/stock/stock.ts +++ b/src/app/pages/stock/stock.ts @@ -1,10 +1,10 @@ import { Component } from '@angular/core'; -import {StockTable} from "../../compontents/stock-table/stock-table"; +import {StockTable} from "../../components/stock-table/stock-table"; @Component({ selector: 'app-stock', imports: [ - StockTable + StockTable, ], templateUrl: './stock.html', styleUrl: './stock.css',