get all start
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
<div class="card">
|
||||||
|
<div nz-row [nzGutter]="10" style="gap: 30px">
|
||||||
|
@for (customer of customers(); track customer.id)
|
||||||
|
{
|
||||||
|
<nz-card style="width:400px;">
|
||||||
|
<h2 style="text-align: center; font-weight: bold">Utilisateur n°{{ customer.id }}</h2>
|
||||||
|
<p>Nom/Prénom : {{ customer.name }} {{ customer.firstName }}</p>
|
||||||
|
<p>Téléphone : {{ customer.phone }}</p>
|
||||||
|
<p>Email : {{ customer.email }}</p>
|
||||||
|
<p>Adresse : {{ customer.address }}</p>
|
||||||
|
<p>Note : {{ customer.note }}</p>
|
||||||
|
</nz-card>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import {Component, inject, signal} from '@angular/core';
|
||||||
|
import {Router} from "@angular/router";
|
||||||
|
import {firstValueFrom} from "rxjs";
|
||||||
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-customers-get-all',
|
||||||
|
imports: [],
|
||||||
|
templateUrl: './customers-get-all.html',
|
||||||
|
styleUrl: './customers-get-all.css',
|
||||||
|
})
|
||||||
|
export class CustomersGetAll {
|
||||||
|
private customerService = inject(CustomersService);
|
||||||
|
private notificationService = inject(NzNotificationService)
|
||||||
|
|
||||||
|
router = inject(Router);
|
||||||
|
|
||||||
|
customers = signal<GetCustomerDto[]>([]);
|
||||||
|
customersLoading = signal<boolean>(false);
|
||||||
|
async ngOnInit() {
|
||||||
|
await this.fetchCustomers();
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchCustomers() {
|
||||||
|
this.customersLoading.set(true);
|
||||||
|
try {
|
||||||
|
const customer = await firstValueFrom(this.customerService.getAllCustomersEndpoint())
|
||||||
|
this.customers.set(customer)
|
||||||
|
} catch (e)
|
||||||
|
{
|
||||||
|
this.notificationService.error('Erreur', 'Erreur de communication avec l\'API');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.customersLoading.set(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1,3 @@
|
|||||||
<app-customers-card-form/>
|
<app-customers-card-form/>
|
||||||
|
|
||||||
|
<app-customers-get-all/>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import {CustomersCardForm} from "./customers-card-form/customers-card-form";
|
import {CustomersCardForm} from "./customers-card-form/customers-card-form";
|
||||||
|
import {CustomersGetAll} from "./customers-get-all/customers-get-all";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-customers',
|
selector: 'app-customers',
|
||||||
imports: [
|
imports: [
|
||||||
CustomersCardForm
|
CustomersCardForm,
|
||||||
|
CustomersGetAll
|
||||||
],
|
],
|
||||||
templateUrl: './customers.html',
|
templateUrl: './customers.html',
|
||||||
styleUrl: './customers.css',
|
styleUrl: './customers.css',
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<p>providers-get-all works!</p>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import {Component, inject, signal} from '@angular/core';
|
||||||
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
|
import {Router} from "@angular/router";
|
||||||
|
import {firstValueFrom} from "rxjs";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-providers-get-all',
|
||||||
|
imports: [],
|
||||||
|
templateUrl: './providers-get-all.html',
|
||||||
|
styleUrl: './providers-get-all.css',
|
||||||
|
})
|
||||||
|
export class ProvidersGetAll {
|
||||||
|
private providersService = inject(ProvidersService);
|
||||||
|
private notificationService = inject(NzNotificationService)
|
||||||
|
|
||||||
|
router = inject(Router);
|
||||||
|
|
||||||
|
providers = signal<GetProviderDto[]>([]);
|
||||||
|
providersLoading = signal<boolean>(false);
|
||||||
|
async ngOnInit() {
|
||||||
|
await this.fetchProviders();
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchProviders() {
|
||||||
|
this.providersLoading.set(true);
|
||||||
|
try {
|
||||||
|
const providers = await firstValueFrom(this.providersService.getAllProvidersEndpoint())
|
||||||
|
this.providers.set(providers)
|
||||||
|
} catch (e)
|
||||||
|
{
|
||||||
|
this.notificationService.error('Erreur', 'Erreur de communication avec l\'API');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.providersLoading.set(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1,3 @@
|
|||||||
<app-providers-card-form/>
|
<app-providers-card-form/>
|
||||||
|
|
||||||
|
<app-providers-get-all/>
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import {ProvidersCardForm} from "./providers-card-form/providers-card-form";
|
import {ProvidersCardForm} from "./providers-card-form/providers-card-form";
|
||||||
|
import {ProvidersGetAll} from "./providers-get-all/providers-get-all";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-providers',
|
selector: 'app-providers',
|
||||||
imports: [
|
imports: [
|
||||||
ProvidersCardForm
|
ProvidersCardForm,
|
||||||
|
ProvidersGetAll
|
||||||
],
|
],
|
||||||
templateUrl: './providers.html',
|
templateUrl: './providers.html',
|
||||||
styleUrl: './providers.css',
|
styleUrl: './providers.css',
|
||||||
|
|||||||
0
src/app/pages/staff/staff-get-all/staff-get-all.css
Normal file
0
src/app/pages/staff/staff-get-all/staff-get-all.css
Normal file
1
src/app/pages/staff/staff-get-all/staff-get-all.html
Normal file
1
src/app/pages/staff/staff-get-all/staff-get-all.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<p>staff-get-all works!</p>
|
||||||
11
src/app/pages/staff/staff-get-all/staff-get-all.ts
Normal file
11
src/app/pages/staff/staff-get-all/staff-get-all.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-staff-get-all',
|
||||||
|
imports: [],
|
||||||
|
templateUrl: './staff-get-all.html',
|
||||||
|
styleUrl: './staff-get-all.css',
|
||||||
|
})
|
||||||
|
export class StaffGetAll {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1 +1,3 @@
|
|||||||
<app-staff-card-form/>
|
<app-staff-card-form/>
|
||||||
|
|
||||||
|
<app-staff-get-all/>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import {StaffCardForm} from "./staff-card-form/staff-card-form";
|
import {StaffCardForm} from "./staff-card-form/staff-card-form";
|
||||||
|
import {StaffGetAll} from "./staff-get-all/staff-get-all";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-staff',
|
selector: 'app-staff',
|
||||||
imports: [
|
imports: [
|
||||||
StaffCardForm
|
StaffCardForm,
|
||||||
|
StaffGetAll
|
||||||
],
|
],
|
||||||
templateUrl: './staff.html',
|
templateUrl: './staff.html',
|
||||||
styleUrl: './staff.css',
|
styleUrl: './staff.css',
|
||||||
|
|||||||
Reference in New Issue
Block a user