providers create form added

This commit is contained in:
2025-11-27 16:42:53 +01:00
parent 6235df5482
commit 20ddd65dc3
21 changed files with 422 additions and 0 deletions
@@ -0,0 +1,34 @@
import { Component } from '@angular/core';
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
import {NzFormModule} from "ng-zorro-antd/form";
import {NzInputDirective} from "ng-zorro-antd/input";
import {NzFlexDirective} from "ng-zorro-antd/flex";
import {NzButtonComponent} from "ng-zorro-antd/button";
@Component({
selector: 'app-providers-add-form',
imports: [ReactiveFormsModule, NzFormModule, NzInputDirective,],
templateUrl: './providers-add-form.html',
styleUrl: './providers-add-form.css',
})
export class ProvidersAddForm {
providerForm = new FormGroup({
lastName: new FormControl<string>(null, [Validators.required]),
firstName: new FormControl<string>(null, [Validators.required]),
phoneNumber: new FormControl<string>(null, [Validators.required]),
email: new FormControl<string>(null, [Validators.required]),
address: new FormControl<string>(null, [Validators.required]),
role: new FormControl<string>(null, [Validators.required]),
price: new FormControl<string>(null, [Validators.required]),
})
submitForm() {
// Pour annuler si le formulaire est invalide
if (this.providerForm.invalid) return;
// Pour obtenir la valeur du formulaire
console.log(this.providerForm.getRawValue())
// Pour vider le formulaire
this.providerForm.reset()
}
}