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"; import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; @Component({ selector: 'app-quotation-form', imports: [ NzFormItemComponent, NzFormLabelComponent, NzFormControlComponent, NzInputDirective, NzColDirective, NzFlexDirective, NzFormDirective, ReactiveFormsModule, NzDatePickerComponent ], templateUrl: './quotation-form.html', styleUrl: './quotation-form.css', }) export class QuotationForm { QuotationForm: FormGroup = new FormGroup({ quantity: new FormControl(null, [Validators.required]), quotationId: new FormControl(null), quotationMessage: new FormControl(null), quotationConditionsSale: new FormControl(null), productId: new FormControl(null), productReferences: new FormControl(null), productName: new FormControl(null), productDuration: new FormControl(null), productCaliber: new FormControl(null), productApprovalNumber: new FormControl(null), productWeight: new FormControl(null), productNec: new FormControl(null), productImage: new FormControl(null), productLink: new FormControl(null), productMinimalQuantity: new FormControl(null) }) submitForm() { // Pour annuler si le formulaire est invalide if (this.QuotationForm.invalid) return; // Pour obtenir la valeur du formulaire console.log(this.QuotationForm.getRawValue()) // Pour vider le formulaire this.QuotationForm.reset() } }