uptading Supplier Page

This commit is contained in:
Enzo
2025-11-27 18:52:30 +01:00
parent 8aef9f628b
commit b55bdedc20
8 changed files with 148 additions and 203 deletions

View File

@@ -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>

View File

@@ -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()
}
}