added patch in delivery note page
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
</nz-form-label>
|
</nz-form-label>
|
||||||
|
|
||||||
<nz-form-control nzSpan="12">
|
<nz-form-control nzSpan="12">
|
||||||
<nz-date-picker formControlName="realDate"></nz-date-picker>
|
<nz-date-picker formControlName="realDeliveryDate"></nz-date-picker>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
</form>
|
</form>
|
||||||
@@ -31,7 +31,7 @@ export class DelivereryNoteForm {
|
|||||||
deliverer: new FormControl<string>(null,[Validators.required]),
|
deliverer: new FormControl<string>(null,[Validators.required]),
|
||||||
expeditionDate: new FormControl(null,[Validators.required]),
|
expeditionDate: new FormControl(null,[Validators.required]),
|
||||||
estimatedDate: new FormControl(null),
|
estimatedDate: new FormControl(null),
|
||||||
realDate: new FormControl(null)
|
realDeliveryDate: new FormControl(null)
|
||||||
})
|
})
|
||||||
|
|
||||||
private deliverersService = inject(DeliverersService);
|
private deliverersService = inject(DeliverersService);
|
||||||
|
|||||||
@@ -24,7 +24,8 @@
|
|||||||
<td>
|
<td>
|
||||||
<app-modal-button type="link" name="Voir les produits">
|
<app-modal-button type="link" name="Voir les produits">
|
||||||
<div style="max-height: 400px; overflow-y: auto;">
|
<div style="max-height: 400px; overflow-y: auto;">
|
||||||
<nz-table [nzData]="deliveryNotes()">
|
<nz-table [nzData]="deliveryNotes()"
|
||||||
|
[nzFrontPagination]="false">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="text-center">
|
<tr class="text-center">
|
||||||
<th>Réference</th>
|
<th>Réference</th>
|
||||||
@@ -47,6 +48,10 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="justify-content: center; display: flex">
|
<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-divider nzType="vertical"></nz-divider>
|
||||||
<app-modal-nav nameIcon="edit" name="Modification du bon de livraison" class="cursor-pointer">
|
<app-modal-nav nameIcon="edit" name="Modification du bon de livraison" class="cursor-pointer">
|
||||||
<app-deliverery-note-form></app-deliverery-note-form>
|
<app-deliverery-note-form></app-deliverery-note-form>
|
||||||
</app-modal-nav>
|
</app-modal-nav>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {DelivereryNoteForm} from "../deliverery-note-form/deliverery-note-form";
|
|||||||
import {DeliverynotesService, GetDeliveryNoteDto} from "../../services/api";
|
import {DeliverynotesService, GetDeliveryNoteDto} from "../../services/api";
|
||||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
import {firstValueFrom} from "rxjs";
|
import {firstValueFrom} from "rxjs";
|
||||||
|
import {format} from "date-fns";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-deliverery-note-table',
|
selector: 'app-deliverery-note-table',
|
||||||
@@ -25,7 +26,7 @@ import {firstValueFrom} from "rxjs";
|
|||||||
styleUrl: './deliverery-note-table.css',
|
styleUrl: './deliverery-note-table.css',
|
||||||
})
|
})
|
||||||
export class DelivereryNoteTable implements OnInit {
|
export class DelivereryNoteTable implements OnInit {
|
||||||
private DeliveryNotesService = inject(DeliverynotesService);
|
private deliveryNotesService = inject(DeliverynotesService);
|
||||||
private notificationService = inject(NzNotificationService)
|
private notificationService = inject(NzNotificationService)
|
||||||
deliveryNotes = signal<GetDeliveryNoteDto[]>([]);
|
deliveryNotes = signal<GetDeliveryNoteDto[]>([]);
|
||||||
deliveryNotesLoading = signal<boolean>(false);
|
deliveryNotesLoading = signal<boolean>(false);
|
||||||
@@ -38,7 +39,7 @@ export class DelivereryNoteTable implements OnInit {
|
|||||||
this.deliveryNotesLoading.set(true)
|
this.deliveryNotesLoading.set(true)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const deliveryNotes = await firstValueFrom(this.DeliveryNotesService.getAllDeliveryNoteEndpoint())
|
const deliveryNotes = await firstValueFrom(this.deliveryNotesService.getAllDeliveryNoteEndpoint())
|
||||||
this.deliveryNotes.set(deliveryNotes);
|
this.deliveryNotes.set(deliveryNotes);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.notificationService.error(
|
this.notificationService.error(
|
||||||
@@ -51,7 +52,7 @@ export class DelivereryNoteTable implements OnInit {
|
|||||||
|
|
||||||
async delete(deliveryNote:number) {
|
async delete(deliveryNote:number) {
|
||||||
try {
|
try {
|
||||||
await firstValueFrom(this.DeliveryNotesService.deleteDeliveryNoteEndpoint(deliveryNote));
|
await firstValueFrom(this.deliveryNotesService.deleteDeliveryNoteEndpoint(deliveryNote));
|
||||||
this.notificationService.success(
|
this.notificationService.success(
|
||||||
'Success',
|
'Success',
|
||||||
'Suppression effectuée'
|
'Suppression effectuée'
|
||||||
@@ -65,6 +66,35 @@ export class DelivereryNoteTable implements OnInit {
|
|||||||
await this.fetchDeliveryNotes();
|
await this.fetchDeliveryNotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async validate(deliveryNote:number) {
|
||||||
|
try {
|
||||||
|
const PatchRealDate = {
|
||||||
|
realDeliveryDate: format(new Date(), 'yyyy-MM-dd')
|
||||||
|
};
|
||||||
|
|
||||||
|
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'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.notificationService.error(
|
||||||
|
'Erreur',
|
||||||
|
'Erreur d\'actualisation de la date'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.fetchDeliveryNotes()
|
||||||
|
}
|
||||||
|
|
||||||
export(deliveryNote: number) {
|
export(deliveryNote: number) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user