mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#1508 - Anzahl der Lesepunkte stimmt nicht
This commit is contained in:
40
angular.json
40
angular.json
@@ -2016,6 +2016,46 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@domain/catalog": {
|
||||
"projectType": "library",
|
||||
"root": "apps/domain/catalog",
|
||||
"sourceRoot": "apps/domain/catalog/src",
|
||||
"prefix": "lib",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:ng-packagr",
|
||||
"options": {
|
||||
"tsConfig": "apps/domain/catalog/tsconfig.lib.json",
|
||||
"project": "apps/domain/catalog/ng-package.json"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"tsConfig": "apps/domain/catalog/tsconfig.lib.prod.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "apps/domain/catalog/src/test.ts",
|
||||
"tsConfig": "apps/domain/catalog/tsconfig.spec.json",
|
||||
"karmaConfig": "apps/domain/catalog/karma.conf.js"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"apps/domain/catalog/tsconfig.lib.json",
|
||||
"apps/domain/catalog/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "sales"
|
||||
|
||||
25
apps/domain/catalog/README.md
Normal file
25
apps/domain/catalog/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Catalog
|
||||
|
||||
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.2.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name --project catalog` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project catalog`.
|
||||
|
||||
> Note: Don't forget to add `--project catalog` or else it will be added to the default project in your `angular.json` file.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build catalog` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Publishing
|
||||
|
||||
After building your library with `ng build catalog`, go to the dist folder `cd dist/catalog` and run `npm publish`.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test catalog` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
||||
32
apps/domain/catalog/karma.conf.js
Normal file
32
apps/domain/catalog/karma.conf.js
Normal file
@@ -0,0 +1,32 @@
|
||||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
require('@angular-devkit/build-angular/plugins/karma'),
|
||||
],
|
||||
client: {
|
||||
clearContext: false, // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
dir: require('path').join(__dirname, '../../../coverage/domain/catalog'),
|
||||
reports: ['html', 'lcovonly', 'text-summary'],
|
||||
fixWebpackSourcePaths: true,
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false,
|
||||
restartOnFileChange: true,
|
||||
});
|
||||
};
|
||||
7
apps/domain/catalog/ng-package.json
Normal file
7
apps/domain/catalog/ng-package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../../dist/domain/catalog",
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
}
|
||||
11
apps/domain/catalog/package.json
Normal file
11
apps/domain/catalog/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "@domain/catalog",
|
||||
"version": "0.0.1",
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^10.1.2",
|
||||
"@angular/core": "^10.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
}
|
||||
}
|
||||
16
apps/domain/catalog/src/lib/catalog.module.ts
Normal file
16
apps/domain/catalog/src/lib/catalog.module.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ModuleWithProviders, NgModule } from '@angular/core';
|
||||
import { DomainCatalogService } from './catalog.service';
|
||||
|
||||
@NgModule({
|
||||
declarations: [],
|
||||
imports: [],
|
||||
exports: [],
|
||||
})
|
||||
export class DomainCatalogModule {
|
||||
static forRoot(): ModuleWithProviders<DomainCatalogModule> {
|
||||
return {
|
||||
ngModule: DomainCatalogModule,
|
||||
providers: [DomainCatalogService],
|
||||
};
|
||||
}
|
||||
}
|
||||
16
apps/domain/catalog/src/lib/catalog.service.spec.ts
Normal file
16
apps/domain/catalog/src/lib/catalog.service.spec.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CatalogService } from './catalog.service';
|
||||
|
||||
describe('CatalogService', () => {
|
||||
let service: CatalogService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(CatalogService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
14
apps/domain/catalog/src/lib/catalog.service.ts
Normal file
14
apps/domain/catalog/src/lib/catalog.service.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { PromotionService } from '@swagger/cat';
|
||||
import { memorize } from '@utils/common';
|
||||
import { shareReplay } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class DomainCatalogService {
|
||||
constructor(private promotionService: PromotionService) {}
|
||||
|
||||
@memorize()
|
||||
getPromotionPoints({ items }: { items: { id: number; quantity: number; price?: number }[] }) {
|
||||
return this.promotionService.PromotionLesepunkte(items).pipe(shareReplay());
|
||||
}
|
||||
}
|
||||
6
apps/domain/catalog/src/public-api.ts
Normal file
6
apps/domain/catalog/src/public-api.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* Public API Surface of catalog
|
||||
*/
|
||||
|
||||
export * from './lib/catalog.service';
|
||||
export * from './lib/catalog.module';
|
||||
24
apps/domain/catalog/src/test.ts
Normal file
24
apps/domain/catalog/src/test.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/dist/zone';
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: {
|
||||
context(
|
||||
path: string,
|
||||
deep?: boolean,
|
||||
filter?: RegExp
|
||||
): {
|
||||
keys(): string[];
|
||||
<T>(id: string): T;
|
||||
};
|
||||
};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
25
apps/domain/catalog/tsconfig.lib.json
Normal file
25
apps/domain/catalog/tsconfig.lib.json
Normal file
@@ -0,0 +1,25 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../out-tsc/lib",
|
||||
"target": "es2015",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"inlineSources": true,
|
||||
"types": [],
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2018"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true,
|
||||
"strictMetadataEmit": true,
|
||||
"enableResourceInlining": true
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
10
apps/domain/catalog/tsconfig.lib.prod.json
Normal file
10
apps/domain/catalog/tsconfig.lib.prod.json
Normal file
@@ -0,0 +1,10 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"declarationMap": false
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": false
|
||||
}
|
||||
}
|
||||
17
apps/domain/catalog/tsconfig.spec.json
Normal file
17
apps/domain/catalog/tsconfig.spec.json
Normal file
@@ -0,0 +1,17 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
||||
17
apps/domain/catalog/tslint.json
Normal file
17
apps/domain/catalog/tslint.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "../../../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"lib",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"lib",
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import { PurchasingOptionsModalComponent, PurchasingOptionsModalData } from '../
|
||||
import { PurchasingOptions } from '../modals/purchasing-options-modal/purchasing-options-modal.store';
|
||||
import { Subject } from 'rxjs';
|
||||
import { StringDictionary } from '@cmf/core';
|
||||
import { DomainCatalogService } from '@domain/catalog';
|
||||
|
||||
@Component({
|
||||
selector: 'page-checkout-review',
|
||||
@@ -77,8 +78,17 @@ export class CheckoutReviewComponent {
|
||||
);
|
||||
|
||||
totalReadingPoints$ = this.items$.pipe(
|
||||
takeUntil(this._orderCompleted),
|
||||
map((items) => items.reduce((total, item) => total + item?.promotion?.points * item?.quantity, 0))
|
||||
switchMap((displayOrders) =>
|
||||
this.domainCatalogService
|
||||
.getPromotionPoints({
|
||||
items: displayOrders.map((i) => ({
|
||||
id: Number(i.product?.catalogProductNumber),
|
||||
quantity: i.quantity,
|
||||
price: i.unitPrice?.value?.value,
|
||||
})),
|
||||
})
|
||||
.pipe(map((response) => Object.values(response.result).reduce((sum, points) => sum + points, 0)))
|
||||
)
|
||||
);
|
||||
|
||||
customerFeatures$ = this.applicationService.activatedProcessId$.pipe(
|
||||
@@ -98,7 +108,8 @@ export class CheckoutReviewComponent {
|
||||
private uiModal: UiModalService,
|
||||
private sso: SsoService,
|
||||
private router: Router,
|
||||
private cdr: ChangeDetectorRef
|
||||
private cdr: ChangeDetectorRef,
|
||||
private domainCatalogService: DomainCatalogService
|
||||
) {}
|
||||
|
||||
async changeItem(shoppingCartItem: ShoppingCartItemDTO) {
|
||||
|
||||
@@ -2,7 +2,9 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { DomainCheckoutService } from '@domain/checkout';
|
||||
import { UiModalService } from '@ui/modal';
|
||||
import { PrintOrderComponent } from '@modal/printer';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { DomainCatalogService } from '@domain/catalog';
|
||||
import { DisplayOrderItemDTO } from '@swagger/oms';
|
||||
|
||||
@Component({
|
||||
selector: 'page-checkout-summary',
|
||||
@@ -23,12 +25,18 @@ export class CheckoutSummaryComponent {
|
||||
);
|
||||
|
||||
totalReadingPoints$ = this.displayOrders$.pipe(
|
||||
map((displayOrders) =>
|
||||
displayOrders.reduce(
|
||||
(total, displayOrder) =>
|
||||
total + displayOrder?.items?.reduce((subTotal, order) => subTotal + order?.promotion?.points * order?.quantity, 0),
|
||||
0
|
||||
)
|
||||
switchMap((displayOrders) =>
|
||||
this.domainCatalogService
|
||||
.getPromotionPoints({
|
||||
items: displayOrders
|
||||
.reduce<DisplayOrderItemDTO[]>((items, order) => [...items, ...order.items], [])
|
||||
.map((i) => ({
|
||||
id: Number(i.product?.catalogProductNumber),
|
||||
quantity: i.quantity,
|
||||
price: i.price?.value?.value,
|
||||
})),
|
||||
})
|
||||
.pipe(map((response) => Object.values(response.result).reduce((sum, points) => sum + points, 0)))
|
||||
)
|
||||
);
|
||||
|
||||
@@ -51,7 +59,11 @@ export class CheckoutSummaryComponent {
|
||||
)
|
||||
);
|
||||
|
||||
constructor(private domainCheckoutService: DomainCheckoutService, private uiModal: UiModalService) {}
|
||||
constructor(
|
||||
private domainCheckoutService: DomainCheckoutService,
|
||||
private uiModal: UiModalService,
|
||||
private domainCatalogService: DomainCatalogService
|
||||
) {}
|
||||
|
||||
openPrintModal(id: number) {
|
||||
this.uiModal.open({
|
||||
|
||||
@@ -66,6 +66,7 @@ import { CDN_PRODUCT_PICTURES } from './tokens';
|
||||
import { DateAdapter, NativeDateAdapter } from '@ui/common';
|
||||
import { ApplicationRefactImp } from './refact-imp/application.refact-imp';
|
||||
import { CDN_PRODUCT_IMAGE } from 'apps/cdn/product-image/src/lib/tokens';
|
||||
import { DomainCatalogModule } from '@domain/catalog';
|
||||
registerLocaleData(localeDe, localeDeExtra);
|
||||
registerLocaleData(localeDe, 'de', localeDeExtra);
|
||||
|
||||
@@ -140,6 +141,7 @@ export function cdnProdutctPictures(config: AppConfiguration): string {
|
||||
* @core Domain
|
||||
*/
|
||||
DomainCheckoutModule,
|
||||
DomainCatalogModule.forRoot(),
|
||||
|
||||
/**
|
||||
* @ui Modules
|
||||
|
||||
386
package-lock.json
generated
386
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -188,6 +188,9 @@
|
||||
],
|
||||
"@modal/history": [
|
||||
"apps/modal/history/src/public-api.ts"
|
||||
],
|
||||
"@domain/catalog": [
|
||||
"apps/domain/catalog/src/public-api.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user