mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
Compare commits
8 Commits
angular-up
...
4266-Archi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
819827cc4c | ||
|
|
d09b5b1ce7 | ||
|
|
180e93a7da | ||
|
|
9671683a93 | ||
|
|
d909d6e804 | ||
|
|
15c50779b4 | ||
|
|
5bdfec7c3f | ||
|
|
6bc265a358 |
@@ -73,10 +73,10 @@
|
||||
<ui-icon icon="documents_refresh" size="24px"></ui-icon>
|
||||
Remission
|
||||
</a>
|
||||
<!-- <a [routerLink]="['/filiale/package-inspection']" routerLinkActive="active" (click)="fetchAndOpenPackages()">
|
||||
<a [routerLink]="['/filiale/package-inspection']" routerLinkActive="active" (click)="fetchAndOpenPackages()">
|
||||
<ui-svg-icon icon="clipboard-check-outline" [size]="24"></ui-svg-icon>
|
||||
Wareneingang
|
||||
</a> -->
|
||||
</a>
|
||||
</ng-container>
|
||||
</shell-footer>
|
||||
</div>
|
||||
|
||||
@@ -11,5 +11,6 @@
|
||||
[hint]="hint$ | async"
|
||||
(scan)="search($event)"
|
||||
[scanner]="true"
|
||||
(hintCleared)="clearHint()"
|
||||
></ui-searchbox>
|
||||
</div>
|
||||
|
||||
@@ -59,8 +59,12 @@ export class FinishShippingDocumentComponent implements OnInit, OnDestroy {
|
||||
this._onDestroy$.complete();
|
||||
}
|
||||
|
||||
search(query: string) {
|
||||
clearHint() {
|
||||
this.hint$.next('');
|
||||
}
|
||||
|
||||
search(query: string) {
|
||||
query = query?.trim();
|
||||
if (!query) {
|
||||
this.hint$.next('Ungültige Eingabe');
|
||||
return;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { ComponentStore, OnStoreInit, tapResponse } from '@ngrx/component-store';
|
||||
import { AddToShoppingCartDTO, AvailabilityDTO, BranchDTO, CheckoutDTO, ShoppingCartDTO, ShoppingCartItemDTO } from '@swagger/checkout';
|
||||
import { DomainCheckoutService } from '@domain/checkout';
|
||||
import { mergeMap, switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
||||
import { catchError, mergeMap, switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
||||
import {
|
||||
BranchService,
|
||||
DisplayOrderDTO,
|
||||
@@ -12,12 +12,13 @@ import {
|
||||
ResponseArgsOfIEnumerableOfBranchDTO,
|
||||
ResponseArgsOfValueTupleOfIEnumerableOfDisplayOrderDTOAndIEnumerableOfKeyValueDTOOfStringAndString,
|
||||
} from '@swagger/oms';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, of, zip } from 'rxjs';
|
||||
import { AuthService } from '@core/auth';
|
||||
import { UiModalService } from '@ui/modal';
|
||||
import { getCatalogProductNumber } from './catalog-product-number';
|
||||
import { ItemDTO } from '@swagger/cat';
|
||||
import { DomainAvailabilityService } from '@domain/availability';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
|
||||
export interface KulturpassOrderModalState {
|
||||
orderItemListItem?: OrderItemListItemDTO;
|
||||
@@ -200,9 +201,18 @@ export class KulturpassOrderModalStore extends ComponentStore<KulturpassOrderMod
|
||||
|
||||
addItemToShoppingCart = this.effect((item$: Observable<ItemDTO>) =>
|
||||
item$.pipe(
|
||||
mergeMap((item) =>
|
||||
this._availabilityService
|
||||
.getTakeAwayAvailability({
|
||||
mergeMap((item) => {
|
||||
const takeAwayAvailability$ = this._availabilityService.getTakeAwayAvailability({
|
||||
item: {
|
||||
ean: item.product.ean,
|
||||
itemId: item.id,
|
||||
price: item.catalogAvailability.price,
|
||||
},
|
||||
quantity: this.itemQuantityByCatalogProductNumber(getCatalogProductNumber(item)) + 1,
|
||||
});
|
||||
|
||||
const deliveryAvailability$ = this._availabilityService
|
||||
.getDeliveryAvailability({
|
||||
item: {
|
||||
ean: item.product.ean,
|
||||
itemId: item.id,
|
||||
@@ -210,12 +220,45 @@ export class KulturpassOrderModalStore extends ComponentStore<KulturpassOrderMod
|
||||
},
|
||||
quantity: this.itemQuantityByCatalogProductNumber(getCatalogProductNumber(item)) + 1,
|
||||
})
|
||||
.pipe(tapResponse(this.handleAddItemToShoppingCartResponse(item), this.handleAddItemToShoppingCartError))
|
||||
)
|
||||
.pipe(
|
||||
catchError((err) => {
|
||||
return of(undefined);
|
||||
})
|
||||
);
|
||||
|
||||
return zip(takeAwayAvailability$, deliveryAvailability$).pipe(
|
||||
tapResponse(this.handleAddItemToShoppingCartResponse2(item), this.handleAddItemToShoppingCartError)
|
||||
);
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
handleAddItemToShoppingCartResponse = (item: ItemDTO) => (availability: AvailabilityDTO) => {
|
||||
handleAddItemToShoppingCartResponse2 = (item: ItemDTO) => ([takeAwayAvailability, deliveryAvailability]: [
|
||||
AvailabilityDTO,
|
||||
AvailabilityDTO
|
||||
]) => {
|
||||
const isPriceMaintained = deliveryAvailability['priceMaintained'] ?? false;
|
||||
const offlinePrice = takeAwayAvailability.price?.value?.value ?? -1;
|
||||
const onlinePrice = deliveryAvailability?.price?.value?.value ?? -1;
|
||||
|
||||
const availability = takeAwayAvailability;
|
||||
|
||||
/**
|
||||
* Onlinepreis ist niedliger als der Offlinepreis
|
||||
* wenn der Artikel nicht Preisgebunden ist, wird der Onlinepreis genommen
|
||||
* wenn der Artikel Preisgebunden ist, wird der Ladenpreis verwendet
|
||||
*/
|
||||
|
||||
/**
|
||||
* Offlinepreis ist niedliger als der Onlinepreis
|
||||
* wenn der Artikel nicht Preisgebunden ist, wird der Ladenpreis genommen
|
||||
* wenn der Artikel Preisgebunden ist, wird der Ladenpreis verwendet
|
||||
*/
|
||||
|
||||
if (onlinePrice < offlinePrice && !isPriceMaintained) {
|
||||
availability.price = deliveryAvailability.price;
|
||||
}
|
||||
|
||||
this.setAvailability({
|
||||
catalogProductNumber: getCatalogProductNumber(item),
|
||||
availability: availability,
|
||||
@@ -240,6 +283,31 @@ export class KulturpassOrderModalStore extends ComponentStore<KulturpassOrderMod
|
||||
this.addItem(addToShoppingCartDTO);
|
||||
};
|
||||
|
||||
// handleAddItemToShoppingCartResponse = (item: ItemDTO) => (availability: AvailabilityDTO) => {
|
||||
// this.setAvailability({
|
||||
// catalogProductNumber: getCatalogProductNumber(item),
|
||||
// availability: availability,
|
||||
// });
|
||||
|
||||
// const addToShoppingCartDTO: AddToShoppingCartDTO = {
|
||||
// quantity: 1,
|
||||
// availability: availability,
|
||||
// destination: {
|
||||
// data: {
|
||||
// target: 1,
|
||||
// targetBranch: { id: this.branch.id },
|
||||
// },
|
||||
// },
|
||||
// promotion: {
|
||||
// points: 0,
|
||||
// },
|
||||
// itemType: item.type,
|
||||
// product: { catalogProductNumber: getCatalogProductNumber(item), ...item.product },
|
||||
// };
|
||||
|
||||
// this.addItem(addToShoppingCartDTO);
|
||||
// };
|
||||
|
||||
handleAddItemToShoppingCartError = (err: any) => {
|
||||
this._modal.error('Fehler beim Hinzufügen des Artikels', err);
|
||||
};
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
{{ priceValue$ | async | currency: 'EUR':'code' }}
|
||||
</ng-container>
|
||||
<ng-template #setManualPrice>
|
||||
<div class="relative flex flex-row items-start">
|
||||
<div class="relative flex flex-row items-start manual-price">
|
||||
<ui-select
|
||||
class="w-[6.5rem] min-h-[3.4375rem] p-4 rounded-card border border-solid border-[#AEB7C1] mr-4"
|
||||
tabindex="-1"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CommonModule, NgIf } from '@angular/common';
|
||||
import {
|
||||
Component,
|
||||
ChangeDetectionStrategy,
|
||||
@@ -322,7 +322,7 @@ export class PurchaseOptionsListItemComponent implements OnInit, OnDestroy, OnCh
|
||||
return;
|
||||
}
|
||||
|
||||
if (price[this.item.id] !== parsedPrice) {
|
||||
if (price?.value?.value !== parsedPrice) {
|
||||
this._store.setPrice(this.item.id, this.parsePrice(value), true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
PickupPurchaseOptionTileComponent,
|
||||
} from './purchase-options-tile';
|
||||
import { isGiftCard, Item, PurchaseOption, PurchaseOptionsStore } from './store';
|
||||
import { delay, map, shareReplay, skip, switchMap, takeUntil } from 'rxjs/operators';
|
||||
import { delay, map, shareReplay, skip, switchMap, takeUntil, tap } from 'rxjs/operators';
|
||||
import { KeyValueDTOOfStringAndString } from '@swagger/cat';
|
||||
|
||||
@Component({
|
||||
@@ -83,7 +83,7 @@ export class PurchaseOptionsModalComponent implements OnInit, OnDestroy {
|
||||
|
||||
hasDownload$ = this.purchasingOptions$.pipe(map((purchasingOptions) => purchasingOptions.includes('download')));
|
||||
|
||||
canContinue$ = this.store.canContinue$.pipe(shareReplay(1));
|
||||
canContinue$ = this.store.canContinue$.pipe(tap((canContinue) => console.log('canContinue', canContinue)));
|
||||
|
||||
private _onDestroy$ = new Subject<void>();
|
||||
|
||||
|
||||
@@ -198,10 +198,17 @@ export function getAvailabilitiesForItem(
|
||||
};
|
||||
}
|
||||
|
||||
export function isArchive(item: Item, type: ActionType): boolean {
|
||||
if (isItemDTO(item, type)) {
|
||||
return item?.features?.some((f) => f.key === 'ARC');
|
||||
} else {
|
||||
return !!item?.features['ARC'];
|
||||
}
|
||||
}
|
||||
|
||||
export function getCanEditPrice(itemId: number): (state: PurchaseOptionsState) => boolean {
|
||||
return (state) => {
|
||||
const item = getItems(state).find((item) => item.id === itemId);
|
||||
|
||||
return isGiftCard(item, getType(state));
|
||||
};
|
||||
}
|
||||
@@ -211,9 +218,14 @@ export function getPriceForPurchaseOption(
|
||||
purchaseOption: PurchaseOption
|
||||
): (state: PurchaseOptionsState) => PriceDTO & { fromCatalogue?: boolean } {
|
||||
return (state) => {
|
||||
if (getCanEditPrice(itemId)(state)) {
|
||||
if (
|
||||
getCanEditPrice(itemId)(state) ||
|
||||
isArchive(
|
||||
getItems(state).find((item) => item.id === itemId),
|
||||
getType(state)
|
||||
)
|
||||
) {
|
||||
const price = getPrices(state)[itemId];
|
||||
|
||||
if (price) {
|
||||
return price;
|
||||
}
|
||||
|
||||
@@ -643,6 +643,7 @@ export class PurchaseOptionsStore extends ComponentStore<PurchaseOptionsState> {
|
||||
setPrice(itemId: number, value: number, manually: boolean = false) {
|
||||
const prices = this.prices;
|
||||
let price = prices[itemId];
|
||||
|
||||
if (price?.value?.value !== value) {
|
||||
if (!price) {
|
||||
price = {
|
||||
|
||||
@@ -82,6 +82,9 @@ export class UiSearchboxNextComponent extends UiFormControlDirective<any>
|
||||
@Input()
|
||||
hint: string = '';
|
||||
|
||||
@Output()
|
||||
hintCleared = new EventEmitter<void>();
|
||||
|
||||
@Input()
|
||||
autocompleteValueSelector: (item: any) => string = (item: any) => item;
|
||||
|
||||
@@ -196,6 +199,7 @@ export class UiSearchboxNextComponent extends UiFormControlDirective<any>
|
||||
clearHint() {
|
||||
this.hint = '';
|
||||
this.focused.emit(true);
|
||||
this.hintCleared.emit();
|
||||
this.cdr.markForCheck();
|
||||
}
|
||||
|
||||
|
||||
48
package-lock.json
generated
48
package-lock.json
generated
@@ -35,7 +35,7 @@
|
||||
"moment": "^2.29.4",
|
||||
"ng2-pdf-viewer": "^9.1.3",
|
||||
"rxjs": "^6.6.7",
|
||||
"scandit-sdk": "^5.12.1",
|
||||
"scandit-sdk": "^5.13.2",
|
||||
"socket.io": "^4.5.4",
|
||||
"tslib": "^2.0.0",
|
||||
"uglify-js": "^3.4.9",
|
||||
@@ -2173,16 +2173,22 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime-corejs2": {
|
||||
"version": "7.20.7",
|
||||
"license": "MIT",
|
||||
"version": "7.22.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.22.10.tgz",
|
||||
"integrity": "sha512-GKgzyeqm8fCoPt14SBTYFGwSTY+LCRoJb+sJPJLRfUhyFD0206ZZEPyUyQhZdbEyFKDtRvvfjbAhk3t5EUw1og==",
|
||||
"dependencies": {
|
||||
"core-js": "^2.6.12",
|
||||
"regenerator-runtime": "^0.13.11"
|
||||
"regenerator-runtime": "^0.14.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime-corejs2/node_modules/regenerator-runtime": {
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz",
|
||||
"integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA=="
|
||||
},
|
||||
"node_modules/@babel/template": {
|
||||
"version": "7.18.10",
|
||||
"license": "MIT",
|
||||
@@ -12722,6 +12728,7 @@
|
||||
},
|
||||
"node_modules/regenerator-runtime": {
|
||||
"version": "0.13.11",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/regenerator-transform": {
|
||||
@@ -13427,10 +13434,11 @@
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/scandit-sdk": {
|
||||
"version": "5.12.2",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"version": "5.13.3",
|
||||
"resolved": "https://registry.npmjs.org/scandit-sdk/-/scandit-sdk-5.13.3.tgz",
|
||||
"integrity": "sha512-lETa3+ZmOXWytmAzb+PtenvU878UvOvsCVP4RhmF/HkyzjhobS/OOsluc0gaWh7U7d+gJIrnlheY8pTehARtqQ==",
|
||||
"dependencies": {
|
||||
"@babel/runtime-corejs2": "^7.20.7",
|
||||
"@babel/runtime-corejs2": "^7.20.13",
|
||||
"@juggle/resize-observer": "^3.4.0",
|
||||
"csstype": "^3.1.1",
|
||||
"eventemitter3": "^5.0.0",
|
||||
@@ -13438,7 +13446,7 @@
|
||||
"js-cookie": "^3.0.1",
|
||||
"objectFitPolyfill": "^2.3.5",
|
||||
"tslib": "^2.4.1",
|
||||
"ua-parser-js": "^1.0.32"
|
||||
"ua-parser-js": "^1.0.33"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.18"
|
||||
@@ -17676,10 +17684,19 @@
|
||||
}
|
||||
},
|
||||
"@babel/runtime-corejs2": {
|
||||
"version": "7.20.7",
|
||||
"version": "7.22.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.22.10.tgz",
|
||||
"integrity": "sha512-GKgzyeqm8fCoPt14SBTYFGwSTY+LCRoJb+sJPJLRfUhyFD0206ZZEPyUyQhZdbEyFKDtRvvfjbAhk3t5EUw1og==",
|
||||
"requires": {
|
||||
"core-js": "^2.6.12",
|
||||
"regenerator-runtime": "^0.13.11"
|
||||
"regenerator-runtime": "^0.14.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"regenerator-runtime": {
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz",
|
||||
"integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/template": {
|
||||
@@ -24494,7 +24511,8 @@
|
||||
}
|
||||
},
|
||||
"regenerator-runtime": {
|
||||
"version": "0.13.11"
|
||||
"version": "0.13.11",
|
||||
"dev": true
|
||||
},
|
||||
"regenerator-transform": {
|
||||
"version": "0.15.1",
|
||||
@@ -24933,9 +24951,11 @@
|
||||
"dev": true
|
||||
},
|
||||
"scandit-sdk": {
|
||||
"version": "5.12.2",
|
||||
"version": "5.13.3",
|
||||
"resolved": "https://registry.npmjs.org/scandit-sdk/-/scandit-sdk-5.13.3.tgz",
|
||||
"integrity": "sha512-lETa3+ZmOXWytmAzb+PtenvU878UvOvsCVP4RhmF/HkyzjhobS/OOsluc0gaWh7U7d+gJIrnlheY8pTehARtqQ==",
|
||||
"requires": {
|
||||
"@babel/runtime-corejs2": "^7.20.7",
|
||||
"@babel/runtime-corejs2": "^7.20.13",
|
||||
"@juggle/resize-observer": "^3.4.0",
|
||||
"csstype": "^3.1.1",
|
||||
"eventemitter3": "^5.0.0",
|
||||
@@ -24943,7 +24963,7 @@
|
||||
"js-cookie": "^3.0.1",
|
||||
"objectFitPolyfill": "^2.3.5",
|
||||
"tslib": "^2.4.1",
|
||||
"ua-parser-js": "^1.0.32"
|
||||
"ua-parser-js": "^1.0.33"
|
||||
},
|
||||
"dependencies": {
|
||||
"eventemitter3": {
|
||||
|
||||
Reference in New Issue
Block a user