Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # src/app/services/api/api/deliverynotes.service.ts # src/app/services/api/api/purchaseorders.service.ts # src/app/services/api/api/quotations.service.ts
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import {Component, inject, signal} from '@angular/core';
|
||||
import {Component, effect, inject, input, OnInit, signal} from '@angular/core';
|
||||
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker";
|
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select";
|
||||
import {DeliverersService, GetDelivererDto} from "../../services/api";
|
||||
import {DeliverersService, GetDelivererDto, GetDeliveryNoteDto} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
|
||||
@@ -21,13 +21,14 @@ import {firstValueFrom} from "rxjs";
|
||||
ReactiveFormsModule,
|
||||
NzDatePickerComponent,
|
||||
NzSelectComponent,
|
||||
NzOptionComponent
|
||||
NzOptionComponent,
|
||||
],
|
||||
templateUrl: './deliverery-note-form.html',
|
||||
styleUrl: './deliverery-note-form.css',
|
||||
})
|
||||
export class DelivereryNoteForm {
|
||||
export class DelivereryNoteForm implements OnInit {
|
||||
deliveryNoteForm: FormGroup = new FormGroup({
|
||||
trackingNumber: new FormControl<string>("TRK-" + Date.now),
|
||||
deliverer: new FormControl<string>(null,[Validators.required]),
|
||||
expeditionDate: new FormControl(null,[Validators.required]),
|
||||
estimatedDate: new FormControl(null),
|
||||
|
||||
@@ -48,24 +48,15 @@
|
||||
</td>
|
||||
<td>
|
||||
<div style="justify-content: center; display: flex">
|
||||
<div>
|
||||
<nz-icon nzType="check" nzTheme="outline" (click)="validate(deliveryNote.id)" class="cursor-pointer text-green-700"/>
|
||||
</div>
|
||||
<nz-icon nzType="check" nzTheme="outline" (click)="validate(deliveryNote.id)" class="cursor-pointer text-green-700"/>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<app-modal-nav nameIcon="edit" name="Modification du bon de livraison" class="cursor-pointer">
|
||||
<app-deliverery-note-form></app-deliverery-note-form>
|
||||
</app-modal-nav>
|
||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(deliveryNote.id)" class="cursor-pointer text-red-700"/>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<div>
|
||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(deliveryNote.id)" class="cursor-pointer text-red-700"/>
|
||||
</div>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<div>
|
||||
<nz-icon nzType="export" nzTheme="outline" (click)="export(deliveryNote.id)" class="cursor-pointer text-green-700"/>
|
||||
</div>
|
||||
<nz-icon nzType="export" nzTheme="outline" (click)="export(deliveryNote.id)" class="cursor-pointer text-green-700"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</nz-table>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, inject, OnInit, signal} from '@angular/core';
|
||||
import {Component, inject, OnInit, signal, viewChild} from '@angular/core';
|
||||
import {DatePipe} from "@angular/common";
|
||||
import {ModalButton} from "../modal-button/modal-button";
|
||||
import {ModalNav} from "../modal-nav/modal-nav";
|
||||
@@ -10,6 +10,7 @@ import {DeliverynotesService, GetDeliveryNoteDto} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
import {format} from "date-fns";
|
||||
import {FileService} from "../../services/file.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-deliverery-note-table',
|
||||
@@ -27,9 +28,11 @@ import {format} from "date-fns";
|
||||
})
|
||||
export class DelivereryNoteTable implements OnInit {
|
||||
private deliveryNotesService = inject(DeliverynotesService);
|
||||
private notificationService = inject(NzNotificationService)
|
||||
private notificationService = inject(NzNotificationService);
|
||||
private fileService = inject(FileService);
|
||||
deliveryNotes = signal<GetDeliveryNoteDto[]>([]);
|
||||
deliveryNotesLoading = signal<boolean>(false);
|
||||
modal = viewChild.required<ModalNav>('modalNav');
|
||||
|
||||
async ngOnInit() {
|
||||
await this.fetchDeliveryNotes();
|
||||
@@ -37,7 +40,6 @@ export class DelivereryNoteTable implements OnInit {
|
||||
|
||||
async fetchDeliveryNotes() {
|
||||
this.deliveryNotesLoading.set(true)
|
||||
|
||||
try {
|
||||
const deliveryNotes = await firstValueFrom(this.deliveryNotesService.getAllDeliveryNoteEndpoint())
|
||||
this.deliveryNotes.set(deliveryNotes);
|
||||
@@ -51,6 +53,7 @@ export class DelivereryNoteTable implements OnInit {
|
||||
}
|
||||
|
||||
async delete(deliveryNote:number) {
|
||||
this.deliveryNotesLoading.set(true)
|
||||
try {
|
||||
await firstValueFrom(this.deliveryNotesService.deleteDeliveryNoteEndpoint(deliveryNote));
|
||||
this.notificationService.success(
|
||||
@@ -63,10 +66,12 @@ export class DelivereryNoteTable implements OnInit {
|
||||
'Impossible de supprimer la ligne'
|
||||
)
|
||||
}
|
||||
this.deliveryNotesLoading.set(false)
|
||||
await this.fetchDeliveryNotes();
|
||||
}
|
||||
|
||||
async validate(deliveryNote:number) {
|
||||
this.deliveryNotesLoading.set(true)
|
||||
try {
|
||||
const PatchRealDate = {
|
||||
realDeliveryDate: format(new Date(), 'yyyy-MM-dd')
|
||||
@@ -91,11 +96,24 @@ export class DelivereryNoteTable implements OnInit {
|
||||
'Erreur d\'actualisation de la date'
|
||||
)
|
||||
}
|
||||
|
||||
this.deliveryNotesLoading.set(false)
|
||||
await this.fetchDeliveryNotes()
|
||||
}
|
||||
|
||||
export(deliveryNote: number) {
|
||||
return
|
||||
async export(deliveryNoteId: number) {
|
||||
this.deliveryNotesLoading.set(true)
|
||||
try {
|
||||
const pdf = await firstValueFrom(
|
||||
this.deliveryNotesService.getDeliveryNotePdfEndpoint(deliveryNoteId, "response")
|
||||
);
|
||||
this.fileService.downloadBlob(pdf)
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de générer un PDF'
|
||||
);
|
||||
}
|
||||
this.deliveryNotesLoading.set(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
</div>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<div>
|
||||
<nz-icon nzType="export" nzTheme="outline" (click)="export()" class="cursor-pointer text-green-700"/>
|
||||
<nz-icon nzType="export" nzTheme="outline" (click)="export(purchaseOrder.id)" class="cursor-pointer text-green-700"/>
|
||||
</div>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<div>
|
||||
|
||||
@@ -8,6 +8,7 @@ import {ModalButton} from "../modal-button/modal-button";
|
||||
import {GetPurchaseOrderDto, PurchaseordersService} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
import {FileService} from "../../services/file.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-purchase-order-table',
|
||||
@@ -24,7 +25,8 @@ import {firstValueFrom} from "rxjs";
|
||||
})
|
||||
export class PurchaseOrderTable implements OnInit {
|
||||
private purchaseOrdersService = inject(PurchaseordersService);
|
||||
private notificationService = inject(NzNotificationService)
|
||||
private notificationService = inject(NzNotificationService);
|
||||
private fileService = inject(FileService);
|
||||
purchaseOrders = signal<GetPurchaseOrderDto[]>([]);
|
||||
purchaseOrdersLoading = signal<boolean>(false);
|
||||
|
||||
@@ -48,6 +50,7 @@ export class PurchaseOrderTable implements OnInit {
|
||||
}
|
||||
|
||||
async delete(purchaseOrderId:number) {
|
||||
this.purchaseOrdersLoading.set(true)
|
||||
try {
|
||||
await firstValueFrom(this.purchaseOrdersService.deletePurchaseOrderEndpoint(purchaseOrderId))
|
||||
this.notificationService.success(
|
||||
@@ -60,11 +63,25 @@ export class PurchaseOrderTable implements OnInit {
|
||||
'Impossible de supprimer la ligne'
|
||||
)
|
||||
}
|
||||
this.purchaseOrdersLoading.set(false)
|
||||
await this.fetchPurchaseOrder();
|
||||
}
|
||||
|
||||
export(){
|
||||
return
|
||||
async export(purchaseOrderId: number){
|
||||
this.purchaseOrdersLoading.set(true)
|
||||
try {
|
||||
const pdf = await firstValueFrom(
|
||||
this.purchaseOrdersService.getPurchaseOrderPdfEndpoint(purchaseOrderId, "response")
|
||||
);
|
||||
this.fileService.downloadBlob(pdf)
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de générer un PDF'
|
||||
);
|
||||
}
|
||||
this.purchaseOrdersLoading.set(false)
|
||||
}
|
||||
|
||||
transfer() {
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
</div>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<div>
|
||||
<nz-icon nzType="export" nzTheme="outline" class="cursor-pointer text-green-700"/>
|
||||
<nz-icon nzType="export" (click)="export(quotation.id)" nzTheme="outline" class="cursor-pointer text-green-700"/>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -8,6 +8,7 @@ import {QuotationForm} from "../quotation-form/quotation-form";
|
||||
import {GetQuotationDto, QuotationsService} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
import {FileService} from "../../services/file.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-quotation-table',
|
||||
@@ -25,7 +26,8 @@ import {firstValueFrom} from "rxjs";
|
||||
|
||||
export class QuotationTable implements OnInit {
|
||||
private quotationsService = inject(QuotationsService);
|
||||
private notificationService = inject(NzNotificationService)
|
||||
private notificationService = inject(NzNotificationService);
|
||||
private fileService = inject(FileService);
|
||||
quotations = signal<GetQuotationDto[]>([]);
|
||||
quotationsLoading = signal<boolean>(false);
|
||||
|
||||
@@ -49,6 +51,7 @@ export class QuotationTable implements OnInit {
|
||||
}
|
||||
|
||||
async delete(quotation:number) {
|
||||
this.quotationsLoading.set(true)
|
||||
try {
|
||||
await firstValueFrom(this.quotationsService.deleteQuotationEndpoint(quotation))
|
||||
this.notificationService.success(
|
||||
@@ -61,7 +64,25 @@ export class QuotationTable implements OnInit {
|
||||
'Impossible de supprimer la ligne'
|
||||
)
|
||||
}
|
||||
this.quotationsLoading.set(false)
|
||||
await this.fetchQuotations();
|
||||
}
|
||||
|
||||
async export(quotationId: number){
|
||||
this.quotationsLoading.set(true)
|
||||
try {
|
||||
const pdf = await firstValueFrom(
|
||||
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'
|
||||
);
|
||||
}
|
||||
this.quotationsLoading.set(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user