mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Compare commits
3 Commits
fix/4690-W
...
fix/4688-A
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2340a0e20 | ||
|
|
a3330263f8 | ||
|
|
89092a5f6e |
@@ -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.
|
||||
|
||||
@@ -125,6 +125,7 @@ export abstract class PickupShelfDetailsBaseComponent {
|
||||
processingStatus: updatedItem.processingStatus,
|
||||
compartmentCode: updatedItem.compartmentCode,
|
||||
compartmentInfo: updatedItem.compartmentInfo,
|
||||
quantity: updatedItem.quantity,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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 } });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ export class PickupShelfOutDetailsComponent extends PickupShelfDetailsBaseCompon
|
||||
|
||||
addToPreviousCompartmentAction$ = this.store.addToPreviousCompartmentAction$;
|
||||
|
||||
mainActions$ = this.store.mainActions$;
|
||||
mainActions$ = this.store.mainShelfOutActions$;
|
||||
|
||||
trackByFnGroupDBHOrderItemListItemDTO = (index: number, group: { type: string; items: DBHOrderItemListItemDTO[] }) => group.type;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PickupShelfDetailsState } from './pickup-shelf-details.state';
|
||||
import { DBHOrderItemListItemDTO } from '@swagger/oms';
|
||||
import { DBHOrderItemListItemDTO, KeyValueDTOOfStringAndString } from '@swagger/oms';
|
||||
|
||||
export const selectOrder = (s: PickupShelfDetailsState) => s.order;
|
||||
|
||||
@@ -245,6 +245,26 @@ export const selectMainActions = (s: PickupShelfDetailsState) => {
|
||||
?.filter((action) => (fetchPartial ? !action.command.includes('FETCHED_PARTIAL') : true));
|
||||
};
|
||||
|
||||
export const selectShelfOutMainActions = (s: PickupShelfDetailsState) => {
|
||||
const items = selectOrderItems(s);
|
||||
const fetchPartial = selectFetchPartial(s);
|
||||
|
||||
// Ticket #4690 Consider every Item for selecting the main actions in Details View - Only for PickUpShelfOut
|
||||
const actions: KeyValueDTOOfStringAndString[] = [];
|
||||
for (const item of items) {
|
||||
const actionsFromItem = item?.actions
|
||||
?.filter((action) => typeof action?.enabled !== 'boolean')
|
||||
?.filter((action) => (fetchPartial ? !action.command.includes('FETCHED_PARTIAL') : true));
|
||||
for (const action of actionsFromItem) {
|
||||
if (!actions.find((a) => a.command === action.command)) {
|
||||
actions.push(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return actions;
|
||||
};
|
||||
|
||||
export const selectCustomerNumber = (s: PickupShelfDetailsState) => {
|
||||
const order = selectOrder(s);
|
||||
return order?.buyer?.buyerNumber;
|
||||
|
||||
@@ -212,6 +212,12 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
|
||||
return this.get(Selectors.selectMainActions);
|
||||
}
|
||||
|
||||
mainShelfOutActions$ = this.select(Selectors.selectShelfOutMainActions);
|
||||
|
||||
get mainShelfOutActions() {
|
||||
return this.get(Selectors.selectShelfOutMainActions);
|
||||
}
|
||||
|
||||
customerNumber$ = this.select(Selectors.selectCustomerNumber);
|
||||
|
||||
get customerNumber() {
|
||||
|
||||
Reference in New Issue
Block a user