Merge tag '3.1' into develop

This commit is contained in:
Lorenz Hilpert
2024-09-04 17:56:06 +02:00
51 changed files with 427 additions and 507 deletions

View File

@@ -13,7 +13,10 @@ export class ThumbnailUrlPipe implements PipeTransform, OnDestroy {
private onDestroy$ = new Subject<void>();
constructor(private domainCatalogThumbnailService: DomainCatalogThumbnailService, private cdr: ChangeDetectorRef) {}
constructor(
private domainCatalogThumbnailService: DomainCatalogThumbnailService,
private cdr: ChangeDetectorRef,
) {}
ngOnDestroy(): void {
this.onDestroy$.next();
@@ -27,7 +30,7 @@ export class ThumbnailUrlPipe implements PipeTransform, OnDestroy {
this.input$
.pipe(
takeUntil(this.onDestroy$),
switchMap((input) => this.domainCatalogThumbnailService.getThumnaulUrl(input))
switchMap((input) => this.domainCatalogThumbnailService.getThumnaulUrl(input)),
)
.subscribe((result) => {
this.result = result;

View File

@@ -43,7 +43,7 @@ export class AppComponent implements OnInit {
private infoService: UserStateService,
private readonly _environment: EnvironmentService,
private readonly _authService: AuthService,
private readonly _modal: UiModalService
private readonly _modal: UiModalService,
) {
this.updateClient();
IsaLogProvider.InfoService = this.infoService;

View File

@@ -1,25 +1,12 @@
import { Injectable } from '@angular/core';
import {
Observable,
of,
BehaviorSubject,
Subject,
merge,
combineLatest,
} from 'rxjs';
import { Observable, of, BehaviorSubject, Subject, merge, combineLatest } from 'rxjs';
import { delay, distinctUntilChanged, map } from 'rxjs/operators';
import { createRandomStringId, createRandomId } from './util';
import {
product,
removeSourcePriceAndProductFromProduct,
} from './data/product';
import { product, removeSourcePriceAndProductFromProduct } from './data/product';
import { RemissionService } from '../services/remission.service';
import { RemissionProcess } from '../models/remission-process';
import { RemissionProduct } from '../models/remission-product';
import {
remissionProducts,
createRemissionProduct,
} from './data/remission-products';
import { remissionProducts, createRemissionProduct } from './data/remission-products';
import { remissionProcessTemplateMock } from './data/remission-process-template';
import { ShippingDocument } from '../models/shipping-document';
import { shippingDocument } from './data/shipping-document';
@@ -41,33 +28,21 @@ import { ActionResult, CapacityType } from '../models';
@Injectable({ providedIn: 'root' })
export class MockRemissionService extends RemissionService {
private delayInMs = 100;
private remissionSubjectStore = new Map<
number,
BehaviorSubject<RemissionProcess>
>();
private remissionSubjectStore = new Map<number, BehaviorSubject<RemissionProcess>>();
private remissionSubjectIdRef = new Map<number, number>();
private reloadProductsSubject = new Subject<void>();
private productSubject = new BehaviorSubject<RemissionProduct[]>(
remissionProducts
);
private productSubject = new BehaviorSubject<RemissionProduct[]>(remissionProducts);
private getRemissionFromStore = (
remissionProcessId: number
): BehaviorSubject<RemissionProcess> => {
private getRemissionFromStore = (remissionProcessId: number): BehaviorSubject<RemissionProcess> => {
const remission =
this.remissionSubjectStore.get(remissionProcessId) ||
this.remissionSubjectStore.get(
this.remissionSubjectIdRef.get(remissionProcessId)
);
this.remissionSubjectStore.get(this.remissionSubjectIdRef.get(remissionProcessId));
return remission;
};
private saveRemissionInStore = (
remissionProcessId: number,
remissionSubject: BehaviorSubject<RemissionProcess>
) => {
private saveRemissionInStore = (remissionProcessId: number, remissionSubject: BehaviorSubject<RemissionProcess>) => {
this.remissionSubjectStore.set(remissionProcessId, remissionSubject);
};
@@ -80,27 +55,20 @@ export class MockRemissionService extends RemissionService {
return processSubject.pipe(distinctUntilChanged(), delay(this.delayInMs));
}
getRemissionProducts(params: {
remissionProcessId: number;
}): Observable<{
getRemissionProducts(params: { remissionProcessId: number }): Observable<{
skip?: number;
take?: number;
hits?: number;
items: RemissionProduct[];
completed: boolean;
}> {
const processSubject = this.getRemissionFromStore(
params.remissionProcessId
);
const processSubject = this.getRemissionFromStore(params.remissionProcessId);
if (!processSubject) {
throw new Error('Prozess nicht gefunden');
}
const process$ = merge(
processSubject,
this.reloadProductsSubject.pipe(map((_) => processSubject.value))
);
const process$ = merge(processSubject, this.reloadProductsSubject.pipe(map((_) => processSubject.value)));
const products$ = this.productSubject.asObservable();
@@ -126,24 +94,19 @@ export class MockRemissionService extends RemissionService {
const productGroupFilter = filter.filter['421228ce'] || [];
if (productGroupFilter.length > 0) {
result.items = result.items.filter((product) =>
productGroupFilter.some((s) => product.productGroup === s)
);
result.items = result.items.filter((product) => productGroupFilter.some((s) => product.productGroup === s));
}
const actionFilter = filter.filter['ce9ee0be'] || [];
result.hits = result.items.length;
result.items = result.items.slice(
result.skip,
result.skip + result.take
);
result.items = result.items.slice(result.skip, result.skip + result.take);
result.completed = result.skip + result.take >= result.hits;
return result;
})
}),
);
}
@@ -153,9 +116,7 @@ export class MockRemissionService extends RemissionService {
createShippingDocument?: boolean;
};
}): Observable<RemissionProcess> {
const processSubject = this.remissionSubjectStore.get(
params.remissionProcessId
);
const processSubject = this.remissionSubjectStore.get(params.remissionProcessId);
if (!processSubject) {
throw new Error('Prozess nicht gefunden');
@@ -214,12 +175,8 @@ export class MockRemissionService extends RemissionService {
}
}
completeRemission(params: {
remissionProcessId: number;
}): Observable<boolean> {
let processSubject = this.remissionSubjectStore.get(
params.remissionProcessId
);
completeRemission(params: { remissionProcessId: number }): Observable<boolean> {
let processSubject = this.remissionSubjectStore.get(params.remissionProcessId);
if (!processSubject) {
const refId = this.remissionSubjectIdRef.get(params.remissionProcessId);
@@ -236,9 +193,7 @@ export class MockRemissionService extends RemissionService {
}
}
getRemission(params: {
remissionProcessId: number;
}): Observable<RemissionProcess> {
getRemission(params: { remissionProcessId: number }): Observable<RemissionProcess> {
const remission = this.getRemissionFromStore(params.remissionProcessId);
if (!remission) {
@@ -248,11 +203,7 @@ export class MockRemissionService extends RemissionService {
return remission.pipe(distinctUntilChanged(), delay(this.delayInMs));
}
isPrintingRequired({
remissionProcessId,
}: {
remissionProcessId: number;
}): Observable<boolean> {
isPrintingRequired({ remissionProcessId }: { remissionProcessId: number }): Observable<boolean> {
const remission = this.getRemissionFromStore(remissionProcessId);
if (!remission) {
@@ -272,10 +223,7 @@ export class MockRemissionService extends RemissionService {
return of(printers).pipe(delay(this.delayInMs));
}
printRemissionList(params: {
remissionProcessId: number;
printerKey: string;
}): Observable<boolean> {
printRemissionList(params: { remissionProcessId: number; printerKey: string }): Observable<boolean> {
const remission = this.getRemissionFromStore(params.remissionProcessId);
if (!remission) {
@@ -285,11 +233,7 @@ export class MockRemissionService extends RemissionService {
return of(true).pipe(delay(this.delayInMs));
}
printShippingDocument(params: {
remissionProcessId: number;
shippingDocumentId?: number;
printerKey: string;
}): Observable<boolean> {
printShippingDocument(params: { remissionProcessId: number; shippingDocumentId?: number; printerKey: string }): Observable<boolean> {
const remission = this.getRemissionFromStore(params.remissionProcessId);
if (!remission || !params.printerKey) {
@@ -307,8 +251,7 @@ export class MockRemissionService extends RemissionService {
getFilters(params: { remissionProcessId: number }): Observable<Filter[]> {
const remission = this.getRemissionFromStore(params.remissionProcessId);
const filterForGivenSourceType =
remission.value.filter.source === 'zentral' ? filter : filterUeberlauf;
const filterForGivenSourceType = remission.value.filter.source === 'zentral' ? filter : filterUeberlauf;
return of(filterForGivenSourceType).pipe(delay(this.delayInMs));
}
@@ -327,38 +270,24 @@ export class MockRemissionService extends RemissionService {
return of(remissionSources).pipe(delay(this.delayInMs));
}
getShippingDocuments(params: {
remissionProcessId: number;
shippingDocumentId: number;
}): Observable<ShippingDocument> {
getShippingDocuments(params: { remissionProcessId: number; shippingDocumentId: number }): Observable<ShippingDocument> {
const remissionSub = this.getRemissionFromStore(params.remissionProcessId);
return remissionSub.pipe(
map((remission) =>
remission.shippingDocuments.find(
(shippingDoc) => shippingDoc.id === params.shippingDocumentId
)
),
map((remission) => remission.shippingDocuments.find((shippingDoc) => shippingDoc.id === params.shippingDocumentId)),
distinctUntilChanged(),
delay(this.delayInMs)
delay(this.delayInMs),
);
}
deleteProductFromRemissionList(input: {
remissionProcessId: number;
remissionProductId: number;
}): Observable<ActionResult<boolean>> {
deleteProductFromRemissionList(input: { remissionProcessId: number; remissionProductId: number }): Observable<ActionResult<boolean>> {
return of({
error: false,
result: true,
});
}
addProductToRemit(input: {
product: Product;
remissionReason: string;
remissionQuantity: number;
}): Observable<RemissionProduct> {
addProductToRemit(input: { product: Product; remissionReason: string; remissionQuantity: number }): Observable<RemissionProduct> {
const productToAdd = removeSourcePriceAndProductFromProduct({ ...product });
const newProduct = createRemissionProduct({
@@ -382,9 +311,7 @@ export class MockRemissionService extends RemissionService {
quantity?: number;
inStock?: number;
}): Observable<ActionResult<boolean>> {
const processSubject = this.getRemissionFromStore(
params.remissionProcessId
);
const processSubject = this.getRemissionFromStore(params.remissionProcessId);
const process = processSubject.value;
const products = this.productSubject.value;
@@ -392,22 +319,15 @@ export class MockRemissionService extends RemissionService {
throw new Error('Prozess nicht gefunden');
}
let productToAdd = products.find(
(product) => product.id === params.remissionProductId
);
let newProducts = products.filter(
(product) => product.id !== params.remissionProductId
);
let productToAdd = products.find((product) => product.id === params.remissionProductId);
let newProducts = products.filter((product) => product.id !== params.remissionProductId);
if (!!params.placementType || !!params.quantity) {
const productToUpdateInProductList = {
...productToAdd,
remissionQuantity: productToAdd.remissionQuantity - params.quantity,
};
newProducts =
productToAdd.remissionQuantity - params.quantity < 1
? newProducts
: [...newProducts, productToUpdateInProductList];
newProducts = productToAdd.remissionQuantity - params.quantity < 1 ? newProducts : [...newProducts, productToUpdateInProductList];
productToAdd = {
...productToAdd,
@@ -415,9 +335,7 @@ export class MockRemissionService extends RemissionService {
};
}
const shippingDocumentToUpdate = process.shippingDocuments.find(
(document) => document.id === params.shippingDocumentId
);
const shippingDocumentToUpdate = process.shippingDocuments.find((document) => document.id === params.shippingDocumentId);
const updatedShippingDocument = {
...shippingDocumentToUpdate,
products: [...shippingDocumentToUpdate.products, productToAdd],
@@ -426,9 +344,7 @@ export class MockRemissionService extends RemissionService {
const updatedProcess = {
...process,
shippingDocuments: [
...process.shippingDocuments.filter(
(document) => document.id !== params.shippingDocumentId
),
...process.shippingDocuments.filter((document) => document.id !== params.shippingDocumentId),
updatedShippingDocument,
],
};
@@ -448,9 +364,7 @@ export class MockRemissionService extends RemissionService {
remissionProductId: number;
placementType?: string;
}): Observable<boolean> {
const processSubject = this.getRemissionFromStore(
params.remissionProcessId
);
const processSubject = this.getRemissionFromStore(params.remissionProcessId);
const process = processSubject.value;
const products = this.productSubject.value;
@@ -458,44 +372,30 @@ export class MockRemissionService extends RemissionService {
throw new Error('Prozess nicht gefunden');
}
const shippingDocumentToUpdate = process.shippingDocuments.find(
(document) => document.id === params.shippingDocumentId
);
const shippingDocumentToUpdate = process.shippingDocuments.find((document) => document.id === params.shippingDocumentId);
const updatedShippingDocument = {
...shippingDocumentToUpdate,
products: shippingDocumentToUpdate.products.filter(
(product) => product.id !== params.remissionProductId
),
products: shippingDocumentToUpdate.products.filter((product) => product.id !== params.remissionProductId),
};
const productToRemove = shippingDocumentToUpdate.products.find(
(product) => product.id === params.remissionProductId
);
const productInProductList = products.find(
(product) => product.id === params.remissionProductId
);
const productToRemove = shippingDocumentToUpdate.products.find((product) => product.id === params.remissionProductId);
const productInProductList = products.find((product) => product.id === params.remissionProductId);
const updatedProductInProductList = !!productInProductList
? {
...productInProductList,
remissionQuantity:
Number(productInProductList.remissionQuantity) +
Number(productToRemove.remissionQuantity),
remissionQuantity: Number(productInProductList.remissionQuantity) + Number(productToRemove.remissionQuantity),
}
: productToRemove;
const updatedProcess = {
...process,
shippingDocuments: [
...process.shippingDocuments.filter(
(document) => document.id !== params.shippingDocumentId
),
...process.shippingDocuments.filter((document) => document.id !== params.shippingDocumentId),
updatedShippingDocument,
],
};
const updatedProducts = [
...this.productSubject.value.filter(
(product) => product.id !== updatedProductInProductList.id
),
...this.productSubject.value.filter((product) => product.id !== updatedProductInProductList.id),
updatedProductInProductList,
];
@@ -509,12 +409,8 @@ export class MockRemissionService extends RemissionService {
this.reloadProductsSubject.next();
}
createShippingDocument(params: {
remissionProcessId: number;
}): Observable<ShippingDocument> {
const processSubject = this.getRemissionFromStore(
params.remissionProcessId
);
createShippingDocument(params: { remissionProcessId: number }): Observable<ShippingDocument> {
const processSubject = this.getRemissionFromStore(params.remissionProcessId);
if (!processSubject) {
throw new Error('Prozess nicht gefunden');
@@ -526,10 +422,7 @@ export class MockRemissionService extends RemissionService {
id: createRandomId(),
shippingDocumentNumber: createRandomStringId(),
};
const updatedShippingDocuments = [
...process.shippingDocuments,
newShippingDocument,
];
const updatedShippingDocuments = [...process.shippingDocuments, newShippingDocument];
const updatedProcess = {
...process,
shippingDocuments: updatedShippingDocuments,
@@ -545,18 +438,14 @@ export class MockRemissionService extends RemissionService {
shippingDocumentId: number;
containerId: string;
}): Observable<ActionResult<boolean>> {
const processSubject = this.getRemissionFromStore(
params.remissionProcessId
);
const processSubject = this.getRemissionFromStore(params.remissionProcessId);
if (!processSubject) {
throw new Error('Prozess nicht gefunden');
}
const process = processSubject.value;
const shippingContainerToUpdate = process.shippingDocuments.find(
(document) => document.id === params.shippingDocumentId
);
const shippingContainerToUpdate = process.shippingDocuments.find((document) => document.id === params.shippingDocumentId);
const updatedShippingContainer = {
...shippingContainerToUpdate,
isCompleted: true,
@@ -564,9 +453,7 @@ export class MockRemissionService extends RemissionService {
const updatedProcess = {
...process,
shippingDocuments: [
...process.shippingDocuments.filter(
(document) => document.id !== params.shippingDocumentId
),
...process.shippingDocuments.filter((document) => document.id !== params.shippingDocumentId),
updatedShippingContainer,
],
};
@@ -579,9 +466,7 @@ export class MockRemissionService extends RemissionService {
}).pipe(delay(this.delayInMs));
}
completeRemissions(params: {
remissionProcessId: number;
}): Observable<boolean> {
completeRemissions(params: { remissionProcessId: number }): Observable<boolean> {
return;
}
@@ -605,9 +490,7 @@ export class MockRemissionService extends RemissionService {
return of(true);
}
deleteShippingDocument(): Observable<
ActionResult<{ deleted: boolean; completedRemissionsExist: boolean }>
> {
deleteShippingDocument(): Observable<ActionResult<{ deleted: boolean; completedRemissionsExist: boolean }>> {
return of({
result: {
deleted: true,
@@ -620,10 +503,7 @@ export class MockRemissionService extends RemissionService {
return;
}
getCapacities(params: {
selectedFilters?: { [filterId: string]: string[] };
supplierId: number;
}): Observable<CapacityType[]> {
getCapacities(params: { selectedFilters?: { [filterId: string]: string[] }; supplierId: number }): Observable<CapacityType[]> {
return of([]);
}
}

View File

@@ -58,11 +58,11 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
this.store.isDownloadAvailabilityAvailable$,
]).pipe(
map((values) => values.some((v) => v)),
shareReplay()
shareReplay(),
);
showDeliveryTruck$ = combineLatest([this.store.isDeliveryAvailabilityAvailable$, this.store.isDeliveryDigAvailabilityAvailable$]).pipe(
map(([delivery, digDelivery]) => delivery || digDelivery)
map(([delivery, digDelivery]) => delivery || digDelivery),
);
showDeliveryB2BTruck$ = combineLatest([
@@ -71,7 +71,7 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
]).pipe(map(([digDelivery, b2bDelivery]) => b2bDelivery && !digDelivery));
customerFeatures$ = this.applicationService.activatedProcessId$.pipe(
switchMap((processId) => this._domainCheckoutService.getCustomerFeatures({ processId }))
switchMap((processId) => this._domainCheckoutService.getCustomerFeatures({ processId })),
);
showSubscriptionBadge$ = this.store.item$.pipe(map((item) => item?.features?.find((i) => i.key === 'PFO')));
@@ -80,13 +80,13 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
promotionPoints$ = this.store.item$.pipe(map((item) => item?.redemptionPoints));
showPromotionBadge$ = combineLatest([this.hasPromotionFeature$, this.promotionPoints$]).pipe(
map(([hasPromotionFeature, promotionPoints]) => hasPromotionFeature && promotionPoints > 0)
map(([hasPromotionFeature, promotionPoints]) => hasPromotionFeature && promotionPoints > 0),
);
showArchivBadge$ = this.store.item$.pipe(map((item) => item?.features?.find((i) => i.key === 'ARC')));
isBadgeVisible$ = combineLatest([this.showSubscriptionBadge$, this.showPromotionBadge$, this.showArchivBadge$]).pipe(
map(([showSubscriptionBadge, showPromotionBadge, showArchivBadge]) => showSubscriptionBadge || showPromotionBadge || showArchivBadge)
map(([showSubscriptionBadge, showPromotionBadge, showArchivBadge]) => showSubscriptionBadge || showPromotionBadge || showArchivBadge),
);
contributors$ = this.store.item$.pipe(map((item) => item?.product?.contributors?.split(';').map((m) => m.trim())));
@@ -101,11 +101,11 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
}
return this._datePipe.transform(date, 'dd. MMMM y');
})
}),
);
selectedBranchId$ = this.applicationService.activatedProcessId$.pipe(
switchMap((processId) => this.applicationService.getSelectedBranch$(processId))
switchMap((processId) => this.applicationService.getSelectedBranch$(processId)),
);
get isTablet$() {
@@ -131,7 +131,7 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
return 'Sie sehen den Bestand einer anderen Filiale.';
}
return '';
})
}),
);
priceMaintained$ = combineLatest([
@@ -142,7 +142,7 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
]).pipe(
map((availabilities) => {
return availabilities?.some((availability) => (availability as any)?.priceMaintained) ?? false;
})
}),
);
price$ = combineLatest([
@@ -174,7 +174,7 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
}
return null;
})
}),
);
constructor(
@@ -193,7 +193,7 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
private _environment: EnvironmentService,
private _router: Router,
private _domainCheckoutService: DomainCheckoutService,
private _store: Store
private _store: Store,
) {}
ngOnInit() {
@@ -201,8 +201,8 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
.pipe(
debounceTime(0),
switchMap((params) =>
this.applicationService.getSelectedBranch$(Number(params.processId)).pipe(map((selectedBranch) => ({ params, selectedBranch })))
)
this.applicationService.getSelectedBranch$(Number(params.processId)).pipe(map((selectedBranch) => ({ params, selectedBranch }))),
),
)
.subscribe(({ params, selectedBranch }) => {
const processId = Number(params.processId);
@@ -221,13 +221,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)
filter((f) => !!f),
);
const ean$ = this.activatedRoute.params.pipe(
tap((_) => (this.showRecommendations = false)),
map((params) => params?.ean || undefined),
filter((f) => !!f)
filter((f) => !!f),
);
const more$ = this.activatedRoute.params.subscribe(() => (this.showMore = false));
@@ -241,9 +241,9 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
this.store.item$
.pipe(
withLatestFrom(this.isTablet$),
filter(([item, isTablet]) => !!item)
filter(([item, isTablet]) => !!item),
)
.subscribe(([item, isTablet]) => (isTablet ? this.updateBreadcrumb(item) : this.updateBreadcrumbDesktop(item)))
.subscribe(([item, isTablet]) => (isTablet ? this.updateBreadcrumb(item) : this.updateBreadcrumbDesktop(item))),
);
}
@@ -354,7 +354,7 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
if (result?.data) {
this.showPurchasingModal(result.data);
}
})
}),
);
}
@@ -425,7 +425,7 @@ export class ArticleDetailsComponent implements OnInit, OnDestroy {
first(),
switchMap((customerFeatures) => {
return this._domainCheckoutService.canSetCustomer({ processId: this.applicationService.activatedProcessId, customerFeatures });
})
}),
)
.toPromise();
this._router.navigate(nav.path, {

View File

@@ -31,7 +31,7 @@ export class ArticleSearchComponent implements OnInit, OnDestroy {
private _breadcrumb: BreadcrumbService,
private _articleSearch: ArticleSearchService,
private _activatedRoute: ActivatedRoute,
private _navigationService: ProductCatalogNavigationService
private _navigationService: ProductCatalogNavigationService,
) {}
ngOnInit() {

View File

@@ -65,7 +65,7 @@ export class ArticleSearchFilterComponent implements OnInit, OnDestroy {
private _environment: EnvironmentService,
private _activatedRoute: ActivatedRoute,
public application: ApplicationService,
private _navigationService: ProductCatalogNavigationService
private _navigationService: ProductCatalogNavigationService,
) {}
ngOnInit() {

View File

@@ -60,7 +60,7 @@ export class PageCatalogComponent implements OnInit, AfterViewInit, OnDestroy {
public auth: AuthService,
private _environmentService: EnvironmentService,
private _renderer: Renderer2,
private _actions: ActionsSubject
private _actions: ActionsSubject,
) {}
ngOnInit() {
@@ -76,7 +76,7 @@ export class PageCatalogComponent implements OnInit, AfterViewInit, OnDestroy {
return 'Bitte wählen Sie eine Filiale aus, um den Bestand einer anderen Filiale zu sehen';
}
return '';
})
}),
);
}

View File

@@ -52,17 +52,17 @@ export class CheckoutSummaryComponent implements OnInit, OnDestroy {
// Ticket #4228 Für die korrekte Gruppierung der Items bei gleichem Bestellziel (Aufsplitten von Abholung und Rücklage)
const ordersWithMultipleFeatures = filteredOrders.filter((order) =>
order.items.find((item) => item.features.orderType !== order.features.orderType)
order.items.find((item) => item.features.orderType !== order.features.orderType),
);
if (!!ordersWithMultipleFeatures) {
for (let orderWithMultipleFeatures of ordersWithMultipleFeatures) {
if (orderWithMultipleFeatures?.items?.length > 1) {
const itemsWithOrderFeature = orderWithMultipleFeatures.items.filter(
(item) => item.features.orderType === orderWithMultipleFeatures.features.orderType
(item) => item.features.orderType === orderWithMultipleFeatures.features.orderType,
);
const itemsWithDifferentOrderFeature = orderWithMultipleFeatures.items.filter(
(item) => item.features.orderType !== orderWithMultipleFeatures.features.orderType
(item) => item.features.orderType !== orderWithMultipleFeatures.features.orderType,
);
filteredOrders = [...filteredOrders.filter((order) => order.id !== orderWithMultipleFeatures.id)];
@@ -85,20 +85,20 @@ export class CheckoutSummaryComponent implements OnInit, OnDestroy {
};
});
}),
shareReplay()
shareReplay(),
);
hasAbholung$ = this.displayOrders$.pipe(
map((displayOrders) => displayOrders.filter((order) => order.features?.orderType === 'Abholung')?.length > 0)
map((displayOrders) => displayOrders.filter((order) => order.features?.orderType === 'Abholung')?.length > 0),
);
totalItemCount$ = this.displayOrders$.pipe(
map((displayOrders) =>
displayOrders.reduce(
(total, displayOrder) => total + displayOrder?.items?.reduce((subTotal, order) => subTotal + order?.quantity, 0),
0
)
)
0,
),
),
);
totalReadingPoints$ = this.displayOrders$.pipe(
@@ -122,7 +122,7 @@ export class CheckoutSummaryComponent implements OnInit, OnDestroy {
} else {
return NEVER;
}
})
}),
);
totalPrice$ = this.displayOrders$.pipe(
@@ -130,9 +130,9 @@ export class CheckoutSummaryComponent implements OnInit, OnDestroy {
displayOrders.reduce(
(total, displayOrder) =>
total + displayOrder?.items?.reduce((subTotal, order) => subTotal + order?.price?.value?.value * order.quantity, 0),
0
)
)
0,
),
),
);
isPrinting$ = new BehaviorSubject(false);
@@ -142,20 +142,20 @@ export class CheckoutSummaryComponent implements OnInit, OnDestroy {
containsDeliveryOrder$ = this.displayOrders$.pipe(
map(
(displayOrders) =>
displayOrders.filter((o) => ['Versand', 'B2B-Versand', 'DIG-Versand'].indexOf(o.features?.orderType) > -1)?.length > 0
)
displayOrders.filter((o) => ['Versand', 'B2B-Versand', 'DIG-Versand'].indexOf(o.features?.orderType) > -1)?.length > 0,
),
);
customer$ = this.displayOrders$.pipe(
switchMap((o) => this.customerService.getCustomers(o[0].buyerNumber, { take: 5 })),
map((customers) => customers.result[0]),
shareReplay()
shareReplay(),
);
isB2BCustomer$ = this.customer$.pipe(map((customer) => customer?.features?.find((f) => f.key === 'b2b') != null));
takeNowOrders$ = this.displayOrders$.pipe(
map((displayOrders) => displayOrders.filter((o) => o.items.find((oi) => oi.features?.orderType === 'Rücklage') != null))
map((displayOrders) => displayOrders.filter((o) => o.items.find((oi) => oi.features?.orderType === 'Rücklage') != null)),
);
get isDesktop$() {
@@ -184,7 +184,7 @@ export class CheckoutSummaryComponent implements OnInit, OnDestroy {
private _productNavigationService: ProductCatalogNavigationService,
private _shelfOutNavigationService: PickUpShelfOutNavigationService,
private _environmentService: EnvironmentService,
private _cdr: ChangeDetectorRef
private _cdr: ChangeDetectorRef,
) {
this.breadcrumb
.getBreadcrumbsByKeyAndTags$(this.applicationService.activatedProcessId, ['checkout'])
@@ -319,7 +319,7 @@ export class CheckoutSummaryComponent implements OnInit, OnDestroy {
first(),
map((printers) => {
if (Array.isArray(printers)) return printers.find((printer) => printer.selected === true);
})
}),
)
.toPromise();

View File

@@ -78,12 +78,12 @@ export class CustomerOrderDetailsItemComponent extends ComponentStore<CustomerOr
switchMap((oi) =>
this._omsService
.getCompletedTasks({ orderId: oi.orderId, orderItemId: oi.orderItemId, orderItemSubsetId: oi.orderItemSubsetId, take: 4, skip: 0 })
.pipe(catchError(() => NEVER))
)
.pipe(catchError(() => NEVER)),
),
);
canChangeQuantity$ = combineLatest([this.orderItem$, this._store.fetchPartial$]).pipe(
map(([item, partialPickup]) => ([16, 8192].includes(item?.processingStatus) || partialPickup) && item.quantity > 1)
map(([item, partialPickup]) => ([16, 8192].includes(item?.processingStatus) || partialPickup) && item.quantity > 1),
);
get quantity() {
@@ -109,7 +109,7 @@ export class CustomerOrderDetailsItemComponent extends ComponentStore<CustomerOr
}
readonly selected$ = combineLatest([this.orderItem$, this._store.selectedeOrderItemSubsetIds$]).pipe(
map(([orderItem, selectedItems]) => selectedItems.includes(orderItem?.orderItemSubsetId))
map(([orderItem, selectedItems]) => selectedItems.includes(orderItem?.orderItemSubsetId)),
);
@Output()
@@ -120,7 +120,7 @@ export class CustomerOrderDetailsItemComponent extends ComponentStore<CustomerOr
}
readonly selectable$ = combineLatest([this._store.items$, this._store.itemsSelectable$, this._store.fetchPartial$]).pipe(
map(([orderItems, selectable, fetchPartial]) => orderItems.length > 1 && selectable && fetchPartial)
map(([orderItems, selectable, fetchPartial]) => orderItems.length > 1 && selectable && fetchPartial),
);
get receipts() {
@@ -152,7 +152,7 @@ export class CustomerOrderDetailsItemComponent extends ComponentStore<CustomerOr
private _domainReceiptService: DomainReceiptService,
private _omsService: DomainOmsService,
private _cdr: ChangeDetectorRef,
private _environment: EnvironmentService
private _environment: EnvironmentService,
) {
super({
more: false,
@@ -194,11 +194,11 @@ export class CustomerOrderDetailsItemComponent extends ComponentStore<CustomerOr
done?.([]);
}
},
() => {}
)
)
)
)
() => {},
),
),
),
),
);
async saveSpecialComment() {
@@ -254,12 +254,15 @@ export class CustomerOrderDetailsItemComponent extends ComponentStore<CustomerOr
// Macht aus einem String Array ein Array von Objekten mit den keys trackingProvider und trackingNumber
private _trackingTransformationHelper(trackingInformationPairs: string[]): Array<{ trackingProvider: string; trackingNumber: string }> {
return trackingInformationPairs.reduce((acc, current, index, array) => {
if (index % 2 === 0) {
acc.push({ trackingProvider: current, trackingNumber: array[index + 1] });
}
return acc;
}, [] as { trackingProvider: string; trackingNumber: string }[]);
return trackingInformationPairs.reduce(
(acc, current, index, array) => {
if (index % 2 === 0) {
acc.push({ trackingProvider: current, trackingNumber: array[index + 1] });
}
return acc;
},
[] as { trackingProvider: string; trackingNumber: string }[],
);
}
getTrackingNumberLink(trackingNumber: string) {

View File

@@ -79,7 +79,7 @@ export class CustomerOrderSearchFilterComponent implements OnInit, OnDestroy {
private _environment: EnvironmentService,
private _activatedRoute: ActivatedRoute,
public application: ApplicationService,
private _navigationService: CustomerOrdersNavigationService
private _navigationService: CustomerOrdersNavigationService,
) {}
ngOnInit() {

View File

@@ -35,7 +35,7 @@ export class CustomerOrderSearchComponent implements OnInit, OnDestroy {
private _navigationService: CustomerOrdersNavigationService,
private _breadcrumb: BreadcrumbService,
private _activatedRoute: ActivatedRoute,
private _environment: EnvironmentService
private _environment: EnvironmentService,
) {}
ngOnInit() {

View File

@@ -127,7 +127,10 @@ export class CustomerOrderSearchStore extends ComponentStore<CustomerOrderSearch
cancelSearch$ = new Subject<void>();
constructor(private _domainGoodsInService: DomainCustomerOrderService, private _cache: CacheService) {
constructor(
private _domainGoodsInService: DomainCustomerOrderService,
private _cache: CacheService,
) {
super({
fetching: false,
silentFetching: false,
@@ -289,10 +292,10 @@ export class CustomerOrderSearchStore extends ComponentStore<CustomerOrderSearch
}
this.patchState({ fetching: false, silentFetching: false });
console.error('GoodsInSearchStore.search()', err);
}
)
},
),
);
})
)
}),
),
);
}

View File

@@ -42,8 +42,10 @@ export interface CustomerOrderSearchResultsState {
styleUrls: ['customer-order-search-results.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CustomerOrderSearchResultsComponent extends ComponentStore<CustomerOrderSearchResultsState>
implements OnInit, AfterViewInit, OnDestroy {
export class CustomerOrderSearchResultsComponent
extends ComponentStore<CustomerOrderSearchResultsState>
implements OnInit, AfterViewInit, OnDestroy
{
@ViewChildren(CustomerOrderItemComponent) listItems: QueryList<CustomerOrderItemComponent>;
@ViewChild(UiScrollContainerComponent) scrollContainer: UiScrollContainerComponent;
@@ -63,7 +65,7 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
listEmpty$ = combineLatest([this.loading$, this.hits$]).pipe(
map(([loading, hits]) => !loading && hits === 0),
shareReplay()
shareReplay(),
);
message$ = this._customerOrderSearchStore.message$;
@@ -76,9 +78,9 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
actions$ = combineLatest([this.items$, this.selectedOrderItemSubsetIds$]).pipe(
map(([items, selectedOrderItemSubsetIds]) =>
items?.find((item) => selectedOrderItemSubsetIds.find((orderItemSubsetId) => item.orderItemSubsetId === orderItemSubsetId))
items?.find((item) => selectedOrderItemSubsetIds.find((orderItemSubsetId) => item.orderItemSubsetId === orderItemSubsetId)),
),
map((item) => item?.actions?.filter((action) => this.selectionRules(action)))
map((item) => item?.actions?.filter((action) => this.selectionRules(action))),
);
get selectedItems() {
@@ -108,7 +110,7 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
filter$ = this._customerOrderSearchStore.filter$.pipe(filter((f) => !!f));
hasFilter$ = combineLatest([this.filter$, this._customerOrderSearchStore.defaultSettings$]).pipe(
map(([filter, defaultFilter]) => !isEqual(filter?.getQueryParams(), Filter.create(defaultFilter).getQueryParams()))
map(([filter, defaultFilter]) => !isEqual(filter?.getQueryParams(), Filter.create(defaultFilter).getQueryParams())),
);
get isTablet$() {
@@ -148,7 +150,7 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
private _navigationService: CustomerOrdersNavigationService,
private _application: ApplicationService,
private _cache: CacheService,
private _router: Router
private _router: Router,
) {
super({
selectedOrderItemSubsetIds: [],
@@ -166,7 +168,7 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
const clean = { ...queryParams };
delete clean['updateResults'];
}
})
}),
);
this._searchResultSubscription.add(
@@ -174,8 +176,8 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
.pipe(
debounceTime(150),
switchMap(([processId, params]) =>
this._application.getSelectedBranch$(processId).pipe(map((selectedBranch) => ({ processId, params, selectedBranch })))
)
this._application.getSelectedBranch$(processId).pipe(map((selectedBranch) => ({ processId, params, selectedBranch }))),
),
)
.subscribe(async ({ processId, params, selectedBranch }) => {
const branchChanged = selectedBranch?.id !== this._customerOrderSearchStore?.selectedBranch?.id;
@@ -243,7 +245,7 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
if (this._activatedRoute?.outlet === 'primary') {
await this.removeDetailsBreadcrumb(processId);
}
})
}),
);
this._searchResultSubscription.add(
@@ -261,12 +263,12 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
await this.navigateToDetails(
processId,
result?.results?.result?.find((_) => true),
queryParams
queryParams,
);
} else if ((!!result?.clear || this._activatedRoute.outlet === 'primary') && this.isDesktopLarge) {
await this._navigationService.getCustomerOrdersResultsPath(processId, { queryParams }).navigate();
}
})
}),
);
this._customerOrderSearchStore.searchResultClearedSubject.pipe(takeUntil(this._onDestroy$)).subscribe((_) => this.clearSelectedItems());
@@ -279,7 +281,7 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
main_qs: this.sharedFilterInputGroupMain?.uiInput?.value,
};
this._customerOrderSearchStore?.setQueryParams(queryParams);
})
}),
);
this._router.events.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
@@ -302,7 +304,7 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
if (this._activatedRoute.outlet === 'primary') {
this._cache.set<number>(
{ processId: this._customerOrderSearchStore.processId, token: this.SCROLL_POSITION_TOKEN },
this.scrollContainer?.scrollPos
this.scrollContainer?.scrollPos,
);
}
}

View File

@@ -43,12 +43,12 @@ export class CustomerOrderComponent implements OnInit {
private _renderer: Renderer2,
private _environmentService: EnvironmentService,
public auth: AuthService,
private _store: CustomerOrderSearchStore
private _store: CustomerOrderSearchStore,
) {}
ngOnInit(): void {
this.selectedBranch$ = this.application.activatedProcessId$.pipe(
switchMap((processId) => this.application.getSelectedBranch$(Number(processId)))
switchMap((processId) => this.application.getSelectedBranch$(Number(processId))),
);
/* Ticket #4544 - Suchrequest abbrechen bei Prozesswechsel

View File

@@ -41,8 +41,10 @@ export interface CustomerTypeSelectorState {
},
],
})
export class CustomerTypeSelectorComponent extends ComponentStore<CustomerTypeSelectorState>
implements OnInit, OnDestroy, ControlValueAccessor {
export class CustomerTypeSelectorComponent
extends ComponentStore<CustomerTypeSelectorState>
implements OnInit, OnDestroy, ControlValueAccessor
{
@ViewChildren(UiCheckboxComponent)
checkboxes: QueryList<UiCheckboxComponent>;
@@ -133,7 +135,7 @@ export class CustomerTypeSelectorComponent extends ComponentStore<CustomerTypeSe
return result;
}),
shareReplay(1)
shareReplay(1),
);
}
@@ -144,7 +146,11 @@ export class CustomerTypeSelectorComponent extends ComponentStore<CustomerTypeSe
onChange = (value: string) => {};
onTouched = () => {};
constructor(private _checkoutService: DomainCheckoutService, private _cache: CacheService, private _cdr: ChangeDetectorRef) {
constructor(
private _checkoutService: DomainCheckoutService,
private _cache: CacheService,
private _cdr: ChangeDetectorRef,
) {
super({
processId: undefined,
customerType: undefined,
@@ -165,10 +171,10 @@ export class CustomerTypeSelectorComponent extends ComponentStore<CustomerTypeSe
this.patchState({ options });
this._cache.set('customerTypeOptions', options);
},
(err) => {}
)
)
)
(err) => {},
),
),
),
);
});

View File

@@ -76,7 +76,7 @@ export abstract class AbstractCreateCustomer implements OnInit, OnDestroy {
protected modal: UiModalService,
protected breadcrumb: BreadcrumbService,
protected cdr: ChangeDetectorRef,
protected customerSearchNavigation: CustomerSearchNavigation
protected customerSearchNavigation: CustomerSearchNavigation,
) {
this._initProcessId$();
}
@@ -88,7 +88,7 @@ export abstract class AbstractCreateCustomer implements OnInit, OnDestroy {
map((data) => +data.processId),
tap((processId) => (this.latestProcessId = processId)),
distinctUntilChanged(),
shareReplay(1)
shareReplay(1),
);
this.processId$
@@ -118,7 +118,7 @@ export abstract class AbstractCreateCustomer implements OnInit, OnDestroy {
const formData = await this.activatedRoute.queryParams
.pipe(
map((params) => params['formData']),
first()
first(),
)
.toPromise();
@@ -192,7 +192,7 @@ export abstract class AbstractCreateCustomer implements OnInit, OnDestroy {
minBirthDateValidator = (): ValidatorFn => {
return (control: AbstractControl): ValidationErrors | null => {
const minAge = 18; // 18 years
const minAge = 16; // 16 years
if (!control.value) {
return null;
@@ -202,8 +202,8 @@ export abstract class AbstractCreateCustomer implements OnInit, OnDestroy {
const minBirthDate = new Date();
minBirthDate.setFullYear(minBirthDate.getFullYear() - minAge);
// Check if customer is over 18 years old
if (this._checkIfAgeOver18(controlBirthDate, minBirthDate)) {
// Check if customer is over 16 years old
if (this._checkIfAgeOver16(controlBirthDate, minBirthDate)) {
return null;
} else {
return { minBirthDate: `Teilnahme ab ${minAge} Jahren` };
@@ -211,7 +211,7 @@ export abstract class AbstractCreateCustomer implements OnInit, OnDestroy {
};
};
private _checkIfAgeOver18(inputDate: Date, minBirthDate: Date): boolean {
private _checkIfAgeOver16(inputDate: Date, minBirthDate: Date): boolean {
// Check year
if (inputDate.getFullYear() < minBirthDate.getFullYear()) {
return true;
@@ -251,7 +251,7 @@ export abstract class AbstractCreateCustomer implements OnInit, OnDestroy {
return of({ invalid: 'E-Mail ist ungültig' });
}
}
})
}),
);
}),
tap((error) => {
@@ -260,7 +260,7 @@ export abstract class AbstractCreateCustomer implements OnInit, OnDestroy {
}
control.markAsTouched();
this.cdr.markForCheck();
})
}),
);
};
@@ -307,13 +307,13 @@ export abstract class AbstractCreateCustomer implements OnInit, OnDestroy {
return of({ invalid: 'Kundenkartencode ist ungültig' });
}
}
})
}),
);
}),
tap(() => {
control.markAsTouched();
this.cdr.markForCheck();
})
}),
);
};

View File

@@ -84,7 +84,7 @@ export class CreateP4MCustomerComponent extends AbstractCreateCustomer implement
return this.fetchCustomerInfo();
}
return of(null);
})
}),
);
this.existingCustomer$
@@ -94,12 +94,12 @@ export class CreateP4MCustomerComponent extends AbstractCreateCustomer implement
if (info) {
return this.customerService.getCustomer(info.id, 2).pipe(
map((res) => res.result),
catchError((err) => NEVER)
catchError((err) => NEVER),
);
}
return NEVER;
}),
withLatestFrom(this.processId$)
withLatestFrom(this.processId$),
)
.subscribe(([customer, processId]) => {
if (customer) {
@@ -166,7 +166,7 @@ export class CreateP4MCustomerComponent extends AbstractCreateCustomer implement
data: err,
});
return [null];
})
}),
);
}

View File

@@ -34,7 +34,7 @@ export class CustomerDetailsViewMainComponent extends ComponentStore<CustomerDet
customerService = inject(CrmCustomerService);
fetching$ = combineLatest([this._store.fetchingCustomer$, this._store.fetchingCustomerList$]).pipe(
map(([fetchingCustomer, fetchingList]) => fetchingCustomer || fetchingList)
map(([fetchingCustomer, fetchingList]) => fetchingCustomer || fetchingList),
);
isBusy$ = this.select((s) => s.isBusy);
@@ -46,31 +46,31 @@ export class CustomerDetailsViewMainComponent extends ComponentStore<CustomerDet
customerId$ = this._store.customerId$;
historyRoute$ = combineLatest([this.processId$, this.customerId$]).pipe(
map(([processId, customerId]) => this._navigation.historyRoute({ processId, customerId }))
map(([processId, customerId]) => this._navigation.historyRoute({ processId, customerId })),
);
ordersRoute$ = combineLatest([this.processId$, this.customerId$]).pipe(
map(([processId, customerId]) => this._navigation.ordersRoute({ processId, customerId }))
map(([processId, customerId]) => this._navigation.ordersRoute({ processId, customerId })),
);
isB2b$ = this._store.isBusinessKonto$;
editRoute$ = combineLatest([this.processId$, this.customerId$, this.isB2b$]).pipe(
map(([processId, customerId, isB2b]) => this._navigation.editRoute({ processId, customerId, isB2b }))
map(([processId, customerId, isB2b]) => this._navigation.editRoute({ processId, customerId, isB2b })),
);
showEditButton$ = combineLatest([this._store.isOnlinekonto$, this._store.isBestellungOhneKonto$]).pipe(
map(([isOnlinekonto, isBestellungOhneKonto]) => !isOnlinekonto && !isBestellungOhneKonto)
map(([isOnlinekonto, isBestellungOhneKonto]) => !isOnlinekonto && !isBestellungOhneKonto),
);
hasKundenkarte$ = combineLatest([this._store.isKundenkarte$, this._store.isOnlineKontoMitKundenkarte$]).pipe(
map(([isKundenkarte, isOnlineKontoMitKundenkarte]) => isKundenkarte || isOnlineKontoMitKundenkarte)
map(([isKundenkarte, isOnlineKontoMitKundenkarte]) => isKundenkarte || isOnlineKontoMitKundenkarte),
);
kundenkarteRoute$ = combineLatest([this.hasKundenkarte$, this.processId$, this.customerId$]).pipe(
map(([hasKundenkarte, processId, customerId]) =>
hasKundenkarte ? this._navigation.kundenkarteRoute({ processId, customerId }) : undefined
)
hasKundenkarte ? this._navigation.kundenkarteRoute({ processId, customerId }) : undefined,
),
);
customerType$ = this._store.select((s) => s.customer?.features?.find((f) => f.enabled)?.description);
@@ -194,7 +194,7 @@ export class CustomerDetailsViewMainComponent extends ComponentStore<CustomerDet
private _checkoutNavigation: CheckoutNavigationService,
private _router: Router,
private _activatedRoute: ActivatedRoute,
private _genderSettings: GenderSettingsService
private _genderSettings: GenderSettingsService,
) {
super({ isBusy: false, shoppingCart: undefined, shippingAddress: undefined, payer: undefined });
}
@@ -221,8 +221,8 @@ export class CustomerDetailsViewMainComponent extends ComponentStore<CustomerDet
this._checkoutService.getShoppingCart({
processId: pid,
latest: true,
})
)
}),
),
)
.subscribe((shoppingCart) => {
this.patchState({ shoppingCart });

View File

@@ -30,9 +30,7 @@
<span class="ssc-text" [class.err]="sscInvalid$ | async">{{ sscText$ | async }}</span>
</div>
<div class="err" *ngIf="supplierIdError$ | async">
Kein Lieferant vorhanden
</div>
<div class="err" *ngIf="supplierIdError$ | async">Kein Lieferant vorhanden</div>
</ng-container>
</div>
</div>
@@ -74,7 +72,7 @@
</div>
<div class="price">
<strong>{{ orderItem.price | currency: 'EUR':'code' }}</strong>
<strong>{{ orderItem.price | currency: 'EUR' : 'code' }}</strong>
</div>
<div class="status spec">
<span>Status</span>
@@ -99,8 +97,6 @@
</div>
<div class="footer">
<button class="cta-reorder" (click)="showReorderModal(); $event.stopPropagation()" [disabled]="editSsc$ | async">
Nachbestellen
</button>
<button class="cta-reorder" (click)="showReorderModal(); $event.stopPropagation()" [disabled]="editSsc$ | async">Nachbestellen</button>
</div>
</ng-container>

View File

@@ -111,7 +111,7 @@ export class GoodsInListItemComponent extends ComponentStore<GoodsInListItemComp
catchError(() => {
this.patchState({ supplierIdError: true });
return [undefined];
})
}),
);
readonly instruction$ = this.statusCodes$.pipe(
@@ -120,7 +120,7 @@ export class GoodsInListItemComponent extends ComponentStore<GoodsInListItemComp
const textObj = code?.texts?.find((text) => text?.textType === 'REWORK');
return textObj && textObj.text ? textObj.text : '';
}),
shareReplay()
shareReplay(),
);
private _onDestroy$ = new Subject<void>();
@@ -129,7 +129,7 @@ export class GoodsInListItemComponent extends ComponentStore<GoodsInListItemComp
private _omsService: DomainOmsService,
private _command: CommandService,
private _modal: UiModalService,
public environmentService: EnvironmentService
public environmentService: EnvironmentService,
) {
super({
item: undefined,

View File

@@ -50,7 +50,7 @@ export class GoodsInListComponent implements OnInit, AfterViewInit, OnDestroy {
listEmpty$ = combineLatest([this.loading$, this.hits$]).pipe(
map(([loading, hits]) => !loading && hits === 0),
shareReplay()
shareReplay(),
);
editSsc: boolean;
@@ -70,7 +70,7 @@ export class GoodsInListComponent implements OnInit, AfterViewInit, OnDestroy {
private _router: Router,
private _route: ActivatedRoute,
private readonly _config: Config,
private _cache: CacheService
private _cache: CacheService,
) {}
ngOnInit() {
@@ -155,7 +155,7 @@ export class GoodsInListComponent implements OnInit, AfterViewInit, OnDestroy {
private _addScrollPositionToCache(): void {
this._cache.set<number>(
{ processId: this._config.get('process.ids.goodsIn'), token: this.SCROLL_POSITION_TOKEN },
this.scrollContainer?.scrollPos
this.scrollContainer?.scrollPos,
);
}

View File

@@ -50,7 +50,7 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
order$ = this.orderId$.pipe(
filter((orderId) => !!orderId),
switchMap((orderId) => this._omsService.getOrder(orderId)),
shareReplay()
shareReplay(),
);
get processId() {
@@ -67,7 +67,7 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
private _omsService: DomainOmsService,
private _breadcrumb: BreadcrumbService,
private _router: Router,
private _uiModal: UiModalService
private _uiModal: UiModalService,
) {
super({
fetching: false,
@@ -166,11 +166,11 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
(err) => {},
() => {
this.patchState({ fetching: false });
}
)
},
),
);
})
)
}),
),
);
openModalIfItemsHaveDifferentCustomers(items: OrderItemListItemDTO[]) {

View File

@@ -46,7 +46,7 @@ export class GoodsOutSearchFilterComponent implements OnInit, OnDestroy {
private _goodsOutSearchStore: GoodsOutSearchStore,
private _breadcrumb: BreadcrumbService,
private _cdr: ChangeDetectorRef,
private _router: Router
private _router: Router,
) {}
ngOnInit() {

View File

@@ -33,7 +33,7 @@ export class GoodsOutSearchComponent implements OnInit, OnDestroy {
private _onDestroy$ = new Subject<void>();
hasFilter$ = combineLatest([this._goodsOutSearchStore.filter$, this._goodsOutSearchStore.defaultSettings$]).pipe(
map(([filter, defaultFilter]) => !isEqual(filter?.getQueryParams(), UiFilter.create(defaultFilter).getQueryParams()))
map(([filter, defaultFilter]) => !isEqual(filter?.getQueryParams(), UiFilter.create(defaultFilter).getQueryParams())),
);
processId$ = this._activatedRoute.data.pipe(map((data) => +data.processId));
@@ -41,7 +41,7 @@ export class GoodsOutSearchComponent implements OnInit, OnDestroy {
constructor(
private _goodsOutSearchStore: GoodsOutSearchStore,
private _breadcrumb: BreadcrumbService,
private _activatedRoute: ActivatedRoute
private _activatedRoute: ActivatedRoute,
) {}
ngOnInit() {

View File

@@ -36,7 +36,7 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
listEmpty$ = combineLatest([this.loading$, this.hits$]).pipe(
map(([loading, hits]) => !loading && hits === 0),
shareReplay()
shareReplay(),
);
selectedOrderItemSubsetIds$ = this.select((s) => s.selectedOrderItemSubsetIds);
@@ -47,9 +47,9 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
actions$ = combineLatest([this.items$, this.selectedOrderItemSubsetIds$]).pipe(
map(([items, selectedOrderItemSubsetIds]) =>
items?.find((item) => selectedOrderItemSubsetIds.find((orderItemSubsetId) => item.orderItemSubsetId === orderItemSubsetId))
items?.find((item) => selectedOrderItemSubsetIds.find((orderItemSubsetId) => item.orderItemSubsetId === orderItemSubsetId)),
),
map((item) => item?.actions?.filter((action) => this.selectionRules(action)))
map((item) => item?.actions?.filter((action) => this.selectionRules(action))),
);
get selectedItems() {
@@ -84,7 +84,7 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
private _activatedRoute: ActivatedRoute,
private _breadcrumb: BreadcrumbService,
private _commandService: CommandService,
private _modal: UiModalService
private _modal: UiModalService,
) {
super({
selectedOrderItemSubsetIds: [],
@@ -233,7 +233,7 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
this.removeScrollPosition(processId);
}
}
})
}),
);
this._searchResultSubscription.add(
@@ -244,7 +244,7 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
this.scrollContainer?.scrollTo(scrollPos);
this.removeScrollPosition(processId);
}
})
}),
);
}
@@ -273,7 +273,7 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
buyerNumber: orderItem.buyerNumber,
archive,
},
}
},
);
} else {
this._router.navigate([`/kunde/${processId}/goods/out/details/order/${encodeURIComponent(orderNumber)}/${processingStatus}`], {

View File

@@ -61,7 +61,7 @@ export class PickupShelfInDetailsComponent extends PickupShelfDetailsBaseCompone
fetchingCoverItems$ = this.store.fetchingCoverOrderItems$;
viewFetching$ = combineLatest([this.fetchingItems$, this.orderItems$]).pipe(
map(([fetchingItems, orderItems]) => fetchingItems && orderItems.length === 0)
map(([fetchingItems, orderItems]) => fetchingItems && orderItems.length === 0),
);
selectedCompartmentInfo = this.store.selectedCompartmentInfo;
@@ -93,14 +93,17 @@ export class PickupShelfInDetailsComponent extends PickupShelfDetailsBaseCompone
return `${latestCompartmentInfos?.latestCompartmentCode}_${latestCompartmentInfos?.latestCompartmentInfo}`;
}
return latestCompartmentInfos?.latestCompartmentCode;
})
}),
);
addToPreviousCompartmentActionDisabled$ = combineLatest([this.displayedCompartmentInfo$, this.changeActionDisabled$]).pipe(
map(([compartmentInfo, changeActionDisabled]) => !!compartmentInfo || changeActionDisabled)
map(([compartmentInfo, changeActionDisabled]) => !!compartmentInfo || changeActionDisabled),
);
constructor(private _uiModal: UiModalService, private _activatedRoute: ActivatedRoute) {
constructor(
private _uiModal: UiModalService,
private _activatedRoute: ActivatedRoute,
) {
super();
}
@@ -110,7 +113,7 @@ export class PickupShelfInDetailsComponent extends PickupShelfDetailsBaseCompone
.subscribe(([params, items]) => {
const orderItemSubsetId = +params?.orderItemSubsetId;
const selectedItem: DBHOrderItemListItemDTO = items?.find(
(item: DBHOrderItemListItemDTO) => item?.orderItemSubsetId === orderItemSubsetId
(item: DBHOrderItemListItemDTO) => item?.orderItemSubsetId === orderItemSubsetId,
);
// Trigger functions only if a new item gets selected
@@ -176,7 +179,7 @@ export class PickupShelfInDetailsComponent extends PickupShelfDetailsBaseCompone
},
side: false,
}).path,
{ queryParamsHandling: 'preserve' }
{ queryParamsHandling: 'preserve' },
);
this.listStore.patchOrderItem({
orderItemSubsetId: item.orderItemSubsetId,
@@ -224,17 +227,17 @@ export class PickupShelfInDetailsComponent extends PickupShelfDetailsBaseCompone
switch (type) {
case 'delivery':
this.store.selectedOrderItems.forEach((item) =>
this.store.patchOrderItemSubset({ item, changes: { estimatedShippingDate: date.toISOString() } })
this.store.patchOrderItemSubset({ item, changes: { estimatedShippingDate: date.toISOString() } }),
);
break;
case 'pickup':
this.store.selectedOrderItems.forEach((item) =>
this.store.patchOrderItemSubset({ item, changes: { compartmentStop: date.toISOString() } })
this.store.patchOrderItemSubset({ item, changes: { compartmentStop: date.toISOString() } }),
);
break;
case 'preferred':
this.store.selectedOrderItems.forEach((item) =>
this.store.patchOrderItemSubset({ item, changes: { preferredPickUpDate: date.toISOString() } })
this.store.patchOrderItemSubset({ item, changes: { preferredPickUpDate: date.toISOString() } }),
);
break;
default:
@@ -258,9 +261,9 @@ export class PickupShelfInDetailsComponent extends PickupShelfDetailsBaseCompone
orderItemSubsetId: orderItem.orderItemSubsetId,
compartmentInfo: orderItem.compartmentInfo,
},
{ side: this.side }
{ side: this.side },
).path,
{ queryParams: { buyerNumber: orderItem?.buyerNumber }, queryParamsHandling: 'merge' }
{ queryParams: { buyerNumber: orderItem?.buyerNumber }, queryParamsHandling: 'merge' },
);
}
@@ -275,9 +278,9 @@ export class PickupShelfInDetailsComponent extends PickupShelfDetailsBaseCompone
orderItemSubsetId: orderItem.orderItemSubsetId,
compartmentInfo: orderItem.compartmentInfo,
},
{ side: this.side }
{ side: this.side },
).path,
{ queryParams: { orderItemSubsetId: orderItem.orderItemSubsetId }, queryParamsHandling: 'merge' }
{ queryParams: { orderItemSubsetId: orderItem.orderItemSubsetId }, queryParamsHandling: 'merge' },
);
}
@@ -301,7 +304,7 @@ export class PickupShelfInDetailsComponent extends PickupShelfDetailsBaseCompone
},
side: this.side,
}).path,
{ queryParamsHandling: 'preserve' }
{ queryParamsHandling: 'preserve' },
);
} else {
if (orderItems.every((item) => item.processingStatus === 128)) {

View File

@@ -65,14 +65,14 @@ export class PickupShelfOutDetailsComponent extends PickupShelfDetailsBaseCompon
}
return groups;
})
}),
);
fetchingOrder$ = this.store.fetchingOrder$;
fetchingItems$ = this.store.fetchingOrderItems$;
viewFetching$ = combineLatest([this.orderItems$, this.fetchingItems$]).pipe(
map(([orderItems, fetchingItems]) => orderItems?.length === 0 && fetchingItems)
map(([orderItems, fetchingItems]) => orderItems?.length === 0 && fetchingItems),
);
selectedCompartmentInfo = this.store.selectedCompartmentInfo;
@@ -129,7 +129,7 @@ export class PickupShelfOutDetailsComponent extends PickupShelfDetailsBaseCompon
compartmentInfo: item.compartmentInfo,
},
}).path,
{ queryParamsHandling: 'preserve' }
{ queryParamsHandling: 'preserve' },
);
}
}
@@ -156,17 +156,17 @@ export class PickupShelfOutDetailsComponent extends PickupShelfDetailsBaseCompon
switch (type) {
case 'delivery': // vsl. Lieferdatum
this.store.orderItems.forEach((item) =>
this.store.patchOrderItemSubset({ item, changes: { estimatedShippingDate: date.toISOString() } })
this.store.patchOrderItemSubset({ item, changes: { estimatedShippingDate: date.toISOString() } }),
);
break;
case 'pickup': // Abholfrist
this.store.orderItems.forEach((item) =>
this.store.patchOrderItemSubset({ item, changes: { compartmentStop: date.toISOString() } })
this.store.patchOrderItemSubset({ item, changes: { compartmentStop: date.toISOString() } }),
);
break;
case 'preferred': // Zurücklegen bis
this.store.orderItems.forEach((item) =>
this.store.patchOrderItemSubset({ item, changes: { preferredPickUpDate: date.toISOString() } })
this.store.patchOrderItemSubset({ item, changes: { preferredPickUpDate: date.toISOString() } }),
);
break;
default:
@@ -191,7 +191,7 @@ export class PickupShelfOutDetailsComponent extends PickupShelfDetailsBaseCompon
compartmentInfo: orderItem.compartmentInfo,
},
}).path,
{ queryParams: { buyerNumber: orderItem?.buyerNumber }, queryParamsHandling: 'merge' }
{ queryParams: { buyerNumber: orderItem?.buyerNumber }, queryParamsHandling: 'merge' },
);
}
@@ -207,7 +207,7 @@ export class PickupShelfOutDetailsComponent extends PickupShelfDetailsBaseCompon
compartmentInfo: orderItem.compartmentInfo,
},
}).path,
{ queryParams: { orderItemSubsetId: orderItem.orderItemSubsetId }, queryParamsHandling: 'merge' }
{ queryParams: { orderItemSubsetId: orderItem.orderItemSubsetId }, queryParamsHandling: 'merge' },
);
}

View File

@@ -127,7 +127,7 @@ export class PickupShelfOutComponent extends PickupShelfBaseComponent {
processingStatus: item.processingStatus,
compartmentInfo: item.compartmentInfo,
},
})
}),
);
}
@@ -142,7 +142,7 @@ export class PickupShelfOutComponent extends PickupShelfBaseComponent {
processingStatus: item.processingStatus,
compartmentInfo: item.compartmentInfo,
},
})
}),
);
}
@@ -179,7 +179,7 @@ export class PickupShelfOutComponent extends PickupShelfBaseComponent {
processingStatus: item.processingStatus,
compartmentInfo: item.compartmentInfo,
},
})
}),
);
}

View File

@@ -20,6 +20,10 @@
</button>
</div>
<ng-template #featureLoading>
<shared-skeleton-loader class="w-64 h-6"></shared-skeleton-loader>
</ng-template>
<div class="page-pickup-shelf-details-header__details bg-white px-4 pt-4 pb-5">
<div class="flex flex-row items-center" [class.mb-8]="!orderItem?.features?.paid && !isKulturpass">
<page-pickup-shelf-details-header-nav-menu class="mr-2" [customer]="customer$ | async"></page-pickup-shelf-details-header-nav-menu>

View File

@@ -75,12 +75,12 @@ export class PickUpShelfDetailsHeaderComponent {
latestDate = new Date(
subsetItems?.reduce((a, b) => {
return new Date(a.data.preferredPickUpDate) > new Date(b.data.preferredPickUpDate) ? a : b;
})?.data?.preferredPickUpDate
})?.data?.preferredPickUpDate,
);
}
return latestDate;
})
}),
);
notificationsChannel$: Observable<NotificationChannel> = this.order$.pipe(map((order) => order?.notificationChannels ?? 0));
@@ -115,7 +115,7 @@ export class PickUpShelfDetailsHeaderComponent {
features$ = this.customer$.pipe(
map((customer) => customer?.features || []),
map((features) => features.filter((f) => f.enabled && !!f.description)),
shareReplay()
shareReplay(),
);
statusActions$ = this.orderItem$.pipe(map((orderItem) => orderItem?.actions?.filter((action) => action.enabled === false)));
@@ -123,14 +123,17 @@ export class PickUpShelfDetailsHeaderComponent {
crudaUpdate$ = this.orderItem$.pipe(map((orederItem) => !!(orederItem?.cruda & 4)));
editButtonDisabled$ = combineLatest([this.changeStatusLoader$, this.crudaUpdate$]).pipe(
map(([changeStatusLoader, crudaUpdate]) => changeStatusLoader || !crudaUpdate)
map(([changeStatusLoader, crudaUpdate]) => changeStatusLoader || !crudaUpdate),
);
canEditStatus$ = combineLatest([this.statusActions$, this.crudaUpdate$]).pipe(
map(([statusActions, crudaUpdate]) => statusActions?.length > 0 && crudaUpdate)
map(([statusActions, crudaUpdate]) => statusActions?.length > 0 && crudaUpdate),
);
constructor(private dateAdapter: DateAdapter, private cdr: ChangeDetectorRef) {}
constructor(
private dateAdapter: DateAdapter,
private cdr: ChangeDetectorRef,
) {}
async handleActionClick(action?: KeyValueDTOOfStringAndString) {
this.changeStatusLoader$.next(true);

View File

@@ -50,9 +50,7 @@
<div>{{ orderItem.product?.name }}</div>
</h3>
<div class="history-wrapper flex flex-col items-end justify-center">
<button class="cta-history text-p1" (click)="historyClick.emit(orderItem)">
Historie
</button>
<button class="cta-history text-p1" (click)="historyClick.emit(orderItem)">Historie</button>
<input
*ngIf="selectable$ | async"

View File

@@ -104,7 +104,7 @@ export class PickUpShelfDetailsItemComponent extends ComponentStore<PickUpShelfD
readonly orderItem$ = this.select((s) => s.orderItem);
emailNotificationDates$ = this.orderItem$.pipe(
switchMap((orderItem) => this._store.getEmailNotificationDate$(orderItem?.orderItemSubsetId))
switchMap((orderItem) => this._store.getEmailNotificationDate$(orderItem?.orderItemSubsetId)),
);
hasEmailNotification$ = this.emailNotificationDates$.pipe(map((dates) => dates?.length > 0));
@@ -114,7 +114,7 @@ export class PickUpShelfDetailsItemComponent extends ComponentStore<PickUpShelfD
hasSmsNotification$ = this.smsNotificationDates$.pipe(map((dates) => dates?.length > 0));
canChangeQuantity$ = combineLatest([this.orderItem$, this._store.fetchPartial$]).pipe(
map(([item, partialPickup]) => ([16, 8192].includes(item?.processingStatus) || partialPickup) && item.quantity > 1)
map(([item, partialPickup]) => ([16, 8192].includes(item?.processingStatus) || partialPickup) && item.quantity > 1),
);
get quantity() {
@@ -141,7 +141,7 @@ export class PickUpShelfDetailsItemComponent extends ComponentStore<PickUpShelfD
}
readonly selected$ = combineLatest([this.orderItem$, this._store.selectedOrderItemIds$]).pipe(
map(([orderItem, selectedItems]) => selectedItems.includes(orderItem?.orderItemSubsetId))
map(([orderItem, selectedItems]) => selectedItems.includes(orderItem?.orderItemSubsetId)),
);
@Output()
@@ -156,7 +156,7 @@ export class PickUpShelfDetailsItemComponent extends ComponentStore<PickUpShelfD
}
readonly selectable$ = combineLatest([this._store.orderItems$, this._store.fetchPartial$]).pipe(
map(([orderItems, fetchPartial]) => orderItems.length > 1 && this.isItemSelectable && fetchPartial)
map(([orderItems, fetchPartial]) => orderItems.length > 1 && this.isItemSelectable && fetchPartial),
);
get receipts() {

View File

@@ -80,13 +80,13 @@ export class PickUpShelfListItemComponent {
}
selected$ = this.store.selectedListItems$.pipe(
map((selectedListItems) => selectedListItems?.find((item) => item?.orderItemSubsetId === this.item?.orderItemSubsetId))
map((selectedListItems) => selectedListItems?.find((item) => item?.orderItemSubsetId === this.item?.orderItemSubsetId)),
);
constructor(
private _elRef: ElementRef,
private _environment: EnvironmentService,
private _processingStatusPipe: PickupShelfProcessingStatusPipe
private _processingStatusPipe: PickupShelfProcessingStatusPipe,
) {}
onDetailsClick() {
@@ -124,7 +124,7 @@ export class PickUpShelfListItemComponent {
store: 'PickupShelfDetailsStore',
},
[this.item],
{ persist: false, ttl: 1000 }
{ persist: false, ttl: 1000 },
);
}

View File

@@ -162,10 +162,13 @@ export const selectNotifications = (orderItemSubsetId: number) => (s: PickupShel
return tasks
.sort((a, b) => new Date(b.completed).getTime() - new Date(a.completed).getTime())
.reduce((data, result) => {
(data[result.name] = data[result.name] || []).push(new Date(result.completed));
return data;
}, {} as Record<string, Date[]>);
.reduce(
(data, result) => {
(data[result.name] = data[result.name] || []).push(new Date(result.completed));
return data;
},
{} as Record<string, Date[]>,
);
};
export const selectLatestNotificationDatesFor = (orderItemSubsetId: number, keys: string[]) => (s: PickupShelfDetailsState) => {

View File

@@ -333,9 +333,9 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
ids: [item.orderItemSubsetId],
eagerLoading: 1,
})
.pipe(tapResponse(this.fetchReceiptsDone, this.fetchReceiptsFailed))
)
)
.pipe(tapResponse(this.fetchReceiptsDone, this.fetchReceiptsFailed)),
),
),
);
private beforeFetchReceipts = () => {
@@ -357,9 +357,9 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
tap(({ orderId }) => this.beforeFetchOrder(orderId)),
// delay(10000),
switchMap(({ orderId }) =>
this._pickupShelfService.getOrderByOrderId(orderId).pipe(tapResponse(this.fetchOrderSuccess, this.fetchOrderFailed))
)
)
this._pickupShelfService.getOrderByOrderId(orderId).pipe(tapResponse(this.fetchOrderSuccess, this.fetchOrderFailed)),
),
),
);
private beforeFetchOrder = (orderId) => {
@@ -400,7 +400,7 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
orderItemSubsetId?: number;
orderDate?: string;
done?: { resolve: (items: DBHOrderItemListItemDTO[]) => void; reject: (err?) => void };
}>
}>,
) =>
trigger$.pipe(
tap((data) => this.beforeFetchOrderItems(data)),
@@ -409,11 +409,11 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
this._pickupShelfIOService.getOrderItemsByOrderNumberOrCompartmentCode({ compartmentCode, orderNumber, filter }).pipe(
tapResponse(
(r) => this.fetchOrderItemsSuccess({ compartmentCode, compartmentInfo, orderItemProcessingStatus }, done?.resolve)(r),
(e) => this.fetchOrderItemsFailed(done?.reject)(e)
)
)
)
)
(e) => this.fetchOrderItemsFailed(done?.reject)(e),
),
),
),
),
);
private beforeFetchOrderItems = ({
@@ -451,41 +451,43 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
});
};
private fetchOrderItemsSuccess = (
{
compartmentCode,
compartmentInfo,
orderItemProcessingStatus,
}: {
compartmentCode?: string;
compartmentInfo?: string;
orderItemProcessingStatus?: OrderItemProcessingStatusValue;
},
resolve?: (items: DBHOrderItemListItemDTO[]) => void
) => (res: ListResponseArgsOfDBHOrderItemListItemDTO) => {
// // Ticket #4348
// check if order items belong to the same customer
// if (buyerNumbers.length > 1) {
// this._modal.error('Fehler beim Laden der Bestellpositionen', new Error('Die Bestellpositionen gehören zu unterschiedlichen Kunden.'));
// return;
// }
this._cacheService.set<DBHOrderItemListItemDTO[]>(
private fetchOrderItemsSuccess =
(
{
name: 'orderItems',
orderId: this.order?.id,
compartmentCode,
compartmentInfo,
orderItemProcessingStatus,
store: 'PickupShelfDetailsStore',
}: {
compartmentCode?: string;
compartmentInfo?: string;
orderItemProcessingStatus?: OrderItemProcessingStatusValue;
},
res.result
);
resolve?: (items: DBHOrderItemListItemDTO[]) => void,
) =>
(res: ListResponseArgsOfDBHOrderItemListItemDTO) => {
// // Ticket #4348
// check if order items belong to the same customer
// if (buyerNumbers.length > 1) {
// this._modal.error('Fehler beim Laden der Bestellpositionen', new Error('Die Bestellpositionen gehören zu unterschiedlichen Kunden.'));
// return;
// }
this.patchState({ fetchingOrderItems: false, orderItems: res.result });
this._runCheckTrigger.next();
resolve?.(res.result);
};
this._cacheService.set<DBHOrderItemListItemDTO[]>(
{
name: 'orderItems',
orderId: this.order?.id,
compartmentCode,
compartmentInfo,
orderItemProcessingStatus,
store: 'PickupShelfDetailsStore',
},
res.result,
);
this.patchState({ fetchingOrderItems: false, orderItems: res.result });
this._runCheckTrigger.next();
resolve?.(res.result);
};
private fetchOrderItemsFailed = (reject?: (err?) => void) => (err: any) => {
this._modal.error('Fehler beim Laden der Bestellpositionen', err);
@@ -498,9 +500,9 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
filter(({ buyerNumber }) => this.customer?.customerNumber !== buyerNumber),
tap(() => this.beforeFetchCustomer()),
switchMap(({ buyerNumber }) =>
this._customerService.getCustomers(buyerNumber).pipe(tapResponse(this.fetchCustomerSuccess, this.fetchCustomerFailed))
)
)
this._customerService.getCustomers(buyerNumber).pipe(tapResponse(this.fetchCustomerSuccess, this.fetchCustomerFailed)),
),
),
);
beforeFetchCustomer = () => {
@@ -546,7 +548,7 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
store: 'PickupShelfDetailsStore',
},
customer,
{ persist: true, ttl: 3600000 }
{ persist: true, ttl: 3600000 },
);
this.patchState({ fetchingCustomer: false, customer });
@@ -564,11 +566,11 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
this._pickupShelfService.patchOrderItemSubset(data.item, data.changes).pipe(
tapResponse(
(res) => this.patchOrderItemSubsetDone(data.item)(res),
(err) => this.patchOrderItemSubsetError(err)
)
)
)
)
(err) => this.patchOrderItemSubsetError(err),
),
),
),
),
);
private patchOrderItemSubsetDone = (item: DBHOrderItemListItemDTO) => (res: ResponseArgsOfOrderItemSubsetDTO) => {
@@ -633,7 +635,7 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
return i;
}) ?? [],
};
}
},
);
fetchOrderItemSubsetTasks = this.effect((item$: Observable<DBHOrderItemListItemDTO>) =>
@@ -642,9 +644,9 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
mergeMap((item) =>
this._pickupShelfService
.getOrderItemSubsetTasks(item)
.pipe(tapResponse(this.fetchOrderItemSubsetTasksDone(item), this.fetchOrderItemSubsetTasksFailed(item)))
)
)
.pipe(tapResponse(this.fetchOrderItemSubsetTasksDone(item), this.fetchOrderItemSubsetTasksFailed(item))),
),
),
);
private beforeFetchOrderItemSubsetTasks = (item: DBHOrderItemListItemDTO) => {
@@ -703,8 +705,8 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
delayWhenCustomerNumberNotExists = delayWhen(() =>
this.customerNumber$.pipe(
filter((cn) => !!cn),
take(1)
)
take(1),
),
);
fetchCoverOrderItems = this.effect((trigger$: Observable<void>) =>
@@ -720,11 +722,11 @@ export class PickupShelfDetailsStore extends ComponentStore<PickupShelfDetailsSt
.pipe(
tapResponse(
(res) => this.fetchCoverOrderItemsDone(res),
(err) => this.fetchCoverOrderItemsFailed(err)
)
)
)
)
(err) => this.fetchCoverOrderItemsFailed(err),
),
),
),
),
);
private beforeFetchCoverOrderItems = () => {

View File

@@ -96,7 +96,7 @@ export class PickupShelfStore extends ComponentStore<PickupShelfState> implement
searchboxHint$ = combineLatest([this.fetchingList$, this.fetchListResponse$]).pipe(
debounceTime(100),
map(([fetching, response]) => (response?.response?.hits === 0 && !fetching ? 'Keine Suchergebnisse' : ''))
map(([fetching, response]) => (response?.response?.hits === 0 && !fetching ? 'Keine Suchergebnisse' : '')),
);
readonly selectedListItems$ = this.select(Selectors.selectSelectedListItems);
@@ -174,9 +174,9 @@ export class PickupShelfStore extends ComponentStore<PickupShelfState> implement
map(() => this.beforeFetchQuerySettings()),
filter((shouldFetch) => shouldFetch),
switchMap(() =>
this._pickupShelfIOService.getQuerySettings().pipe(tapResponse(this.fetchQuerySettingsDone, this.fetchQuerySettingsError))
)
)
this._pickupShelfIOService.getQuerySettings().pipe(tapResponse(this.fetchQuerySettingsDone, this.fetchQuerySettingsError)),
),
),
);
/**
@@ -212,8 +212,8 @@ export class PickupShelfStore extends ComponentStore<PickupShelfState> implement
delayWhenFilterIsNotReady = delayWhen((value: { emitFetchListResponse: boolean } | void) =>
this.filter$.pipe(
filter((filter) => !!filter),
take(1)
)
take(1),
),
);
fetchList = this.effect((trigger$: Observable<{ emitFetchListResponse: boolean } | void>) =>
@@ -221,7 +221,7 @@ export class PickupShelfStore extends ComponentStore<PickupShelfState> implement
this.delayWhenFilterIsNotReady,
withLatestFrom(this.filter$, this.processId$),
map(([{ emitFetchListResponse } = { emitFetchListResponse: true }, filter, processId]) =>
this.beforeFetchList(emitFetchListResponse, filter, processId)
this.beforeFetchList(emitFetchListResponse, filter, processId),
),
switchMap(({ emitFetchListResponse, filter, processId, list }) =>
this._pickupShelfIOService
@@ -233,11 +233,11 @@ export class PickupShelfStore extends ComponentStore<PickupShelfState> implement
takeUntil(this._cancelListRequests),
tapResponse(
(res) => this.fetchListDone({ processId, queryParams: filter.getQueryParams(), emitFetchListResponse })(res),
(err) => this.fetchListError(err)
)
)
)
)
(err) => this.fetchListError(err),
),
),
),
),
);
private beforeFetchList = (emitFetchListResponse: boolean, filter: Filter, processId: number) => {
@@ -258,22 +258,26 @@ export class PickupShelfStore extends ComponentStore<PickupShelfState> implement
return { emitFetchListResponse, filter, processId, list };
};
private fetchListDone = ({
processId,
queryParams,
emitFetchListResponse,
}: {
processId: number;
queryParams: Record<string, string>;
emitFetchListResponse: boolean;
}) => (response: ListResponseArgsOfDBHOrderItemListItemDTO) => {
this.patchState({ fetchingList: false, list: response.result, listHits: response.hits });
if (emitFetchListResponse) {
this._fetchListResponse.next({ processId, response, queryParams });
}
private fetchListDone =
({
processId,
queryParams,
emitFetchListResponse,
}: {
processId: number;
queryParams: Record<string, string>;
emitFetchListResponse: boolean;
}) =>
(response: ListResponseArgsOfDBHOrderItemListItemDTO) => {
this.patchState({ fetchingList: false, list: response.result, listHits: response.hits });
if (emitFetchListResponse) {
this._fetchListResponse.next({ processId, response, queryParams });
}
this._cacheService.set<ListResponseArgsOfDBHOrderItemListItemDTO>({ processId, queryToken: queryParams }, response, { persist: true });
};
this._cacheService.set<ListResponseArgsOfDBHOrderItemListItemDTO>({ processId, queryToken: queryParams }, response, {
persist: true,
});
};
private fetchListError = (err: any) => {
this._modalService.error('Fehler beim Laden der Liste', err);
@@ -295,11 +299,11 @@ export class PickupShelfStore extends ComponentStore<PickupShelfState> implement
takeUntil(this._cancelListRequests),
tapResponse(
(r) => this.fetchMoreListDone(r),
(e) => this.fetchMoreListError(e)
)
(e) => this.fetchMoreListError(e),
),
);
})
)
}),
),
);
private beforeFetchMoreList = () => {
@@ -319,6 +323,6 @@ export class PickupShelfStore extends ComponentStore<PickupShelfState> implement
patchOrderItem = this.updater(
(state, { orderItemSubsetId, changes }: { orderItemSubsetId: number; changes: Partial<DBHOrderItemListItemDTO> }) => {
return { ...state, list: this.list.map((li) => (li.orderItemSubsetId === orderItemSubsetId ? { ...li, ...changes } : li)) };
}
},
);
}

View File

@@ -45,7 +45,7 @@ export class AddProductModalComponent implements OnInit, OnDestroy {
private _remiService: DomainRemissionService,
private _modal: UiModalService,
private _config: Config,
private _cache: CacheService
private _cache: CacheService,
) {
this.item = this._modalRef.data.item;

View File

@@ -44,7 +44,7 @@
{{ item.ean }}
</div>
<div class="font-bold price">
{{ item.price.value.value | currency: item.price.value.currency:'code' }}
{{ item.price.value.value | currency: item.price.value.currency : 'code' }}
</div>
<div *ngIf="item.assortment | assortment; let assortment">
<button [uiOverlayTrigger]="assortmentTooltip" data-name="assortment" class="text-active-branch font-bold">

View File

@@ -69,7 +69,7 @@ export class RemissionListItemComponent implements OnDestroy {
private _modal: UiModalService,
private _remissionService: DomainRemissionService,
private _store: RemissionListComponentStore,
@Host() private _listComponent: RemissionListComponent
@Host() private _listComponent: RemissionListComponent,
) {}
ngOnDestroy() {
@@ -178,7 +178,7 @@ export class RemissionListItemComponent implements OnDestroy {
const items = await this._store.items$.pipe(first()).toPromise();
const itemsByEan = items?.filter(
(i) => i.dto.product.ean === this.item.dto.product.ean && i.dto.id !== this.item.dto.id && i.placementType === 'Stapel'
(i) => i.dto.product.ean === this.item.dto.product.ean && i.dto.id !== this.item.dto.id && i.placementType === 'Stapel',
);
if (itemsByEan?.length > 0) {

View File

@@ -98,12 +98,12 @@ export class RemissionListComponent implements OnInit, OnDestroy {
}
return true;
})
}),
);
listEmpty$ = combineLatest([this.fetching$, this.hits$]).pipe(
map(([loading, hits]) => !loading && hits === 0),
shareReplay()
shareReplay(),
);
get queryParams$() {
@@ -115,7 +115,7 @@ export class RemissionListComponent implements OnInit, OnDestroy {
queryParams = { ...filter.getQueryParams(), ...params, supplier, source };
}
return queryParams;
})
}),
);
}
@@ -131,7 +131,7 @@ export class RemissionListComponent implements OnInit, OnDestroy {
return suppliers;
}
return suppliers.filter((supplier) => supplier?.id === selectedSupplier?.id);
})
}),
);
trackByItemId: TrackByFunction<RemissionListItem> = (_, item) => item.dto.id;
@@ -147,7 +147,7 @@ export class RemissionListComponent implements OnInit, OnDestroy {
private readonly _activatedRoute: ActivatedRoute,
private readonly _breadcrumb: BreadcrumbService,
private readonly _applicationService: ApplicationService,
private readonly _config: Config
private readonly _config: Config,
) {}
ngOnInit() {

View File

@@ -29,7 +29,7 @@ export class RemissionComponent implements OnInit, OnDestroy {
private _applicationService: ApplicationService,
private _router: Router,
private _cache: CacheService,
private _toastService: ToasterService
private _toastService: ToasterService,
) {}
ngOnInit(): void {
@@ -38,7 +38,7 @@ export class RemissionComponent implements OnInit, OnDestroy {
this._router.events
?.pipe(
filter((event) => event instanceof NavigationEnd),
takeUntil(this._onDestroy$)
takeUntil(this._onDestroy$),
)
.subscribe(() => {
this.updateProcess();

View File

@@ -96,13 +96,13 @@ export class TaskInfoComponent implements OnChanges {
teaser$ = this.info$.pipe(
filter((info) => !isNullOrUndefined(info)),
switchMap((info) => this.domainTaskCalendarService.getTeaserFile({ infoId: info.id }).pipe(catchError((error) => [undefined])))
switchMap((info) => this.domainTaskCalendarService.getTeaserFile({ infoId: info.id }).pipe(catchError((error) => [undefined]))),
);
attachments$ = this.info$.pipe(
filter((info) => info.attachments > 0),
switchMap((info) => this.domainTaskCalendarService.getFiles({ infoId: info.id })),
map((response) => response.result)
map((response) => response.result),
);
type$ = this.info$.pipe(map((info) => this.domainTaskCalendarService.getInfoType(info)));
@@ -119,19 +119,19 @@ export class TaskInfoComponent implements OnChanges {
res.result.map((comment) => ({
date: new Date(comment.created),
note: comment.text,
}))
)
})),
),
);
processingStatus$ = this.info$.pipe(
map((info) => this.domainTaskCalendarService.getProcessingStatusList(info)),
shareReplay()
shareReplay(),
);
showUpdateComment$ = combineLatest([this.info$, this.processingStatus$]).pipe(
map(
([info, processingStatus]) => !!info.updateComment && ((info.successor && processingStatus.includes('Removed')) || info.predecessor)
)
([info, processingStatus]) => !!info.updateComment && ((info.successor && processingStatus.includes('Removed')) || info.predecessor),
),
);
@HostBinding('class')
@@ -146,7 +146,7 @@ export class TaskInfoComponent implements OnChanges {
private uiModal: UiModalService,
private clipboard: Clipboard,
@Optional() private modalRef: UiModalRef,
private router: Router
private router: Router,
) {}
ngOnChanges({ info }: SimpleChanges): void {

View File

@@ -30,7 +30,7 @@ export class TaskSearchbarComponent implements OnInit, OnDestroy {
private _activatedRoute: ActivatedRoute,
private _cdr: ChangeDetectorRef,
private _breadcrumb: BreadcrumbService,
private _config: Config
private _config: Config,
) {}
getControlValueFromQuery() {

View File

@@ -29,7 +29,7 @@ export class TaskCalendarFilterComponent implements OnInit, OnDestroy {
private _router: Router,
private _activatedRoute: ActivatedRoute,
private _breadcrumb: BreadcrumbService,
private _config: Config
private _config: Config,
) {}
private _initFilter(filter: UiFilter) {

View File

@@ -32,13 +32,17 @@ export class PageTaskCalendarComponent implements OnInit, OnDestroy {
map(([_, filter, initialFilter]) => {
return !isEqual(filter?.getQueryParams(), initialFilter?.getQueryParams());
}),
shareReplay()
shareReplay(),
);
@ViewChild(TaskSearchbarComponent)
searchbar: TaskSearchbarComponent;
constructor(private taskCalendarStore: TaskCalendarStore, private _activatedRoute: ActivatedRoute, private readonly _config: Config) {
constructor(
private taskCalendarStore: TaskCalendarStore,
private _activatedRoute: ActivatedRoute,
private readonly _config: Config,
) {
this.taskCalendarStore.loadFilter();
}

View File

@@ -40,14 +40,14 @@ export class TaskSearchComponent implements OnInit, OnDestroy, AfterViewInit {
grouped.map((g) => ({
...g,
items: this.domainTaskCalendarService.sort(g.items, ['Overdue', 'InProcess', 'Approved', 'Completed', 'Removed']),
}))
})),
),
// Entfernte ans ende der Gruppe setzen
map((grouped) => grouped.map((g) => ({ ...g, items: g.items.sort((a, b) => this.domainTaskCalendarService.moveRemovedToEnd(a, b)) })))
map((grouped) => grouped.map((g) => ({ ...g, items: g.items.sort((a, b) => this.domainTaskCalendarService.moveRemovedToEnd(a, b)) }))),
);
showEmptyMessage$ = combineLatest([this.fetching$, this.searchResultsLength$, this.taskCalendarStore.hits$]).pipe(
map(([fetching, length, hits]) => !fetching && length <= 0 && hits === 0)
map(([fetching, length, hits]) => !fetching && length <= 0 && hits === 0),
);
previousBreadcrumb$: Observable<Breadcrumb> = this._breadcrumb.getBreadcrumbsByKeyAndTags$(this._taskCalendarKey, ['task-calendar']).pipe(
@@ -57,7 +57,7 @@ export class TaskSearchComponent implements OnInit, OnDestroy, AfterViewInit {
}
// Fallback wenn kein vorheriger Breadcrumb existiert
return { path: '/filiale/task-calendar/tasks', name: 'Aufgaben', section: 'branch', key: 'task-calendar' };
})
}),
);
constructor(
@@ -66,7 +66,7 @@ export class TaskSearchComponent implements OnInit, OnDestroy, AfterViewInit {
private domainTaskCalendarService: DomainTaskCalendarService,
private _activatedRoute: ActivatedRoute,
private _config: Config,
private _breadcrumb: BreadcrumbService
private _breadcrumb: BreadcrumbService,
) {}
ngOnInit() {

View File

@@ -118,7 +118,11 @@ export class BranchSelectorComponent implements OnInit, OnDestroy, AfterViewInit
@HostBinding('class.focused')
focused = false;
constructor(public store: BranchSelectorStore, private _auth: AuthService, private _elementRef: ElementRef) {}
constructor(
public store: BranchSelectorStore,
private _auth: AuthService,
private _elementRef: ElementRef,
) {}
writeValue(obj: any): void {
if (obj?.id) {
@@ -157,7 +161,7 @@ export class BranchSelectorComponent implements OnInit, OnDestroy, AfterViewInit
this.complete
.pipe(takeUntil(this._onDestroy$), withLatestFrom(this.store.branches$))
.subscribe(([query, branches]) =>
query?.length > 1 ? this.filterBranchesFn({ query, branches }) : this.store.setFilteredBranches(branches)
query?.length > 1 ? this.filterBranchesFn({ query, branches }) : this.store.setFilteredBranches(branches),
);
}

View File

@@ -37,8 +37,10 @@ export interface SharedGoodsInOutOrderDetailsItemComponentState {
styleUrls: ['goods-in-out-order-details-item.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SharedGoodsInOutOrderDetailsItemComponent extends ComponentStore<SharedGoodsInOutOrderDetailsItemComponentState>
implements OnInit, OnDestroy {
export class SharedGoodsInOutOrderDetailsItemComponent
extends ComponentStore<SharedGoodsInOutOrderDetailsItemComponentState>
implements OnInit, OnDestroy
{
@ViewChild('autosize') autosize: CdkTextareaAutosize;
@Input()
@@ -78,12 +80,12 @@ export class SharedGoodsInOutOrderDetailsItemComponent extends ComponentStore<Sh
switchMap((oi) =>
this._omsService
.getCompletedTasks({ orderId: oi.orderId, orderItemId: oi.orderItemId, orderItemSubsetId: oi.orderItemSubsetId, take: 4, skip: 0 })
.pipe(catchError(() => NEVER))
)
.pipe(catchError(() => NEVER)),
),
);
canChangeQuantity$ = combineLatest([this.orderItem$, this._host.fetchPartial$]).pipe(
map(([item, partialPickup]) => ([16, 8192].includes(item?.processingStatus) || partialPickup) && item.quantity > 1)
map(([item, partialPickup]) => ([16, 8192].includes(item?.processingStatus) || partialPickup) && item.quantity > 1),
);
get quantity() {
@@ -109,7 +111,7 @@ export class SharedGoodsInOutOrderDetailsItemComponent extends ComponentStore<Sh
}
readonly selected$ = combineLatest([this.orderItem$, this._host.selectedeOrderItemSubsetIds$]).pipe(
map(([orderItem, selectedItems]) => selectedItems.includes(orderItem?.orderItemSubsetId))
map(([orderItem, selectedItems]) => selectedItems.includes(orderItem?.orderItemSubsetId)),
);
@Output()
@@ -120,7 +122,7 @@ export class SharedGoodsInOutOrderDetailsItemComponent extends ComponentStore<Sh
}
readonly selectable$ = combineLatest([this._host.orderItems$, this._host.itemsSelectable$, this._host.fetchPartial$]).pipe(
map(([orderItems, selectable, fetchPartial]) => orderItems.length > 1 && selectable && fetchPartial)
map(([orderItems, selectable, fetchPartial]) => orderItems.length > 1 && selectable && fetchPartial),
);
get receipts() {
@@ -152,7 +154,7 @@ export class SharedGoodsInOutOrderDetailsItemComponent extends ComponentStore<Sh
private _omsService: DomainOmsService,
private _modal: UiModalService,
private _cdr: ChangeDetectorRef,
private _auth: AuthService
private _auth: AuthService,
) {
super({
more: false,
@@ -193,11 +195,11 @@ export class SharedGoodsInOutOrderDetailsItemComponent extends ComponentStore<Sh
done?.([]);
}
},
() => {}
)
)
)
)
() => {},
),
),
),
),
);
async saveSpecialComment() {

View File

@@ -92,7 +92,7 @@
</ng-template>
</div>
<div class="item-price">
{{ item.price | currency: 'EUR':'code' }}
{{ item.price | currency: 'EUR' : 'code' }}
</div>
<div class="label-value" *ngIf="showSupplier; else showBranch">

View File

@@ -67,7 +67,7 @@ export class SearchComponentStoreService<T = any> extends ComponentStore<SearchS
@Inject(SEARCH_STATE_SETTINGS_LOADER) private readonly _settingsLoader: SearchStateSettingsLoader,
@Inject(SEARCH_STATE_SEARCH_SERVICE) private readonly _searchService: SearchStateSearchService<T>,
private readonly _cache: CacheService,
private readonly _uiModal: UiModalService
private readonly _uiModal: UiModalService,
) {
super({
items: [],
@@ -77,7 +77,7 @@ export class SearchComponentStoreService<T = any> extends ComponentStore<SearchS
this.filter$
.pipe(
takeUntil(this._onDestroy$),
filter((filter) => !!filter)
filter((filter) => !!filter),
)
.subscribe((filter) => {
const cachedResult = this._cache.get(filter?.getQueryParams());
@@ -190,14 +190,14 @@ export class SearchComponentStoreService<T = any> extends ComponentStore<SearchS
this.cacheResults(filter, { items: [...items, ...res.items], hits: res.hits });
this.patchState({ latestResponse: res.response });
},
(err) => this.handleSearchError(err)
(err) => this.handleSearchError(err),
),
finalize(() => {
this.searchCompleted.next(this.state);
})
}),
);
})
)
}),
),
);
searchRequest(filter: UiFilter, items: T[]): Observable<SearchStateSearchResult<T>> {

View File

@@ -12,7 +12,7 @@ variables:
value: '3'
# Minor Version einstellen
- name: 'Minor'
value: '0'
value: '1'
- name: 'Patch'
value: "$[counter(format('{0}.{1}', variables['Major'], variables['Minor']),0)]"
- name: 'BuildUniqueID'