mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merge branch 'feature/customer_pages' of https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend into feature/customer_pages
This commit is contained in:
40
angular.json
40
angular.json
@@ -1656,6 +1656,46 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@domain/oms": {
|
||||
"projectType": "library",
|
||||
"root": "apps/domain/oms",
|
||||
"sourceRoot": "apps/domain/oms/src",
|
||||
"prefix": "lib",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:ng-packagr",
|
||||
"options": {
|
||||
"tsConfig": "apps/domain/oms/tsconfig.lib.json",
|
||||
"project": "apps/domain/oms/ng-package.json"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"tsConfig": "apps/domain/oms/tsconfig.lib.prod.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "apps/domain/oms/src/test.ts",
|
||||
"tsConfig": "apps/domain/oms/tsconfig.spec.json",
|
||||
"karmaConfig": "apps/domain/oms/karma.conf.js"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"apps/domain/oms/tsconfig.lib.json",
|
||||
"apps/domain/oms/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "sales"
|
||||
|
||||
25
apps/domain/oms/README.md
Normal file
25
apps/domain/oms/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Oms
|
||||
|
||||
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 oms` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project oms`.
|
||||
|
||||
> Note: Don't forget to add `--project oms` or else it will be added to the default project in your `angular.json` file.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build oms` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Publishing
|
||||
|
||||
After building your library with `ng build oms`, go to the dist folder `cd dist/oms` and run `npm publish`.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test oms` 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/oms/karma.conf.js
Normal file
32
apps/domain/oms/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/oms'),
|
||||
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/oms/ng-package.json
Normal file
7
apps/domain/oms/ng-package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../../dist/domain/oms",
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
}
|
||||
11
apps/domain/oms/package.json
Normal file
11
apps/domain/oms/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "@domain/oms",
|
||||
"version": "0.0.1",
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^10.1.2",
|
||||
"@angular/core": "^10.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
}
|
||||
}
|
||||
8
apps/domain/oms/src/lib/oms.module.ts
Normal file
8
apps/domain/oms/src/lib/oms.module.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
@NgModule({
|
||||
declarations: [],
|
||||
imports: [],
|
||||
exports: [],
|
||||
})
|
||||
export class OmsModule {}
|
||||
16
apps/domain/oms/src/lib/oms.service.spec.ts
Normal file
16
apps/domain/oms/src/lib/oms.service.spec.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { OmsService } from './oms.service';
|
||||
|
||||
describe('OmsService', () => {
|
||||
let service: OmsService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(OmsService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
21
apps/domain/oms/src/lib/oms.service.ts
Normal file
21
apps/domain/oms/src/lib/oms.service.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { OrderDTO, OrderListItemDTO, OrderService } from '@swagger/oms';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class OmsService {
|
||||
constructor(private orderService: OrderService) {}
|
||||
|
||||
getOrderItemsByCustomerNumber(customerNumber: string, skip: number): Observable<OrderListItemDTO[]> {
|
||||
return this.orderService
|
||||
.OrderGetOrdersByBuyerNumber({ buyerNumber: customerNumber, take: 20, skip })
|
||||
.pipe(map((orders) => orders.result));
|
||||
}
|
||||
|
||||
private getOrder(orderId: number): Observable<OrderDTO> {
|
||||
return this.orderService.OrderGetOrder(orderId).pipe(map((order) => order.result));
|
||||
}
|
||||
}
|
||||
6
apps/domain/oms/src/public-api.ts
Normal file
6
apps/domain/oms/src/public-api.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* Public API Surface of oms
|
||||
*/
|
||||
|
||||
export * from './lib/oms.service';
|
||||
export * from './lib/oms.module';
|
||||
24
apps/domain/oms/src/test.ts
Normal file
24
apps/domain/oms/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/oms/tsconfig.lib.json
Normal file
25
apps/domain/oms/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/oms/tsconfig.lib.prod.json
Normal file
10
apps/domain/oms/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/oms/tsconfig.spec.json
Normal file
17
apps/domain/oms/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/oms/tslint.json
Normal file
17
apps/domain/oms/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"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<a [routerLink]="['/customer', customer?.id]" class="card-customer-details">
|
||||
<span class="title">Kundendetails</span>
|
||||
</a>
|
||||
<a class="card-customer-orders">
|
||||
<a class="card-customer-orders" [routerLink]="['/customer', customer?.id, 'orders']">
|
||||
<span class="title">Bestellungen</span>
|
||||
</a>
|
||||
<div class="card-customer-card">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<ng-container *ngIf="customer$ | async; let customer">
|
||||
<a class="card-customer-orders">
|
||||
<a [routerLink]="['/customer', customer?.id, 'orders']" class="card-customer-orders">
|
||||
<span class="title">Bestellungen</span>
|
||||
</a>
|
||||
<a *ngIf="hasCustomerCard$ | async" [routerLink]="['/customer', customer?.id, 'card']" class="card-customer-card">
|
||||
|
||||
@@ -24,6 +24,8 @@ import { CustomerDataEditB2BComponent } from './customer-data-edit/customer-data
|
||||
import { UiRadioModule } from '@ui/radio';
|
||||
import { CustomerCardComponent } from './customer-card/customer-card.component';
|
||||
import { CardTemplateComponent } from './shared/card-template/card-template.component';
|
||||
import { CustomerOrdersComponent } from './customer-orders/customer-orders.component';
|
||||
import { UiCommonModule } from '@ui/common';
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
@@ -36,6 +38,7 @@ import { CardTemplateComponent } from './shared/card-template/card-template.comp
|
||||
UiSelectModule,
|
||||
FormsModule,
|
||||
UiRadioModule,
|
||||
UiCommonModule,
|
||||
],
|
||||
exports: [CustomerDetailsComponent],
|
||||
declarations: [
|
||||
@@ -54,6 +57,7 @@ import { CardTemplateComponent } from './shared/card-template/card-template.comp
|
||||
ShippingEditB2CComponent,
|
||||
CustomerCardComponent,
|
||||
CardTemplateComponent,
|
||||
CustomerOrdersComponent,
|
||||
],
|
||||
})
|
||||
export class CustomerDetailsModule {}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<ng-container *ngIf="customer$ | async; let customer">
|
||||
<a [routerLink]="['/customer', customer?.id]" class="card-customer-details">
|
||||
<span class="title">Kundendetails</span>
|
||||
</a>
|
||||
<a *ngIf="hasCustomerCard$ | async" [routerLink]="['/customer', customer?.id, 'card']" class="card-customer-card">
|
||||
<span class="title">Kundenkarte</span>
|
||||
</a>
|
||||
|
||||
<ng-container *ngIf="orders$ | async; let orders">
|
||||
<div class="card card-customer-orders">
|
||||
<div class="header">
|
||||
<h1>Bestellungen</h1>
|
||||
<p class="desc" *ngIf="orders.length > 0">Übersicht aller offenen und<br />früheren Bestellungen</p>
|
||||
<p class="desc-empty" *ngIf="orders.length === 0">Es sind keine Bestellungen vorhanden</p>
|
||||
</div>
|
||||
<div class="orders" [class.card-link-visible]="hasCustomerCard$ | async" uiScrollContainer (reachEnd)="reachEnd()">
|
||||
<div *ngFor="let order of orders; let i = index" class="order-row-wrapper">
|
||||
<div class="line"></div>
|
||||
<div class="order-row">
|
||||
<div class="order-col bold">
|
||||
{{ order.orderDate | date: 'dd.MM.yy' }}
|
||||
</div>
|
||||
<div class="order-col bold">
|
||||
{{ order.processingStatus | processingStatus }}
|
||||
</div>
|
||||
<div class="order-col">{{ order.orderType | orderType }} | {{ order.shopName }}</div>
|
||||
<div class="order-col">{{ order.orderValue | orderPrice }} {{ order.currency }} | {{ order.itemsCount }} Artikel</div>
|
||||
<div class="order-col details">Details</div>
|
||||
</div>
|
||||
<div *ngIf="i === orders.length - 1" class="line"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ui-icon class="spin" *ngIf="isLoading" icon="spinner" size="32px"></ui-icon>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
@@ -0,0 +1,85 @@
|
||||
:host {
|
||||
@apply flex flex-col box-border;
|
||||
}
|
||||
|
||||
.title {
|
||||
@apply text-page-heading font-bold;
|
||||
}
|
||||
|
||||
.card-customer-card,
|
||||
.card-customer-details {
|
||||
@apply bg-white p-4 text-center;
|
||||
box-shadow: 0 -2px 24px 0 #dce2e9;
|
||||
}
|
||||
|
||||
.card-customer-orders {
|
||||
box-shadow: 0 -2px 24px 0 #dce2e9;
|
||||
}
|
||||
|
||||
.card-customer-card .title,
|
||||
.card-customer-details .title {
|
||||
@apply text-inactive-customer text-xl;
|
||||
}
|
||||
|
||||
.header {
|
||||
@apply bg-white rounded-card p-card;
|
||||
box-shadow: 0px 19px 25px -10px white;
|
||||
height: 180px;
|
||||
}
|
||||
|
||||
a {
|
||||
@apply no-underline;
|
||||
}
|
||||
|
||||
h1 {
|
||||
@apply text-center text-page-heading;
|
||||
}
|
||||
|
||||
.desc {
|
||||
@apply text-center text-card-heading;
|
||||
}
|
||||
|
||||
.desc-empty {
|
||||
@apply text-center text-regular;
|
||||
}
|
||||
|
||||
.orders {
|
||||
@apply flex flex-col bg-white;
|
||||
height: calc(100vh - 575px);
|
||||
}
|
||||
|
||||
.card-link-visible {
|
||||
height: calc(100vh - 635px);
|
||||
}
|
||||
|
||||
.line {
|
||||
@apply bg-customer h-px-2;
|
||||
}
|
||||
|
||||
.order-row {
|
||||
@apply flex flex-row justify-around bg-white py-4;
|
||||
}
|
||||
|
||||
.details {
|
||||
@apply text-brand text-cta-l font-bold;
|
||||
}
|
||||
|
||||
.bold {
|
||||
@apply font-bold;
|
||||
}
|
||||
|
||||
.card {
|
||||
@apply flex flex-col items-stretch h-full;
|
||||
}
|
||||
|
||||
.footer {
|
||||
@apply bg-white;
|
||||
flex-grow: 1;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.spin {
|
||||
@apply animate-spin fixed;
|
||||
top: 65%;
|
||||
left: 50%;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { CrmCustomerService } from '@domain/crm';
|
||||
import { CustomerDTO } from '@swagger/crm';
|
||||
|
||||
import { first, map, shareReplay, switchMap, withLatestFrom } from 'rxjs/operators';
|
||||
import { OrderItemDTO, OrderListItemDTO } from '@swagger/oms';
|
||||
import { OmsService } from '@domain/oms';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { BehaviorSubject, combineLatest, merge, of, Subscription } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'page-customer-orders',
|
||||
templateUrl: 'customer-orders.component.html',
|
||||
styleUrls: ['customer-orders.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class CustomerOrdersComponent implements OnInit, OnDestroy {
|
||||
private subs = new Subscription();
|
||||
|
||||
customer$: Observable<CustomerDTO>;
|
||||
|
||||
skip$ = new BehaviorSubject<number>(0);
|
||||
orders$ = new BehaviorSubject<OrderListItemDTO[]>([]);
|
||||
|
||||
isLoading: boolean;
|
||||
hasCustomerCard$: Observable<boolean>;
|
||||
|
||||
constructor(private activatedRoute: ActivatedRoute, private customerDetailsService: CrmCustomerService, private omsService: OmsService) {}
|
||||
|
||||
ngOnInit() {
|
||||
let customerId$ = this.activatedRoute.params.pipe(map((params) => Number(params['customerId'])));
|
||||
this.customer$ = customerId$.pipe(
|
||||
switchMap((customerId) => this.customerDetailsService.getCustomer(customerId, 2)),
|
||||
map(({ result }) => result)
|
||||
);
|
||||
|
||||
let customerFeatures$ = this.customer$.pipe(map((customer: CustomerDTO) => Object.values(customer.features).filter((f) => f.enabled)));
|
||||
this.hasCustomerCard$ = customerFeatures$.pipe(map((features) => !!features.find((feature) => feature.description === 'Kundenkarte')));
|
||||
|
||||
this.subs.add(
|
||||
combineLatest([this.customer$, this.skip$])
|
||||
.pipe(
|
||||
switchMap(([customer, skip]) => this.omsService.getOrderItemsByCustomerNumber(customer.customerNumber, skip)),
|
||||
shareReplay(),
|
||||
withLatestFrom(this.orders$)
|
||||
)
|
||||
.subscribe(([newOrders, orders]) => {
|
||||
this.orders$.next([...orders, ...newOrders]);
|
||||
this.isLoading = false;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subs.unsubscribe();
|
||||
}
|
||||
|
||||
async fetchOrders() {
|
||||
const orders = await this.orders$.pipe(first()).toPromise();
|
||||
this.skip$.next(orders.length);
|
||||
}
|
||||
|
||||
reachEnd() {
|
||||
this.isLoading = true;
|
||||
this.fetchOrders();
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import { CustomerDataEditB2BComponent } from './customer-details/customer-data-e
|
||||
import { CustomerDataEditB2CComponent } from './customer-details/customer-data-edit/customer-data-edit-b2c.component';
|
||||
import { CustomerDetailsComponent } from './customer-details/customer-details.component';
|
||||
import { CustomerCardGuard } from './customer-details/guards/customer-card.guard';
|
||||
import { CustomerOrdersComponent } from './customer-details/customer-orders/customer-orders.component';
|
||||
import { CustomerSearchComponent } from './customer-search/customer-search.component';
|
||||
import { CustomerSearchMainComponent } from './customer-search/search-main/search-main.component';
|
||||
import { CustomerSearchResultComponent } from './customer-search/search-results/search-results.component';
|
||||
@@ -57,6 +58,10 @@ const routes: Routes = [
|
||||
canActivate: [CustomerCardGuard],
|
||||
component: CustomerCardComponent,
|
||||
},
|
||||
{
|
||||
path: ':customerId/orders',
|
||||
component: CustomerOrdersComponent,
|
||||
},
|
||||
{
|
||||
path: ':customerId/edit/b2c',
|
||||
component: CustomerDataEditB2CComponent,
|
||||
|
||||
@@ -2,5 +2,8 @@
|
||||
export * from './country.pipe';
|
||||
export * from './gender.pipe';
|
||||
export * from './address.pipe';
|
||||
export * from './order-type.pipe';
|
||||
export * from './processing-status.pipe';
|
||||
export * from './order-price.pipe';
|
||||
export * from './pipes.module';
|
||||
// end:ng42.barrel
|
||||
|
||||
14
apps/page/customer/src/lib/pipes/order-price.pipe.ts
Normal file
14
apps/page/customer/src/lib/pipes/order-price.pipe.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'orderPrice',
|
||||
})
|
||||
export class OrderPricePipe implements PipeTransform {
|
||||
transform(value: any): string {
|
||||
let str = `${value}`;
|
||||
if (str.indexOf('.') < 0) {
|
||||
str = `${str}.00`;
|
||||
}
|
||||
return str.replace('.', ',');
|
||||
}
|
||||
}
|
||||
20
apps/page/customer/src/lib/pipes/order-type.pipe.ts
Normal file
20
apps/page/customer/src/lib/pipes/order-type.pipe.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { OrderType } from '@swagger/oms';
|
||||
|
||||
@Pipe({
|
||||
name: 'orderType',
|
||||
})
|
||||
export class OrderTypePipe implements PipeTransform {
|
||||
orderTypeText = {
|
||||
0: '',
|
||||
1: 'Filiale',
|
||||
2: 'Online',
|
||||
3: 'Download',
|
||||
4: 'Filiale und Download',
|
||||
5: 'Online und Download',
|
||||
};
|
||||
|
||||
transform(value: OrderType): string {
|
||||
return this.orderTypeText[value] || '';
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,12 @@ import { NgModule } from '@angular/core';
|
||||
import { AddressPipe } from './address.pipe';
|
||||
import { CountryPipe } from './country.pipe';
|
||||
import { GenderPipe } from './gender.pipe';
|
||||
import { OrderTypePipe } from './order-type.pipe';
|
||||
import { ProcessingStatusPipe } from './processing-status.pipe';
|
||||
import { OrderPricePipe } from './order-price.pipe';
|
||||
|
||||
@NgModule({
|
||||
exports: [CountryPipe, GenderPipe, AddressPipe],
|
||||
declarations: [CountryPipe, GenderPipe, AddressPipe],
|
||||
exports: [CountryPipe, GenderPipe, AddressPipe, OrderTypePipe, ProcessingStatusPipe, OrderPricePipe],
|
||||
declarations: [CountryPipe, GenderPipe, AddressPipe, OrderTypePipe, ProcessingStatusPipe, OrderPricePipe],
|
||||
})
|
||||
export class CustomerPipesModule {}
|
||||
|
||||
18
apps/page/customer/src/lib/pipes/processing-status.pipe.ts
Normal file
18
apps/page/customer/src/lib/pipes/processing-status.pipe.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { OrderProcessingStatus } from '@swagger/oms';
|
||||
|
||||
@Pipe({
|
||||
name: 'processingStatus',
|
||||
})
|
||||
export class ProcessingStatusPipe implements PipeTransform {
|
||||
processingStatusText = {
|
||||
0: '',
|
||||
1: 'offen',
|
||||
2: 'in Bearbeitung',
|
||||
3: 'abgeschlossen',
|
||||
};
|
||||
|
||||
transform(value: OrderProcessingStatus): string {
|
||||
return this.processingStatusText[value] || '';
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,9 @@ export { ProductDTO } from './models/product-dto';
|
||||
export { SizeOfString } from './models/size-of-string';
|
||||
export { WeightOfAvoirdupois } from './models/weight-of-avoirdupois';
|
||||
export { Avoirdupois } from './models/avoirdupois';
|
||||
export { PriceDTO } from './models/price-dto';
|
||||
export { PriceValueDTO } from './models/price-value-dto';
|
||||
export { VATValueDTO } from './models/vatvalue-dto';
|
||||
export { VATType } from './models/vattype';
|
||||
export { Gender } from './models/gender';
|
||||
export { PaymentType } from './models/payment-type';
|
||||
@@ -41,9 +44,6 @@ export { DisplayOrderItemSubsetDTO } from './models/display-order-item-subset-dt
|
||||
export { EntityDTOOfDisplayOrderItemSubsetDTOAndIOrderItemStatus } from './models/entity-dtoof-display-order-item-subset-dtoand-iorder-item-status';
|
||||
export { ReadOnlyEntityDTOOfDisplayOrderItemSubsetDTOAndIOrderItemStatus } from './models/read-only-entity-dtoof-display-order-item-subset-dtoand-iorder-item-status';
|
||||
export { QuantityUnitType } from './models/quantity-unit-type';
|
||||
export { PriceDTO } from './models/price-dto';
|
||||
export { PriceValueDTO } from './models/price-value-dto';
|
||||
export { VATValueDTO } from './models/vatvalue-dto';
|
||||
export { PromotionDTO } from './models/promotion-dto';
|
||||
export { EntityDTOOfDisplayOrderItemDTOAndIOrderItem } from './models/entity-dtoof-display-order-item-dtoand-iorder-item';
|
||||
export { ReadOnlyEntityDTOOfDisplayOrderItemDTOAndIOrderItem } from './models/read-only-entity-dtoof-display-order-item-dtoand-iorder-item';
|
||||
@@ -75,14 +75,11 @@ export { EntityDTOContainerOfLabelDTO } from './models/entity-dtocontainer-of-la
|
||||
export { LabelDTO } from './models/label-dto';
|
||||
export { EntityDTOContainerOfTenantDTO } from './models/entity-dtocontainer-of-tenant-dto';
|
||||
export { TenantDTO } from './models/tenant-dto';
|
||||
export { EntityDTOOfTenantDTOAndIReadOnlyTenant } from './models/entity-dtoof-tenant-dtoand-iread-only-tenant';
|
||||
export { ReadOnlyEntityDTOOfTenantDTOAndIReadOnlyTenant } from './models/read-only-entity-dtoof-tenant-dtoand-iread-only-tenant';
|
||||
export { EntityDTOReferenceContainer } from './models/entity-dtoreference-container';
|
||||
export { EntityDTOOfLabelDTOAndIReadOnlyLabel } from './models/entity-dtoof-label-dtoand-iread-only-label';
|
||||
export { ReadOnlyEntityDTOOfLabelDTOAndIReadOnlyLabel } from './models/read-only-entity-dtoof-label-dtoand-iread-only-label';
|
||||
export { Address } from './models/address';
|
||||
export { BranchType } from './models/branch-type';
|
||||
export { EntityDTOOfBranchDTOAndIReadOnlyBranch } from './models/entity-dtoof-branch-dtoand-iread-only-branch';
|
||||
export { ReadOnlyEntityDTOOfBranchDTOAndIReadOnlyBranch } from './models/read-only-entity-dtoof-branch-dtoand-iread-only-branch';
|
||||
export { OrderProcessingStatus } from './models/order-processing-status';
|
||||
export { EntityDTOContainerOfOrderItemDTO } from './models/entity-dtocontainer-of-order-item-dto';
|
||||
@@ -100,7 +97,6 @@ export { EntityDTOContainerOfPackageDTO } from './models/entity-dtocontainer-of-
|
||||
export { PackageDTO } from './models/package-dto';
|
||||
export { EntityDTOContainerOfUserDTO } from './models/entity-dtocontainer-of-user-dto';
|
||||
export { UserDTO } from './models/user-dto';
|
||||
export { EntityDTOOfUserDTOAndIReadOnlyUser } from './models/entity-dtoof-user-dtoand-iread-only-user';
|
||||
export { ReadOnlyEntityDTOOfUserDTOAndIReadOnlyUser } from './models/read-only-entity-dtoof-user-dtoand-iread-only-user';
|
||||
export { AddresseeDTO } from './models/addressee-dto';
|
||||
export { PersonNamesDTO } from './models/person-names-dto';
|
||||
@@ -178,7 +174,6 @@ export { ResponseArgsOfIEnumerableOfVATDTO } from './models/response-args-of-ien
|
||||
export { VATDTO } from './models/vatdto';
|
||||
export { EntityDTOContainerOfCountryDTO } from './models/entity-dtocontainer-of-country-dto';
|
||||
export { CountryDTO } from './models/country-dto';
|
||||
export { EntityDTOOfCountryDTOAndIReadOnlyCountry } from './models/entity-dtoof-country-dtoand-iread-only-country';
|
||||
export { ReadOnlyEntityDTOOfCountryDTOAndIReadOnlyCountry } from './models/read-only-entity-dtoof-country-dtoand-iread-only-country';
|
||||
export { EntityDTOOfVATDTOAndIVAT } from './models/entity-dtoof-vatdtoand-ivat';
|
||||
export { ReadOnlyEntityDTOOfVATDTOAndIVAT } from './models/read-only-entity-dtoof-vatdtoand-ivat';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* tslint:disable */
|
||||
import { EntityDTOOfBranchDTOAndIReadOnlyBranch } from './entity-dtoof-branch-dtoand-iread-only-branch';
|
||||
import { ReadOnlyEntityDTOOfBranchDTOAndIReadOnlyBranch } from './read-only-entity-dtoof-branch-dtoand-iread-only-branch';
|
||||
import { EntityDTOContainerOfLabelDTO } from './entity-dtocontainer-of-label-dto';
|
||||
import { Address } from './address';
|
||||
import { BranchType } from './branch-type';
|
||||
export interface BranchDTO extends EntityDTOOfBranchDTOAndIReadOnlyBranch {
|
||||
export interface BranchDTO extends ReadOnlyEntityDTOOfBranchDTOAndIReadOnlyBranch {
|
||||
label?: EntityDTOContainerOfLabelDTO;
|
||||
parent?: number;
|
||||
branchNumber?: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* tslint:disable */
|
||||
import { EntityDTOOfCountryDTOAndIReadOnlyCountry } from './entity-dtoof-country-dtoand-iread-only-country';
|
||||
export interface CountryDTO extends EntityDTOOfCountryDTOAndIReadOnlyCountry {
|
||||
import { ReadOnlyEntityDTOOfCountryDTOAndIReadOnlyCountry } from './read-only-entity-dtoof-country-dtoand-iread-only-country';
|
||||
export interface CountryDTO extends ReadOnlyEntityDTOOfCountryDTOAndIReadOnlyCountry {
|
||||
name?: string;
|
||||
isO3166_A_3?: string;
|
||||
isDefault?: string;
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
/* tslint:disable */
|
||||
import { ReadOnlyEntityDTOOfBranchDTOAndIReadOnlyBranch } from './read-only-entity-dtoof-branch-dtoand-iread-only-branch';
|
||||
export interface EntityDTOOfBranchDTOAndIReadOnlyBranch extends ReadOnlyEntityDTOOfBranchDTOAndIReadOnlyBranch {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
/* tslint:disable */
|
||||
import { ReadOnlyEntityDTOOfCountryDTOAndIReadOnlyCountry } from './read-only-entity-dtoof-country-dtoand-iread-only-country';
|
||||
export interface EntityDTOOfCountryDTOAndIReadOnlyCountry extends ReadOnlyEntityDTOOfCountryDTOAndIReadOnlyCountry {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
/* tslint:disable */
|
||||
import { ReadOnlyEntityDTOOfLabelDTOAndIReadOnlyLabel } from './read-only-entity-dtoof-label-dtoand-iread-only-label';
|
||||
export interface EntityDTOOfLabelDTOAndIReadOnlyLabel extends ReadOnlyEntityDTOOfLabelDTOAndIReadOnlyLabel {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
/* tslint:disable */
|
||||
import { ReadOnlyEntityDTOOfTenantDTOAndIReadOnlyTenant } from './read-only-entity-dtoof-tenant-dtoand-iread-only-tenant';
|
||||
export interface EntityDTOOfTenantDTOAndIReadOnlyTenant extends ReadOnlyEntityDTOOfTenantDTOAndIReadOnlyTenant {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
/* tslint:disable */
|
||||
import { ReadOnlyEntityDTOOfUserDTOAndIReadOnlyUser } from './read-only-entity-dtoof-user-dtoand-iread-only-user';
|
||||
export interface EntityDTOOfUserDTOAndIReadOnlyUser extends ReadOnlyEntityDTOOfUserDTOAndIReadOnlyUser {
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/* tslint:disable */
|
||||
import { EntityDTOOfLabelDTOAndIReadOnlyLabel } from './entity-dtoof-label-dtoand-iread-only-label';
|
||||
import { ReadOnlyEntityDTOOfLabelDTOAndIReadOnlyLabel } from './read-only-entity-dtoof-label-dtoand-iread-only-label';
|
||||
import { EntityDTOContainerOfTenantDTO } from './entity-dtocontainer-of-tenant-dto';
|
||||
export interface LabelDTO extends EntityDTOOfLabelDTOAndIReadOnlyLabel {
|
||||
export interface LabelDTO extends ReadOnlyEntityDTOOfLabelDTOAndIReadOnlyLabel {
|
||||
name?: string;
|
||||
key?: string;
|
||||
bitMask?: number;
|
||||
|
||||
@@ -3,6 +3,7 @@ import { EnvironmentChannel } from './environment-channel';
|
||||
import { OrderType } from './order-type';
|
||||
import { OrderItemProcessingStatusValue } from './order-item-processing-status-value';
|
||||
import { ProductDTO } from './product-dto';
|
||||
import { PriceDTO } from './price-dto';
|
||||
import { VATType } from './vattype';
|
||||
import { Gender } from './gender';
|
||||
import { PaymentType } from './payment-type';
|
||||
@@ -31,6 +32,7 @@ export interface OrderItemListItemDTO {
|
||||
product?: ProductDTO;
|
||||
quantity?: number;
|
||||
overallQuantity?: number;
|
||||
retailPrice?: PriceDTO;
|
||||
price?: number;
|
||||
vatType?: VATType;
|
||||
currency?: string;
|
||||
|
||||
@@ -3,6 +3,9 @@ import { EnvironmentChannel } from './environment-channel';
|
||||
import { OrderType } from './order-type';
|
||||
import { OrderProcessingStatus } from './order-processing-status';
|
||||
import { Gender } from './gender';
|
||||
import { PaymentType } from './payment-type';
|
||||
import { ShippingAddressDTO } from './shipping-address-dto';
|
||||
import { PayerDTO } from './payer-dto';
|
||||
export interface OrderListItemDTO {
|
||||
clientChannel?: EnvironmentChannel;
|
||||
orderId?: number;
|
||||
@@ -16,12 +19,17 @@ export interface OrderListItemDTO {
|
||||
orderType?: OrderType;
|
||||
processingStatus?: OrderProcessingStatus;
|
||||
orderDate?: string;
|
||||
buyerNumber?: string;
|
||||
organisation?: string;
|
||||
gender?: Gender;
|
||||
title?: string;
|
||||
lastName?: string;
|
||||
firstName?: string;
|
||||
paymentType?: PaymentType;
|
||||
paymentReference?: string;
|
||||
currency?: string;
|
||||
orderValue?: number;
|
||||
itemsCount?: number;
|
||||
shippingAddress?: ShippingAddressDTO;
|
||||
billingAddress?: PayerDTO;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* tslint:disable */
|
||||
import { EntityDTOOfTenantDTOAndIReadOnlyTenant } from './entity-dtoof-tenant-dtoand-iread-only-tenant';
|
||||
export interface TenantDTO extends EntityDTOOfTenantDTOAndIReadOnlyTenant {
|
||||
import { ReadOnlyEntityDTOOfTenantDTOAndIReadOnlyTenant } from './read-only-entity-dtoof-tenant-dtoand-iread-only-tenant';
|
||||
export interface TenantDTO extends ReadOnlyEntityDTOOfTenantDTOAndIReadOnlyTenant {
|
||||
name?: string;
|
||||
key?: string;
|
||||
bitMask?: number;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* tslint:disable */
|
||||
import { EntityDTOOfUserDTOAndIReadOnlyUser } from './entity-dtoof-user-dtoand-iread-only-user';
|
||||
import { ReadOnlyEntityDTOOfUserDTOAndIReadOnlyUser } from './read-only-entity-dtoof-user-dtoand-iread-only-user';
|
||||
import { Gender } from './gender';
|
||||
export interface UserDTO extends EntityDTOOfUserDTOAndIReadOnlyUser {
|
||||
export interface UserDTO extends ReadOnlyEntityDTOOfUserDTOAndIReadOnlyUser {
|
||||
name?: string;
|
||||
email?: string;
|
||||
gender: Gender;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { UiClickOutsideDirective } from './click-outside.directive';
|
||||
import { IsInViewportDirective } from './is-in-viewport.directive';
|
||||
import { ScrollContainerDirective } from './scroll-container.directive';
|
||||
import { SkeletonLoaderComponent } from './skeleton-loader';
|
||||
|
||||
const components = [SkeletonLoaderComponent];
|
||||
const directives = [UiClickOutsideDirective, IsInViewportDirective];
|
||||
const directives = [UiClickOutsideDirective, IsInViewportDirective, ScrollContainerDirective];
|
||||
@NgModule({
|
||||
imports: [],
|
||||
exports: [...components, ...directives],
|
||||
|
||||
82
apps/ui/common/src/lib/scroll-container.directive.ts
Normal file
82
apps/ui/common/src/lib/scroll-container.directive.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import {
|
||||
Directive,
|
||||
ElementRef,
|
||||
EventEmitter,
|
||||
Host,
|
||||
HostListener,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnInit,
|
||||
Output,
|
||||
Renderer2,
|
||||
SimpleChanges,
|
||||
} from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { filter } from 'rxjs/operators';
|
||||
|
||||
@Directive({ selector: '[uiScrollContainer]' })
|
||||
export class ScrollContainerDirective implements OnChanges, OnInit {
|
||||
@Input('uiScrollContainer')
|
||||
direction: 'horizontal' | 'vertical';
|
||||
|
||||
@Input()
|
||||
deltaStart = 0;
|
||||
|
||||
@Input()
|
||||
deltaEnd = 0;
|
||||
|
||||
private scrollEvent$ = new Subject<Event>();
|
||||
|
||||
@Output()
|
||||
reachStart = this.scrollEvent$.pipe(
|
||||
filter((event) => {
|
||||
if (this.direction === 'vertical') {
|
||||
const top = this.nativeElement.scrollTop;
|
||||
return top <= this.deltaStart;
|
||||
} else {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
@Output()
|
||||
reachEnd = this.scrollEvent$.pipe(
|
||||
filter((event) => {
|
||||
if (this.direction === 'vertical') {
|
||||
const top = this.nativeElement.scrollTop;
|
||||
const height = this.nativeElement.scrollHeight - this.nativeElement.clientHeight - this.deltaEnd;
|
||||
return top >= height;
|
||||
} else {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
get nativeElement(): HTMLElement {
|
||||
return this.elementRef.nativeElement;
|
||||
}
|
||||
|
||||
constructor(@Host() private elementRef: ElementRef, private renderer: Renderer2) {}
|
||||
ngOnInit(): void {
|
||||
if (!this.direction) {
|
||||
this.direction = 'vertical';
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges({ direction }: SimpleChanges): void {
|
||||
if (direction) {
|
||||
if (this.direction === 'horizontal') {
|
||||
this.renderer.setStyle(this.elementRef.nativeElement, 'overflow-x', 'scroll');
|
||||
this.renderer.setStyle(this.elementRef.nativeElement, 'overflow-y', 'auto');
|
||||
} else {
|
||||
this.renderer.setStyle(this.elementRef.nativeElement, 'overflow-y', 'scroll');
|
||||
this.renderer.setStyle(this.elementRef.nativeElement, 'overflow-x', 'auto');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('scroll', ['$event'])
|
||||
onScroll(event: Event) {
|
||||
this.scrollEvent$.next(event);
|
||||
}
|
||||
}
|
||||
392
package-lock.json
generated
392
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -160,6 +160,9 @@
|
||||
],
|
||||
"@ui/checkbox": [
|
||||
"apps/ui/checkbox/src/public-api.ts"
|
||||
],
|
||||
"@domain/oms": [
|
||||
"apps/domain/oms/src/public-api.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user