mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Compare commits
1 Commits
fix/4750-R
...
fix/4688-A
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2340a0e20 |
@@ -116,38 +116,8 @@ export abstract class PickupShelfBaseComponent implements OnInit {
|
||||
return queryParams;
|
||||
}
|
||||
|
||||
regsiterFetchListResponseHandler() {
|
||||
this.listStore.fetchListResponse$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(async ({ processId, queryParams, response }) => {
|
||||
/**
|
||||
* Wenn die Suche erfolgreich war, wird der Benutzer auf die Liste oder Detailseite des gefundenen Artikels weitergeleitet.
|
||||
*/
|
||||
const filterQueryParams = this.listStore.filter.getQueryParams();
|
||||
|
||||
// Only Update QueryParams if the user is already on the details, edit or history page
|
||||
// const view: string = this.activatedRoute.snapshot.data.view;
|
||||
// if (['filter', 'details', 'edit', 'history'].includes(view)) {
|
||||
// await this.router.navigate([], { queryParams: { ...queryParams, ...filterQueryParams }, skipLocationChange: true });
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (response.hits === 1 || this._hasSameOrderNumber(response)) {
|
||||
const detailsPath = await this.getPathForDetail(response.result[0]).pipe(take(1)).toPromise();
|
||||
await this.router.navigate(detailsPath.path, { queryParams: { ...queryParams, ...filterQueryParams, ...detailsPath.queryParams } });
|
||||
} else if (response.hits > 1) {
|
||||
const listPath = await this.getPathFoListBreadcrumb({ processId, queryParams });
|
||||
await this.router.navigate(listPath.path, { queryParams: { ...queryParams, ...filterQueryParams, ...listPath.queryParams } });
|
||||
} else {
|
||||
await this.router.navigate([], { queryParams: { ...queryParams, ...filterQueryParams } });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Fix Ticket #4684 Navigate on Details if items contain same OrderNumber
|
||||
private _hasSameOrderNumber(response: ListResponseArgsOfDBHOrderItemListItemDTO) {
|
||||
if (response.hits === 0) return false;
|
||||
const orderNumbers = new Set(response.result.map((item) => item.orderNumber));
|
||||
return orderNumbers.size === 1;
|
||||
}
|
||||
// Fix Ticket #4688 Navigation behaves different based on section PickUpShelfOut and PickUpShelfIn
|
||||
abstract regsiterFetchListResponseHandler(): void | Promise<void>;
|
||||
|
||||
/**
|
||||
* Sucht die Breadcrumb anhand des Tags.
|
||||
|
||||
@@ -16,6 +16,7 @@ import { map, take } from 'rxjs/operators';
|
||||
import { ApplicationService } from '@core/application';
|
||||
import { FilterAutocompleteProvider } from '@shared/components/filter';
|
||||
import { PickUpShelfInAutocompleteProvider } from './providers/pickup-shelf-in-autocomplete.provider';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
@Component({
|
||||
selector: 'page-pickup-shelf-in',
|
||||
@@ -205,4 +206,23 @@ export class PickupShelfInComponent extends PickupShelfBaseComponent {
|
||||
async getNameForHistoryBreadcrumb(data: GetNameForBreadcrumbData): Promise<string> {
|
||||
return 'Historie';
|
||||
}
|
||||
|
||||
async regsiterFetchListResponseHandler() {
|
||||
this.listStore.fetchListResponse$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(async ({ processId, queryParams, response }) => {
|
||||
/**
|
||||
* Wenn die Suche erfolgreich war, wird der Benutzer auf die Liste oder Detailseite des gefundenen Artikels weitergeleitet.
|
||||
*/
|
||||
const filterQueryParams = this.listStore.filter.getQueryParams();
|
||||
|
||||
if (response.hits === 1) {
|
||||
const detailsPath = await this.getPathForDetail(response.result[0]).pipe(take(1)).toPromise();
|
||||
await this.router.navigate(detailsPath.path, { queryParams: { ...queryParams, ...filterQueryParams, ...detailsPath.queryParams } });
|
||||
} else if (response.hits > 1) {
|
||||
const listPath = await this.getPathFoListBreadcrumb({ processId, queryParams });
|
||||
await this.router.navigate(listPath.path, { queryParams: { ...queryParams, ...filterQueryParams, ...listPath.queryParams } });
|
||||
} else {
|
||||
await this.router.navigate([], { queryParams: { ...queryParams, ...filterQueryParams } });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { PickupShelfIOService, PickupShelfOutService } from '@domain/pickup-shel
|
||||
import { GetNameForBreadcrumbData, GetPathForBreadcrumbData, PickupShelfBaseComponent } from '../pickup-shelf-base.component';
|
||||
import { NavigationRoute, PickUpShelfOutNavigationService } from '@shared/services';
|
||||
import { AsyncPipe } from '@angular/common';
|
||||
import { DBHOrderItemListItemDTO } from '@swagger/oms';
|
||||
import { DBHOrderItemListItemDTO, ListResponseArgsOfDBHOrderItemListItemDTO } from '@swagger/oms';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { provideActionHandlers } from '@core/command';
|
||||
@@ -15,6 +15,7 @@ import { ActionHandlerServices } from '@domain/oms';
|
||||
import { ActionHandlerService } from '../services/action-handler.service';
|
||||
import { FilterAutocompleteProvider } from '@shared/components/filter';
|
||||
import { PickUpShelfOutAutocompleteProvider } from './providers/pickup-shelf-out-autocomplete.provider';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
@Component({
|
||||
selector: 'page-pickup-shelf-out',
|
||||
@@ -203,4 +204,30 @@ export class PickupShelfOutComponent extends PickupShelfBaseComponent {
|
||||
async getNameForHistoryBreadcrumb(data: GetNameForBreadcrumbData): Promise<string> {
|
||||
return 'Historie';
|
||||
}
|
||||
|
||||
async regsiterFetchListResponseHandler() {
|
||||
this.listStore.fetchListResponse$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(async ({ processId, queryParams, response }) => {
|
||||
/**
|
||||
* Wenn die Suche erfolgreich war, wird der Benutzer auf die Liste oder Detailseite des gefundenen Artikels weitergeleitet.
|
||||
*/
|
||||
const filterQueryParams = this.listStore.filter.getQueryParams();
|
||||
|
||||
if (response.hits === 1 || this._hasSameOrderNumber(response)) {
|
||||
const detailsPath = await this.getPathForDetail(response.result[0]).pipe(take(1)).toPromise();
|
||||
await this.router.navigate(detailsPath.path, { queryParams: { ...queryParams, ...filterQueryParams, ...detailsPath.queryParams } });
|
||||
} else if (response.hits > 1) {
|
||||
const listPath = await this.getPathFoListBreadcrumb({ processId, queryParams });
|
||||
await this.router.navigate(listPath.path, { queryParams: { ...queryParams, ...filterQueryParams, ...listPath.queryParams } });
|
||||
} else {
|
||||
await this.router.navigate([], { queryParams: { ...queryParams, ...filterQueryParams } });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Fix Ticket #4684 Navigate on Details if items contain same OrderNumber
|
||||
private _hasSameOrderNumber(response: ListResponseArgsOfDBHOrderItemListItemDTO) {
|
||||
if (response.hits === 0) return false;
|
||||
const orderNumbers = new Set(response.result.map((item) => item.orderNumber));
|
||||
return orderNumbers.size === 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user