Merged PR 861: #2211 Reservieren in andere Filiale - Stockabfrage mit Branch

#2211 Reservieren in andere Filiale - Stockabfrage mit Branch

Related work items: #2211
This commit is contained in:
Andreas Schickinger
2021-09-21 15:10:36 +00:00
committed by Lorenz Hilpert
parent 33173f88f3
commit 19539da8aa
2 changed files with 25 additions and 2 deletions

View File

@@ -97,6 +97,27 @@ export class DomainAvailabilityService {
);
}
@memorize({ ttl: 10000 })
getTakeAwayAvailabilityByBranch({
branch,
itemId,
price,
quantity,
}: {
branch: BranchDTO;
itemId: number;
price: PriceDTO;
quantity: number;
}): Observable<AvailabilityDTO> {
return this._stock.StockStockRequest({ stockRequest: { branchIds: [branch.id], itemId } }).pipe(
withLatestFrom(this.getTakeAwaySupplier()),
map(([response, supplier]) => {
return this._mapToTakeAwayAvailability({ response, supplier, branch, quantity, price });
}),
shareReplay()
);
}
getTakeAwayAvailabilityByEan({
eans,
price,

View File

@@ -374,9 +374,11 @@ export class PurchasingOptionsModalStore extends ComponentStore<PurchasingOption
this.patchState({ fetchingAvailability: true });
switch (option) {
case 'take-away':
availability$ = this.availabilityService.getTakeAwayAvailability({
item: { itemId: item.id, ean: item.product.ean, price: item.catalogAvailability.price },
availability$ = this.availabilityService.getTakeAwayAvailabilityByBranch({
itemId: item.id,
price: item.catalogAvailability.price,
quantity,
branch,
});
break;
case 'pick-up':