mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merged PR 1577: #4168 Fix PDP Recommendations Routing
#4168 Fix PDP Recommendations Routing
This commit is contained in:
committed by
Lorenz Hilpert
parent
97b30d5b14
commit
75e24771b3
@@ -8,7 +8,7 @@ import { BranchDTO } from '@swagger/checkout';
|
||||
import { UiModalService } from '@ui/modal';
|
||||
import { ModalReviewsComponent } from '@modal/reviews';
|
||||
import { BehaviorSubject, combineLatest, Subscription } from 'rxjs';
|
||||
import { debounceTime, filter, first, map, shareReplay, switchMap, withLatestFrom } from 'rxjs/operators';
|
||||
import { debounceTime, filter, first, map, shareReplay, switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
||||
import { ArticleDetailsStore } from './article-details.store';
|
||||
import { ModalImagesComponent } from 'apps/modal/images/src/public-api';
|
||||
import { ProductImageService } from 'apps/cdn/product-image/src/public-api';
|
||||
@@ -182,11 +182,13 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
const id$ = this.activatedRoute.params.pipe(
|
||||
tap((_) => (this.showRecommendations = false)),
|
||||
map((params) => Number(params?.id) || undefined),
|
||||
filter((f) => !!f)
|
||||
);
|
||||
|
||||
const ean$ = this.activatedRoute.params.pipe(
|
||||
tap((_) => (this.showRecommendations = false)),
|
||||
map((params) => params?.ean || undefined),
|
||||
filter((f) => !!f)
|
||||
);
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
<a
|
||||
class="article"
|
||||
*ngFor="let recommendation of store.recommendations$ | async"
|
||||
[routerLink]="['/kunde', applicationService.activatedProcessId, 'product', 'details', 'ean', recommendation.product.ean]"
|
||||
[routerLink]="getDetailsPath(recommendation.product.ean)"
|
||||
[queryParams]="{ main_qs: recommendation.product.ean }"
|
||||
(click)="close.emit()"
|
||||
>
|
||||
<img [src]="recommendation.product?.ean | productImage: 195:315:true" alt="product-image" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Component, EventEmitter, Output } from '@angular/core';
|
||||
import { ApplicationService } from '@core/application';
|
||||
import { ArticleDetailsStore } from '../article-details.store';
|
||||
import { ProductCatalogNavigationService } from '@shared/services';
|
||||
|
||||
@Component({
|
||||
selector: 'page-article-recommendations',
|
||||
@@ -11,5 +12,13 @@ export class ArticleRecommendationsComponent {
|
||||
@Output()
|
||||
close = new EventEmitter<void>();
|
||||
|
||||
constructor(public readonly store: ArticleDetailsStore, public readonly applicationService: ApplicationService) {}
|
||||
constructor(
|
||||
public readonly store: ArticleDetailsStore,
|
||||
private readonly _applicationService: ApplicationService,
|
||||
private readonly _navigationService: ProductCatalogNavigationService
|
||||
) {}
|
||||
|
||||
getDetailsPath(ean?: string) {
|
||||
return this._navigationService.getArticleDetailsPath({ processId: this._applicationService.activatedProcessId, ean });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ export class ArticleSearchService extends ComponentStore<ArticleSearchState> {
|
||||
search = this.effect((options$: Observable<{ clear?: boolean }>) =>
|
||||
options$.pipe(
|
||||
tap((options) => {
|
||||
this.searchStarted.next();
|
||||
this.searchStarted.next({ clear: options?.clear });
|
||||
this.patchState({
|
||||
searchState: 'fetching',
|
||||
items: options.clear ? [] : this.items,
|
||||
|
||||
@@ -216,12 +216,15 @@ export class ArticleSearchResultsComponent implements OnInit, OnDestroy, AfterVi
|
||||
|
||||
// #4143 To make Splitscreen Search and Filter work combined
|
||||
this.subscriptions.add(
|
||||
this.searchService.searchStarted.subscribe(async (_) => {
|
||||
const queryParams = {
|
||||
...this.cleanupQueryParams(this.searchService.filter.getQueryParams()),
|
||||
main_qs: this.sharedFilterInputGroupMain?.uiInput?.value,
|
||||
};
|
||||
await this.searchService.setDefaultFilter(queryParams);
|
||||
this.searchService.searchStarted.subscribe(async (options) => {
|
||||
if (!options?.clear) {
|
||||
const queryParams = {
|
||||
...this.cleanupQueryParams(this.searchService.filter.getQueryParams()),
|
||||
main_qs: this.sharedFilterInputGroupMain?.uiInput?.value,
|
||||
};
|
||||
|
||||
await this.searchService.setDefaultFilter(queryParams);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user