Merged PR 1660: #4256 Fix HSC Kundenbestellungen Filter and Search History handling

#4256 Fix HSC Kundenbestellungen Filter and Search History handling
This commit is contained in:
Nino Righi
2023-10-24 08:22:26 +00:00
committed by Lorenz Hilpert
parent 9def487ab8
commit 705dc23908

View File

@@ -70,7 +70,7 @@ export class CustomerOrderSearchMainComponent implements OnInit, OnDestroy {
.pipe(debounceTime(50))
.subscribe(([processId, queryParams]) => {
this.removeBreadcrumbs(processId);
this.updateBreadcrumb(processId, queryParams);
this.updateBreadcrumb(queryParams);
})
);
@@ -88,17 +88,19 @@ export class CustomerOrderSearchMainComponent implements OnInit, OnDestroy {
})
);
// #4143 To make Splitscreen Search and Filter work combined
this._subscriptions.add(
this._customerOrderSearchStore.searchStarted.subscribe(async (_) => {
const queryParams = {
...this.cleanupQueryParams(this._customerOrderSearchStore.filter.getQueryParams()),
main_qs: this.filterInputGroup?.uiInput?.value,
};
// Im Zuge des Tickets #4256 auskommentiert, da es zu Problemen geführt hat
// In der Filter Komponente wird dies schon gemacht
this._customerOrderSearchStore.setQueryParams(queryParams);
})
);
// // #4143 To make Splitscreen Search and Filter work combined
// this._subscriptions.add(
// this._customerOrderSearchStore.searchStarted.subscribe(async (_) => {
// const queryParams = {
// ...this.cleanupQueryParams(this._customerOrderSearchStore.filter.getQueryParams()),
// main_qs: this.filterInputGroup?.uiInput?.value,
// };
// this._customerOrderSearchStore.setQueryParams(queryParams);
// })
// );
}
ngOnDestroy() {
@@ -147,15 +149,19 @@ export class CustomerOrderSearchMainComponent implements OnInit, OnDestroy {
async search(filter: Filter) {
this._customerOrderSearchStore.setMessage('');
this.filterInputGroup?.cancelAutocomplete();
const queryParams = filter.getQueryParams();
this._customerOrderSearchStore.setQueryParams(queryParams);
await this.updateQueryParams(queryParams);
this._customerOrderSearchStore.search({ clear: true });
await this.updateQueryParams(this.processId);
}
async updateBreadcrumb(processId: number, params: Record<string, string>) {
async updateBreadcrumb(params: Record<string, string>) {
await this._breadcrumb.addOrUpdateBreadcrumbIfNotExists({
key: processId,
key: this.processId,
name: 'Kundenbestellung',
path: this._navigationService.getCustomerOrdersBasePath(processId).path,
path: this._navigationService.getCustomerOrdersBasePath(this.processId).path,
tags: ['customer-order', 'main', 'filter'],
section: 'customer',
params,
@@ -164,12 +170,12 @@ export class CustomerOrderSearchMainComponent implements OnInit, OnDestroy {
setQueryHistory(filter: Filter, query: string) {
filter.fromQueryParams({ main_qs: query });
const queryParams = filter.getQueryParams();
this._customerOrderSearchStore.setQueryParams(queryParams);
}
async updateQueryParams(processId: number) {
const queryParams = { ...this._customerOrderSearchStore.filter?.getQueryParams() };
queryParams.main_qs = queryParams.main_qs ?? '';
async updateQueryParams(queryParams: Record<string, string>) {
await this._router.navigate([], { queryParams });
this.updateBreadcrumb(processId, queryParams);
await this.updateBreadcrumb(queryParams);
}
}