Merged PR 1623: #4278 Fix Customer Order Removed Double Search Request and keep queryParams i...

#4278 Fix Customer Order Removed Double Search Request and keep queryParams in sync with filter settings
This commit is contained in:
Nino Righi
2023-09-04 16:29:44 +00:00
committed by Andreas Schickinger
parent 0441401d9f
commit 732b5a7fb1

View File

@@ -209,7 +209,7 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
this._customerOrderSearchStore.processId,
this._customerOrderSearchStore.filter?.getQueryParams()
);
} else {
} else if (this._customerOrderSearchStore?.results?.length === 0) {
this._customerOrderSearchStore.search({ siletReload: true });
}
} else if (branchChanged) {
@@ -250,7 +250,8 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
if (result.results.hits === 1) {
await this.navigateToDetails(
processId,
result?.results?.result?.find((_) => true)
result?.results?.result?.find((_) => true),
queryParams
);
} else if (!!result?.clear || this.isTablet || this._navigationService.mainOutletActive(this._activatedRoute)) {
await this._navigationService.navigateToResults({
@@ -404,8 +405,7 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
this._customerOrderSearchStore.search({ clear });
}
async navigateToDetails(processId: number, orderItem: OrderItemListItemDTO) {
const archive = !!this._customerOrderSearchStore.filter?.getQueryParams()?.main_archive || false;
async navigateToDetails(processId: number, orderItem: OrderItemListItemDTO, queryParams: Record<string, string>) {
await this._navigationService.navigateToDetails({
processId,
processingStatus: orderItem?.processingStatus,
@@ -414,9 +414,9 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
queryParams: orderItem?.compartmentCode
? {
buyerNumber: orderItem.buyerNumber,
archive: String(archive),
...queryParams,
}
: { archive: String(archive) },
: { ...queryParams },
});
}