Merge branch 'feature/customer_pages' into feature/755-HFI-Firmendetails

This commit is contained in:
Lorenz Hilpert
2020-11-27 15:02:08 +01:00
42 changed files with 710 additions and 35 deletions

View File

@@ -1336,6 +1336,86 @@
}
}
}
},
"@ui/select": {
"projectType": "library",
"root": "apps/ui/select",
"sourceRoot": "apps/ui/select/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "apps/ui/select/tsconfig.lib.json",
"project": "apps/ui/select/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "apps/ui/select/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "apps/ui/select/src/test.ts",
"tsConfig": "apps/ui/select/tsconfig.spec.json",
"karmaConfig": "apps/ui/select/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/ui/select/tsconfig.lib.json",
"apps/ui/select/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"@ui/toggle": {
"projectType": "library",
"root": "apps/ui/toggle",
"sourceRoot": "apps/ui/toggle/src",
"prefix": "ui",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "apps/ui/toggle/tsconfig.lib.json",
"project": "apps/ui/toggle/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "apps/ui/toggle/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "apps/ui/toggle/src/test.ts",
"tsConfig": "apps/ui/toggle/tsconfig.spec.json",
"karmaConfig": "apps/ui/toggle/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/ui/toggle/tsconfig.lib.json",
"apps/ui/toggle/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "sales"

View File

@@ -20,13 +20,20 @@ export abstract class CustomerSearch implements OnInit, OnDestroy {
private destroy$ = new Subject();
public filtersLoaded$ = new BehaviorSubject<boolean>(false);
filtersLoaded$ = new BehaviorSubject<boolean>(false);
public queryFilter$ = new BehaviorSubject<QueryFilter>({
queryFilter$ = new BehaviorSubject<QueryFilter>({
query: '',
filters: [],
});
queryFilterEmpty$ = this.queryFilter$.pipe(
map((qf) => {
return !qf.query && Object.entries(this.getSelecteFiltersAsDictionary()).length === 0;
}),
tap(console.log.bind(window))
);
get queryFilter() {
return this.queryFilter$.value;
}

View File

@@ -9,7 +9,7 @@
class="apply-filter"
[class.loading]="search.searchState === 'fetching'"
(click)="applyFilters()"
[disabled]="search.searchState === 'fetching'"
[disabled]="search.searchState === 'fetching' || search.queryFilterEmpty$ | async"
>
<span *ngIf="search.searchState !== 'fetching'">
Filter anwenden

View File

@@ -12,6 +12,10 @@ button.apply-filter {
min-width: 201px;
}
button.apply-filter:disabled {
@apply bg-inactive-customer;
}
button.apply-filter.loading {
padding-top: 15px;
padding-bottom: 17px;

View File

@@ -14,12 +14,7 @@
<ui-searchbox-warning *ngIf="searchState === 'empty'">
Keine Suchergebnisse
</ui-searchbox-warning>
<button
*ngIf="queryControl?.value?.length"
type="reset"
uiSearchboxClearButton
(click)="queryControl.reset(); input.focus()"
>
<button *ngIf="queryControl?.value?.length" type="reset" uiSearchboxClearButton (click)="queryControl.reset(); input.focus()">
<ui-icon icon="close" size="22px"></ui-icon>
</button>
<button
@@ -27,33 +22,16 @@
type="submit"
uiSearchboxSearchButton
(click)="startSearch()"
[disabled]="searchState === 'fetching'"
[disabled]="searchState === 'fetching' || search.queryFilterEmpty$ | async"
>
<ui-icon
class="spin"
*ngIf="searchState === 'fetching'"
icon="spinner"
size="32px"
></ui-icon>
<ui-icon class="spin" *ngIf="searchState === 'fetching'" icon="spinner" size="32px"></ui-icon>
<ng-container *ngIf="searchState !== 'fetching'">
<ui-icon
*ngIf="isMobile && !input?.value?.length"
icon="scan"
size="32px"
></ui-icon>
<ui-icon
*ngIf="!isMobile || !!input?.value?.length"
icon="search"
size="24px"
></ui-icon>
<ui-icon *ngIf="isMobile && !input?.value?.length" icon="scan" size="32px"></ui-icon>
<ui-icon *ngIf="!isMobile || !!input?.value?.length" icon="search" size="24px"></ui-icon>
</ng-container>
</button>
<ui-searchbox-autocomplete
uiClickOutside
(clicked)="autocomplete.close()"
#autocomplete
>
<ui-searchbox-autocomplete uiClickOutside (clicked)="autocomplete.close()" #autocomplete>
<button
uiSearchboxAutocompleteOption
[value]="result?.display"

View File

@@ -26,7 +26,10 @@
<span class="menu-item">Artikelsuche</span>
</ng-template>
</div>
<div class="menu-item-grid align-center active" (click)="routeToMenu('/customer/search', 'customersearch')">
<div
class="menu-item-grid align-center active"
(click)="routeToMenu('/customer/search', 'customersearch', { customertype: 'b2b;store;loyalty;webshop' })"
>
<div>
<lib-icon
class="menu-icon"

View File

@@ -23,6 +23,7 @@ import { RemissionFinishingProcessStatus } from '../../modules/remission/models/
import { DeleteFormState } from '../../core/store/actions/forms.actions';
import { USER_FORM_STATE_KEY, USER_EXTRAS_FORM_STATE_KEY, USER_ERRORS_FORM_STATE_KEY } from '../../core/utils/app.constants';
import { CustomerHelperService } from '../../modules/customer/services/customer-helper.service';
import { StringDictionary } from '@cmf/core';
@Component({
selector: 'app-menu',
@@ -44,7 +45,7 @@ export class MenuComponent implements OnInit, OnDestroy {
) {}
activeMenu = '';
routeToMenu(menuPath: string, menuTag: string): void {
routeToMenu(menuPath: string, menuTag: string, queryParams?: StringDictionary<string>): void {
if (this.processes && this.processes.length < 1 && this.module === ModuleSwitcher.Customer) {
this.createProcess(menuPath);
}
@@ -89,7 +90,7 @@ export class MenuComponent implements OnInit, OnDestroy {
} else {
this.store.dispatch(new ChangeCurrentRoute(menuPath));
}
this.router.navigate([menuPath]);
this.router.navigate([menuPath], { queryParams });
}
routeToMenuBranch(menuPath: string, menuTag: string): void {

View File

@@ -23,7 +23,7 @@
background: $isa-branch;
}
.is-active.customer {
background: $isa-customer-light;
background: #e6eff9;
}
}

View File

@@ -48,3 +48,7 @@
transform: rotate(-90deg);
}
}
.isa-btn {
@apply inline-flex text-inactive-customer;
}

View File

@@ -40,6 +40,10 @@
width: 60px;
}
.ui-searchbox-wrapper ::ng-deep [uiSearchboxSearchButton]:disabled {
@apply text-inactive-customer;
}
.ui-searchbox-wrapper ::ng-deep [uiSearchboxClearButton] {
@apply mr-2;
width: auto;

25
apps/ui/select/README.md Normal file
View File

@@ -0,0 +1,25 @@
# Select
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 select` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project select`.
> Note: Don't forget to add `--project select` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build select` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build select`, go to the dist folder `cd dist/select` and run `npm publish`.
## Running unit tests
Run `ng test select` 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).

View 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/ui/select'),
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,
});
};

View File

@@ -0,0 +1,7 @@
{
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../../dist/ui/select",
"lib": {
"entryFile": "src/public-api.ts"
}
}

View File

@@ -0,0 +1,11 @@
{
"name": "@ui/select",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^10.1.2",
"@angular/core": "^10.1.2"
},
"dependencies": {
"tslib": "^2.0.0"
}
}

View File

@@ -0,0 +1,5 @@
// start:ng42.barrel
export * from './ui-select-option.component';
export * from './ui-select.component';
export * from './ui-select.module';
// end:ng42.barrel

View File

@@ -0,0 +1 @@
{{ label }}

View File

View File

@@ -0,0 +1,30 @@
import { Component, ChangeDetectionStrategy, Input, HostListener, EventEmitter, Output } from '@angular/core';
@Component({
selector: 'ui-select-option',
templateUrl: 'ui-select-option.component.html',
styleUrls: ['ui-select-option.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class UiSelectOptionComponent {
@Input()
label: string;
@Input()
value: any;
onSelect = (value: any) => {};
constructor() {}
registerOnSelect(fn: any) {
this.onSelect = fn;
}
@HostListener('click')
select() {
if (typeof this.onSelect === 'function') {
this.onSelect.call(null, this.value);
}
}
}

View File

@@ -0,0 +1,11 @@
<div class="ui-input-wrapper">
<div class="ui-select-value" (click)="toggle()">{{ label }}</div>
<button class="ui-select-toggle" (click)="toggle()" [disabled]="disabled">
<ui-icon icon="arrow_head"></ui-icon>
</button>
</div>
<div class="ui-select-dropdown-wrapper">
<div class="ui-select-options">
<ng-content select="ui-select-option"></ng-content>
</div>
</div>

View File

@@ -0,0 +1,50 @@
:host {
@apply flex flex-col box-border text-regular;
}
.ui-input-wrapper {
@apply flex flex-row bg-white py-px-5 px-px-10;
}
.ui-select-value {
@apply flex-grow;
}
.ui-select-toggle {
@apply bg-transparent border-none outline-none;
}
.ui-select-toggle ui-icon {
transition: 250ms all ease-in-out;
transform: rotate(90deg);
}
:host.toggled .ui-select-toggle ui-icon {
transform: rotate(270deg);
}
.ui-select-dropdown-wrapper {
@apply flex flex-col relative;
}
.ui-select-options {
transition: 250ms all ease-in-out;
@apply z-dropdown overflow-auto left-0 right-0;
max-height: 0rem;
}
:host.toggled .ui-select-dropdown-wrapper .ui-select-options {
max-height: 20rem;
}
.ui-select-dropdown-wrapper .ui-select-options {
@apply flex flex-col absolute bg-white shadow-xl rounded-b-card;
}
:host ::ng-deep ui-select-option {
@apply py-px-5 px-px-10 cursor-pointer;
&:hover {
@apply bg-glitter;
}
}

View File

@@ -0,0 +1,99 @@
import {
Component,
ChangeDetectionStrategy,
Input,
ContentChildren,
QueryList,
HostBinding,
AfterContentInit,
ChangeDetectorRef,
} from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { UiSelectOptionComponent } from './ui-select-option.component';
@Component({
selector: 'ui-select',
templateUrl: 'ui-select.component.html',
styleUrls: ['ui-select.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class UiSelectComponent implements ControlValueAccessor, AfterContentInit {
@Input()
value: any;
get label() {
return this.options.find((o) => o.value === this.value)?.label;
}
@Input()
disabled: boolean;
@ContentChildren(UiSelectOptionComponent, { read: UiSelectOptionComponent })
options: QueryList<UiSelectOptionComponent>;
@Input()
@HostBinding('class.toggled')
toggled: boolean;
private onChange = (value: any) => {};
private onTouched = () => {};
constructor(private cdr: ChangeDetectorRef) {}
writeValue(obj: any): void {
this.value = obj;
this.cdr.markForCheck();
}
registerOnChange(fn: any): void {
this.onChange = fn;
}
registerOnTouched(fn: any): void {
this.onTouched = fn;
}
setDisabledState?(isDisabled: boolean): void {
this.disabled = isDisabled;
if (isDisabled) {
this.close();
}
this.cdr.markForCheck();
}
toggle() {
this.toggled = !this.toggled;
this.cdr.markForCheck();
}
open() {
this.toggled = true;
this.cdr.markForCheck();
}
close() {
this.toggled = false;
this.cdr.markForCheck();
}
ngAfterContentInit() {
this.registerOptionsSelect();
this.options.changes.subscribe((_) => {
this.registerOptionsSelect();
});
}
private registerOptionsSelect() {
this.options.forEach((option) => {
option.registerOnSelect((value) => {
if (value !== this.value) {
this.value = value;
this.onChange(value);
}
this.onTouched();
this.close();
});
});
}
}

View File

@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { UiSelectComponent } from './ui-select.component';
import { UiIconModule } from '@ui/icon';
import { UiSelectOptionComponent } from './ui-select-option.component';
@NgModule({
imports: [CommonModule, UiIconModule],
exports: [UiSelectComponent, UiSelectOptionComponent],
declarations: [UiSelectComponent, UiSelectOptionComponent],
})
export class UiSelectModule {}

View File

@@ -0,0 +1,5 @@
/*
* Public API Surface of select
*/
export * from './lib';

View 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);

View 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"
]
}

View 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
}
}

View 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"
]
}

View File

@@ -0,0 +1,17 @@
{
"extends": "../../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"ui",
"camelCase"
],
"component-selector": [
true,
"element",
"ui",
"kebab-case"
]
}
}

25
apps/ui/toggle/README.md Normal file
View File

@@ -0,0 +1,25 @@
# Toggle
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 toggle` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project toggle`.
> Note: Don't forget to add `--project toggle` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build toggle` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build toggle`, go to the dist folder `cd dist/toggle` and run `npm publish`.
## Running unit tests
Run `ng test toggle` 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).

View 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/ui/toggle'),
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,
});
};

View File

@@ -0,0 +1,7 @@
{
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../../dist/ui/toggle",
"lib": {
"entryFile": "src/public-api.ts"
}
}

View File

@@ -0,0 +1,11 @@
{
"name": "@ui/toggle",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^10.1.2",
"@angular/core": "^10.1.2"
},
"dependencies": {
"tslib": "^2.0.0"
}
}

View File

@@ -0,0 +1,4 @@
// start:ng42.barrel
export * from './ui-toggle.directive';
export * from './ui-toggle.module';
// end:ng42.barrel

View File

@@ -0,0 +1,21 @@
import { Directive, Input } from '@angular/core';
@Directive({ selector: '[uiToggle]', exportAs: 'uiToggle' })
export class UiToggleDirective {
@Input()
toggled = false;
constructor() {}
toggle() {
this.toggled = !this.toggled;
}
open() {
this.toggled = true;
}
close() {
this.toggled = false;
}
}

View File

@@ -0,0 +1,8 @@
import { NgModule } from '@angular/core';
import { UiToggleDirective } from './ui-toggle.directive';
@NgModule({
exports: [UiToggleDirective],
declarations: [UiToggleDirective],
})
export class UiToggleModule {}

View File

@@ -0,0 +1,5 @@
/*
* Public API Surface of toggle
*/
export * from './lib';

View 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);

View 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"
]
}

View 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
}
}

View 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"
]
}

View File

@@ -0,0 +1,17 @@
{
"extends": "../../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"ui",
"camelCase"
],
"component-selector": [
true,
"element",
"ui",
"kebab-case"
]
}
}

View File

@@ -136,6 +136,12 @@
],
"@ui/input": [
"apps/ui/input/src/public-api.ts"
],
"@ui/select": [
"apps/ui/select/src/public-api.ts"
],
"@ui/toggle": [
"apps/ui/toggle/src/public-api.ts"
]
}
}