Refactor code
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
<div class="header-container">
|
||||
<!-- LOGO -->
|
||||
<div class="logo">
|
||||
<a routerLink="/welcome">
|
||||
<a routerLink="/dashboard">
|
||||
<img
|
||||
src="https://www.pyro-fetes.com/wp-content/themes/pcptheme/img/logo-pyro-fetes-OR-top.png"
|
||||
alt="logo"
|
||||
|
||||
@@ -4,11 +4,11 @@ export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
pathMatch: 'full',
|
||||
redirectTo: '/welcome'
|
||||
redirectTo: '/dashboard'
|
||||
},
|
||||
{
|
||||
path: 'welcome',
|
||||
loadComponent: () => import('./pages/welcome/welcome').then(x => x.Welcome)
|
||||
path: 'dashboard',
|
||||
loadComponent: () => import('./pages/dashboard/dashboard').then(x => x.Dashboard)
|
||||
},
|
||||
{
|
||||
path: 'stock',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, inject, OnInit, output, signal} from '@angular/core';
|
||||
import {Component, inject, OnInit, signal} from '@angular/core';
|
||||
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||
|
||||
@@ -9,7 +9,6 @@ import {DelivererForm} from "../deliverer-form/deliverer-form";
|
||||
import {DeliverersService, GetDelivererDto, GetSupplierDto} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
import {SupplierForm} from "../supplier-form/supplier-form";
|
||||
|
||||
@Component({
|
||||
selector: 'app-deliverer-table',
|
||||
@@ -29,9 +28,10 @@ import {SupplierForm} from "../supplier-form/supplier-form";
|
||||
export class DelivererTable implements OnInit {
|
||||
private deliverersService = inject(DeliverersService);
|
||||
private notificationService = inject(NzNotificationService)
|
||||
|
||||
deliverers = signal<GetDelivererDto[]>([]);
|
||||
deliverersLoading = signal<boolean>(false);
|
||||
updateDeliverer = viewChild.required<DelivererForm>('delivererForm');
|
||||
|
||||
modal = viewChild.required<ModalNav>('modalNav');
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -44,11 +44,8 @@ export class DelivererTable implements OnInit {
|
||||
try {
|
||||
const deliverers = await firstValueFrom(this.deliverersService.getAllDelivererEndpoint())
|
||||
this.deliverers.set(deliverers);
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur de communication avec l\'API'
|
||||
)
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors du chargement des transporteurs');
|
||||
}
|
||||
this.deliverersLoading.set(false)
|
||||
}
|
||||
@@ -56,11 +53,8 @@ export class DelivererTable implements OnInit {
|
||||
async delete(deliverer: number) {
|
||||
try {
|
||||
await firstValueFrom(this.deliverersService.deleteDelivererEndpoint(deliverer))
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Suppression effectuée'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.success('Success', 'Suppression effectuée');
|
||||
} catch {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de supprimer la ligne'
|
||||
@@ -71,10 +65,7 @@ export class DelivererTable implements OnInit {
|
||||
|
||||
async edit(id: number, updateDelivererComponent: DelivererForm) {
|
||||
if (updateDelivererComponent.delivererForm.invalid) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'écriture dans le formulaire'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Formulaire invalide');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -83,7 +74,7 @@ export class DelivererTable implements OnInit {
|
||||
await firstValueFrom(this.deliverersService.updateDelivererEndpoint(id, deliverers))
|
||||
|
||||
this.notificationService.success('Success', 'Transporteur modifié')
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
||||
}
|
||||
}
|
||||
@@ -100,7 +91,7 @@ export class DelivererTable implements OnInit {
|
||||
|
||||
await this.edit(supplierId, updateDelivererComponent);
|
||||
updateDelivererComponent.delivererForm.reset();
|
||||
modal.isVisible = false;
|
||||
this.onModalCancel(modal);
|
||||
await this.fetchDeliverers();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</nz-form-label>
|
||||
|
||||
<nz-form-control nzSpan="9" nzErrorTip="Ce champ est requis">
|
||||
<nz-select formControlName="delivererId" [nzPlaceHolder]="'Choisir un transporteur'" nzShowSearch>
|
||||
<nz-select formControlName="delivererId" nzPlaceHolder="Choisir un transporteur" nzShowSearch>
|
||||
@for (deliverer of deliverers(); track deliverer.id) {
|
||||
<nz-option [nzValue]="deliverer.id" [nzLabel]="deliverer.transporter"></nz-option>
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export class DelivereryNoteForm implements OnInit {
|
||||
try {
|
||||
const deliverers = await firstValueFrom(this.deliverersService.getAllDelivererEndpoint());
|
||||
this.deliverers.set(deliverers);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de récupérer les transporteurs');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,15 +28,14 @@ export class DelivereryNoteTable implements OnInit {
|
||||
private deliveryNotesService = inject(DeliverynotesService);
|
||||
private notificationService = inject(NzNotificationService);
|
||||
private fileService = inject(FileService);
|
||||
|
||||
deliveryNotes = signal<GetDeliveryNoteDto[]>([]);
|
||||
deliveryNotesLoading = signal<boolean>(false);
|
||||
modal = viewChild.required<ModalNav>('modalNav');
|
||||
|
||||
date: string = "";
|
||||
modal = viewChild.required<ModalNav>('modalNav');
|
||||
|
||||
async ngOnInit() {
|
||||
await this.fetchDeliveryNotes();
|
||||
this.date = new Date().toISOString().split('T')[0];
|
||||
}
|
||||
|
||||
async fetchDeliveryNotes() {
|
||||
@@ -44,11 +43,8 @@ export class DelivereryNoteTable implements OnInit {
|
||||
try {
|
||||
const deliveryNotes = await firstValueFrom(this.deliveryNotesService.getAllDeliveryNoteEndpoint());
|
||||
this.deliveryNotes.set(deliveryNotes);
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur de communication avec l\'API'
|
||||
)
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors du chargement des bons de livraison');
|
||||
}
|
||||
this.deliveryNotesLoading.set(false)
|
||||
}
|
||||
@@ -57,15 +53,9 @@ export class DelivereryNoteTable implements OnInit {
|
||||
this.deliveryNotesLoading.set(true)
|
||||
try {
|
||||
await firstValueFrom(this.deliveryNotesService.deleteDeliveryNoteEndpoint(deliveryNote));
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Suppression effectuée'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de supprimer la ligne'
|
||||
)
|
||||
this.notificationService.success('Success', 'Suppression effectuée');
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de supprimer la ligne');
|
||||
}
|
||||
this.deliveryNotesLoading.set(false)
|
||||
await this.fetchDeliveryNotes();
|
||||
@@ -80,22 +70,12 @@ export class DelivereryNoteTable implements OnInit {
|
||||
|
||||
try {
|
||||
await firstValueFrom(this.deliveryNotesService.patchRealDeliveryDateEndpoint(deliveryNote, PatchRealDate))
|
||||
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Date actualisée'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'La date à déjà été actualisée'
|
||||
)
|
||||
this.notificationService.success('Success', 'Date actualisée');
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'La date à déjà été actualisée');
|
||||
}
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'actualisation de la date'
|
||||
)
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur d\'actualisation de la date');
|
||||
}
|
||||
this.deliveryNotesLoading.set(false)
|
||||
await this.fetchDeliveryNotes()
|
||||
@@ -104,15 +84,10 @@ export class DelivereryNoteTable implements OnInit {
|
||||
async export(deliveryNoteId: number) {
|
||||
this.deliveryNotesLoading.set(true)
|
||||
try {
|
||||
const pdf = await firstValueFrom(
|
||||
this.deliveryNotesService.getDeliveryNotePdfEndpoint(deliveryNoteId, "response")
|
||||
);
|
||||
const pdf = await firstValueFrom(this.deliveryNotesService.getDeliveryNotePdfEndpoint(deliveryNoteId, "response"));
|
||||
this.fileService.downloadBlob(pdf)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de générer un PDF'
|
||||
);
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de générer un PDF');
|
||||
}
|
||||
this.deliveryNotesLoading.set(false)
|
||||
}
|
||||
@@ -139,7 +114,7 @@ export class DelivereryNoteTable implements OnInit {
|
||||
|
||||
await firstValueFrom(this.deliveryNotesService.updateDeliveryNoteEndpoint(id, deliveryNoteDto));
|
||||
this.notificationService.success('Success', 'Bon de livraison modifié');
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la modification');
|
||||
}
|
||||
}
|
||||
@@ -156,7 +131,7 @@ export class DelivereryNoteTable implements OnInit {
|
||||
|
||||
await this.edit(id, updateDelivereryNoteComponent);
|
||||
updateDelivereryNoteComponent.deliveryNoteForm.reset();
|
||||
modal.isVisible = false;
|
||||
this.onModalCancel(modal);
|
||||
await this.fetchDeliveryNotes();
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,7 @@ export class DeliveryValidator implements OnInit {
|
||||
const wareHouses = await firstValueFrom(this.warehousesService.getAllWarehouseEndpoint());
|
||||
this.wareHouses.set(wareHouses);
|
||||
} catch {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur de communication avec l\'API'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Erreur lors du chargement des quantitées')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,10 +52,7 @@ export class DeliveryValidator implements OnInit {
|
||||
const deliveries = await firstValueFrom(this.deliveryNotesService.getAllDeliveryNotesNotArrivedEndpoint());
|
||||
this.deliveryNotes.set(deliveries);
|
||||
} catch {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur de communication avec l\'API'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Erreur lors du chargement des bon de livraison')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,11 +70,8 @@ export class DeliveryValidator implements OnInit {
|
||||
realDeliveryDate: format(new Date(), 'yyyy-MM-dd')
|
||||
};
|
||||
await firstValueFrom(this.deliveryNotesService.patchRealDeliveryDateEndpoint(id, PatchRealDate));
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur de communication avec l\'API',
|
||||
)
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible d\'actualiser la date')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,18 +89,12 @@ export class DeliveryValidator implements OnInit {
|
||||
));
|
||||
}
|
||||
|
||||
this.notificationService.success(
|
||||
'Succès',
|
||||
'Les produits sont bien ajoutés au stock'
|
||||
)
|
||||
this.notificationService.success('Succès', 'Les produits sont bien ajoutés au stock')
|
||||
|
||||
modal.isVisible = false;
|
||||
await this.fetchDeliveryNotes();
|
||||
} catch {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Vous devez choisir un entrepôt',
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Vous devez choisir un entrepôt')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, input, Input, output} from '@angular/core';
|
||||
import {Component, input, output} from '@angular/core';
|
||||
import {NzModalComponent} from "ng-zorro-antd/modal";
|
||||
import {NzButtonComponent} from "ng-zorro-antd/button";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, Input, input, output} from '@angular/core';
|
||||
import {Component, input, output} from '@angular/core';
|
||||
import {NzButtonModule} from 'ng-zorro-antd/button';
|
||||
import {NzModalModule} from 'ng-zorro-antd/modal';
|
||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||
|
||||
@@ -4,7 +4,7 @@ import {NzColDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||
import {GetPriceDto, GetSupplierDto} from "../../services/api";
|
||||
import {GetPriceDto} from "../../services/api";
|
||||
|
||||
@Component({
|
||||
selector: 'app-price-form',
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<form nz-form nzLayout="horizontal" [formGroup]="productForm">
|
||||
<nz-form-item nz-flex>
|
||||
<nz-form-label nzSpan="9" nzRequired>
|
||||
Prix
|
||||
</nz-form-label>
|
||||
|
||||
<nz-form-control nzSpan="8" nzErrorTip="Ce champ est requis">
|
||||
<input nz-input placeholder="Prix" formControlName="price">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
|
||||
<nz-form-item nz-flex>
|
||||
<nz-form-label nzSpan="9" nzRequired>
|
||||
Quantité
|
||||
</nz-form-label>
|
||||
|
||||
<nz-form-control nzSpan="8" nzErrorTip="Ce champ est requis">
|
||||
<input nz-input placeholder="Quantité" formControlName="quantity">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</form>
|
||||
@@ -1,29 +0,0 @@
|
||||
import {Component} from '@angular/core';
|
||||
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||
|
||||
@Component({
|
||||
selector: 'app-product-form',
|
||||
imports: [
|
||||
FormsModule,
|
||||
NzColDirective,
|
||||
NzFlexDirective,
|
||||
NzFormControlComponent,
|
||||
NzFormDirective,
|
||||
NzFormItemComponent,
|
||||
NzFormLabelComponent,
|
||||
NzInputDirective,
|
||||
ReactiveFormsModule
|
||||
],
|
||||
templateUrl: './product-form.html',
|
||||
styleUrl: './product-form.css',
|
||||
})
|
||||
export class ProductForm {
|
||||
productForm: FormGroup = new FormGroup({
|
||||
price: new FormControl<string>(null, [Validators.required]),
|
||||
quantity: new FormControl<string>(null, [Validators.required])
|
||||
})
|
||||
}
|
||||
@@ -56,11 +56,8 @@ export class PurchaseOrderTable implements OnInit {
|
||||
try {
|
||||
const purchaseOrders = await firstValueFrom(this.purchaseOrdersService.getAllPurchaseOrderEndpoint())
|
||||
this.purchaseOrders.set(purchaseOrders);
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur de communication avec l\'API'
|
||||
)
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors du chargement des bons de commande')
|
||||
}
|
||||
this.purchaseOrdersLoading.set(false)
|
||||
}
|
||||
@@ -69,15 +66,9 @@ export class PurchaseOrderTable implements OnInit {
|
||||
this.purchaseOrdersLoading.set(true)
|
||||
try {
|
||||
await firstValueFrom(this.purchaseOrdersService.deletePurchaseOrderEndpoint(purchaseOrderId))
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Suppression effectuée'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de supprimer la ligne'
|
||||
)
|
||||
this.notificationService.success('Success', 'Suppression effectuée')
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de supprimer la ligne')
|
||||
}
|
||||
this.purchaseOrdersLoading.set(false)
|
||||
await this.fetchPurchaseOrder();
|
||||
@@ -90,11 +81,8 @@ export class PurchaseOrderTable implements OnInit {
|
||||
this.purchaseOrdersService.getPurchaseOrderPdfEndpoint(purchaseOrderId, "response")
|
||||
);
|
||||
this.fileService.downloadBlob(pdf)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de générer un PDF'
|
||||
);
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de générer un PDF');
|
||||
}
|
||||
this.purchaseOrdersLoading.set(false)
|
||||
}
|
||||
@@ -138,10 +126,7 @@ export class PurchaseOrderTable implements OnInit {
|
||||
|
||||
async edit(id: number, updatePurchaseOrderComponent: PurchaseOrderForm) {
|
||||
if (updatePurchaseOrderComponent.purchaseOrderForm.invalid) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'écriture dans le formulaire'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Formulaire invalide')
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -150,7 +135,7 @@ export class PurchaseOrderTable implements OnInit {
|
||||
await firstValueFrom(this.purchaseOrdersService.patchPurchaseOrderPurchaseConditionsEndpoint(id, purchaseOrders))
|
||||
|
||||
this.notificationService.success('Success', 'Bon de commande modifié')
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
||||
}
|
||||
}
|
||||
@@ -159,15 +144,9 @@ export class PurchaseOrderTable implements OnInit {
|
||||
this.purchaseOrdersLoading.set(true)
|
||||
try {
|
||||
await firstValueFrom(this.purchaseOrdersService.deleteProductFromPurchaseOrderEndpoint(productId, purchaseOrderId))
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Suppression effectuée'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de supprimer la ligne'
|
||||
)
|
||||
this.notificationService.success('Success', 'Suppression effectuée')
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de supprimer la ligne')
|
||||
}
|
||||
this.purchaseOrdersLoading.set(false)
|
||||
await this.fetchPurchaseOrder();
|
||||
@@ -175,10 +154,7 @@ export class PurchaseOrderTable implements OnInit {
|
||||
|
||||
async editQuantity(productId: number, purchaseOrderId: number, updateQuantityComponent: QuantityForm) {
|
||||
if (updateQuantityComponent.quantityForm.invalid) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'écriture dans le formulaire'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Erreur d\'écriture dans le formulaire')
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -209,7 +185,7 @@ export class PurchaseOrderTable implements OnInit {
|
||||
|
||||
await this.edit(id, updatePurchaseOrderComponent);
|
||||
updatePurchaseOrderComponent.purchaseOrderForm.reset();
|
||||
modal.isVisible = false;
|
||||
this.onModalCancel(modal);
|
||||
await this.fetchPurchaseOrder();
|
||||
}
|
||||
|
||||
@@ -229,7 +205,7 @@ export class PurchaseOrderTable implements OnInit {
|
||||
|
||||
await this.editQuantity(productId, purchaseOrderId, updateQuantityComponent);
|
||||
updateQuantityComponent.quantityForm.reset();
|
||||
modal.isVisible = false;
|
||||
this.onModalCancel(modal);
|
||||
await this.fetchPurchaseOrder();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import {NzColDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||
import {GetDelivererDto, GetPurchaseProductDto} from "../../services/api";
|
||||
import {GetPurchaseProductDto} from "../../services/api";
|
||||
|
||||
@Component({
|
||||
selector: 'app-quantity-form',
|
||||
|
||||
@@ -34,8 +34,10 @@ export class QuotationTable implements OnInit {
|
||||
private quotationsService = inject(QuotationsService);
|
||||
private notificationService = inject(NzNotificationService);
|
||||
private fileService = inject(FileService);
|
||||
|
||||
quotations = signal<GetQuotationDto[]>([]);
|
||||
quotationsLoading = signal<boolean>(false);
|
||||
|
||||
modal = viewChild.required<ModalNav>('modalNav');
|
||||
modalQuantity = viewChild.required<ModalNav>('modalQuantity');
|
||||
|
||||
@@ -49,11 +51,8 @@ export class QuotationTable implements OnInit {
|
||||
try {
|
||||
const quotations = await firstValueFrom(this.quotationsService.getAllQuotationEndpoint())
|
||||
this.quotations.set(quotations);
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur de communication avec l\'API'
|
||||
)
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors du chargement des devis')
|
||||
}
|
||||
this.quotationsLoading.set(false)
|
||||
}
|
||||
@@ -62,15 +61,9 @@ export class QuotationTable implements OnInit {
|
||||
this.quotationsLoading.set(true)
|
||||
try {
|
||||
await firstValueFrom(this.quotationsService.deleteQuotationEndpoint(quotation))
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Suppression effectuée'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de supprimer la ligne'
|
||||
)
|
||||
this.notificationService.success('Success', 'Suppression effectuée')
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de supprimer la ligne')
|
||||
}
|
||||
this.quotationsLoading.set(false)
|
||||
await this.fetchQuotations();
|
||||
@@ -83,12 +76,8 @@ export class QuotationTable implements OnInit {
|
||||
this.quotationsService.getQuotationPdfEndpoint(quotationId, "response")
|
||||
);
|
||||
this.fileService.downloadBlob(pdf)
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de générer un PDF'
|
||||
);
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de générer un PDF');
|
||||
}
|
||||
this.quotationsLoading.set(false)
|
||||
}
|
||||
@@ -103,8 +92,7 @@ export class QuotationTable implements OnInit {
|
||||
const quotations = updateQuotationComponent.quotationForm.getRawValue();
|
||||
await firstValueFrom(this.quotationsService.updateQuotationEndpoint(id, quotations));
|
||||
this.notificationService.success('Success', 'Devis modifié')
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
||||
}
|
||||
}
|
||||
@@ -113,15 +101,9 @@ export class QuotationTable implements OnInit {
|
||||
this.quotationsLoading.set(true)
|
||||
try {
|
||||
await firstValueFrom(this.quotationsService.deleteProductFromQuotationEndpoint(productId, quotationId))
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Suppression effectuée'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de supprimer la ligne'
|
||||
)
|
||||
this.notificationService.success('Success', 'Suppression effectuée')
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de supprimer la ligne')
|
||||
}
|
||||
this.quotationsLoading.set(false)
|
||||
await this.fetchQuotations();
|
||||
@@ -129,10 +111,7 @@ export class QuotationTable implements OnInit {
|
||||
|
||||
async editQuantity(productId: number, quotationId: number, updateQuantityComponent: QuantityForm) {
|
||||
if (updateQuantityComponent.quantityForm.invalid) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'écriture dans le formulaire'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Formulaire invalide')
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -141,7 +120,7 @@ export class QuotationTable implements OnInit {
|
||||
await firstValueFrom(this.quotationsService.patchQuotationProductQuantityEndpoint(productId, quotationId, quantity))
|
||||
|
||||
this.notificationService.success('Success', 'Quantité modifiée')
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
||||
}
|
||||
}
|
||||
@@ -158,7 +137,7 @@ export class QuotationTable implements OnInit {
|
||||
|
||||
await this.edit(id, updateQuotationComponent);
|
||||
updateQuotationComponent.quotationForm.reset();
|
||||
modal.isVisible = false;
|
||||
this.onModalCancel(modal);
|
||||
await this.fetchQuotations();
|
||||
}
|
||||
|
||||
@@ -178,7 +157,7 @@ export class QuotationTable implements OnInit {
|
||||
|
||||
await this.editQuantity(productId, quotationId, updateQuantityComponent);
|
||||
updateQuantityComponent.quantityForm.reset();
|
||||
modal.isVisible = false;
|
||||
this.onModalCancel(modal);
|
||||
await this.fetchQuotations();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,10 +49,7 @@ export class SettingForm implements OnInit {
|
||||
const settingsPicture = await firstValueFrom(this.settingsService.getSettingEndpoint());
|
||||
this.settings.set(settingsPicture);
|
||||
} catch {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Aucun paramètre défini'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Aucun paramètre défini')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +75,7 @@ export class SettingForm implements OnInit {
|
||||
}
|
||||
await this.fetchSettings();
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', "Erreur de communication avec l'API");
|
||||
this.notificationService.error('Erreur', 'Impossible de changer les paramètres actuellement');
|
||||
}
|
||||
|
||||
this.settingForm.reset();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</nz-form-label>
|
||||
|
||||
<nz-form-control nzSpan="4" nzErrorTip="Requis">
|
||||
<input nz-input type="number" placeholder="12345" formControlName="minimalQuantity">
|
||||
<input nz-input type="number" placeholder="0" formControlName="minimalQuantity">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</form>
|
||||
@@ -76,7 +76,7 @@ export class StockTable implements OnInit {
|
||||
);
|
||||
this.products.set(productsWithQuantity);
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur de communication avec l\'API');
|
||||
this.notificationService.error('Erreur', 'Impossible de charger le catalogue');
|
||||
}
|
||||
this.productsLoading.set(false);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ export class StockTable implements OnInit {
|
||||
|
||||
async edit(id: number, updateProductComponent: StockForm) {
|
||||
if (updateProductComponent.stockForm.invalid) {
|
||||
this.notificationService.error('Erreur', 'Erreur d\'écriture dans le formulaire')
|
||||
this.notificationService.error('Erreur', 'Formulaire invalide')
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -115,7 +115,7 @@ export class StockTable implements OnInit {
|
||||
if (!this.selectedProduct) return;
|
||||
await this.edit(productId, updateProductComponent);
|
||||
updateProductComponent.stockForm.reset();
|
||||
modal.isVisible = false;
|
||||
this.onModalCancel(modal);
|
||||
await this.fetchProducts();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<nz-table [nzData]="filteredSuppliers()"
|
||||
<nz-table [nzData]="suppliers()"
|
||||
[nzLoading]="suppliersLoading()"
|
||||
[nzFrontPagination]="false">
|
||||
<thead>
|
||||
@@ -15,7 +15,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="text-align: center">
|
||||
@for (supplier of filteredSuppliers(); track supplier.id) {
|
||||
@for (supplier of suppliers(); track supplier.id) {
|
||||
<tr>
|
||||
<td>{{ supplier.name }}</td>
|
||||
<td>{{ supplier.phone }}</td>
|
||||
@@ -26,7 +26,7 @@
|
||||
<td>{{ supplier.deliveryDelay }} jours</td>
|
||||
<td>
|
||||
<app-modal-button type="link" [name]="'Voir les produits'" size="45%">
|
||||
<nz-table [nzData]="filteredSuppliers()" [nzFrontPagination]="false">
|
||||
<nz-table [nzData]="suppliers()" [nzFrontPagination]="false">
|
||||
<thead>
|
||||
<tr class="text-center">
|
||||
<th>Produit</th>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, computed, inject, OnInit, signal, viewChild} from '@angular/core';
|
||||
import {Component, inject, OnInit, signal, viewChild} from '@angular/core';
|
||||
import {ModalNav} from "../modal-nav/modal-nav";
|
||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||
@@ -29,11 +29,13 @@ export class SupplierTable implements OnInit {
|
||||
private suppliersService = inject(SuppliersService);
|
||||
private pricesService = inject(PricesService);
|
||||
private notificationService = inject(NzNotificationService);
|
||||
|
||||
suppliers = signal<GetSupplierDto[]>([]);
|
||||
suppliersLoading = signal<boolean>(false);
|
||||
updateSupplier = viewChild.required<SupplierForm>('supplierForm');
|
||||
|
||||
supplierModal = viewChild.required<ModalNav>('supplierModal');
|
||||
productModal = viewChild.required<ModalNav>('productModal');
|
||||
|
||||
selectedSupplier: GetSupplierDto | null = null;
|
||||
selectedProduct: GetPriceDto | null = null;
|
||||
selectedProductSupplierId: number | null = null;
|
||||
@@ -42,29 +44,12 @@ export class SupplierTable implements OnInit {
|
||||
await this.fetchSuppliers();
|
||||
}
|
||||
|
||||
private searchQuery = signal<string>('');
|
||||
|
||||
filteredSuppliers = computed(() => {
|
||||
const q = this.searchQuery().toLowerCase().trim();
|
||||
|
||||
if (!q) return this.suppliers();
|
||||
|
||||
return this.suppliers().filter(s => {
|
||||
const name = (s.name ?? '').toLowerCase();
|
||||
return name.includes(q);
|
||||
});
|
||||
});
|
||||
|
||||
applySearch(query: string) {
|
||||
this.searchQuery.set(query);
|
||||
}
|
||||
|
||||
async fetchSuppliers() {
|
||||
this.suppliersLoading.set(true);
|
||||
try {
|
||||
const suppliers = await firstValueFrom(this.suppliersService.getAllSuppliersEndpoint());
|
||||
this.suppliers.set(suppliers);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur de communication avec l\'API');
|
||||
}
|
||||
this.suppliersLoading.set(false);
|
||||
@@ -79,8 +64,7 @@ export class SupplierTable implements OnInit {
|
||||
const suppliers = updateSupplierComponent.supplierForm.getRawValue();
|
||||
await firstValueFrom(this.suppliersService.updateSupplierEndpoint(id, suppliers));
|
||||
this.notificationService.success('Success', 'Fournisseur modifié');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la modification');
|
||||
}
|
||||
}
|
||||
@@ -90,7 +74,7 @@ export class SupplierTable implements OnInit {
|
||||
await firstValueFrom(this.suppliersService.deleteSupplierEndpoint(supplier));
|
||||
this.notificationService.success('Succès', 'Suppression effectuée');
|
||||
await this.fetchSuppliers();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de supprimer la ligne');
|
||||
}
|
||||
}
|
||||
@@ -122,13 +106,13 @@ export class SupplierTable implements OnInit {
|
||||
modal: ModalNav
|
||||
) {
|
||||
if (productId == null || supplierId == null || !this.selectedProduct) {
|
||||
this.notificationService.error('Erreur', 'Identifiants produit/fournisseur manquants');
|
||||
this.notificationService.error('Erreur', 'Identifiants produit ou fournisseur manquants');
|
||||
return;
|
||||
}
|
||||
|
||||
await this.editPrice(productId, supplierId, updateProductComponent);
|
||||
updateProductComponent.priceForm.reset();
|
||||
modal.isVisible = false;
|
||||
this.onModalCancel(modal);
|
||||
await this.fetchSuppliers();
|
||||
}
|
||||
|
||||
@@ -150,8 +134,7 @@ export class SupplierTable implements OnInit {
|
||||
};
|
||||
await firstValueFrom(this.pricesService.patchPriceEndpoint(productId, supplierId, body));
|
||||
this.notificationService.success('Success', 'Prix modifié');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la modification');
|
||||
}
|
||||
}
|
||||
@@ -162,7 +145,7 @@ export class SupplierTable implements OnInit {
|
||||
await firstValueFrom(this.suppliersService.deleteProductToSupplierEndpoint(idSupplier, idProduct));
|
||||
this.notificationService.success('Succès', 'Produit supprimé');
|
||||
await this.fetchSuppliers();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de supprimer le produit');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,10 @@ import {firstValueFrom} from "rxjs";
|
||||
export class UserTable implements OnInit {
|
||||
private usersService = inject(UsersService);
|
||||
private notificationService = inject(NzNotificationService)
|
||||
|
||||
users = signal<GetUserDto[]>([]);
|
||||
usersLoading = signal<boolean>(false);
|
||||
updateUser = viewChild.required<ProfilForm>('profilForm');
|
||||
|
||||
modal = viewChild.required<ModalNav>('modalNav');
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -38,11 +39,8 @@ export class UserTable implements OnInit {
|
||||
try {
|
||||
const users = await firstValueFrom(this.usersService.getAllUsersEndpoint())
|
||||
this.users.set(users);
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur de communication avec l\'API'
|
||||
)
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de charger les utilisateurs')
|
||||
}
|
||||
this.usersLoading.set(false)
|
||||
}
|
||||
@@ -50,25 +48,16 @@ export class UserTable implements OnInit {
|
||||
async delete(user: number) {
|
||||
try {
|
||||
await firstValueFrom(this.usersService.deleteUserEndpoint(user))
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Suppression effectuée'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de supprimer la ligne'
|
||||
)
|
||||
this.notificationService.success('Success', 'Suppression effectuée')
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Impossible de supprimer la ligne')
|
||||
}
|
||||
await this.fetchUsers();
|
||||
}
|
||||
|
||||
async edit(id: number, updateUserComponent: ProfilForm) {
|
||||
if (updateUserComponent.profilForm.invalid) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'écriture dans le formulaire'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Formulaire invalide')
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,15 +65,9 @@ export class UserTable implements OnInit {
|
||||
const users = updateUserComponent.profilForm.getRawValue();
|
||||
await firstValueFrom(this.usersService.updateUserEndpoint(id, users))
|
||||
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Utilisateur modifié'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur lors de la modification'
|
||||
)
|
||||
this.notificationService.success('Success', 'Utilisateur modifié')
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,15 +83,11 @@ export class UserTable implements OnInit {
|
||||
|
||||
await this.edit(userId, updateUserComponent);
|
||||
updateUserComponent.profilForm.reset();
|
||||
modal.isVisible = false;
|
||||
this.onModalCancel(modal);
|
||||
await this.fetchUsers();
|
||||
}
|
||||
|
||||
onModalCancel(modal: ModalNav) {
|
||||
modal.isVisible = false;
|
||||
}
|
||||
|
||||
filterUser(input: string, option: any) {
|
||||
return option.nzLabel.toLowerCase().includes(input.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,16 +7,16 @@ import {firstValueFrom} from "rxjs";
|
||||
import {StockAlert} from "../../services/stock.alert";
|
||||
|
||||
@Component({
|
||||
selector: 'app-welcome',
|
||||
selector: 'app-dashboard',
|
||||
imports: [
|
||||
InfoCard,
|
||||
DeliveryValidator,
|
||||
],
|
||||
templateUrl: './welcome.html',
|
||||
styleUrl: './welcome.css'
|
||||
templateUrl: './dashboard.html',
|
||||
styleUrl: './dashboard.css'
|
||||
})
|
||||
|
||||
export class Welcome {
|
||||
export class Dashboard {
|
||||
private productsService = inject(ProductsService);
|
||||
private deliverersService = inject(DeliverersService);
|
||||
private suppliersService = inject(SuppliersService);
|
||||
@@ -32,8 +32,8 @@ export class Welcome {
|
||||
try {
|
||||
const deliverers = await firstValueFrom(this.deliverersService.getAllDelivererEndpoint());
|
||||
this.deliversCount.set(deliverers.length);
|
||||
} catch (e) {
|
||||
this.notificationsService.error('Error', 'Error while getting deliverers.');
|
||||
} catch {
|
||||
this.notificationsService.error('Erreur', 'Impossible de charger les transporteurs');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export class Welcome {
|
||||
this.suppliers.set(suppliers);
|
||||
this.suppliersCount.set(suppliers.length);
|
||||
} catch {
|
||||
this.notificationsService.error('Error', 'Error while getting suppliers.');
|
||||
this.notificationsService.error('Erreur', 'Impossible de charger les fournisseurs');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,11 +52,8 @@ export class Welcome {
|
||||
const products = await firstValueFrom(this.productsService.getAllProductsUnderLimitEndpoint());
|
||||
this.productsUnderLimitCount.set(products.length);
|
||||
await this.stockAlertService.generatePurchaseOrder(products, this.suppliers());
|
||||
} catch (e) {
|
||||
this.notificationsService.error(
|
||||
'Error',
|
||||
'Error while getting products.',
|
||||
)
|
||||
} catch {
|
||||
this.notificationsService.error('Error', 'Impossible de charger les produits.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class Deliverer {
|
||||
async onModalOk() {
|
||||
await this.addDeliverer()
|
||||
this.createDeliverer().delivererForm.reset();
|
||||
this.modal().isVisible = false;
|
||||
this.onModalCancel();
|
||||
await this.delivererTable().fetchDeliverers()
|
||||
}
|
||||
|
||||
@@ -36,24 +36,15 @@ export class Deliverer {
|
||||
|
||||
async addDeliverer() {
|
||||
if (this.createDeliverer().delivererForm.invalid) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'écriture dans le formulaire'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Formulaire invalide')
|
||||
}
|
||||
try {
|
||||
const deliverers = this.createDeliverer().delivererForm.getRawValue();
|
||||
await firstValueFrom(this.deliverersService.createDelivererEndpoint(deliverers))
|
||||
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Transporteur enregistré'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'enregistrement'
|
||||
)
|
||||
this.notificationService.success('Success', 'Transporteur enregistré')
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur d\'enregistrement')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export class Stock implements OnInit {
|
||||
const suppliers = await firstValueFrom(this.suppliersService.getAllSuppliersEndpoint());
|
||||
this.suppliers.set(suppliers);
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur de communication avec l\'API');
|
||||
this.notificationService.error('Erreur', 'Impossible de charger les fournisseurs');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export class Supplier {
|
||||
async onModalOk() {
|
||||
await this.addSupplier()
|
||||
this.createSupplier().supplierForm.reset();
|
||||
this.modal().isVisible = false;
|
||||
this.onModalCancel();
|
||||
await this.supplierTable().fetchSuppliers()
|
||||
}
|
||||
|
||||
@@ -36,24 +36,15 @@ export class Supplier {
|
||||
|
||||
async addSupplier() {
|
||||
if (this.createSupplier().supplierForm.invalid) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'écriture dans le formulaire'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Formulaire invalide')
|
||||
}
|
||||
try {
|
||||
const suppliers = this.createSupplier().supplierForm.getRawValue();
|
||||
await firstValueFrom(this.suppliersService.createSupplierEndpoint(suppliers))
|
||||
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Fournisseur enregistré'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'enregistrement'
|
||||
)
|
||||
this.notificationService.success('Success', 'Fournisseur enregistré')
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur d\'enregistrement')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class User {
|
||||
async onModalOk() {
|
||||
await this.addUser()
|
||||
this.createUser().profilForm.reset();
|
||||
this.modal().isVisible = false;
|
||||
this.onModalCancel();
|
||||
await this.usersTable().fetchUsers()
|
||||
}
|
||||
|
||||
@@ -36,24 +36,15 @@ export class User {
|
||||
|
||||
async addUser() {
|
||||
if (this.createUser().profilForm.invalid) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'écriture dans le formulaire'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Formulaire invalide')
|
||||
}
|
||||
try {
|
||||
const users = this.createUser().profilForm.getRawValue();
|
||||
await firstValueFrom(this.usersService.createUserEndpoint(users))
|
||||
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Utilisateur crée'
|
||||
)
|
||||
} catch (e) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'enregistrement'
|
||||
)
|
||||
this.notificationService.success('Success', 'Utilisateur crée')
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur d\'enregistrement')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import {Routes} from '@angular/router';
|
||||
import {Welcome} from './welcome';
|
||||
|
||||
export const WELCOME_ROUTES: Routes = [
|
||||
{path: '', component: Welcome},
|
||||
];
|
||||
Reference in New Issue
Block a user