added stock-form for change minimale quantity
This commit is contained in:
38
src/app/components/stock-form/stock-form.ts
Normal file
38
src/app/components/stock-form/stock-form.ts
Normal file
@@ -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<number>(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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user