mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#1209 Warenausgabe: im Dropdown werden nur noch Actions mit enabled === false angezeigt, Rest als Buttons
This commit is contained in:
@@ -1,15 +1,6 @@
|
||||
import {
|
||||
Component,
|
||||
ChangeDetectionStrategy,
|
||||
Input,
|
||||
Output,
|
||||
EventEmitter,
|
||||
} from '@angular/core';
|
||||
import { Component, ChangeDetectionStrategy, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { OrderDetailsCardInput } from './order-details-card-input';
|
||||
import {
|
||||
KeyValueDTOOfStringAndString,
|
||||
OrderItemProcessingStatusValue,
|
||||
} from '@swagger/oms';
|
||||
import { KeyValueDTOOfStringAndString, OrderItemProcessingStatusValue } from '@swagger/oms';
|
||||
import { DateAdapter } from '@isa-ui/core/date';
|
||||
import { ShelfOrderDetailsService } from '../../services';
|
||||
|
||||
@@ -23,12 +14,7 @@ export class ShelfOrderDetailsCardComponent {
|
||||
minDate = this.dateAdapter.addCalendarDays(new Date(), -1);
|
||||
|
||||
get processingKeys() {
|
||||
const availableProcessStatus = this.orderDetailsService.getAvailableProcessStatus(
|
||||
this.orderDetails && this.orderDetails.processingStatus,
|
||||
this.actions
|
||||
);
|
||||
|
||||
return availableProcessStatus;
|
||||
return this.orderDetailsService.getAvailableProcessStatusRefact(this.actions.filter((a) => a.enabled === false));
|
||||
}
|
||||
|
||||
get actions(): KeyValueDTOOfStringAndString[] {
|
||||
@@ -74,8 +60,5 @@ export class ShelfOrderDetailsCardComponent {
|
||||
@Output()
|
||||
changePickUpDeadline = new EventEmitter<Date>();
|
||||
|
||||
constructor(
|
||||
private dateAdapter: DateAdapter<Date>,
|
||||
private orderDetailsService: ShelfOrderDetailsService
|
||||
) {}
|
||||
constructor(private dateAdapter: DateAdapter<Date>, private orderDetailsService: ShelfOrderDetailsService) {}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
<div class="isa-card isa-border-bottom-radius-0">
|
||||
<div
|
||||
class="isa-flex isa-align-items-center isa-justify-content-space-between isa-h-30"
|
||||
>
|
||||
<app-shelf-details-customer-features
|
||||
[customerNumber]="(orderDetailsCard$ | async)?.customerNumber"
|
||||
>
|
||||
<div class="isa-flex isa-align-items-center isa-justify-content-space-between isa-h-30">
|
||||
<app-shelf-details-customer-features [customerNumber]="(orderDetailsCard$ | async)?.customerNumber">
|
||||
</app-shelf-details-customer-features>
|
||||
<button
|
||||
type="button"
|
||||
class="isa-btn isa-btn-secondary isa-p-0 isa-h-min"
|
||||
(click)="navigateToDetails()"
|
||||
>
|
||||
<button type="button" class="isa-btn isa-btn-secondary isa-p-0 isa-h-min" (click)="navigateToDetails()">
|
||||
Bearbeiten
|
||||
</button>
|
||||
</div>
|
||||
@@ -22,14 +14,8 @@
|
||||
(changePickUpDeadline)="changePickupDeadline($event)"
|
||||
>
|
||||
</app-shelf-order-details-card>
|
||||
<div
|
||||
class="isa-flex isa-flex-direction-row-reverse isa-mb-n10"
|
||||
*ngIf="partialPickup"
|
||||
>
|
||||
<div
|
||||
class="isa-flex isa-flex-direction-column"
|
||||
*ngIf="orderItems$ | async; let orderItems"
|
||||
>
|
||||
<div class="isa-flex isa-flex-direction-row-reverse isa-mb-n10" *ngIf="partialPickup">
|
||||
<div class="isa-flex isa-flex-direction-column" *ngIf="orderItems$ | async; let orderItems">
|
||||
<button
|
||||
type="button"
|
||||
class="isa-btn isa-btn-secondary isa-mr-n10 isa-mb-7"
|
||||
@@ -46,20 +32,14 @@
|
||||
>
|
||||
Alle entfernen
|
||||
</button>
|
||||
<span class="isa-text-right">
|
||||
{{ selectedForPartialPickup.size }} von {{ orderItems?.length }} Titel
|
||||
</span>
|
||||
<span class="isa-text-right"> {{ selectedForPartialPickup.size }} von {{ orderItems?.length }} Titel </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ng-container *ngFor="let orderItem of orderItems$ | async">
|
||||
<div class="order-item-features" *ngIf="orderItem.features">
|
||||
<div class="order-item-feature" *ngIf="orderItem.features.prebooked">
|
||||
<lib-icon
|
||||
*ngIf="orderItem.features?.prebooked"
|
||||
name="tag_icon_preorder"
|
||||
height="48px"
|
||||
></lib-icon>
|
||||
<lib-icon *ngIf="orderItem.features?.prebooked" name="tag_icon_preorder" height="48px"></lib-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="isa-card isa-mt-2 isa-border-radius-0">
|
||||
@@ -72,10 +52,7 @@
|
||||
>
|
||||
</app-shelf-order-item-details>
|
||||
<div class="isa-flex isa-justify-content-flex-end isa-mt-7">
|
||||
<button
|
||||
class="isa-btn isa-btn-secondary isa-p-0 isa-h-min"
|
||||
(click)="navigateToHistory(orderItem)"
|
||||
>
|
||||
<button class="isa-btn isa-btn-secondary isa-p-0 isa-h-min" (click)="navigateToHistory(orderItem)">
|
||||
Historie
|
||||
</button>
|
||||
</div>
|
||||
@@ -90,25 +67,16 @@
|
||||
</ng-container>
|
||||
|
||||
<section *ngIf="orderDetailsCard$ | async as orderDetails">
|
||||
<div
|
||||
class="isa-card isa-mt-2 isa-border-top-radius-0"
|
||||
*ngIf="orderDetails.actions | showShelfTags"
|
||||
>
|
||||
<app-shelf-order-details-shelf-tags
|
||||
#shelfDetailsTag
|
||||
></app-shelf-order-details-shelf-tags>
|
||||
<div class="isa-card isa-mt-2 isa-border-top-radius-0" *ngIf="orderDetails.actions | showShelfTags">
|
||||
<app-shelf-order-details-shelf-tags #shelfDetailsTag></app-shelf-order-details-shelf-tags>
|
||||
</div>
|
||||
|
||||
<div class="cta-sticky isa-my-28 isa-text-center">
|
||||
<ng-container *ngFor="let action of orderDetails.actions">
|
||||
<ng-container *ngFor="let action of filterEnabledActions(orderDetails.actions)">
|
||||
<button
|
||||
#btn
|
||||
*ngIf="action | showButtonForPartialPickUp: partialPickup"
|
||||
[disabled]="
|
||||
statusChangeInProgress$
|
||||
| async
|
||||
| shelfEditActionInProgress: activeButton:btn
|
||||
"
|
||||
[disabled]="statusChangeInProgress$ | async | shelfEditActionInProgress: activeButton:btn"
|
||||
[class.isa-btn-primary]="action.selected"
|
||||
[class.isa-btn-secondary]="!action.selected"
|
||||
[class.isa-btn-outline-primary]="!action.selected"
|
||||
@@ -116,14 +84,7 @@
|
||||
(click)="handleActionClick(action, btn)"
|
||||
>
|
||||
<span>{{ action?.label }}</span>
|
||||
<div
|
||||
class="spinner isa-btn-loader"
|
||||
*ngIf="
|
||||
statusChangeInProgress$
|
||||
| async
|
||||
| shelfEditActionInProgress: activeButton:btn
|
||||
"
|
||||
></div>
|
||||
<div class="spinner isa-btn-loader" *ngIf="statusChangeInProgress$ | async | shelfEditActionInProgress: activeButton:btn"></div>
|
||||
</button>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
@@ -1,23 +1,6 @@
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
QueryList,
|
||||
ViewChild,
|
||||
ViewChildren,
|
||||
} from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, QueryList, ViewChild, ViewChildren } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import {
|
||||
map,
|
||||
switchMap,
|
||||
first,
|
||||
filter,
|
||||
flatMap,
|
||||
distinctUntilChanged,
|
||||
shareReplay,
|
||||
withLatestFrom,
|
||||
take,
|
||||
tap,
|
||||
} from 'rxjs/operators';
|
||||
import { map, switchMap, first, filter, flatMap, distinctUntilChanged, shareReplay, withLatestFrom, take, tap } from 'rxjs/operators';
|
||||
import {
|
||||
OrderItemProcessingStatusValue,
|
||||
OrderItemListItemDTO,
|
||||
@@ -67,14 +50,10 @@ export class ShelfOrderDetailsComponent {
|
||||
get processingStatusChangeData() {
|
||||
return {
|
||||
...{
|
||||
...(this.compartmentInfoFromTag
|
||||
? { compartmentInfo: this.compartmentInfoFromTag }
|
||||
: {}),
|
||||
...(this.compartmentInfoFromTag ? { compartmentInfo: this.compartmentInfoFromTag } : {}),
|
||||
},
|
||||
...{
|
||||
...(this.quantityForPartialPickup
|
||||
? { quantityForPartialPickup: this.quantityForPartialPickup }
|
||||
: {}),
|
||||
...(this.quantityForPartialPickup ? { quantityForPartialPickup: this.quantityForPartialPickup } : {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -89,9 +68,7 @@ export class ShelfOrderDetailsComponent {
|
||||
};
|
||||
}
|
||||
|
||||
processingStatus$ = this.activatedRoute.params.pipe(
|
||||
map((params) => params['processingStatus'])
|
||||
);
|
||||
processingStatus$ = this.activatedRoute.params.pipe(map((params) => params['processingStatus']));
|
||||
|
||||
partialPickup = false;
|
||||
activeButton: HTMLButtonElement;
|
||||
@@ -118,13 +95,9 @@ export class ShelfOrderDetailsComponent {
|
||||
|
||||
orderItems$ = this.getOrderItems$();
|
||||
|
||||
orderDetailsCard$ = this.orderDetailsService.orderDetailsCardFromOrderItems$(
|
||||
this.orderItems$
|
||||
);
|
||||
orderDetailsCard$ = this.orderDetailsService.orderDetailsCardFromOrderItems$(this.orderItems$);
|
||||
|
||||
showPickUpAndPrintOption$ = this.orderDetailsService.showPickUpAndPrintOption$(
|
||||
this.orderDetailsCard$
|
||||
);
|
||||
showPickUpAndPrintOption$ = this.orderDetailsService.showPickUpAndPrintOption$(this.orderDetailsCard$);
|
||||
|
||||
constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
@@ -155,6 +128,10 @@ export class ShelfOrderDetailsComponent {
|
||||
});
|
||||
}
|
||||
|
||||
filterEnabledActions(actions: KeyValueDTOOfStringAndString[]): KeyValueDTOOfStringAndString[] {
|
||||
return actions.filter((a) => !a.hasOwnProperty('enabled'));
|
||||
}
|
||||
|
||||
async changeProcessingStatus(
|
||||
status: OrderItemProcessingStatusValue,
|
||||
data: {
|
||||
@@ -165,36 +142,22 @@ export class ShelfOrderDetailsComponent {
|
||||
const items = await this.orderItems$.pipe(first()).toPromise();
|
||||
let results: ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[];
|
||||
|
||||
results = await this.orderDetailsService.setProcessingStatus(
|
||||
items,
|
||||
status,
|
||||
this.processingStatusChangeData
|
||||
);
|
||||
results = await this.orderDetailsService.setProcessingStatus(items, status, this.processingStatusChangeData);
|
||||
|
||||
if (data.shouldPrint) {
|
||||
await this.abholfachEtikettService.print(
|
||||
this.abholfachEtikettService.orderSubsetIdsForWhichToPrintAbholfachEtikett(
|
||||
items
|
||||
),
|
||||
this.abholfachEtikettService.orderSubsetIdsForWhichToPrintAbholfachEtikett(items),
|
||||
this.printData
|
||||
);
|
||||
}
|
||||
|
||||
if (data.createShippingNote) {
|
||||
const receipts = await this.shippingNoteService.create(
|
||||
this.shippingNoteService.getSubsetIdsForWhichToCreateShippingNotes(
|
||||
items
|
||||
),
|
||||
this.printData
|
||||
);
|
||||
const existingReceipts: ReceiptDTO[] = items.reduce(
|
||||
(acc, curr) => [...(acc || []), ...curr.receipts],
|
||||
[]
|
||||
);
|
||||
await this.shippingNoteService.print(
|
||||
[...existingReceipts, ...(receipts || [])],
|
||||
this.shippingNoteService.getSubsetIdsForWhichToCreateShippingNotes(items),
|
||||
this.printData
|
||||
);
|
||||
const existingReceipts: ReceiptDTO[] = items.reduce((acc, curr) => [...(acc || []), ...curr.receipts], []);
|
||||
await this.shippingNoteService.print([...existingReceipts, ...(receipts || [])], this.printData);
|
||||
}
|
||||
|
||||
this.statusChangeInProgress$.next(false);
|
||||
@@ -231,9 +194,7 @@ export class ShelfOrderDetailsComponent {
|
||||
async navigateToDetails() {
|
||||
const data = await race(
|
||||
this.orderNumber$.pipe(map((orderNumber) => ({ orderNumber }))),
|
||||
this.compartmentCode$.pipe(
|
||||
map((compartmentCode) => ({ compartmentCode }))
|
||||
)
|
||||
this.compartmentCode$.pipe(map((compartmentCode) => ({ compartmentCode })))
|
||||
)
|
||||
.pipe(
|
||||
withLatestFrom(this.processingStatus$),
|
||||
@@ -265,9 +226,7 @@ export class ShelfOrderDetailsComponent {
|
||||
})[]
|
||||
) {
|
||||
const totalQuantity = items.reduce((sum, item) => sum + item.quantity, 0);
|
||||
const totalSelected = Array.from(
|
||||
this.quantityForPartialPickup.values()
|
||||
).reduce((sum, q) => sum + q, 0);
|
||||
const totalSelected = Array.from(this.quantityForPartialPickup.values()).reduce((sum, q) => sum + q, 0);
|
||||
const shouldNavigate = totalQuantity === totalSelected;
|
||||
|
||||
return shouldNavigate;
|
||||
@@ -290,8 +249,7 @@ export class ShelfOrderDetailsComponent {
|
||||
results: ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]
|
||||
) {
|
||||
const firstItem = Array.isArray(items) && items[0];
|
||||
const firstResult =
|
||||
Array.isArray(results) && results[0] && results[0].result;
|
||||
const firstResult = Array.isArray(results) && results[0] && results[0].result;
|
||||
|
||||
if (!firstItem || !firstResult) {
|
||||
return;
|
||||
@@ -311,10 +269,7 @@ export class ShelfOrderDetailsComponent {
|
||||
);
|
||||
}
|
||||
|
||||
async handleActionClick(
|
||||
action: KeyValueDTOOfStringAndString,
|
||||
target: HTMLButtonElement
|
||||
) {
|
||||
async handleActionClick(action: KeyValueDTOOfStringAndString, target: HTMLButtonElement) {
|
||||
this.activeButton = target;
|
||||
this.setState(action);
|
||||
}
|
||||
@@ -323,9 +278,7 @@ export class ShelfOrderDetailsComponent {
|
||||
let navigate = true;
|
||||
let items = await this.orderItems$.pipe(first()).toPromise();
|
||||
let results: ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[];
|
||||
let currentReceipts: ReceiptDTO[] = this.orderDetailsService.getReceipts(
|
||||
items
|
||||
);
|
||||
let currentReceipts: ReceiptDTO[] = this.orderDetailsService.getReceipts(items);
|
||||
let remainingItemsAfterPartialRemit: (OrderItemListItemDTO & {
|
||||
receipts?: ReceiptDTO[];
|
||||
})[] = [];
|
||||
@@ -349,35 +302,24 @@ export class ShelfOrderDetailsComponent {
|
||||
return false;
|
||||
});
|
||||
|
||||
items = items.filter(({ orderItemId }) =>
|
||||
this.selectedForPartialPickup.has(orderItemId)
|
||||
);
|
||||
items = items.filter(({ orderItemId }) => this.selectedForPartialPickup.has(orderItemId));
|
||||
}
|
||||
|
||||
const actionsToTake = this.actionHandlerService.getActions(action);
|
||||
|
||||
for (const a of actionsToTake) {
|
||||
try {
|
||||
const {
|
||||
results: newResults,
|
||||
receipts: newReceipts,
|
||||
} = await this.executeAction(a, items, currentReceipts);
|
||||
const { results: newResults, receipts: newReceipts } = await this.executeAction(a, items, currentReceipts);
|
||||
|
||||
if (newResults) {
|
||||
results = newResults;
|
||||
}
|
||||
|
||||
if (Array.isArray(newReceipts)) {
|
||||
currentReceipts = Array.from(
|
||||
new Set([...(currentReceipts || []), ...(newReceipts || [])])
|
||||
);
|
||||
currentReceipts = Array.from(new Set([...(currentReceipts || []), ...(newReceipts || [])]));
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(
|
||||
`Fehler beim Aktualisieren des Postens ${
|
||||
err.message ? '(Meldung ' + err.message + ')' : ''
|
||||
})`
|
||||
);
|
||||
console.error(`Fehler beim Aktualisieren des Postens ${err.message ? '(Meldung ' + err.message + ')' : ''})`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -419,9 +361,7 @@ export class ShelfOrderDetailsComponent {
|
||||
let receipts: ReceiptDTO[];
|
||||
|
||||
if (this.actionHandlerService.shouldDetermineSupplier(command)) {
|
||||
const updatedItems = await this.orderDetailsService.setDetermineSupplier(
|
||||
items
|
||||
);
|
||||
const updatedItems = await this.orderDetailsService.setDetermineSupplier(items);
|
||||
this.navigateAfterSupplierDetermined(updatedItems);
|
||||
}
|
||||
|
||||
@@ -431,9 +371,7 @@ export class ShelfOrderDetailsComponent {
|
||||
|
||||
if (this.actionHandlerService.shouldCreateShippingNote(command)) {
|
||||
receipts = await this.shippingNoteService.create(
|
||||
this.shippingNoteService.getSubsetIdsForWhichToCreateShippingNotes(
|
||||
items
|
||||
),
|
||||
this.shippingNoteService.getSubsetIdsForWhichToCreateShippingNotes(items),
|
||||
this.printData
|
||||
);
|
||||
}
|
||||
@@ -444,9 +382,7 @@ export class ShelfOrderDetailsComponent {
|
||||
|
||||
if (this.actionHandlerService.shouldPrintAbholfachetikett(command)) {
|
||||
await this.abholfachEtikettService.print(
|
||||
this.abholfachEtikettService.orderSubsetIdsForWhichToPrintAbholfachEtikett(
|
||||
items
|
||||
),
|
||||
this.abholfachEtikettService.orderSubsetIdsForWhichToPrintAbholfachEtikett(items),
|
||||
this.printData
|
||||
);
|
||||
}
|
||||
@@ -460,38 +396,22 @@ export class ShelfOrderDetailsComponent {
|
||||
receipts?: ReceiptDTO[];
|
||||
})[]
|
||||
) {
|
||||
const targetStatus = this.actionHandlerService.getNewProcessingStatus(
|
||||
command
|
||||
);
|
||||
const results = await this.orderDetailsService.setProcessingStatus(
|
||||
items,
|
||||
targetStatus,
|
||||
this.processingStatusChangeData
|
||||
);
|
||||
const targetStatus = this.actionHandlerService.getNewProcessingStatus(command);
|
||||
const results = await this.orderDetailsService.setProcessingStatus(items, targetStatus, this.processingStatusChangeData);
|
||||
|
||||
return results.filter((result) => !!result);
|
||||
}
|
||||
|
||||
private getOrderItems$() {
|
||||
return race(
|
||||
this.orderNumber$.pipe(
|
||||
switchMap((orderNumber) =>
|
||||
this.detailsFacade.getOrderItemsByOrderNumber$(orderNumber)
|
||||
)
|
||||
),
|
||||
this.compartmentCode$.pipe(
|
||||
switchMap((compartmentCode) =>
|
||||
this.detailsFacade.getOrderItemsByCompartmentCode$(compartmentCode)
|
||||
)
|
||||
)
|
||||
this.orderNumber$.pipe(switchMap((orderNumber) => this.detailsFacade.getOrderItemsByOrderNumber$(orderNumber))),
|
||||
this.compartmentCode$.pipe(switchMap((compartmentCode) => this.detailsFacade.getOrderItemsByCompartmentCode$(compartmentCode)))
|
||||
).pipe(
|
||||
flatMap((items) =>
|
||||
this.processingStatus$.pipe(
|
||||
map((processingStatus) => {
|
||||
if (!!processingStatus) {
|
||||
return items.filter(
|
||||
(item) => item.processingStatus === +processingStatus
|
||||
);
|
||||
return items.filter((item) => item.processingStatus === +processingStatus);
|
||||
}
|
||||
return items;
|
||||
})
|
||||
@@ -506,14 +426,8 @@ export class ShelfOrderDetailsComponent {
|
||||
this.quantityForPartialPickup.delete(orderItem.orderItemId);
|
||||
}
|
||||
|
||||
private setItemForPartialPickUp(
|
||||
orderItem: OrderItemListItemDTO,
|
||||
quantity?: number
|
||||
) {
|
||||
private setItemForPartialPickUp(orderItem: OrderItemListItemDTO, quantity?: number) {
|
||||
this.selectedForPartialPickup.set(orderItem.orderItemId, orderItem);
|
||||
this.quantityForPartialPickup.set(
|
||||
orderItem.orderItemId,
|
||||
isNullOrUndefined(quantity) ? orderItem.quantity : quantity
|
||||
);
|
||||
this.quantityForPartialPickup.set(orderItem.orderItemId, isNullOrUndefined(quantity) ? orderItem.quantity : quantity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,7 @@ export class ShelfOrderDetailsService {
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
customerNumber: item.buyerNumber,
|
||||
estimatedShippingDate: item.estimatedShippingDate
|
||||
? new Date(item.estimatedShippingDate)
|
||||
: undefined,
|
||||
estimatedShippingDate: item.estimatedShippingDate ? new Date(item.estimatedShippingDate) : undefined,
|
||||
orderDate: new Date(item.orderDate),
|
||||
orderNumber: item.orderNumber,
|
||||
processingStatus: item.processingStatus,
|
||||
@@ -48,9 +46,7 @@ export class ShelfOrderDetailsService {
|
||||
compartmentCode: item.compartmentCode,
|
||||
compartmentInfo: item.compartmentInfo,
|
||||
...{
|
||||
...(item.pickUpDeadline
|
||||
? { pickUpDeadline: new Date(item.pickUpDeadline) }
|
||||
: {}),
|
||||
...(item.pickUpDeadline ? { pickUpDeadline: new Date(item.pickUpDeadline) } : {}),
|
||||
},
|
||||
...{ ...(item.orderId ? { orderId: item.orderId } : {}) },
|
||||
...{ ...(item.receipts ? { receipts: item.receipts } : {}) },
|
||||
@@ -100,20 +96,39 @@ export class ShelfOrderDetailsService {
|
||||
return copy;
|
||||
}
|
||||
|
||||
public getAvailableProcessStatusRefact(
|
||||
currentActions: KeyValueDTOOfStringAndString[]
|
||||
): Map<
|
||||
number,
|
||||
{
|
||||
value: string;
|
||||
disabled: boolean;
|
||||
}
|
||||
> {
|
||||
const result = new Map<number, { value: string; disabled: boolean }>();
|
||||
|
||||
if (Array.isArray(currentActions) && currentActions.length) {
|
||||
currentActions.forEach((action) => {
|
||||
const identifier = Number(action.key);
|
||||
|
||||
if (typeof identifier === 'number') {
|
||||
result.set(identifier, { value: action.value, disabled: false });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public getReceipts(
|
||||
items: (OrderItemListItemDTO & {
|
||||
receipts?: ReceiptDTO[];
|
||||
})[]
|
||||
): ReceiptDTO[] {
|
||||
return items.reduce(
|
||||
(acc, curr) => [...(acc || []), ...(curr.receipts ? curr.receipts : [])],
|
||||
[]
|
||||
);
|
||||
return items.reduce((acc, curr) => [...(acc || []), ...(curr.receipts ? curr.receipts : [])], []);
|
||||
}
|
||||
|
||||
public showPickUpAndPrintOption$(
|
||||
orderDetailsCard$: Observable<OrderDetailsCardInput>
|
||||
): Observable<boolean> {
|
||||
public showPickUpAndPrintOption$(orderDetailsCard$: Observable<OrderDetailsCardInput>): Observable<boolean> {
|
||||
return orderDetailsCard$.pipe(
|
||||
map((details) => {
|
||||
if (!Array.isArray(details.actions)) {
|
||||
@@ -121,11 +136,7 @@ export class ShelfOrderDetailsService {
|
||||
}
|
||||
|
||||
details.actions.some((action) =>
|
||||
this.actionHandlerService
|
||||
.getActions(action)
|
||||
.some((command) =>
|
||||
this.actionHandlerService.shouldPrintShippingNote(command)
|
||||
)
|
||||
this.actionHandlerService.getActions(action).some((command) => this.actionHandlerService.shouldPrintShippingNote(command))
|
||||
);
|
||||
})
|
||||
);
|
||||
@@ -140,9 +151,7 @@ export class ShelfOrderDetailsService {
|
||||
compartmentInfo?: string;
|
||||
quantityForPartialPickup?: Map<number, number>;
|
||||
}
|
||||
): Promise<
|
||||
ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]
|
||||
> {
|
||||
): Promise<ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]> {
|
||||
let results: ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[];
|
||||
|
||||
switch (status) {
|
||||
@@ -179,9 +188,7 @@ export class ShelfOrderDetailsService {
|
||||
receipts?: ReceiptDTO[];
|
||||
})[],
|
||||
compartmentInfo: string
|
||||
): Promise<
|
||||
ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]
|
||||
> {
|
||||
): Promise<ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]> {
|
||||
return this.detailsFacade.arrived(items, compartmentInfo);
|
||||
}
|
||||
|
||||
@@ -190,9 +197,7 @@ export class ShelfOrderDetailsService {
|
||||
receipts?: ReceiptDTO[];
|
||||
})[],
|
||||
quantityForPartialPickup: Map<number, number>
|
||||
): Promise<
|
||||
ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]
|
||||
> {
|
||||
): Promise<ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]> {
|
||||
return this.detailsFacade.pickedUp(items, quantityForPartialPickup);
|
||||
}
|
||||
|
||||
@@ -200,9 +205,7 @@ export class ShelfOrderDetailsService {
|
||||
items: (OrderItemListItemDTO & {
|
||||
receipts?: ReceiptDTO[];
|
||||
})[]
|
||||
): Promise<
|
||||
ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]
|
||||
> {
|
||||
): Promise<ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]> {
|
||||
return this.detailsFacade.reorder(items);
|
||||
}
|
||||
|
||||
@@ -210,9 +213,7 @@ export class ShelfOrderDetailsService {
|
||||
items: (OrderItemListItemDTO & {
|
||||
receipts?: ReceiptDTO[];
|
||||
})[]
|
||||
): Promise<
|
||||
ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]
|
||||
> {
|
||||
): Promise<ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]> {
|
||||
return this.detailsFacade.backToStock(items);
|
||||
}
|
||||
|
||||
@@ -221,17 +222,13 @@ export class ShelfOrderDetailsService {
|
||||
receipts?: ReceiptDTO[];
|
||||
})[],
|
||||
status: number
|
||||
): Promise<
|
||||
ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]
|
||||
> {
|
||||
const payloads = items.map(
|
||||
({ orderId, orderItemId, orderItemSubsetId }) => ({
|
||||
orderId,
|
||||
orderItemId,
|
||||
orderItemSubsetId,
|
||||
data: { processingStatus: status } as StatusValues,
|
||||
})
|
||||
);
|
||||
): Promise<ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO[]> {
|
||||
const payloads = items.map(({ orderId, orderItemId, orderItemSubsetId }) => ({
|
||||
orderId,
|
||||
orderItemId,
|
||||
orderItemSubsetId,
|
||||
data: { processingStatus: status } as StatusValues,
|
||||
}));
|
||||
return this.detailsFacade.changeStatus(payloads);
|
||||
}
|
||||
|
||||
@@ -258,27 +255,17 @@ export class ShelfOrderDetailsService {
|
||||
const compartmentCodeItem = items.find((item) => item.compartmentCode);
|
||||
const orderNumberItem = items.find((item) => item.orderNumber);
|
||||
|
||||
const compartmentCode =
|
||||
compartmentCodeItem && compartmentCodeItem.compartmentCode;
|
||||
const compartmentCode = compartmentCodeItem && compartmentCodeItem.compartmentCode;
|
||||
const orderNumber = orderNumberItem && orderNumberItem.orderNumber;
|
||||
|
||||
if (compartmentCode || orderNumber) {
|
||||
const result = await this.orderCheckoutService
|
||||
.OrderCheckoutOrderAtSupplierResponse(orderId)
|
||||
.pipe(
|
||||
tap((response) =>
|
||||
this.detailsFacade.setDeterminedSupplier(
|
||||
response,
|
||||
compartmentCodeItem || orderNumberItem
|
||||
)
|
||||
),
|
||||
tap((response) => this.detailsFacade.setDeterminedSupplier(response, compartmentCodeItem || orderNumberItem)),
|
||||
map((response) => response.body && response.body.result),
|
||||
switchMap((data) =>
|
||||
this.detailsFacade.getOrderItemsByOrderNumber$(data.orderNumber)
|
||||
),
|
||||
filter(
|
||||
(itms) => Array.isArray(itms) && itms[0].processingStatus !== 1
|
||||
),
|
||||
switchMap((data) => this.detailsFacade.getOrderItemsByOrderNumber$(data.orderNumber)),
|
||||
filter((itms) => Array.isArray(itms) && itms[0].processingStatus !== 1),
|
||||
take(1)
|
||||
)
|
||||
.toPromise();
|
||||
|
||||
Reference in New Issue
Block a user