This commit is contained in:
Cristiano
2025-12-02 08:34:58 +01:00
parent 5b1030570f
commit 4b3faa236d
37 changed files with 178 additions and 495 deletions

View File

@@ -1,4 +1,4 @@
import {Component, inject, input, OnInit, signal} from '@angular/core';
import {Component, inject, input, OnChanges, OnInit, signal} 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";
@@ -26,7 +26,7 @@ import {firstValueFrom} from "rxjs";
templateUrl: './update-loan.html',
styleUrl: './update-loan.css',
})
export class UpdateLoan implements OnInit {
export class UpdateLoan implements OnInit, OnChanges {
updateLoanForm = new FormGroup({
userId: new FormControl<number>(null, Validators.required),
bookId: new FormControl<number>(null, Validators.required),
@@ -64,7 +64,7 @@ export class UpdateLoan implements OnInit {
async fetchUsers() {
try {
const users = await firstValueFrom(this.userService.getAllUsersEndpoint());
const users = await firstValueFrom(this.userService.getAllUserEndpoint());
this.users.set(users);
} catch (e) {
this.notificationService.error('Erreur', 'Impossible de récupérer les utilisateurs');
@@ -73,7 +73,7 @@ export class UpdateLoan implements OnInit {
async fetchBooks() {
try {
const books = await firstValueFrom(this.bookService.getAllBooksEndpoint());
const books = await firstValueFrom(this.bookService.getAllBookEndpoint());
this.books.set(books);
} catch (e) {
this.notificationService.error('Erreur', 'Impossible de récupérer les livres');