55 lines
2.1 KiB
TypeScript
55 lines
2.1 KiB
TypeScript
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<number>(null, [Validators.required]),
|
|
quotationId: new FormControl<number>(null),
|
|
quotationMessage: new FormControl<string>(null),
|
|
quotationConditionsSale: new FormControl<string>(null),
|
|
productId: new FormControl<number>(null),
|
|
productReferences: new FormControl<number>(null),
|
|
productName: new FormControl<string>(null),
|
|
productDuration: new FormControl<number>(null),
|
|
productCaliber: new FormControl<number>(null),
|
|
productApprovalNumber: new FormControl<number>(null),
|
|
productWeight: new FormControl<number>(null),
|
|
productNec: new FormControl<number>(null),
|
|
productImage: new FormControl<string>(null),
|
|
productLink: new FormControl<string>(null),
|
|
productMinimalQuantity: new FormControl<number>(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()
|
|
}
|
|
}
|