uptading Supplier Page
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<form nz-form nzLayout="horizontal" [formGroup]="supplierForm" (ngSubmit)="submitForm()">
|
||||
<form nz-form nzLayout="horizontal" [formGroup]="supplierForm">
|
||||
|
||||
<nz-form-item nz-flex>
|
||||
<nz-form-label nzSpan="9" nzRequired>
|
||||
@@ -54,13 +54,4 @@
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
|
||||
<nz-form-item nz-flex>
|
||||
<nz-form-label nzSpan="9" nzRequired>
|
||||
Produits
|
||||
</nz-form-label>
|
||||
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
||||
<input nz-input placeholder="Produits" formControlName="product">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {Component, input} from '@angular/core';
|
||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||
import {GetSupplierDto} from "../../services/api";
|
||||
|
||||
@Component({
|
||||
selector: 'app-supplier-form',
|
||||
@@ -28,18 +29,8 @@ export class SupplierForm {
|
||||
address: new FormControl<string>(null, [Validators.required]),
|
||||
city: new FormControl<string>(null, [Validators.required]),
|
||||
deliveryDelay: new FormControl<string>(null, [Validators.required]),
|
||||
product: new FormControl<string>(null, [Validators.required]),
|
||||
|
||||
})
|
||||
supplier= input.required<GetSupplierDto>()
|
||||
|
||||
submitForm() {
|
||||
// Pour annuler si le formulaire est invalide
|
||||
if (this.supplierForm.invalid) return;
|
||||
|
||||
// Pour obtenir la valeur du formulaire
|
||||
console.log(this.supplierForm.getRawValue())
|
||||
|
||||
// Pour vider le formulaire
|
||||
this.supplierForm.reset()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user