added loan's forms

This commit is contained in:
2025-11-11 15:40:33 +01:00
parent 2ca124589a
commit 48b4c778ea
16 changed files with 497 additions and 4 deletions

View File

@@ -0,0 +1,41 @@
import { Component } from '@angular/core';
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid";
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
import {NzInputDirective} from "ng-zorro-antd/input";
@Component({
selector: 'app-update-loan',
imports: [
FormsModule,
NzColDirective,
NzFormControlComponent,
NzFormDirective,
NzFormItemComponent,
NzFormLabelComponent,
NzInputDirective,
NzRowDirective,
ReactiveFormsModule
],
templateUrl: './update-loan.html',
styleUrl: './update-loan.css',
})
export class UpdateLoan {
updateLoanForm = new FormGroup({
name: new FormControl<string>(null, [Validators.required]),
book: new FormControl<string>(null, [Validators.required]),
plannedDate: new FormControl(null, [Validators.required]),
effectiveDate: new FormControl(null, [Validators.required]),
})
submitForm() {
// Pour annuler si le formulaire est invalide
if (this.updateLoanForm.invalid) return;
// Pour obtenir la valeur du formulaire
console.log(this.updateLoanForm.getRawValue())
// Pour vider le formulaire
this.updateLoanForm.reset()
}
}