diff --git a/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.html b/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.html index 7074917f8..c5d73b0a5 100644 --- a/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.html +++ b/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.html @@ -40,6 +40,11 @@ [src]="orderItem.product?.ean | productImage" [alt]="orderItem.product?.name" /> + @if (hasRewardPoints$ | async) { + + Prämie + + }
@@ -117,10 +122,15 @@
{{ orderItem.product?.ean }}
} - @if (orderItem.price !== undefined) { + @if (orderItem.price !== undefined || (hasRewardPoints$ | async)) {
-
Preis
-
{{ orderItem.price | currency: 'EUR' }}
+ @if (hasRewardPoints$ | async) { +
Prämie
+
{{ rewardPoints$ | async | number: '1.0-0' }} Lesepunkte
+ } @else { +
Preis
+
{{ orderItem.price | currency: 'EUR' }}
+ }
} @if (!!orderItem.retailPrice?.vat?.inPercent) { diff --git a/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.scss b/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.scss index 293facbaa..0d264fdd7 100644 --- a/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.scss +++ b/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.scss @@ -21,6 +21,8 @@ button { } .page-pickup-shelf-details-item__thumbnail { + @apply flex flex-col items-center gap-2; + img { @apply rounded shadow-cta w-[3.625rem] max-h-[5.9375rem]; } diff --git a/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.ts b/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.ts index 4bf3bb62b..d2d18a807 100644 --- a/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.ts +++ b/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-details-item/pickup-shelf-details-item.component.ts @@ -1,20 +1,22 @@ import { CdkTextareaAutosize, TextFieldModule } from '@angular/cdk/text-field'; -import { AsyncPipe, CurrencyPipe, DatePipe } from '@angular/common'; +import { AsyncPipe, CurrencyPipe, DatePipe, DecimalPipe } from '@angular/common'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, - OnInit, Output, ViewChild, - inject, OnDestroy, + inject, + OnDestroy, } from '@angular/core'; import { FormsModule, ReactiveFormsModule, UntypedFormControl } from '@angular/forms'; import { NavigateOnClickDirective, ProductImageModule } from '@cdn/product-image'; import { DBHOrderItemListItemDTO, OrderDTO, ReceiptDTO } from '@generated/swagger/oms-api'; +import { getOrderItemRewardFeature } from '@isa/oms/data-access'; import { UiCommonModule } from '@ui/common'; +import { LabelComponent, Labeltype, LabelPriority } from '@isa/ui/label'; import { UiTooltipModule } from '@ui/tooltip'; import { PickupShelfPaymentTypePipe } from '../pipes/payment-type.pipe'; import { IconModule } from '@shared/components/icon'; @@ -48,6 +50,7 @@ export interface PickUpShelfDetailsItemComponentState { ReactiveFormsModule, CurrencyPipe, DatePipe, + DecimalPipe, AsyncPipe, ProductImageModule, TextFieldModule, @@ -56,12 +59,13 @@ export interface PickUpShelfDetailsItemComponentState { UiQuantityDropdownModule, NotificationTypePipe, NavigateOnClickDirective, - MatomoModule + MatomoModule, + LabelComponent ], }) export class PickUpShelfDetailsItemComponent extends ComponentStore - implements OnInit, OnDestroy + implements OnDestroy { private _store = inject(PickupShelfDetailsStore); @@ -117,6 +121,22 @@ export class PickUpShelfDetailsItemComponent hasSmsNotification$ = this.smsNotificationDates$.pipe(map((dates) => dates?.length > 0)); + /** + * Observable that indicates whether the order item has reward points (Lesepunkte). + * Returns true if the item has a 'praemie' feature. + */ + hasRewardPoints$ = this.orderItem$.pipe( + map((orderItem) => getOrderItemRewardFeature(orderItem) !== undefined), + ); + + /** + * Observable that emits the reward points (Lesepunkte) value for the order item. + * Returns the parsed numeric value from the 'praemie' feature, or undefined if not present. + */ + rewardPoints$ = this.orderItem$.pipe( + map((orderItem) => getOrderItemRewardFeature(orderItem)), + ); + canChangeQuantity$ = combineLatest([this.orderItem$, this._store.fetchPartial$]).pipe( map(([item, partialPickup]) => ([16, 8192].includes(item?.processingStatus) || partialPickup) && item.quantity > 1), ); @@ -167,12 +187,12 @@ export class PickUpShelfDetailsItemComponent return this._store.receipts; } - readonly receipts$ = this._store.receipts$; - set receipts(receipts: ReceiptDTO[]) { this._store.updateReceipts(receipts); } + readonly receipts$ = this._store.receipts$; + readonly receiptCount$ = this.receipts$.pipe(map((receipts) => receipts?.length)); specialCommentControl = new UntypedFormControl(); @@ -181,7 +201,11 @@ export class PickUpShelfDetailsItemComponent private _onDestroy$ = new Subject(); - expanded: boolean = false; + expanded = false; + + // Expose to template + Labeltype = Labeltype; + LabelPriority = LabelPriority; constructor(private _cdr: ChangeDetectorRef) { super({ @@ -189,8 +213,6 @@ export class PickUpShelfDetailsItemComponent }); } - ngOnInit() {} - ngOnDestroy() { // Remove Prev OrderItem from selected list this._store.selectOrderItem(this.orderItem, false); diff --git a/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-list-item/pickup-shelf-list-item.component.css b/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-list-item/pickup-shelf-list-item.component.css index e3d37b1f2..627a521b1 100644 --- a/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-list-item/pickup-shelf-list-item.component.css +++ b/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-list-item/pickup-shelf-list-item.component.css @@ -39,6 +39,7 @@ .page-pickup-shelf-list-item__item-thumbnail { grid-area: thumbnail; + @apply flex flex-col items-center gap-2; } .page-pickup-shelf-list-item__item-image { diff --git a/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-list-item/pickup-shelf-list-item.component.html b/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-list-item/pickup-shelf-list-item.component.html index 933f0fd8a..b0dfc05f3 100644 --- a/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-list-item/pickup-shelf-list-item.component.html +++ b/apps/isa-app/src/page/pickup-shelf/shared/pickup-shelf-list-item/pickup-shelf-list-item.component.html @@ -10,7 +10,7 @@ [class.page-pickup-shelf-list-item__item-grid-container-main]="primaryOutletActive" [class.page-pickup-shelf-list-item__item-grid-container-secondary]="primaryOutletActive && isItemSelectable === undefined" > -
+
@if (item?.product?.ean | productImage; as productImage) { } + @if (hasRewardPoints) { + + Prämie + + }
selectedListItems?.find((item) => item?.orderItemSubsetId === this.item?.orderItemSubsetId), ), ); + // Expose to template + Labeltype = Labeltype; + LabelPriority = LabelPriority; + constructor( private _elRef: ElementRef, private _environment: EnvironmentService, diff --git a/libs/oms/data-access/src/lib/helpers/order/get-order-item-reward-feature.helper.ts b/libs/oms/data-access/src/lib/helpers/order/get-order-item-reward-feature.helper.ts index ae1c7561a..e6c0034be 100644 --- a/libs/oms/data-access/src/lib/helpers/order/get-order-item-reward-feature.helper.ts +++ b/libs/oms/data-access/src/lib/helpers/order/get-order-item-reward-feature.helper.ts @@ -1,7 +1,17 @@ -import { OrderItemDTO, DisplayOrderItemDTO } from '@generated/swagger/oms-api'; - +/** + * Extracts and parses the reward points (Lesepunkte) value from an order item's features. + * + * @param orderItem - An object containing a features property with key-value pairs + * @returns The parsed numeric value of reward points, or undefined if not present + * + * @example + * ```ts + * const orderItem = { features: { praemie: '12.345' } }; + * const points = getOrderItemRewardFeature(orderItem); // returns 12345 + * ``` + */ export function getOrderItemRewardFeatureHelper( - orderItem: OrderItemDTO | DisplayOrderItemDTO | undefined, + orderItem: { features?: { [key: string]: string } } | undefined, ): undefined | number { if (!orderItem || !orderItem.features) { return undefined;