#4335 Fehler bei Öffnung einer Bestellung mit Status "eingetroffen"

This commit is contained in:
Lorenz Hilpert
2023-10-05 11:40:47 +02:00
parent d13cf0ef8d
commit a97d87ed7b
6 changed files with 65 additions and 26 deletions

View File

@@ -65,6 +65,6 @@ export abstract class PickupShelfDetailsBaseComponent {
* Benachrichtigungs Badges
*/
getNotifications$(item: DBHOrderItemListItemDTO): Observable<Record<string, Date[]>> {
return this.store.getNotifications(item.orderItemSubsetId);
return this.store.getNotifications$(item.orderItemSubsetId);
}
}

View File

@@ -13,7 +13,6 @@
[selected]="true"
(historyClick)="navigateToHistoryPage($event)"
[order]="order$ | async"
[notifications]="getNotifications$(item) | async"
(specialCommentChanged)="updateSpecialComment(item, $event)"
(sharedOnInit)="fetchNotifications(item)"
></page-pickup-shelf-details-item>

View File

@@ -6,25 +6,24 @@
Artikel wird für Sie vorgemerkt.
</ui-tooltip>
</ng-container>
<ng-container *ngIf="notifications; let notificationsSent">
<ng-container *ngIf="notificationsSent?.NOTIFICATION_EMAIL">
<img [uiOverlayTrigger]="emailTooltip" src="/assets/images/email_bookmark.svg" />
<ui-tooltip yPosition="above" xPosition="after" [yOffset]="-11" [xOffset]="-8" #emailTooltip [closeable]="true">
Per E-Mail benachrichtigt <br />
<ng-container *ngFor="let notification of notificationsSent?.NOTIFICATION_EMAIL">
{{ notification | date: 'dd.MM.yyyy | HH:mm' }} Uhr<br />
</ng-container>
</ui-tooltip>
</ng-container>
<ng-container *ngIf="notificationsSent?.NOTIFICATION_SMS">
<img [uiOverlayTrigger]="smsTooltip" src="/assets/images/sms_bookmark.svg" />
<ui-tooltip yPosition="above" xPosition="after" [yOffset]="-11" [xOffset]="-8" #smsTooltip [closeable]="true">
Per SMS benachrichtigt <br />
<ng-container *ngFor="let notification of notificationsSent?.NOTIFICATION_SMS">
{{ notification | date: 'dd.MM.yyyy | HH:mm' }} Uhr<br />
</ng-container>
</ui-tooltip>
</ng-container>
<ng-container *ngIf="hasEmailNotification$ | async">
<img [uiOverlayTrigger]="emailTooltip" src="/assets/images/email_bookmark.svg" />
<ui-tooltip yPosition="above" xPosition="after" [yOffset]="-11" [xOffset]="-8" #emailTooltip [closeable]="true">
Per E-Mail benachrichtigt <br />
<ng-container *ngFor="let notification of emailNotificationDates$ | async">
{{ notification | date: 'dd.MM.yyyy | HH:mm' }} Uhr<br />
</ng-container>
</ui-tooltip>
</ng-container>
<ng-container *ngIf="hasSmsNotification$ | async">
<img [uiOverlayTrigger]="smsTooltip" src="/assets/images/sms_bookmark.svg" />
<ui-tooltip yPosition="above" xPosition="after" [yOffset]="-11" [xOffset]="-8" #smsTooltip [closeable]="true">
Per SMS benachrichtigt <br />
<ng-container *ngFor="let notification of smsNotificationDates$ | async">
{{ notification | date: 'dd.MM.yyyy | HH:mm' }} Uhr<br />
</ng-container>
</ui-tooltip>
</ng-container>
</div>
<div class="page-pickup-shelf-details-item__item-container">

View File

@@ -20,7 +20,7 @@ import { PickupShelfPaymentTypePipe } from '../pipes/payment-type.pipe';
import { IconModule } from '@shared/components/icon';
import { ComponentStore } from '@ngrx/component-store';
import { isEqual } from 'lodash';
import { map } from 'rxjs/operators';
import { map, switchMap } from 'rxjs/operators';
import { Subject, combineLatest } from 'rxjs';
import { PickupShelfDetailsStore } from '../../store';
import { UiQuantityDropdownModule } from '@ui/quantity-dropdown';
@@ -85,6 +85,8 @@ export class PickUpShelfDetailsItemComponent extends ComponentStore<PickUpShelfD
}
}
orderItems$ = this.select((s) => s.orderItem);
@Input()
get order() {
return this.get((s) => s.order);
@@ -95,8 +97,15 @@ export class PickUpShelfDetailsItemComponent extends ComponentStore<PickUpShelfD
readonly orderItem$ = this.select((s) => s.orderItem);
@Input()
notifications: Record<string, Date[]>;
emailNotificationDates$ = this.orderItem$.pipe(
switchMap((orderItem) => this._store.getEmailNotificationDate$(orderItem?.orderItemSubsetId))
);
hasEmailNotification$ = this.emailNotificationDates$.pipe(map((dates) => dates?.length > 0));
smsNotificationDates$ = this.orderItem$.pipe(switchMap((orderItem) => this._store.getSmsNotificationDate$(orderItem?.orderItemSubsetId)));
hasSmsNotification$ = this.smsNotificationDates$.pipe(map((dates) => dates?.length > 0));
canChangeQuantity$ = combineLatest([this.orderItem$, this._store.fetchPartial$]).pipe(
map(([item, partialPickup]) => ([16, 8192].includes(item?.processingStatus) || partialPickup) && item.quantity > 1)
@@ -178,6 +187,12 @@ export class PickUpShelfDetailsItemComponent extends ComponentStore<PickUpShelfD
this._onDestroy$.complete();
}
ngOnChanges(changes) {
if (changes.notifications) {
console.log('changes', changes);
}
}
saveSpecialComment() {
this.specialCommentChanged.emit(this.specialCommentControl.value ?? '');
}

View File

@@ -144,6 +144,24 @@ export const selectNotifications = (orderItemSubsetId: number) => (s: PickupShel
}, {} as Record<string, Date[]>);
};
export const selectLatestNotificationDatesFor = (orderItemSubsetId: number, key: string) => (s: PickupShelfDetailsState) => {
const notifications = selectNotifications(orderItemSubsetId)(s);
return (
notifications?.[key]?.filter((date) => {
// check if curr is an invalid date
return !isNaN(date.getTime());
}) ?? []
);
};
export const selectLatestEmailNotificationDates = (orderItemSubsetId: number) => (s: PickupShelfDetailsState) => {
return selectLatestNotificationDatesFor(orderItemSubsetId, 'NOTIFICATION_EMAIL')(s);
};
export const selectLatestSmsNotificationDate2 = (orderItemSubsetId: number) => (s: PickupShelfDetailsState) => {
return selectLatestNotificationDatesFor(orderItemSubsetId, 'NOTIFICATION_SMS')(s);
};
export const selectCanSelectAction = (s: PickupShelfDetailsState) => {
const items = selectOrderItems(s);
const selectedOrderItemIds = selectSelectedOrderItemIds(s);

View File

@@ -506,11 +506,19 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
};
});
getOrderItemSubsetTasks = (orderItemSubsetId: number) => {
getOrderItemSubsetTasks$ = (orderItemSubsetId: number) => {
return this.select(Selectors.selectOrderItemSubsetTasks(orderItemSubsetId));
};
getNotifications = (orderItemSubsetId: number) => {
getNotifications$ = (orderItemSubsetId: number) => {
return this.select(Selectors.selectNotifications(orderItemSubsetId));
};
getEmailNotificationDate$ = (orderItemSubsetId: number) => {
return this.select(Selectors.selectLatestEmailNotificationDates(orderItemSubsetId));
};
getSmsNotificationDate$ = (orderItemSubsetId: number) => {
return this.select(Selectors.selectLatestSmsNotificationDate2(orderItemSubsetId));
};
}