mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
#1087 Add Teilabholung Create and Print Shipping Note
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
import { Component, OnInit, ChangeDetectionStrategy, Input, Output, EventEmitter } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
ChangeDetectionStrategy,
|
||||
Input,
|
||||
Output,
|
||||
EventEmitter,
|
||||
} from '@angular/core';
|
||||
import { OrderDetailsCardInput } from './order-details-card-input';
|
||||
import { ProcessingStatusNameMap } from '../../constants';
|
||||
import { OrderItemProcessingStatusValue } from '@swagger/oms';
|
||||
@@ -17,7 +24,10 @@ export class ShelfOrderDetailsCardComponent implements OnInit {
|
||||
const copy = new Map(ProcessingStatusNameMap);
|
||||
|
||||
if (this.orderDetails) {
|
||||
if (this.orderDetails.processingStatus === 16 || this.orderDetails.processingStatus === 8192) {
|
||||
if (
|
||||
this.orderDetails.processingStatus === 16 ||
|
||||
this.orderDetails.processingStatus === 8192
|
||||
) {
|
||||
copy.delete(128);
|
||||
}
|
||||
if (this.orderDetails.processingStatus >= 0) {
|
||||
@@ -25,6 +35,10 @@ export class ShelfOrderDetailsCardComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.showCreateShippingNote) {
|
||||
copy.set(256, this.getUpdatedPickUpOption(copy.get(256)));
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
@@ -51,6 +65,8 @@ export class ShelfOrderDetailsCardComponent implements OnInit {
|
||||
@Input()
|
||||
orderDetails: OrderDetailsCardInput;
|
||||
|
||||
@Input() showCreateShippingNote = false;
|
||||
|
||||
@Output()
|
||||
changeProcessingStatus = new EventEmitter<OrderItemProcessingStatusValue>();
|
||||
|
||||
@@ -63,4 +79,11 @@ export class ShelfOrderDetailsCardComponent implements OnInit {
|
||||
constructor(private dateAdapter: DateAdapter<Date>) {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
private getUpdatedPickUpOption(
|
||||
option: { value: string; disabled: boolean },
|
||||
text = 'abgeholt und Lieferschein drucken'
|
||||
) {
|
||||
return { ...option, value: text };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
</div>
|
||||
<app-shelf-order-details-card
|
||||
[orderDetails]="orderDetailsCard$ | async"
|
||||
[showCreateShippingNote]="showPickUpAndPrintCta$ | async"
|
||||
(changeEstimatedDeliveryDate)="changeEstimatedShippingDate($event)"
|
||||
(changeProcessingStatus)="changeProcessingStatus($event)"
|
||||
(changePickUpDeadline)="changePickupDeadline($event)"
|
||||
|
||||
@@ -166,26 +166,26 @@ export class ShelfOrderDetailsComponent {
|
||||
map((details) => details.processingStatus === 128) // wenn eingetroffen(=128)
|
||||
);
|
||||
|
||||
private readonly showPartialPickIp$ = combineLatest([
|
||||
private readonly showPartialPickUp$ = combineLatest([
|
||||
this.orderDetailsCard$,
|
||||
this.orderItems$,
|
||||
]).pipe(
|
||||
map(([details, items]) => {
|
||||
return (
|
||||
details.processingStatus === 128 &&
|
||||
(items.length > 1 || items.some((i) => i.quantity > 1))
|
||||
(items.length > 1 || items.some((i) => i.quantity > 1)) &&
|
||||
!this.partialPickup
|
||||
);
|
||||
}) // wenn eingetroffen(=128) und mehr als 1 Artikel
|
||||
);
|
||||
|
||||
showPickUpCta$ = this.showPickUp$.pipe(
|
||||
withLatestFrom(this.isPaid$),
|
||||
map(([showPickUp, isPaid]) => !!showPickUp && !isPaid)
|
||||
withLatestFrom(this.isPaid$, this.showPartialPickUp$),
|
||||
map(([showPickUp, isPaid, showPartialPickUp]) => !!showPickUp && !isPaid)
|
||||
);
|
||||
|
||||
showPickUpPartialCollectCta$ = this.showPartialPickIp$.pipe(
|
||||
withLatestFrom(this.isPaid$),
|
||||
map(([showPartialPickUp, isPaid]) => !!showPartialPickUp && !isPaid) //
|
||||
showPickUpPartialCollectCta$ = this.showPartialPickUp$.pipe(
|
||||
map((showPartialPickUp) => !!showPartialPickUp) //
|
||||
);
|
||||
|
||||
showPickUpAndPrintCta$ = this.showPickUp$.pipe(
|
||||
@@ -231,8 +231,14 @@ export class ShelfOrderDetailsComponent {
|
||||
createShippingNote?: boolean;
|
||||
} = {}
|
||||
) {
|
||||
const shouldCreateShippingNote =
|
||||
(await this.showPickUpAndPrintCta$.pipe(take(1)).toPromise()) ||
|
||||
data.createShippingNote;
|
||||
|
||||
console.log({ shouldCreateShippingNote });
|
||||
this.statusChangeInProgress$.next(true);
|
||||
let items = await this.orderItems$.pipe(first()).toPromise();
|
||||
|
||||
let results: ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[];
|
||||
let navigate = true;
|
||||
if (this.partialPickup) {
|
||||
@@ -253,7 +259,7 @@ export class ShelfOrderDetailsComponent {
|
||||
this.quantityForPartialPickup
|
||||
);
|
||||
|
||||
if (data.createShippingNote) {
|
||||
if (shouldCreateShippingNote) {
|
||||
const subSetIdsForWhichToCreateShippingNotes = this.getSubsetIdsForWhichToCreateShippingNotes(
|
||||
items
|
||||
);
|
||||
@@ -267,7 +273,9 @@ export class ShelfOrderDetailsComponent {
|
||||
const allPaymentReceipts = items.reduce(
|
||||
(acc, curr) => [
|
||||
...acc,
|
||||
...curr.receipts.filter((receipt) => receipt.receiptType === 1),
|
||||
...(curr.receipts || []).filter(
|
||||
(receipt) => receipt.receiptType === 1
|
||||
),
|
||||
],
|
||||
[]
|
||||
);
|
||||
@@ -391,7 +399,9 @@ export class ShelfOrderDetailsComponent {
|
||||
): number[] {
|
||||
return items
|
||||
.filter(
|
||||
(item) => !item.receipts.some((receipt) => receipt.receiptType === 1)
|
||||
(item) =>
|
||||
Array.isArray(item.receipts) &&
|
||||
item.receipts.some((receipt) => receipt.receiptType === 1)
|
||||
)
|
||||
.map((result) => result.orderItemSubsetId);
|
||||
}
|
||||
|
||||
@@ -15,18 +15,11 @@ import {
|
||||
ChangeDetectionStrategy,
|
||||
} from '@angular/core';
|
||||
import { SearchStateFacade } from 'apps/sales/src/app/store/customer';
|
||||
import {
|
||||
first,
|
||||
takeUntil,
|
||||
map,
|
||||
debounceTime,
|
||||
filter,
|
||||
withLatestFrom,
|
||||
} from 'rxjs/operators';
|
||||
import { first, takeUntil, map, withLatestFrom } from 'rxjs/operators';
|
||||
import { groupBy } from 'apps/sales/src/app/utils';
|
||||
import { OrderItemListItemDTO } from '@swagger/oms';
|
||||
import { ShelfNavigationService } from '../../shared/services';
|
||||
import { Store, Select } from '@ngxs/store';
|
||||
import { Select } from '@ngxs/store';
|
||||
import { ProcessSelectors } from 'apps/sales/src/app/core/store/selectors/process.selectors';
|
||||
import { ORDER_DETAILS_PREFIX } from './order-details-prefix';
|
||||
|
||||
@@ -57,8 +50,7 @@ export class ShelfSearchResultsComponent implements OnInit, OnDestroy {
|
||||
|
||||
constructor(
|
||||
private searchStateFacade: SearchStateFacade,
|
||||
private shelfNavigationService: ShelfNavigationService,
|
||||
private store: Store
|
||||
private shelfNavigationService: ShelfNavigationService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
Reference in New Issue
Block a user