Staff PT1

This commit is contained in:
2026-06-07 19:06:19 +02:00
parent 0d156faead
commit 9885e4ee85
13 changed files with 253 additions and 9 deletions
+29 -5
View File
@@ -1,16 +1,40 @@
import { Component } from '@angular/core';
import {Component, inject, signal} from '@angular/core';
import {StaffCardForm} from "./staff-card-form/staff-card-form";
import {StaffGetAll} from "./staff-get-all/staff-get-all";
import {NzRowDirective} from "ng-zorro-antd/grid";
import {GetProviderDto, GetStaffDto, ServiceprovidersService, StaffsService} from "../../services/api";
import {NzNotificationService} from "ng-zorro-antd/notification";
import {Router} from "@angular/router";
import {firstValueFrom} from "rxjs";
@Component({
selector: 'app-staff',
imports: [
StaffCardForm,
StaffGetAll
],
imports: [StaffCardForm, StaffGetAll, NzRowDirective,],
templateUrl: './staff.html',
styleUrl: './staff.css',
})
export class Staff {
private staffsService = inject(StaffsService);
private notificationService = inject(NzNotificationService)
router = inject(Router);
staffs = signal<GetStaffDto[]>([]);
staffsLoading = signal<boolean>(false);
async ngOnInit() {
await this.fetchStaff();
}
async fetchStaff() {
this.staffsLoading.set(true);
try {
const staff = await firstValueFrom(this.staffsService.getAllStaffsEndpoint())
this.staffs.set(staff)
} catch (e) {
this.notificationService.error('Erreur', 'Erreur de communication avec l\'API');
}
this.staffsLoading.set(false);
}
}