mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
committed by
Andreas Schickinger
parent
dd6821642f
commit
bc525fbffc
31
angular.json
31
angular.json
@@ -3843,6 +3843,37 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@core/toast": {
|
||||
"projectType": "library",
|
||||
"root": "apps/core/toast",
|
||||
"sourceRoot": "apps/core/toast/src",
|
||||
"prefix": "lib",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:ng-packagr",
|
||||
"options": {
|
||||
"project": "apps/core/toast/ng-package.json"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"tsConfig": "apps/core/toast/tsconfig.lib.prod.json"
|
||||
},
|
||||
"development": {
|
||||
"tsConfig": "apps/core/toast/tsconfig.lib.json"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "apps/core/toast/src/test.ts",
|
||||
"tsConfig": "apps/core/toast/tsconfig.spec.json",
|
||||
"karmaConfig": "apps/core/toast/karma.conf.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "isa-app"
|
||||
|
||||
25
apps/core/toast/README.md
Normal file
25
apps/core/toast/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Toast
|
||||
|
||||
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.0.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name --project toast` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project toast`.
|
||||
|
||||
> Note: Don't forget to add `--project toast` or else it will be added to the default project in your `angular.json` file.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build toast` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Publishing
|
||||
|
||||
After building your library with `ng build toast`, go to the dist folder `cd dist/toast` and run `npm publish`.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test toast` 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 Overview and Command Reference](https://angular.io/cli) page.
|
||||
41
apps/core/toast/karma.conf.js
Normal file
41
apps/core/toast/karma.conf.js
Normal file
@@ -0,0 +1,41 @@
|
||||
// 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'),
|
||||
require('@angular-devkit/build-angular/plugins/karma'),
|
||||
],
|
||||
client: {
|
||||
jasmine: {
|
||||
// you can add configuration options for Jasmine here
|
||||
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||
// for example, you can disable the random execution with `random: false`
|
||||
// or set a specific seed with `seed: 4321`
|
||||
},
|
||||
clearContext: false, // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
jasmineHtmlReporter: {
|
||||
suppressAll: true, // removes the duplicated traces
|
||||
},
|
||||
coverageReporter: {
|
||||
dir: require('path').join(__dirname, '../../../coverage/core/toast'),
|
||||
subdir: '.',
|
||||
reporters: [{ type: 'html' }, { type: 'text-summary' }],
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false,
|
||||
restartOnFileChange: true,
|
||||
});
|
||||
};
|
||||
7
apps/core/toast/ng-package.json
Normal file
7
apps/core/toast/ng-package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../../dist/core/toast",
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
}
|
||||
11
apps/core/toast/package.json
Normal file
11
apps/core/toast/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "@core/toast",
|
||||
"version": "0.0.1",
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^12.2.0",
|
||||
"@angular/core": "^12.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
}
|
||||
}
|
||||
3
apps/core/toast/src/lib/animation/index.ts
Normal file
3
apps/core/toast/src/lib/animation/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// start:ng42.barrel
|
||||
export * from './toast-animation';
|
||||
// end:ng42.barrel
|
||||
14
apps/core/toast/src/lib/animation/toast-animation.ts
Normal file
14
apps/core/toast/src/lib/animation/toast-animation.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { AnimationTriggerMetadata, trigger, state, transition, style, animate } from '@angular/animations';
|
||||
|
||||
export const slideAnimationTime = 150;
|
||||
export const toastAnimations: {
|
||||
readonly slideToast: AnimationTriggerMetadata;
|
||||
} = {
|
||||
slideToast: trigger('slideAnimation', [
|
||||
state('default', style({ transform: 'translateY(0%)' })),
|
||||
transition('void => *', [style({ transform: 'translateY(-100%)' }), animate(`${slideAnimationTime}ms ease-in`)]),
|
||||
transition('default => closing', animate(`${slideAnimationTime}ms ease-in`, style({ transform: 'translateY(-100%)' }))),
|
||||
]),
|
||||
};
|
||||
|
||||
export type ToastAnimationState = 'default' | 'closing';
|
||||
4
apps/core/toast/src/lib/defs/index.ts
Normal file
4
apps/core/toast/src/lib/defs/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// start:ng42.barrel
|
||||
export * from './toast';
|
||||
export * from './toast-ref';
|
||||
// end:ng42.barrel
|
||||
17
apps/core/toast/src/lib/defs/toast-ref.ts
Normal file
17
apps/core/toast/src/lib/defs/toast-ref.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { OverlayRef } from '@angular/cdk/overlay';
|
||||
|
||||
export class ToastRef {
|
||||
constructor(private readonly _overlay: OverlayRef) {}
|
||||
|
||||
close() {
|
||||
this._overlay.dispose();
|
||||
}
|
||||
|
||||
isVisible() {
|
||||
return this._overlay && this._overlay.overlayElement;
|
||||
}
|
||||
|
||||
getPosition() {
|
||||
return this._overlay.overlayElement.getBoundingClientRect();
|
||||
}
|
||||
}
|
||||
11
apps/core/toast/src/lib/defs/toast.ts
Normal file
11
apps/core/toast/src/lib/defs/toast.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { TemplateRef } from '@angular/core';
|
||||
|
||||
export interface Toast {
|
||||
title?: string;
|
||||
text?: string;
|
||||
timer?: number;
|
||||
position?: 'top-left' | 'top' | 'top-right' | 'bottom-right' | 'bottom' | 'bottom-left';
|
||||
size?: 'width-full' | 'content';
|
||||
template?: TemplateRef<any>; // For rendering dynamic content
|
||||
templateContext?: {}; // For rendering dynamic content
|
||||
}
|
||||
8
apps/core/toast/src/lib/index.ts
Normal file
8
apps/core/toast/src/lib/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// start:ng42.barrel
|
||||
export * from './toast.component';
|
||||
export * from './toast.module';
|
||||
export * from './toast.service';
|
||||
export * from './defs';
|
||||
export * from './animation';
|
||||
export * from './tokens';
|
||||
// end:ng42.barrel
|
||||
20
apps/core/toast/src/lib/toast.component.html
Normal file
20
apps/core/toast/src/lib/toast.component.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<div
|
||||
class="toast-main"
|
||||
[style.width]="width"
|
||||
[@slideAnimation]="{ value: animationState }"
|
||||
(@slideAnimation.done)="onSlideFinished($event)"
|
||||
>
|
||||
<button class="absolute top-2 right-2 p-6 border-none bg-transparent" (click)="close()">
|
||||
<ui-icon icon="close" size="20px"></ui-icon>
|
||||
</button>
|
||||
<div class="toast-content flex flex-col justify-center items-center">
|
||||
<h1 class="text-card-sub font-bold text-center py-5 whitespace-pre-wrap">{{ data.title }}</h1>
|
||||
<ng-container *ngIf="data.text; else templateRef">
|
||||
<p class="block text-base overflow-y-hidden text-center overflow-x-hidden">{{ data.text }}</p>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ng-template #templateRef>
|
||||
<ng-container *ngTemplateOutlet="data.template; context: data.templateContext"> </ng-container>
|
||||
</ng-template>
|
||||
12
apps/core/toast/src/lib/toast.component.scss
Normal file
12
apps/core/toast/src/lib/toast.component.scss
Normal file
@@ -0,0 +1,12 @@
|
||||
.toast-main {
|
||||
@apply block relative mx-auto box-border text-white p-4;
|
||||
background-color: var(--toast-background);
|
||||
min-width: 18.75rem;
|
||||
max-width: calc(100vw - 2rem);
|
||||
min-height: 10rem;
|
||||
border-radius: 25px;
|
||||
}
|
||||
|
||||
.toast-content {
|
||||
min-height: 8rem;
|
||||
}
|
||||
24
apps/core/toast/src/lib/toast.component.spec.ts
Normal file
24
apps/core/toast/src/lib/toast.component.spec.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ToastComponent } from './toast.component';
|
||||
|
||||
describe('ToastComponent', () => {
|
||||
let component: ToastComponent;
|
||||
let fixture: ComponentFixture<ToastComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ToastComponent],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ToastComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
48
apps/core/toast/src/lib/toast.component.ts
Normal file
48
apps/core/toast/src/lib/toast.component.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, OnDestroy, OnInit } from '@angular/core';
|
||||
import { toastAnimations, ToastAnimationState, slideAnimationTime } from './animation';
|
||||
import { Toast, ToastRef } from './defs';
|
||||
import { TOAST_CONFIG_TOKEN } from './tokens';
|
||||
|
||||
@Component({
|
||||
selector: 'lib-toast',
|
||||
templateUrl: 'toast.component.html',
|
||||
styleUrls: ['toast.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
animations: [toastAnimations.slideToast],
|
||||
})
|
||||
export class ToastComponent implements OnInit, OnDestroy {
|
||||
timeoutRef: NodeJS.Timeout;
|
||||
animationState: ToastAnimationState = 'default';
|
||||
width: string = '100vw';
|
||||
|
||||
constructor(
|
||||
@Inject(TOAST_CONFIG_TOKEN) public readonly data: Toast,
|
||||
private readonly _ref: ToastRef,
|
||||
private readonly _cdr: ChangeDetectorRef
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.data?.size) {
|
||||
this.width = this.data?.size === 'width-full' ? '100vw' : '100%';
|
||||
}
|
||||
|
||||
this.timeoutRef = setTimeout(() => {
|
||||
this.close();
|
||||
this._cdr.markForCheck();
|
||||
}, slideAnimationTime + (this.data.timer ?? 5000));
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
clearTimeout(this.timeoutRef);
|
||||
}
|
||||
|
||||
close() {
|
||||
this.animationState = 'closing';
|
||||
}
|
||||
|
||||
onSlideFinished(event: AnimationEvent) {
|
||||
if (this.animationState === 'closing') {
|
||||
this._ref.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
apps/core/toast/src/lib/toast.module.ts
Normal file
12
apps/core/toast/src/lib/toast.module.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { OverlayModule } from '@angular/cdk/overlay';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { UiIconModule } from '@ui/icon';
|
||||
import { ToastComponent } from './toast.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [ToastComponent],
|
||||
imports: [CommonModule, OverlayModule, UiIconModule],
|
||||
exports: [ToastComponent],
|
||||
})
|
||||
export class ToastModule {}
|
||||
16
apps/core/toast/src/lib/toast.service.spec.ts
Normal file
16
apps/core/toast/src/lib/toast.service.spec.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ToastService } from './toast.service';
|
||||
|
||||
describe('ToastService', () => {
|
||||
let service: ToastService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ToastService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
79
apps/core/toast/src/lib/toast.service.ts
Normal file
79
apps/core/toast/src/lib/toast.service.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import { Overlay } from '@angular/cdk/overlay';
|
||||
import { ComponentPortal } from '@angular/cdk/portal';
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { Toast, ToastRef } from './defs';
|
||||
import { ToastComponent } from './toast.component';
|
||||
import { TOAST_CONFIG_TOKEN } from './tokens';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ToastService {
|
||||
private _lastToastRef: ToastRef;
|
||||
|
||||
get lastToastRef() {
|
||||
return this._lastToastRef;
|
||||
}
|
||||
|
||||
set lastToastRef(toastRef: ToastRef) {
|
||||
this._lastToastRef = toastRef;
|
||||
}
|
||||
|
||||
constructor(private readonly _overlay: Overlay, private readonly _injector: Injector) {}
|
||||
|
||||
create(data: Toast) {
|
||||
const positionStrategy = this.getPositionStrategy(data);
|
||||
const overlayRef = this._overlay.create({ positionStrategy });
|
||||
|
||||
this.lastToastRef = new ToastRef(overlayRef);
|
||||
const injector = this.getInjector(data, this.lastToastRef);
|
||||
|
||||
const toastPortal = new ComponentPortal(ToastComponent, null, injector);
|
||||
overlayRef.attach(toastPortal);
|
||||
|
||||
return this.lastToastRef;
|
||||
}
|
||||
|
||||
getInjector(data: Toast, ref: ToastRef) {
|
||||
return Injector.create({
|
||||
parent: this._injector,
|
||||
providers: [
|
||||
{ provide: TOAST_CONFIG_TOKEN, useValue: data },
|
||||
{ provide: ToastRef, useValue: ref },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
getPositionStrategy(data: Toast) {
|
||||
switch (data?.position) {
|
||||
case 'top':
|
||||
return this._overlay.position().global().top(this.getNextPosition()).centerHorizontally();
|
||||
case 'top-left':
|
||||
return this._overlay.position().global().top(this.getNextPosition()).left('1rem');
|
||||
case 'top-right':
|
||||
return this._overlay.position().global().top(this.getNextPosition()).right('1rem');
|
||||
case 'bottom':
|
||||
return this._overlay.position().global().bottom(this.getNextPosition(true)).centerHorizontally();
|
||||
case 'bottom-left':
|
||||
return this._overlay.position().global().bottom(this.getNextPosition(true)).left('1rem');
|
||||
case 'bottom-right':
|
||||
return this._overlay.position().global().bottom(this.getNextPosition(true)).right('1rem');
|
||||
default:
|
||||
return this._overlay.position().global().top(this.getNextPosition()).centerHorizontally();
|
||||
}
|
||||
}
|
||||
|
||||
getNextPosition(fromBottom?: boolean) {
|
||||
const lastToastIsVisible = this.lastToastRef && this.lastToastRef.isVisible();
|
||||
|
||||
let position = fromBottom ? 6 : 9;
|
||||
|
||||
if (lastToastIsVisible && fromBottom) {
|
||||
position = (window.innerHeight - this.lastToastRef.getPosition().bottom + this.lastToastRef.getPosition().height + 16) / 16;
|
||||
} else if (lastToastIsVisible) {
|
||||
position = (this.lastToastRef.getPosition().bottom + 16) / 16;
|
||||
}
|
||||
|
||||
return position + 'rem';
|
||||
}
|
||||
}
|
||||
4
apps/core/toast/src/lib/tokens.ts
Normal file
4
apps/core/toast/src/lib/tokens.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
import { Toast } from './defs';
|
||||
|
||||
export const TOAST_CONFIG_TOKEN = new InjectionToken<Toast>('TOAST_DATA');
|
||||
5
apps/core/toast/src/public-api.ts
Normal file
5
apps/core/toast/src/public-api.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
* Public API Surface of toast
|
||||
*/
|
||||
|
||||
export * from './lib';
|
||||
25
apps/core/toast/src/test.ts
Normal file
25
apps/core/toast/src/test.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js';
|
||||
import 'zone.js/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(), { teardown: { destroyAfterEach: true } });
|
||||
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
20
apps/core/toast/tsconfig.lib.json
Normal file
20
apps/core/toast/tsconfig.lib.json
Normal file
@@ -0,0 +1,20 @@
|
||||
/* 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"
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
10
apps/core/toast/tsconfig.lib.prod.json
Normal file
10
apps/core/toast/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": {
|
||||
"compilationMode": "partial"
|
||||
}
|
||||
}
|
||||
17
apps/core/toast/tsconfig.spec.json
Normal file
17
apps/core/toast/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"
|
||||
]
|
||||
}
|
||||
@@ -5,10 +5,16 @@ import { UiModalService } from '@ui/modal';
|
||||
import { ReorderModalComponent, ReorderResult } from '@modal/reorder';
|
||||
import { DomainCheckoutService } from '@domain/checkout';
|
||||
import { AvailabilityDTO2, OrderItemListItemDTO } from '@swagger/oms';
|
||||
import { ToastService } from '@core/toast';
|
||||
|
||||
@Injectable()
|
||||
export class ReOrderActionHandler extends ActionHandler<OrderItemsContext> {
|
||||
constructor(private _command: CommandService, private _domainCheckoutService: DomainCheckoutService, private _uiModal: UiModalService) {
|
||||
constructor(
|
||||
private _command: CommandService,
|
||||
private _domainCheckoutService: DomainCheckoutService,
|
||||
private _uiModal: UiModalService,
|
||||
private _toastService: ToastService
|
||||
) {
|
||||
super('REORDER');
|
||||
}
|
||||
|
||||
@@ -30,6 +36,8 @@ export class ReOrderActionHandler extends ActionHandler<OrderItemsContext> {
|
||||
const reorderResult = await this.reorder(result.data.item, result.data.availability, result.data.comment);
|
||||
const resItem = reorderResult.item1;
|
||||
|
||||
this.createToast(result?.data?.comment);
|
||||
|
||||
updatedItems.push({
|
||||
...result.data.item,
|
||||
orderItemSubsetId: resItem.id,
|
||||
@@ -57,6 +65,27 @@ export class ReOrderActionHandler extends ActionHandler<OrderItemsContext> {
|
||||
return { ...data, items: updatedItems };
|
||||
}
|
||||
|
||||
createToast(comment?: string) {
|
||||
let text: string = '';
|
||||
|
||||
switch (comment) {
|
||||
case 'Artikel unverkäuflich, (und physisch in der Filiale vorhanden)':
|
||||
text = 'Der Beschädigte Artikel wurde auf die Remi-Liste gesetzt.';
|
||||
break;
|
||||
case 'Falscher Titel geliefert (richtiges Etikett)':
|
||||
text = 'Die Falschlieferung wurde auf die Remi-Liste gesetzt.';
|
||||
break;
|
||||
default:
|
||||
text = '';
|
||||
break;
|
||||
}
|
||||
|
||||
this._toastService.create({
|
||||
title: 'Artikel wurde nachbestellt',
|
||||
text,
|
||||
});
|
||||
}
|
||||
|
||||
async reorder(orderItem: OrderItemListItemDTO, availability: AvailabilityDTO2, comment: string) {
|
||||
return await this._domainCheckoutService
|
||||
.reorder(orderItem.orderId, orderItem.orderItemId, orderItem.orderItemSubsetId, {
|
||||
|
||||
@@ -23,4 +23,7 @@ body.branch {
|
||||
--shell-process-text-inactive: #9ca5b0;
|
||||
--shell-process-badge-background: #edeff0;
|
||||
--shell-process-badge-active: #596470;
|
||||
|
||||
// @core/toast
|
||||
--toast-background: #596470;
|
||||
}
|
||||
|
||||
@@ -26,4 +26,7 @@ body.customer {
|
||||
|
||||
// @page/dashboard
|
||||
--page-dashboard-card-title-color: #1f466c;
|
||||
|
||||
// @core/toast
|
||||
--toast-background: #1f466c;
|
||||
}
|
||||
|
||||
@@ -15,4 +15,7 @@
|
||||
--shell-process-add-label: #f70400;
|
||||
--shell-process-border-active: #f70400;
|
||||
--shell-process-background: #fff;
|
||||
|
||||
// @core/toast
|
||||
--toast-background: #1f466c;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ApplicationService } from '@core/application';
|
||||
import { BreadcrumbService } from '@core/breadcrumb';
|
||||
import { CacheService } from '@core/cache';
|
||||
import { Config } from '@core/config';
|
||||
import { ToastService } from '@core/toast';
|
||||
import { DomainRemissionService } from '@domain/remission';
|
||||
import { UiErrorModalComponent, UiModalService } from '@ui/modal';
|
||||
|
||||
@@ -26,7 +27,8 @@ export class FinishRemissionComponent implements OnInit, OnDestroy {
|
||||
private _router: Router,
|
||||
private _breadcrumb: BreadcrumbService,
|
||||
private _config: Config,
|
||||
private _cache: CacheService
|
||||
private _cache: CacheService,
|
||||
private _toastService: ToastService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -70,6 +72,7 @@ export class FinishRemissionComponent implements OnInit, OnDestroy {
|
||||
try {
|
||||
await this._remissionService.completeRemission(returnId);
|
||||
this.clearProcessData();
|
||||
this.createToast();
|
||||
await this.navigateToList();
|
||||
} catch (err) {
|
||||
this._modal.open({
|
||||
@@ -91,6 +94,19 @@ export class FinishRemissionComponent implements OnInit, OnDestroy {
|
||||
await this._router.navigate(['/filiale', 'remission', 'list']);
|
||||
}
|
||||
|
||||
createToast() {
|
||||
const supplierId = +this._activatedRoute?.snapshot?.queryParams?.supplier;
|
||||
this._toastService.create({
|
||||
title: 'Warenbegleitschein versendet',
|
||||
text:
|
||||
supplierId === 1
|
||||
? 'Der Warenbegleitschein wurde digital an ZL versendet.'
|
||||
: supplierId === 2
|
||||
? 'Der Warenbegleitschein wurde digital an Blank versendet.'
|
||||
: '',
|
||||
});
|
||||
}
|
||||
|
||||
clearProcessData() {
|
||||
// Muss beim Abschließen der Remission erfolgen, da er sonst auf die Liste routet (siehe remission.component.ts updateProcess())
|
||||
this._applicationService.patchProcess(this.processId, {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ApplicationService } from '@core/application';
|
||||
import { BreadcrumbService } from '@core/breadcrumb';
|
||||
import { CacheService } from '@core/cache';
|
||||
import { Config } from '@core/config';
|
||||
import { ToastService } from '@core/toast';
|
||||
import { Subject } from 'rxjs';
|
||||
import { filter, first, takeUntil } from 'rxjs/operators';
|
||||
|
||||
@@ -25,7 +26,8 @@ export class RemissionComponent implements OnInit, OnDestroy {
|
||||
private _activatedRoute: ActivatedRoute,
|
||||
private _applicationService: ApplicationService,
|
||||
private _router: Router,
|
||||
private _cache: CacheService
|
||||
private _cache: CacheService,
|
||||
private _toastService: ToastService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -47,6 +49,7 @@ export class RemissionComponent implements OnInit, OnDestroy {
|
||||
ngOnDestroy(): void {
|
||||
this._onDestroy$.next();
|
||||
this._onDestroy$.complete();
|
||||
this.createToast();
|
||||
}
|
||||
|
||||
addBreadcrumbIfNotExists() {
|
||||
@@ -80,4 +83,14 @@ export class RemissionComponent implements OnInit, OnDestroy {
|
||||
clearCache() {
|
||||
this._cache.delete({ processId: String(this.processId) });
|
||||
}
|
||||
|
||||
async createToast() {
|
||||
const process = await this._applicationService.getProcessById$(this.processId).pipe(first()).toPromise();
|
||||
if (process?.data?.active) {
|
||||
this._toastService.create({
|
||||
title: 'Wannendeckel Auflegen',
|
||||
text: 'Wenn Sie die Remission unterbrechen legen Sie den Wannendeckel auf die Wanne.',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
package-lock.json
generated
34
package-lock.json
generated
@@ -5549,7 +5549,7 @@
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||
},
|
||||
"base": {
|
||||
@@ -6636,7 +6636,7 @@
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -7278,7 +7278,7 @@
|
||||
},
|
||||
"decamelize-keys": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/decamelize-keys/-/decamelize-keys-1.1.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz",
|
||||
"integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@@ -7316,7 +7316,7 @@
|
||||
},
|
||||
"deep-freeze-strict": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/deep-freeze-strict/-/deep-freeze-strict-1.1.1.tgz",
|
||||
"resolved": "https://registry.npmjs.org/deep-freeze-strict/-/deep-freeze-strict-1.1.1.tgz",
|
||||
"integrity": "sha1-d9BYPKJKab5LvZrC+uQV1VUj5bA=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -8447,7 +8447,7 @@
|
||||
},
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -8991,7 +8991,7 @@
|
||||
},
|
||||
"globjoin": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/globjoin/-/globjoin-0.1.4.tgz",
|
||||
"resolved": "https://registry.npmjs.org/globjoin/-/globjoin-0.1.4.tgz",
|
||||
"integrity": "sha1-L0SUrIkZ43Z8XLtpHp9GMyQoXUM=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -9084,7 +9084,7 @@
|
||||
"dependencies": {
|
||||
"isarray": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/isarray/-/isarray-2.0.1.tgz",
|
||||
"integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4="
|
||||
}
|
||||
}
|
||||
@@ -10151,7 +10151,7 @@
|
||||
},
|
||||
"is-plain-obj": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
|
||||
"integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -11276,7 +11276,7 @@
|
||||
},
|
||||
"lines-and-columns": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
|
||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
|
||||
"integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -11681,7 +11681,7 @@
|
||||
},
|
||||
"memorystream": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/memorystream/-/memorystream-0.3.1.tgz",
|
||||
"resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz",
|
||||
"integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -12545,7 +12545,7 @@
|
||||
},
|
||||
"normalize-selector": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/normalize-selector/-/normalize-selector-0.2.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/normalize-selector/-/normalize-selector-0.2.0.tgz",
|
||||
"integrity": "sha1-0LFF62kRicY6eNIB3E/bEpPvDAM=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -14492,7 +14492,7 @@
|
||||
},
|
||||
"postcss-media-query-parser": {
|
||||
"version": "0.2.3",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz",
|
||||
"resolved": "https://registry.npmjs.org/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz",
|
||||
"integrity": "sha1-J7Ocb02U+Bsac7j3Y1HGCeXO8kQ=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -15111,7 +15111,7 @@
|
||||
},
|
||||
"postcss-resolve-nested-selector": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.1.tgz",
|
||||
"resolved": "https://registry.npmjs.org/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.1.tgz",
|
||||
"integrity": "sha1-Kcy8fDfe36wwTp//C/FZaz9qDk4=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -16628,7 +16628,7 @@
|
||||
},
|
||||
"retry": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/retry/-/retry-0.12.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
|
||||
"integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -17897,7 +17897,7 @@
|
||||
},
|
||||
"style-search": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/style-search/-/style-search-0.1.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/style-search/-/style-search-0.1.0.tgz",
|
||||
"integrity": "sha1-eVjHk+R+MuB9K1yv5cC/jhLneQI=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -18300,7 +18300,7 @@
|
||||
},
|
||||
"svg-tags": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/svg-tags/-/svg-tags-1.0.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/svg-tags/-/svg-tags-1.0.0.tgz",
|
||||
"integrity": "sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q=",
|
||||
"dev": true
|
||||
},
|
||||
@@ -18749,7 +18749,7 @@
|
||||
},
|
||||
"to-fast-properties": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
||||
"integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4="
|
||||
},
|
||||
"to-object-path": {
|
||||
|
||||
@@ -54,6 +54,9 @@
|
||||
"@swagger/availability": [
|
||||
"apps/swagger/availability/src/public-api.ts"
|
||||
],
|
||||
"@core/toast": [
|
||||
"apps/core/toast/src/public-api.ts",
|
||||
],
|
||||
"@swagger/checkout": [
|
||||
"apps/swagger/checkout/src/public-api.ts"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user