[HIMA-110] moved application files to apps/sales/ & changed import paths to match new paths

This commit is contained in:
Eraldo Hasanaj
2019-03-04 13:46:41 +01:00
parent c94fc11147
commit 583906a711
414 changed files with 3027 additions and 1886 deletions

View File

@@ -1,142 +1,8 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"newProjectRoot": "apps",
"projects": {
"hima": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/hima",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.webmanifest"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
],
"serviceWorker": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "hima:build"
},
"configurations": {
"production": {
"browserTarget": "hima:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "hima:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.webmanifest"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"hima-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "hima:serve"
},
"configurations": {
"production": {
"devServerTarget": "hima:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"cat-service": {
"root": "projects/cat-service",
"sourceRoot": "projects/cat-service/src",
@@ -165,9 +31,7 @@
"projects/cat-service/tsconfig.lib.json",
"projects/cat-service/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
"exclude": ["**/node_modules/**"]
}
}
}
@@ -200,13 +64,124 @@
"projects/feed-service/tsconfig.lib.json",
"projects/feed-service/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
"exclude": ["**/node_modules/**"]
}
}
}
},
"sales": {
"root": "apps/sales/",
"sourceRoot": "apps/sales/src",
"projectType": "application",
"prefix": "sales",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/sales",
"index": "apps/sales/src/index.html",
"main": "apps/sales/src/main.ts",
"polyfills": "apps/sales/src/polyfills.ts",
"tsConfig": "apps/sales/tsconfig.app.json",
"assets": ["apps/sales/src/favicon.ico", "apps/sales/src/assets"],
"styles": ["apps/sales/src/styles.scss"],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "apps/sales/src/environments/environment.ts",
"with": "apps/sales/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "sales:build"
},
"configurations": {
"production": {
"browserTarget": "sales:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "sales:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "apps/sales/src/test.ts",
"polyfills": "apps/sales/src/polyfills.ts",
"tsConfig": "apps/sales/tsconfig.spec.json",
"karmaConfig": "apps/sales/karma.conf.js",
"styles": ["apps/sales/src/styles.scss"],
"scripts": [],
"assets": ["apps/sales/src/favicon.ico", "apps/sales/src/assets"]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/sales/tsconfig.app.json",
"apps/sales/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**"]
}
}
}
},
"sales-e2e": {
"root": "apps/sales-e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "apps/sales-e2e/protractor.conf.js",
"devServerTarget": "sales:serve"
},
"configurations": {
"production": {
"devServerTarget": "sales:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "apps/sales-e2e/tsconfig.e2e.json",
"exclude": ["**/node_modules/**"]
}
}
}
}
},
"defaultProject": "hima"
}
}

View File

@@ -9,6 +9,6 @@ describe('workspace-project App', () => {
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('Welcome to hima!');
expect(page.getTitleText()).toEqual('Welcome to sales!');
});
});

View File

@@ -1,7 +1,7 @@
{
"extends": "../tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"outDir": "../../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [

View File

@@ -16,7 +16,7 @@ module.exports = function (config) {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
dir: require('path').join(__dirname, '../../coverage'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},

View File

@@ -2,7 +2,7 @@
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"name": "sales",
"installMode": "prefetch",
"resources": {
"files": [
@@ -13,7 +13,8 @@
"/*.js"
]
}
}, {
},
{
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",

View File

@@ -0,0 +1,4 @@
<sales-header></sales-header>
<sales-content [isConnected]="isConnected"></sales-content>
<sales-menu></sales-menu>

View File

@@ -2,7 +2,7 @@ import { Component, ViewChild } from '@angular/core';
import { ConnectionService } from 'ng-connection-service';
@Component({
selector: 'app-root',
selector: 'sales-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})

View File

@@ -28,7 +28,6 @@ import { NgxsReduxDevtoolsPluginModule } from '@ngxs/devtools-plugin';
import { NgxsLoggerPluginModule } from '@ngxs/logger-plugin';
import { FeedState } from './core/store/state/feed.state';
import { ProcessState } from './core/store/state/process.state';
import { environment } from 'src/environments/environment';
import { BreadcrumbsState } from './core/store/state/breadcrumbs.state';
import { FilterState } from './core/store/state/filter.state';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@@ -38,6 +37,7 @@ import { AutocompleteState } from './core/store/state/autocomplete.state';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { NotifierState } from './core/store/state/notifier.state';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
const states = [
FeedState,
@@ -89,7 +89,9 @@ export function _feedServiceEndpointProviderFactory(conf: ConfigService) {
ReactiveFormsModule,
SharedModule,
ScrollingModule,
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })
ServiceWorkerModule.register('ngsw-worker.js', {
enabled: environment.production
})
],
providers: [
{

View File

@@ -1,10 +1,10 @@
<div class="breadacrumb-grid" [ngClass]="{'grid-with-arrow': !backArrow, 'breadcumb-mb-5': lowerMargin}">
<!-- <app-back-arrow (back)="addOne()"></app-back-arrow> TESTING ANIMATION PURPOSES-->
<app-back-arrow
<!-- <sales-back-arrow (back)="addOne()"></sales-back-arrow> TESTING ANIMATION PURPOSES-->
<sales-back-arrow
*ngIf="backArrow"
(back)="goBack(breadcrumbs[breadcrumbs.length - 2])"
class="align-right back-arrow"
></app-back-arrow>
></sales-back-arrow>
<div
class="align-center breadcrumb-container"
[ngClass]="{ 'with-arrow': backArrow }"

View File

@@ -1,14 +1,17 @@
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { Breadcrumb } from 'src/app/core/models/breadcrumb.model';
import { Process } from 'src/app/core/models/process.model';
import { Breadcrumb } from 'apps/sales/src/app/core/models/breadcrumb.model';
import { Process } from 'apps/sales/src/app/core/models/process.model';
import { Select, Store } from '@ngxs/store';
import { ProcessState } from 'src/app/core/store/state/process.state';
import { PopBreadcrumbsAfterCurrent, ChangeCurrentRoute } from 'src/app/core/store/actions/process.actions';
import { ProcessState } from 'apps/sales/src/app/core/store/state/process.state';
import {
PopBreadcrumbsAfterCurrent,
ChangeCurrentRoute
} from 'apps/sales/src/app/core/store/actions/process.actions';
import { Router } from '@angular/router';
@Component({
selector: 'app-breadcrumbs',
selector: 'sales-breadcrumbs',
templateUrl: './breadcrumbs.component.html',
styleUrls: ['./breadcrumbs.component.scss']
})
@@ -39,7 +42,9 @@ export class BreadcrumbsComponent implements OnInit {
}
get selectedBreadCrumbIndex() {
return this.breadcrumbs.findIndex(t => t.path.indexOf(this.currentRoute) >= 0);
return this.breadcrumbs.findIndex(
t => t.path.indexOf(this.currentRoute) >= 0
);
}
get lowerMargin() {
@@ -81,7 +86,7 @@ export class BreadcrumbsComponent implements OnInit {
this.router.navigate(['/search-results#start']);
}
ngOnInit() { }
ngOnInit() {}
addOne() {
this.breadcrumbs.push({

View File

@@ -1,4 +1,4 @@
<app-modal id="checkout-modal">
<sales-modal id="checkout-modal">
<div class="modal-step-1" *ngIf="stepOne">
<div class="header">
@@ -95,4 +95,4 @@
</div>
</div>
</app-modal>
</sales-modal>

View File

@@ -2,13 +2,16 @@ import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
import { ModalService } from '../../core/services/modal.service';
import { Router } from '@angular/router';
import { Store } from '@ngxs/store';
import { ChangeCurrentRoute, SetCartData } from 'src/app/core/store/actions/process.actions';
import {
ChangeCurrentRoute,
SetCartData
} from 'apps/sales/src/app/core/store/actions/process.actions';
import { ItemDTO, CatImageService } from 'cat-service';
const points = 60;
@Component({
selector: 'app-checkout',
selector: 'sales-checkout',
templateUrl: './checkout.component.html',
styleUrls: ['./checkout.component.scss']
})
@@ -19,12 +22,11 @@ export class CheckoutComponent implements OnInit {
// Step one mock data
locations = [
{ name: 'München Karlsplatz', date: '01.05.2019'},
{ name: 'München Marienplatz', date: '01.05.2019'},
{ name: 'München Ollenhauerstraße', date: '01.05.2019'},
{ name: 'München Pasing Bahnhofsplatz', date: '01.05.2019'},
{ name: 'München Theatinerstraße', date: '01.05.2019'}
{ name: 'München Karlsplatz', date: '01.05.2019' },
{ name: 'München Marienplatz', date: '01.05.2019' },
{ name: 'München Ollenhauerstraße', date: '01.05.2019' },
{ name: 'München Pasing Bahnhofsplatz', date: '01.05.2019' },
{ name: 'München Theatinerstraße', date: '01.05.2019' }
];
currentLocation = this.locations[0];
currentPickUpDate = this.locations[0].date;
@@ -52,7 +54,6 @@ export class CheckoutComponent implements OnInit {
this.imgUrl = url;
});
}
}
get book() {
@@ -64,7 +65,7 @@ export class CheckoutComponent implements OnInit {
private store: Store,
private router: Router,
private catImageService: CatImageService
) { }
) {}
ngOnInit() {
this.currentPrice = this.bookPriceString();
@@ -72,7 +73,7 @@ export class CheckoutComponent implements OnInit {
}
// STEP ONE
selectLocation (locationIndx: number, dropdown: any) {
selectLocation(locationIndx: number, dropdown: any) {
this.currentLocation = this.locations[locationIndx];
this.currentPickUpDate = this.currentLocation.date;
this.toggleDropdown(dropdown);
@@ -90,23 +91,37 @@ export class CheckoutComponent implements OnInit {
}
// STEP TWO
setNumberOfItems (numberOfItems: number, element: any) {
setNumberOfItems(numberOfItems: number, element: any) {
this.currentNumberOfItems = numberOfItems;
this.displayItemsNumber = numberOfItems;
this.currentPoints = numberOfItems * points;
this.currentPrice = (Math.round((this.bookPrice() * numberOfItems * 100)) / 100).toLocaleString().replace('.', ',');
this.currentPrice = (
Math.round(this.bookPrice() * numberOfItems * 100) / 100
)
.toLocaleString()
.replace('.', ',');
this.toggleDropdown(element);
}
updateCart() {
this.store.dispatch(new SetCartData(this.currentNumberOfItems, this._book, { name: 'Artikelsuche', path: '/article-search' }));
this.store.dispatch(
new SetCartData(this.currentNumberOfItems, this._book, {
name: 'Artikelsuche',
path: '/article-search'
})
);
this.store.dispatch(new ChangeCurrentRoute('article-search'));
this.router.navigate(['article-search']);
this.closeModal();
}
itemsConfirmed () {
this.store.dispatch(new SetCartData(this.currentNumberOfItems, this._book, { name: 'Kundensuche', path: '/customer-search' }));
itemsConfirmed() {
this.store.dispatch(
new SetCartData(this.currentNumberOfItems, this._book, {
name: 'Kundensuche',
path: '/customer-search'
})
);
this.store.dispatch(new ChangeCurrentRoute('customer-search'));
this.router.navigate(['customer-search']);
this.closeModal();
@@ -154,7 +169,9 @@ export class CheckoutComponent implements OnInit {
}
private bookPriceString(): string {
const formatedPrice = (+Math.round(this._book.av[0].price.value.value * 100) / 100).toFixed(2);
const formatedPrice = (
+Math.round(this._book.av[0].price.value.value * 100) / 100
).toFixed(2);
return formatedPrice.toLocaleString().replace('.', ',');
}
}

View File

@@ -32,5 +32,5 @@
</div>
</div>
</div>
<app-process-header></app-process-header>
<sales-process-header></sales-process-header>
</div>

View File

@@ -1,7 +1,7 @@
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-header',
selector: 'sales-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss']
})

View File

@@ -1,25 +1,27 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Observable } from 'rxjs';
import { Process } from 'src/app/core/models/process.model';
import { Process } from 'apps/sales/src/app/core/models/process.model';
import { Store, Select } from '@ngxs/store';
import { ProcessState } from 'src/app/core/store/state/process.state';
import { AddProcess, ChangeCurrentRoute, ResetBreadcrumbsTo } from 'src/app/core/store/actions/process.actions';
import { getRandomPic } from 'src/app/core/utils/process.util';
import { Breadcrumb } from 'src/app/core/models/breadcrumb.model';
import { ProcessState } from 'apps/sales/src/app/core/store/state/process.state';
import {
AddProcess,
ChangeCurrentRoute,
ResetBreadcrumbsTo
} from 'apps/sales/src/app/core/store/actions/process.actions';
import { getRandomPic } from 'apps/sales/src/app/core/utils/process.util';
import { Breadcrumb } from 'apps/sales/src/app/core/models/breadcrumb.model';
@Component({
selector: 'app-menu',
selector: 'sales-menu',
templateUrl: './menu.component.html',
styleUrls: ['./menu.component.scss']
})
export class MenuComponent implements OnInit {
@Select(ProcessState.getProcesses) processes$: Observable<Process[]>;
processes: Process[];
constructor(public router: Router,
private store: Store) { }
constructor(public router: Router, private store: Store) {}
activeMenu = '';
routeToMenu(menuPath: string, menuTag: string): void {
@@ -27,7 +29,12 @@ export class MenuComponent implements OnInit {
this.createProcess(menuPath);
}
this.activeMenu = menuTag;
this.store.dispatch(new ResetBreadcrumbsTo({ name: this.nameFromPath(menuPath), path: this.routeFromPath(menuPath) }));
this.store.dispatch(
new ResetBreadcrumbsTo({
name: this.nameFromPath(menuPath),
path: this.routeFromPath(menuPath)
})
);
this.store.dispatch(new ChangeCurrentRoute(this.routeFromPath(menuPath)));
this.router.navigate([menuPath]);
}
@@ -66,8 +73,6 @@ export class MenuComponent implements OnInit {
}
ngOnInit() {
this.processes$.subscribe(
(data: Process[]) => this.processes = data
);
this.processes$.subscribe((data: Process[]) => (this.processes = data));
}
}

View File

@@ -1,12 +1,12 @@
<div class="grid-container pt-19">
<div class="align-left pt-3">
<div class="process-grid-container ml-5">
<app-process-tab
<sales-process-tab
style="display: inline-block;"
*ngFor="let process of processes"
[process]="process"
[@add]="process.new"
></app-process-tab>
></sales-process-tab>
</div>
</div>
<div class="align-right">

View File

@@ -1,16 +1,16 @@
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { Process } from 'src/app/core/models/process.model';
import { Process } from 'apps/sales/src/app/core/models/process.model';
import { Observable } from 'rxjs';
import { Breadcrumb } from 'src/app/core/models/breadcrumb.model';
import { getRandomPic } from 'src/app/core/utils/process.util';
import { Breadcrumb } from 'apps/sales/src/app/core/models/breadcrumb.model';
import { getRandomPic } from 'apps/sales/src/app/core/utils/process.util';
import { Store, Select } from '@ngxs/store';
import { AddProcess } from 'src/app/core/store/actions/process.actions';
import { ProcessState } from 'src/app/core/store/state/process.state';
import { AddProcess } from 'apps/sales/src/app/core/store/actions/process.actions';
import { ProcessState } from 'apps/sales/src/app/core/store/state/process.state';
import { addAnimation } from './add.animation';
import { Router } from '@angular/router';
@Component({
selector: 'app-process-header',
selector: 'sales-process-header',
templateUrl: './process-header.component.html',
styleUrls: ['./process-header.component.scss'],
animations: [addAnimation]

View File

@@ -29,5 +29,5 @@
</a>
</div>
</div>
<app-process-delete-dialog #deleteporcessdialog (deleted)="deleteProcess($event)" [process]='process'></app-process-delete-dialog>
<sales-process-delete-dialog #deleteporcessdialog (deleted)="deleteProcess($event)" [process]='process'></sales-process-delete-dialog>
</div>

View File

@@ -1,5 +1,12 @@
import { Component, OnInit, Input, ViewChild, Output, EventEmitter } from '@angular/core';
import { Process } from 'src/app/core/models/process.model';
import {
Component,
OnInit,
Input,
ViewChild,
Output,
EventEmitter
} from '@angular/core';
import { Process } from 'apps/sales/src/app/core/models/process.model';
import { Router } from '@angular/router';
import { Store, Select } from '@ngxs/store';
import {
@@ -11,15 +18,15 @@ import {
import { Cart } from '../../core/models/cart.model';
import { AddBreadcrumb } from '../../core/store/actions/process.actions';
import { Breadcrumb } from '../../core/models/breadcrumb.model';
import { ProcessDeleteDialogComponent } from 'src/app/modules/process/process-delete-dialog/process-delete-dialog.component';
import { ProcessState } from 'src/app/core/store/state/process.state';
import { ProcessDeleteDialogComponent } from 'apps/sales/src/app/modules/process/process-delete-dialog/process-delete-dialog.component';
import { ProcessState } from 'apps/sales/src/app/core/store/state/process.state';
import { Observable } from 'rxjs';
import { take } from 'rxjs/operators';
import { SearchResultsComponent } from '../search-results/search-results.component';
import { Notify } from 'src/app/core/store/actions/notifier.actions';
import { Notify } from 'apps/sales/src/app/core/store/actions/notifier.actions';
@Component({
selector: 'app-process-tab',
selector: 'sales-process-tab',
templateUrl: './process-tab.component.html',
styleUrls: ['./process-tab.component.scss']
})

View File

@@ -1,7 +1,7 @@
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-product-card-loading',
selector: 'sales-product-card-loading',
templateUrl: './product-card-loading.component.html',
styleUrls: ['./product-card-loading.component.scss']
})

View File

@@ -1,28 +1,29 @@
import { Component, OnInit, Input } from '@angular/core';
import { Product } from 'src/app/core/models/product.model';
import { Product } from 'apps/sales/src/app/core/models/product.model';
import { Router } from '@angular/router';
import { CatImageService } from 'cat-service';
import { ReplaySubject, Observable, of } from 'rxjs';
import { flatMap, catchError, filter, map } from 'rxjs/operators';
import { getProductTypeIcon } from 'src/app/core/utils/product.util';
import { getProductTypeIcon } from 'apps/sales/src/app/core/utils/product.util';
import { ItemDTO } from 'projects/cat-service/src/lib';
import { Select, Store } from '@ngxs/store';
import { AddSelectedProduct } from 'src/app/core/store/actions/product.actions';
import { ChangeCurrentRoute } from 'src/app/core/store/actions/process.actions';
import { ProcessState } from 'src/app/core/store/state/process.state';
import { AddSelectedProduct } from 'apps/sales/src/app/core/store/actions/product.actions';
import { ChangeCurrentRoute } from 'apps/sales/src/app/core/store/actions/process.actions';
import { ProcessState } from 'apps/sales/src/app/core/store/state/process.state';
@Component({
selector: 'app-product-card',
selector: 'sales-product-card',
templateUrl: './product-card.component.html',
styleUrls: ['./product-card.component.scss']
})
export class ProductCardComponent implements OnInit {
private _product: Product;
@Select(ProcessState.getProducts) items$: Observable<ItemDTO[]>;
@Input() index: number;
@Input()
get product() { return this._product; }
get product() {
return this._product;
}
set product(val) {
if (val !== this.product) {
this._product = val;
@@ -68,15 +69,17 @@ export class ProductCardComponent implements OnInit {
productDetails(product: Product, element: HTMLElement) {
// TODO: this is temporary solution for the incostency of product detail API
this.items$.pipe(
map(item => {
if (item) {
return item.find(i => i && i.id === product.id);
}
})
).subscribe(
(data: ItemDTO) => this.store.dispatch(new AddSelectedProduct(data, this.index))
);
this.items$
.pipe(
map(item => {
if (item) {
return item.find(i => i && i.id === product.id);
}
})
)
.subscribe((data: ItemDTO) =>
this.store.dispatch(new AddSelectedProduct(data, this.index))
);
const currentRoute = 'product-details/' + product.id;
this.store.dispatch(new ChangeCurrentRoute(currentRoute));

View File

@@ -120,11 +120,11 @@
</div>
</div>
<div class="recommandations">
<app-recommendations></app-recommendations>
<sales-recommendations></sales-recommendations>
</div>
</div>
<app-loading loading="true" *ngIf="!product"></app-loading>
<sales-loading loading="true" *ngIf="!product"></sales-loading>
<ng-container *ngIf="item">
<app-checkout #checkout (closed)="cartActionCompleted($event)" [book]="item"></app-checkout>
<sales-checkout #checkout (closed)="cartActionCompleted($event)" [book]="item"></sales-checkout>
</ng-container>

View File

@@ -1,18 +1,18 @@
import { ActivatedRoute } from '@angular/router';
import { Component, OnInit, ViewChild } from '@angular/core';
import { CheckoutComponent } from '../checkout/checkout.component';
import { ProductService } from 'src/app/core/services/product.service';
import { ProductService } from 'apps/sales/src/app/core/services/product.service';
import { ItemDTO, CatImageService } from 'cat-service';
import { Observable } from 'rxjs';
import { ProcessState } from 'src/app/core/store/state/process.state';
import { ProcessState } from 'apps/sales/src/app/core/store/state/process.state';
import { Select, Store } from '@ngxs/store';
import { UpdateBreadcrump } from 'src/app/core/store/actions/process.actions';
import { NotifierState } from 'src/app/core/store/state/notifier.state';
import { Notify } from 'src/app/core/store/actions/notifier.actions';
import { Process } from 'src/app/core/models/process.model';
import { UpdateBreadcrump } from 'apps/sales/src/app/core/store/actions/process.actions';
import { NotifierState } from 'apps/sales/src/app/core/store/state/notifier.state';
import { Notify } from 'apps/sales/src/app/core/store/actions/notifier.actions';
import { Process } from 'apps/sales/src/app/core/models/process.model';
@Component({
selector: 'app-product-details',
selector: 'sales-product-details',
templateUrl: './product-details.component.html',
styleUrls: ['./product-details.component.scss']
})
@@ -53,12 +53,12 @@ export class ProductDetailsComponent implements OnInit {
private productService: ProductService,
private catImageService: CatImageService,
private store: Store
) { }
) {}
ngOnInit() {
this.store.select(ProcessState.getCurrentProcess).subscribe(
(process: Process) => this.currentProcess = process
);
this.store
.select(ProcessState.getCurrentProcess)
.subscribe((process: Process) => (this.currentProcess = process));
this.detailInitialize();
}
@@ -67,19 +67,21 @@ export class ProductDetailsComponent implements OnInit {
this.selectedItem$.subscribe((data: ItemDTO) => {
this.selectedItem = data;
});
this.productService.getItemById(params['id']).subscribe((item: ItemDTO) => {
this.item = item;
this.product = this.productDetailMapper(item);
this.store.dispatch(
new UpdateBreadcrump({
name:
this.product.title.substring(0, 12) +
(this.product.title.length > 12 ? '...' : ''),
path: '/product-details/' + item.id
})
);
return this.product;
});
this.productService
.getItemById(params['id'])
.subscribe((item: ItemDTO) => {
this.item = item;
this.product = this.productDetailMapper(item);
this.store.dispatch(
new UpdateBreadcrump({
name:
this.product.title.substring(0, 12) +
(this.product.title.length > 12 ? '...' : ''),
path: '/product-details/' + item.id
})
);
return this.product;
});
});
}
@@ -141,10 +143,13 @@ export class ProductDetailsComponent implements OnInit {
',00 ' +
item.av[0].price.value.currency;
} else {
const afterDecimal = item.av[0].price.value.value.toString().split('.')[1];
const afterDecimal = item.av[0].price.value.value
.toString()
.split('.')[1];
if (afterDecimal.length === 1) {
price =
item.av[0].price.value.value.toString().replace('.', ',') + '0' +
item.av[0].price.value.value.toString().replace('.', ',') +
'0' +
' ' +
item.av[0].price.value.currency;
} else {

View File

@@ -1,30 +1,30 @@
<div class="result-container">
<app-filter (filtersChanged)="updateSearch()"></app-filter>
<sales-filter (filtersChanged)="updateSearch()"></sales-filter>
<div *ngIf="!ds || (ds.loading && !ds.results)">
<div [@stagger]="'yes'">
<div *ngFor="let dummy of dummies" [style.marginTop.px]="10">
<app-product-card-loading> </app-product-card-loading>
<sales-product-card-loading> </sales-product-card-loading>
</div>
</div>
</div>
<cdk-virtual-scroll-viewport itemSize="190" class="viewport" #scroller>
<div *cdkVirtualFor="let product of ds; let i = index" class="product-item">
<app-product-card
<sales-product-card
[product]="product"
[index]="i"
*ngIf="product != null; else loadingComponent"
>
</app-product-card>
</sales-product-card>
<ng-template #loadingComponent>
<app-product-card-loading></app-product-card-loading>
<sales-product-card-loading></sales-product-card-loading>
</ng-template>
</div>
</cdk-virtual-scroll-viewport>
<app-loading
<sales-loading
*ngIf="!ds || ds.loading"
[style.marginTop.px]="60"
[style.marginBottom.px]="60"
loading="true"
text="Inhalte werden geladen"
></app-loading>
></sales-loading>
</div>

View File

@@ -11,10 +11,10 @@ import { ProcessState } from '../../core/store/state/process.state';
import { staggerAnimation } from './stagger.animation';
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
import { SearchDataSource } from './search-data.datasource';
import { NotifierState } from 'src/app/core/store/state/notifier.state';
import { NotifierState } from 'apps/sales/src/app/core/store/state/notifier.state';
@Component({
selector: 'app-search-results',
selector: 'sales-search-results',
templateUrl: './search-results.component.html',
styleUrls: ['./search-results.component.scss'],
animations: [staggerAnimation]

View File

@@ -4,7 +4,7 @@ import { feedMock } from 'mocks/feed.mock';
import { FeedCard } from '../../models/feed-card.model';
import { FeedService, FeedDTO } from 'feed-service';
import { map } from 'rxjs/operators';
import { FeedMapping } from 'src/app/core/mappings/feed.mapping';
import { FeedMapping } from 'apps/sales/src/app/core/mappings/feed.mapping';
import { PagedApiResponse } from 'projects/feed-service/src/lib';
export class FeedStateModel {

Some files were not shown because too many files have changed in this diff Show More