mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Kulturpass - Mehrfache Artikelauswahl über EAN überschreitet verfügbare Exemplare
This commit is contained in:
@@ -188,4 +188,8 @@ export class KulturpassOrderModalStore extends ComponentStore<KulturpassOrderMod
|
||||
this._modal.error('Fehler beim Bestellen', err);
|
||||
this.patchState({ ordering: false });
|
||||
};
|
||||
|
||||
itemQuantityByCatalogProductNumber(catalogProductNumber: string) {
|
||||
return this.shoppingCart?.items?.find((i) => i?.data?.product?.catalogProductNumber === catalogProductNumber)?.data?.quantity ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { AddToShoppingCartDTO } from '@swagger/checkout';
|
||||
import { KulturpassOrderModalStore } from '../kulturpass-order-modal.store';
|
||||
|
||||
@Component({
|
||||
selector: 'shared-kulturpass-order-searchbox',
|
||||
|
||||
@@ -8,6 +8,7 @@ import { DomainCatalogService } from '@domain/catalog';
|
||||
import { AddToShoppingCartDTO, AvailabilityDTO, BranchDTO } from '@swagger/checkout';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { UiModalService } from '@ui/modal';
|
||||
import { KulturpassOrderModalStore } from '../kulturpass-order-modal.store';
|
||||
|
||||
export interface KulturpassOrderSearchboxState {
|
||||
query: string;
|
||||
@@ -34,6 +35,7 @@ export class KulturpassOrderSearchboxStore extends ComponentStore<KulturpassOrde
|
||||
hint$ = new Subject<string>();
|
||||
|
||||
constructor(
|
||||
private _parentStore: KulturpassOrderModalStore,
|
||||
private _catalogService: DomainCatalogService,
|
||||
private _availabilityService: DomainAvailabilityService,
|
||||
private _modal: UiModalService
|
||||
@@ -106,7 +108,7 @@ export class KulturpassOrderSearchboxStore extends ComponentStore<KulturpassOrde
|
||||
itemId: item.id,
|
||||
price: item.catalogAvailability.price,
|
||||
},
|
||||
quantity: 1,
|
||||
quantity: this._parentStore.itemQuantityByCatalogProductNumber(String(item?.product?.catalogProductNumber ?? item.id)) + 1,
|
||||
})
|
||||
.pipe(tapResponse(this.handleAvailabilityResponse(item), this.handleAvailabilityError))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user