Commit b0e1013a authored by prumde's avatar prumde

Updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174471 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 87c844ea
...@@ -2,7 +2,7 @@ import { Component } from '@angular/core'; ...@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
import {Location, LocationStrategy, PathLocationStrategy} from '@angular/common'; import {Location, LocationStrategy, PathLocationStrategy} from '@angular/common';
import {AppState} from './ecm-store/reducers'; import {AppState} from './ecm-store/reducers';
import {CartActions, CategoryActions, MenuActions} from './ecm-store/actions'; import {CartActions, CategoryActions, MenuActions, WishListActions} from './ecm-store/actions';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@Component({ @Component({
...@@ -14,7 +14,7 @@ import { Store } from '@ngrx/store'; ...@@ -14,7 +14,7 @@ import { Store } from '@ngrx/store';
export class AppComponent { export class AppComponent {
title = 'Proteus ECM'; title = 'Proteus ECM';
location: Location; location: Location;
constructor(location: Location, private store: Store<AppState>, private cartActions: CartActions, private categoryAction: CategoryActions, private menuAction:MenuActions) { constructor(location: Location, private store: Store<AppState>, private cartAction: CartActions, private categoryAction: CategoryActions, private menuAction:MenuActions, private wishListAction: WishListActions) {
this.location = location; this.location = location;
console.log( ' this.location.path(true)[' + this.location.path(true) + ']'); console.log( ' this.location.path(true)[' + this.location.path(true) + ']');
this.checkAppState(); this.checkAppState();
...@@ -24,7 +24,8 @@ export class AppComponent { ...@@ -24,7 +24,8 @@ export class AppComponent {
this.setItem('appstate', this.get('app_stat'), true ); this.setItem('appstate', this.get('app_stat'), true );
this.setItem('TOKEN_ID', this.get('TOKEN_ID'), true ); this.setItem('TOKEN_ID', this.get('TOKEN_ID'), true );
this.store.dispatch(this.cartActions.loadCartItems()); this.store.dispatch(this.cartAction.loadCartItems());
this.store.dispatch(this.wishListAction.loadWishlistItems());
this.store.dispatch(this.categoryAction.loadCategories()); this.store.dispatch(this.categoryAction.loadCategories());
this.store.dispatch(this.menuAction.loadMenu()); this.store.dispatch(this.menuAction.loadMenu());
......
...@@ -57,7 +57,7 @@ Overlay End --> ...@@ -57,7 +57,7 @@ Overlay End -->
<ng-template #fixedHeaderLarge> <ng-template #fixedHeaderLarge>
<md-toolbar color="primary"> <md-toolbar color="primary">
<button [ngClass]="{onSelect: selectedOption === 'MENU'}" md-button (click)="menuAction();" class="square-button"> <button md-button (click)="menuAction();" class="square-button">
<span class="ecm-menu-icon ecm-menu-icon1"></span> <span class="ecm-menu-icon ecm-menu-icon1"></span>
<span class="ecm-menu-icon ecm-menu-icon2"></span> <span class="ecm-menu-icon ecm-menu-icon2"></span>
<span class="ecm-menu-icon ecm-menu-icon3"></span> <span class="ecm-menu-icon ecm-menu-icon3"></span>
...@@ -66,7 +66,7 @@ Overlay End --> ...@@ -66,7 +66,7 @@ Overlay End -->
<span class="siteHeading">{{siteHeading}}</span> <span class="siteHeading">{{siteHeading}}</span>
<ecm-search [compFadeState]="headerFadeState" [headerState]="'fixed'"></ecm-search> <ecm-search [compFadeState]="headerFadeState" [headerState]="'fixed'"></ecm-search>
<span (click)="cartAction();" > <span (click)="cartAction();" >
<button [ngClass]="{onSelect: selectedOption === 'CART'}" md-button class="square-button"> <button md-button class="square-button">
<span *ngIf="(cartItems | async)?.length!=0" class="fixed-header-badge">{{(cartItems | async)?.length}}</span> <span *ngIf="(cartItems | async)?.length!=0" class="fixed-header-badge">{{(cartItems | async)?.length}}</span>
<img mdTooltip="Show Cart" [mdTooltipPosition]="'below'" class="fixed-header-cart img-cart-32" src="cart_32_32.svg"/> <img mdTooltip="Show Cart" [mdTooltipPosition]="'below'" class="fixed-header-cart img-cart-32" src="cart_32_32.svg"/>
<!-- <img *ngIf="cartItems == 0" class="fixed-header-cart img-cart-32 no-badge" /> --> <!-- <img *ngIf="cartItems == 0" class="fixed-header-cart img-cart-32 no-badge" /> -->
...@@ -74,7 +74,7 @@ Overlay End --> ...@@ -74,7 +74,7 @@ Overlay End -->
</button> </button>
</span> </span>
<span (click)="userAction();" > <span (click)="userAction();" >
<button [ngClass]="{onSelect: selectedOption === 'USER'}" md-button class="square-button"> <button md-button class="square-button">
<img *ngIf="userData" mdTooltip="Click here to Manage Account" [mdTooltipPosition]="'below'" [src]="profileImageLink" onerror="this.src = '/ecm/assets/images/svg/user_32_32.svg'; this.className = 'fixed-header-no-user'" title="{{userData.name}}" [ngClass]="( userImage.src.indexOf('/ibase/') > 0 ) ? 'fixed-header-user' : 'fixed-header-no-user' " #userImage/> <img *ngIf="userData" mdTooltip="Click here to Manage Account" [mdTooltipPosition]="'below'" [src]="profileImageLink" onerror="this.src = '/ecm/assets/images/svg/user_32_32.svg'; this.className = 'fixed-header-no-user'" title="{{userData.name}}" [ngClass]="( userImage.src.indexOf('/ibase/') > 0 ) ? 'fixed-header-user' : 'fixed-header-no-user' " #userImage/>
<img *ngIf="!userData" mdTooltip="Click here for Login" [mdTooltipPosition]="'below'" class="fixed-header-no-user img-user-32" src="user_32_32.svg"/> <img *ngIf="!userData" mdTooltip="Click here for Login" [mdTooltipPosition]="'below'" class="fixed-header-no-user img-user-32" src="user_32_32.svg"/>
<!--<md-icon class="example-icon">account_circle</md-icon>--> <!--<md-icon class="example-icon">account_circle</md-icon>-->
......
...@@ -10,7 +10,6 @@ import { RESIZE_EVENT } from '../ecm-store/ecm-resize'; ...@@ -10,7 +10,6 @@ import { RESIZE_EVENT } from '../ecm-store/ecm-resize';
import { EcmPanelComponent } from '../ecm-view/ecm-panel/ecm-panel.component'; import { EcmPanelComponent } from '../ecm-view/ecm-panel/ecm-panel.component';
import { ScrollService } from '../scroll.service'; import { ScrollService } from '../scroll.service';
import { EcmCartService } from '../ecm-view/ecm-cart/ecm-cart.service';
import 'rxjs/add/operator/filter'; import 'rxjs/add/operator/filter';
//declare var initSearch: any; //declare var initSearch: any;
...@@ -93,7 +92,7 @@ export class ECMHeaderComponent implements OnInit, OnDestroy { ...@@ -93,7 +92,7 @@ export class ECMHeaderComponent implements OnInit, OnDestroy {
cartCounter: number; cartCounter: number;
profileImageLink : string; profileImageLink : string;
clientWidth: any; clientWidth: any;
constructor( @Inject( DOCUMENT ) private document: Document, private route: ActivatedRoute, private router: Router, private scroll_service: ScrollService, private store: Store<AppState>, public cartService: EcmCartService) { } constructor( @Inject( DOCUMENT ) private document: Document, private route: ActivatedRoute, private router: Router, private scroll_service: ScrollService, private store: Store<AppState>) { }
ngOnInit() { ngOnInit() {
console.log( 'ECMHeaderComponent onInit' ); console.log( 'ECMHeaderComponent onInit' );
...@@ -176,32 +175,6 @@ export class ECMHeaderComponent implements OnInit, OnDestroy { ...@@ -176,32 +175,6 @@ export class ECMHeaderComponent implements OnInit, OnDestroy {
userAction() { userAction() {
this.createUserData(); this.createUserData();
// if ( this.userData )
// this.ecmPanel.open('USER_OPT');
// else
// this.ecmPanel.open('SIGNIN_OPT');
//
// if( this.clientWidth < 640 )
// {
// //show overlay with user-option
// this.ecmPanel.updatePosition({ top:'0px', left: '0px' });
// this.ecmPanel.updateSize({ width:'100%', height: '100%' });
// }
// else
// {
// if ( this.userData )
// {
// //show sidepanel with user-option
// this.ecmPanel.updatePosition({ top:'65px', right: '20px' });
// this.ecmPanel.updateSize({ width:'300px', height: '400px' });
// }
// else {
// //show overlay with sign-in-option
// this.ecmPanel.updatePosition({ top:'100px', left: 'calc( 50% - 375px / 2 )' });
// this.ecmPanel.updateSize({ width:'375px', height: '535px' });
// }
// }
if( this.clientWidth < 640 ) if( this.clientWidth < 640 )
{ {
//show overlay with user-option //show overlay with user-option
...@@ -220,13 +193,6 @@ export class ECMHeaderComponent implements OnInit, OnDestroy { ...@@ -220,13 +193,6 @@ export class ECMHeaderComponent implements OnInit, OnDestroy {
{ {
//show sidepanel with user-option //show sidepanel with user-option
this.ecmPanel.open({ type: 'inplace', option: 'USER_OPT', top:'65px', left: '', right: '20px', width:'300px', height: '400px' }); this.ecmPanel.open({ type: 'inplace', option: 'USER_OPT', top:'65px', left: '', right: '20px', width:'300px', height: '400px' });
if(this.selectedOption){
this.selectedOption = null;
this.closeMenu();
}
else{
this.selectedOption = "USER";
}
} }
else else
{ {
...@@ -256,15 +222,7 @@ export class ECMHeaderComponent implements OnInit, OnDestroy { ...@@ -256,15 +222,7 @@ export class ECMHeaderComponent implements OnInit, OnDestroy {
} }
else else
{ {
this.ecmPanel.open({ type: 'inplace', option: 'CART_OPT', top:'65px', left: '', right: '75px', width:'360px', height: '500px' }); this.ecmPanel.open({ type: 'inplace', option: 'CART_OPT', top:'65px', left: '', right: '75px', width:'360px', height: '' });
}
if(this.selectedOption){
this.selectedOption = null;
this.closeMenu();
}
else{
this.selectedOption = "CART";
} }
} }
} }
...@@ -281,14 +239,6 @@ export class ECMHeaderComponent implements OnInit, OnDestroy { ...@@ -281,14 +239,6 @@ export class ECMHeaderComponent implements OnInit, OnDestroy {
} }
else { else {
this.ecmPanel.open({ type: 'inplace', option: 'MENU_OPT', hideClose: true , top:'60px', left: '16px', width:'280px', height: '70%' }); this.ecmPanel.open({ type: 'inplace', option: 'MENU_OPT', hideClose: true , top:'60px', left: '16px', width:'280px', height: '70%' });
if(this.selectedOption){
this.selectedOption = null;
this.closeMenu();
}
else{
this.selectedOption = "MENU";
}
} }
} }
......
...@@ -60,47 +60,4 @@ export class EcmProductDetailService { ...@@ -60,47 +60,4 @@ export class EcmProductDetailService {
console.error('Service handleError:' + errMsg); console.error('Service handleError:' + errMsg);
return Observable.throw(errMsg); return Observable.throw(errMsg);
} }
addToCart( cartData ) {
console.log( "StoreInCart Called" );
console.log(JSON.stringify(cartData));
let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
this.http.post( '/ecm/service/feeds/cart', JSON.stringify(cartData) , options)
.subscribe( data => {
console.log( "Inserted in Cart" );
}, error => {
console.log( error.json() );
});
}
addToWishlist(itemCode) {
console.log( "StoreInWishList Called" );
let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
this.http.post('/ecm/service/feeds/wishlist/'+itemCode, options)
.subscribe( data => {
console.log( "Inserted in wishList" );
}, error => {
console.log( error.json() );
});
}
removeFromWishlist(itemCode) {
console.log( "removeFromWishlist Called" );
let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
this.http.delete('/ecm/service/feeds/wishlist/'+itemCode, options)
.subscribe( data => {
console.log( "removed from wishList" );
}, error => {
console.log( error.json() );
});
}
} }
...@@ -110,37 +110,6 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -110,37 +110,6 @@ export class EcmProductDetailsComponent implements OnInit {
} }
} }
}); });
/*
this.productDetailService.getItemDetail( itemCode ).subscribe(
itemDetail => {
if( itemDetail ) console.log( 'comp itemCode[' + itemCode + '] itemDetail[' + itemDetail + '] \n this.itemDetail[' + JSON.stringify( itemDetail ) + ']' );
this.itemDetail = itemDetail;
if(this.itemDetail)
{
this.storeCatSubcat();
let ecmTemplateName = itemDetail.itemCategory.ecmTemplate;
console.log( "getItemDetail ecmTemplateName: " + ecmTemplateName )
this.ecmTemplate = ECM_TEMPLATES[ecmTemplateName];
this.scatCode = this.itemDetail.itemSubCategory.scatCode;
this.noOfReviews = this.itemDetail.itemRatings.NO_OF_REVIEWS;
console.log("Changed scatCode.."+this.scatCode);
if( this.ecmTemplate )
{
this.ecmTemplate.setItemDetail(itemDetail);
}
else
{
alert( "Sorry, the " + ecmTemplateName + " is not in the system yet!" );
}
}
console.log( 'comp ecmTemplate[' + this.ecmTemplate + ']' );
},
);
*/
} }
scrollToReviews() { scrollToReviews() {
...@@ -224,35 +193,16 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -224,35 +193,16 @@ export class EcmProductDetailsComponent implements OnInit {
} }
addToCart(item) { addToCart(item) {
//this.getAttributeType(itemCode);
//let cartData = new Item;
//cartData.itemCode = itemCode;
//cartData.itemQuantity = 1;
/*cartData.costRate = this.itemDetail.itemHeader.itemCostRate;
cartData.descr = this.itemDetail.itemHeader.itemDescr;
cartData.shDescr = this.itemDetail.itemHeader.itemShDescr;
if(this.attribCode == "COLOR"){
cartData.phyAttribId3 = this.attribVal;
}
else if(this.attribCode == "SIZE"){
cartData.phyAttribId1 = this.attribVal;
}
*/
item.itemQuantity = 1; item.itemQuantity = 1;
this.store.dispatch(this.cartActions.addToCartSuccess(item)); this.store.dispatch(this.cartActions.addToCartSuccess(item));
//this.store.dispatch({ type: ADD_TO_CART, payload: cartData });
//this.productDetailService.addToCart(cartData);
} }
addToWishlist( item ) { addToWishlist( item ) {
this.store.dispatch(this.wishListAction.addToWishlistSuccess(item)); this.store.dispatch(this.wishListAction.addToWishlistSuccess(item));
this.productDetailService.addToWishlist( item.itemCode );
} }
removeFromWishlist( item ) { removeFromWishlist( item ) {
this.store.dispatch(this.wishListAction.deleteWishlistItemSuccess(item)); this.store.dispatch(this.wishListAction.deleteWishlistItemSuccess(item));
this.productDetailService.removeFromWishlist( item.itemCode );
} }
showSnackbar( message ) { showSnackbar( message ) {
......
...@@ -2,7 +2,7 @@ import { Component, Input, OnChanges, Inject, Output, EventEmitter, ViewChild } ...@@ -2,7 +2,7 @@ import { Component, Input, OnChanges, Inject, Output, EventEmitter, ViewChild }
import { Reviews } from '../ecm-model/product-review.model'; import { Reviews } from '../ecm-model/product-review.model';
import { EcmProductReviewService } from './ecm-product-review.service'; import { EcmProductReviewService } from './ecm-product-review.service';
import { ItemDetail } from '../ecm-model/product-detail-model'; import { ItemDetail } from '../ecm-model/product-detail-model';
import {MdDialog, MdDialogRef, MdDialogConfig, MD_DIALOG_DATA} from '@angular/material'; import { MdDialog, MdDialogRef, MdDialogConfig, MD_DIALOG_DATA } from '@angular/material';
import { FormBuilder, Validators,NgForm } from '@angular/forms'; import { FormBuilder, Validators,NgForm } from '@angular/forms';
@Component( { @Component( {
...@@ -142,8 +142,7 @@ export class EcmProductReviewComponent implements OnChanges { ...@@ -142,8 +142,7 @@ export class EcmProductReviewComponent implements OnChanges {
} }
ngOnChanges(){ ngOnChanges(){
if(this.itemDetail) if ( this.itemDetail ) {
{
this.itemCode = this.itemDetail.itemCode; this.itemCode = this.itemDetail.itemCode;
this.itemAvgRating = this.itemDetail.itemRatings.AVG_RATING; this.itemAvgRating = this.itemDetail.itemRatings.AVG_RATING;
} }
...@@ -186,7 +185,6 @@ export class ECMWriteReviewDialog { ...@@ -186,7 +185,6 @@ export class ECMWriteReviewDialog {
this.reviewData.productRating = this.userReview.rating; this.reviewData.productRating = this.userReview.rating;
this.reviewData.productRemarks = this.userReview.remarks; this.reviewData.productRemarks = this.userReview.remarks;
this.reviewData.productComments = this.userReview.comments; this.reviewData.productComments = this.userReview.comments;
} }
this.reviewData.item_code = this.detail.itemCode; this.reviewData.item_code = this.detail.itemCode;
......
...@@ -8,8 +8,6 @@ import { AppState } from '../ecm-store/reducers'; ...@@ -8,8 +8,6 @@ import { AppState } from '../ecm-store/reducers';
import { CartActions, WishListActions } from '../ecm-store/actions'; import { CartActions, WishListActions } from '../ecm-store/actions';
import { ECMSigninService } from './ecm-signin.service'; import { ECMSigninService } from './ecm-signin.service';
import { EcmCartService } from '../ecm-view/ecm-cart/ecm-cart.service';
import { EcmWishListService } from '../ecm-view/ecm-wish-list/ecm-wish-list.service';
declare var encPwd: any; declare var encPwd: any;
...@@ -46,7 +44,7 @@ export class EcmSigninComponent implements OnInit { ...@@ -46,7 +44,7 @@ export class EcmSigninComponent implements OnInit {
statusPending: boolean = false; statusPending: boolean = false;
statusErrorMsg: string; statusErrorMsg: string;
constructor(public signinService: ECMSigninService, private store: Store<AppState>, public cartService: EcmCartService, public wishListService: EcmWishListService, private cartAction:CartActions, private wishListAction:WishListActions) { } constructor(public signinService: ECMSigninService, private store: Store<AppState>, private cartAction:CartActions, private wishListAction:WishListActions) { }
activeForm: any = 'signInForm'; activeForm: any = 'signInForm';
activeNGForm: NgForm; activeNGForm: NgForm;
...@@ -168,7 +166,6 @@ export class EcmSigninComponent implements OnInit { ...@@ -168,7 +166,6 @@ export class EcmSigninComponent implements OnInit {
console.log( 'comp errorMessage[' + errorMessage + ']' ); console.log( 'comp errorMessage[' + errorMessage + ']' );
} }
); );
} }
login(signinForm) { login(signinForm) {
......
...@@ -19,10 +19,9 @@ export class CartEffects { ...@@ -19,10 +19,9 @@ export class CartEffects {
.map(items => this.cartActions.loadCartItemsSuccess(items)); .map(items => this.cartActions.loadCartItemsSuccess(items));
@Effect() addToCart$ = this.update$ @Effect() addToCart$ = this.update$
.ofType(CartActions.ADD_TO_CART) .ofType(CartActions.ADD_TO_CART_SUCCESS)
.map(action => action.payload) .map(action => action.payload)
.switchMap(item => this.svc.addToCart(item) .switchMap(item => this.svc.addToCart(item));
.map(item => this.cartActions.addToCartSuccess(item)));
@Effect() updateCart$ = this.update$ @Effect() updateCart$ = this.update$
.ofType(CartActions.UPDATE_CART) .ofType(CartActions.UPDATE_CART)
......
...@@ -19,14 +19,12 @@ export class WishlistEffects { ...@@ -19,14 +19,12 @@ export class WishlistEffects {
.map(items => this.wishlistActions.loadWishlistItemsSuccess(items)); .map(items => this.wishlistActions.loadWishlistItemsSuccess(items));
@Effect() addToWishlist$ = this.update$ @Effect() addToWishlist$ = this.update$
.ofType(WishListActions.ADD_TO_WISHLIST) .ofType(WishListActions.ADD_TO_WISHLIST_SUCCESS)
.map(action => action.payload) .map(action => action.payload)
.switchMap(item => this.svc.addToWishlist(item) .switchMap(item => this.svc.addToWishlist(item.itemCode));
.map(item => this.wishlistActions.addToWishlistSuccess(item)));
@Effect() deleteFromWishlist$ = this.update$ @Effect() deleteFromWishlist$ = this.update$
.ofType(WishListActions.DELETE_WISHLIST_ITEM) .ofType(WishListActions.DELETE_WISHLIST_ITEM_SUCCESS)
.map(action => action.payload) .map(action => action.payload)
.switchMap(item => this.svc.deleteWishlistItem(item)) .switchMap(item => this.svc.deleteWishlistItem(item.itemCode));
.map(item => this.wishlistActions.deleteWishlistItemSuccess(item));
} }
...@@ -427,6 +427,13 @@ h6 ...@@ -427,6 +427,13 @@ h6
height:20px; height:20px;
} }
.chg-password-header {
display: block;
text-align: center;
font-size: 22px;
padding-bottom: 20px;
}
.changePass-form { .changePass-form {
padding: 0px 20px; padding: 0px 20px;
padding-top: 40px; padding-top: 40px;
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<ng-template #changePwdScreen> <ng-template #changePwdScreen>
<div class="changePass-form"> <div class="changePass-form">
<h4>Change Password</h4> <span class="chg-password-header">Change Password</span>
<form #changePass="ngForm" (ngSubmit)="changePassword(changePass);" novalidate autocomplete="off"> <form #changePass="ngForm" (ngSubmit)="changePassword(changePass);" novalidate autocomplete="off">
<md-input-container class="password-input-container" [hideRequiredMarker] = "true"> <md-input-container class="password-input-container" [hideRequiredMarker] = "true">
<input mdInput class="username-input" placeholder="Current Password" required name="cpassword" [(ngModel)]="_current_password" #current_password="ngModel" (keydown)="clearTimer();" type = 'password' <input mdInput class="username-input" placeholder="Current Password" required name="cpassword" [(ngModel)]="_current_password" #current_password="ngModel" (keydown)="clearTimer();" type = 'password'
......
...@@ -34,6 +34,7 @@ export class EcmUserOptionComponent implements OnInit { ...@@ -34,6 +34,7 @@ export class EcmUserOptionComponent implements OnInit {
_current_password: string; _current_password: string;
_new_password: string; _new_password: string;
_confirm_password: string; _confirm_password: string;
timer : any;
constructor( public signinService: ECMSigninService, private store: Store<AppState>, public cartService: EcmCartService, private cartAction: CartActions, private locationService: EcmLocationService) { } constructor( public signinService: ECMSigninService, private store: Store<AppState>, public cartService: EcmCartService, private cartAction: CartActions, private locationService: EcmLocationService) { }
...@@ -150,4 +151,12 @@ export class EcmUserOptionComponent implements OnInit { ...@@ -150,4 +151,12 @@ export class EcmUserOptionComponent implements OnInit {
} }
); );
} }
scrollIntoView(formChildElement){
console.log('formChildElement' , formChildElement);
clearTimeout(this.timer);
this.timer = setTimeout(() => {
formChildElement.scrollIntoView(true);
}, 500);
}
} }
...@@ -525,7 +525,7 @@ ...@@ -525,7 +525,7 @@
} }
.scrollMe{ .scrollMe{
overflow: hidden; overflow: hidden;
max-height: 350px; max-height: 230px;
} }
.scrollMe:hover { .scrollMe:hover {
overflow: auto; overflow: auto;
......
...@@ -7,21 +7,19 @@ import { EcmCategoryComponent } from '../ecm-category/ecm-category.component'; ...@@ -7,21 +7,19 @@ import { EcmCategoryComponent } from '../ecm-category/ecm-category.component';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import {AppState} from '../../ecm-store/reducers'; import { AppState } from '../../ecm-store/reducers';
import {CartActions} from '../../ecm-store/actions'; import { CartActions } from '../../ecm-store/actions';
import { Item } from '../../ecm-model/product-model'; import { Item } from '../../ecm-model/product-model';
import { EcmCartService } from './ecm-cart.service'; import { EcmCartService } from './ecm-cart.service';
import { ECMCart } from '../../ecm-model/cart-model'; import { ECMCart } from '../../ecm-model/cart-model';
import { EcmProductDetailService } from '../../ecm-product-details/ecm-product-detail.service';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
@Component( { @Component( {
selector: 'ecm-cart', selector: 'ecm-cart',
templateUrl: './ecm-cart.component.html', templateUrl: './ecm-cart.component.html',
styleUrls: ['./ecm-cart.component.css'], styleUrls: ['./ecm-cart.component.css']
providers: [EcmProductDetailService]
}) })
export class EcmCartComponent implements OnInit, AfterViewChecked { export class EcmCartComponent implements OnInit, AfterViewChecked {
cartItemsDetail: ItemDetail[]; cartItemsDetail: ItemDetail[];
...@@ -39,7 +37,7 @@ export class EcmCartComponent implements OnInit, AfterViewChecked { ...@@ -39,7 +37,7 @@ export class EcmCartComponent implements OnInit, AfterViewChecked {
@ViewChild('scrollMe') private myScrollContainer: ElementRef; @ViewChild('scrollMe') private myScrollContainer: ElementRef;
constructor( private route: ActivatedRoute, public dialog: MdDialog, private router: Router,public productDetailService: EcmProductDetailService, public cartService: EcmCartService, public snackBar: MdSnackBar, private http: Http, private store: Store<AppState>, private cartAction: CartActions) { } constructor( private route: ActivatedRoute, public dialog: MdDialog, private router: Router, public cartService: EcmCartService, public snackBar: MdSnackBar, private http: Http, private store: Store<AppState>, private cartAction: CartActions) { }
ngOnInit() { ngOnInit() {
this.getCartItem(); this.getCartItem();
...@@ -68,16 +66,6 @@ export class EcmCartComponent implements OnInit, AfterViewChecked { ...@@ -68,16 +66,6 @@ export class EcmCartComponent implements OnInit, AfterViewChecked {
deleteCartItem( item ) { deleteCartItem( item ) {
console.log( "deleteCartItem Called" ); console.log( "deleteCartItem Called" );
/*
this.store.dispatch({ type: REMOVE, payload: item });
this.http.delete( this.userActionUrl + '/' + item.itemCode, {})
.subscribe( data => {
console.log( "deleted item in Cart" );
}, error => {
console.log( error.json() );
});
*/
this.store.dispatch(this.cartAction.deleteCartItem(item)); this.store.dispatch(this.cartAction.deleteCartItem(item));
this.getCartItem(); this.getCartItem();
...@@ -95,12 +83,9 @@ export class EcmCartComponent implements OnInit, AfterViewChecked { ...@@ -95,12 +83,9 @@ export class EcmCartComponent implements OnInit, AfterViewChecked {
let cartData = new Item; let cartData = new Item;
cartData.itemCode = item.itemCode; cartData.itemCode = item.itemCode;
cartData.itemQuantity = item.itemQuantity; cartData.itemQuantity = item.itemQuantity;
//cartData.costRate = item.itemHeader.itemDiscountedRate;
//this.store.dispatch({ type: 'UPDATE_QUANTITY', payload: cartData });
this.store.dispatch(this.cartAction.updateCart(cartData)); this.store.dispatch(this.cartAction.updateCart(cartData));
this.openSnackBar( 'Quantity increased of ' + item.itemHeader.itemShDescr ); this.openSnackBar( 'Quantity increased of ' + item.itemHeader.itemShDescr );
//this.productDetailService.addToCart(cartData);
} }
decrement(item : ItemDetail) { decrement(item : ItemDetail) {
...@@ -108,12 +93,8 @@ export class EcmCartComponent implements OnInit, AfterViewChecked { ...@@ -108,12 +93,8 @@ export class EcmCartComponent implements OnInit, AfterViewChecked {
let cartData = new Item; let cartData = new Item;
cartData.itemCode = item.itemCode; cartData.itemCode = item.itemCode;
cartData.itemQuantity = item.itemQuantity; cartData.itemQuantity = item.itemQuantity;
// cartData.costRate = item.itemHeader.itemDiscountedRate;
//this.store.dispatch({ type: 'UPDATE_QUANTITY', payload: cartData });
this.store.dispatch(this.cartAction.updateCart(cartData)); this.store.dispatch(this.cartAction.updateCart(cartData));
this.openSnackBar( 'Quantity decreased of ' + item.itemHeader.itemShDescr ); this.openSnackBar( 'Quantity decreased of ' + item.itemHeader.itemShDescr );
//this.productDetailService.addToCart(cartData);
} }
checkQantity(item) { checkQantity(item) {
......
...@@ -24,7 +24,6 @@ private userActionUrl = '/ecm/service/feeds/cart'; ...@@ -24,7 +24,6 @@ private userActionUrl = '/ecm/service/feeds/cart';
this.cartItems = data; this.cartItems = data;
if ( data && data != null ) { if ( data && data != null ) {
this.cartItems.forEach( item => { this.cartItems.forEach( item => {
//this.store.dispatch({ type: ADD_TO_CART, payload: item });
this.store.dispatch(this.cartActions.addToCart(item)); this.store.dispatch(this.cartActions.addToCart(item));
}) })
} }
......
...@@ -3,7 +3,6 @@ import { Store } from '@ngrx/store'; ...@@ -3,7 +3,6 @@ import { Store } from '@ngrx/store';
import { AppState } from '../../ecm-store/reducers'; import { AppState } from '../../ecm-store/reducers';
import { CategoryActions, SubCategoryActions } from '../../ecm-store/actions'; import { CategoryActions, SubCategoryActions } from '../../ecm-store/actions';
import { EcmCategoryService } from './ecm-category.service';
import { ScrollService } from '../../scroll.service'; import { ScrollService } from '../../scroll.service';
import { Category } from '../../ecm-model/category-model'; import { Category } from '../../ecm-model/category-model';
...@@ -12,8 +11,7 @@ import { Observable } from 'rxjs/Observable'; ...@@ -12,8 +11,7 @@ import { Observable } from 'rxjs/Observable';
@Component({ @Component({
selector: 'ecm-category', selector: 'ecm-category',
templateUrl: './ecm-category.component.html', templateUrl: './ecm-category.component.html',
styleUrls: ['./ecm-category.component.css'], styleUrls: ['./ecm-category.component.css']
providers: [EcmCategoryService]
}) })
export class EcmCategoryComponent implements OnInit { export class EcmCategoryComponent implements OnInit {
errorMessage: string; errorMessage: string;
...@@ -26,7 +24,7 @@ export class EcmCategoryComponent implements OnInit { ...@@ -26,7 +24,7 @@ export class EcmCategoryComponent implements OnInit {
this.position=window.pageYOffset; this.position=window.pageYOffset;
} }
constructor(public categoryService: EcmCategoryService, private scroll_service: ScrollService, private store: Store<AppState>, private categoryAction:CategoryActions, private subCategoryAction: SubCategoryActions) { } constructor(private scroll_service: ScrollService, private store: Store<AppState>, private categoryAction:CategoryActions, private subCategoryAction: SubCategoryActions) { }
ngOnInit() { ngOnInit() {
this.getCategories(); this.getCategories();
...@@ -44,24 +42,9 @@ export class EcmCategoryComponent implements OnInit { ...@@ -44,24 +42,9 @@ export class EcmCategoryComponent implements OnInit {
getCategories() { getCategories() {
this.categories = this.store.select('categories'); this.categories = this.store.select('categories');
/*
this.categoryService.getCategories().subscribe(
categories => {
this.categories = categories;
console.log('comp categories[' + JSON.stringify( categories ) + '] \n this.categories[' + JSON.stringify( this.categories ) + ']');
},
error => {
this.errorMessage = <any>error;
console.log('comp errorMessage[' + this.errorMessage + ']');
});
*/
} }
storeCategory(selectedCategory) { storeCategory(selectedCategory) {
console.log(selectedCategory);
//this.store.dispatch({type: 'CLEAR_CATEGORY', payload: selectedCategory});
//this.store.dispatch({type: 'CATEGORY', payload: selectedCategory});
this.store.dispatch( this.subCategoryAction.resetSubCategoryList() ); this.store.dispatch( this.subCategoryAction.resetSubCategoryList() );
this.store.dispatch( this.subCategoryAction.loadSubCategories( selectedCategory.catCode ) ); this.store.dispatch( this.subCategoryAction.loadSubCategories( selectedCategory.catCode ) );
this.store.dispatch(this.categoryAction.getCategorySuccess(selectedCategory)); this.store.dispatch(this.categoryAction.getCategorySuccess(selectedCategory));
......
import { Component, OnInit, ViewChild, ElementRef, Input, Output, EventEmitter } from '@angular/core'; import { Component, OnInit, ViewChild, ElementRef, Input, Output, EventEmitter } from '@angular/core';
import { FormBuilder, Validators,NgForm } from '@angular/forms'; import { FormBuilder, Validators,NgForm } from '@angular/forms';
import { EcmCartService } from '../ecm-cart/ecm-cart.service';
import { ItemDetail } from '../../ecm-model/product-detail-model'; import { ItemDetail } from '../../ecm-model/product-detail-model';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
...@@ -25,7 +24,7 @@ export class EcmCheckoutComponent implements OnInit { ...@@ -25,7 +24,7 @@ export class EcmCheckoutComponent implements OnInit {
years; years;
cartItems: Observable<ItemDetail[]>; cartItems: Observable<ItemDetail[]>;
constructor(private formBuilder: FormBuilder, public cartService: EcmCartService, private store: Store<AppState>) { constructor(private formBuilder: FormBuilder, private store: Store<AppState>) {
this.countries = [ this.countries = [
{ viewValue: 'India' }, { viewValue: 'India' },
{ viewValue: 'UAE' }, { viewValue: 'UAE' },
......
...@@ -42,16 +42,6 @@ export class EcmPanelComponent implements OnInit { ...@@ -42,16 +42,6 @@ export class EcmPanelComponent implements OnInit {
{ {
} }
// this.dialogRef = this.dialog.open(ECMDialog,{
// data: {
// option: sideOption
// }
// });
// this.updatePosition({ top:'0px', left: '0px' });
//
// this.dialogRef.afterClosed().subscribe(result => {
//
// });
} }
close(){ close(){
...@@ -89,18 +79,34 @@ export class EcmPanelComponent implements OnInit { ...@@ -89,18 +79,34 @@ export class EcmPanelComponent implements OnInit {
this.rightSlidePanel.nativeElement.style.borderRadius = "0px"; this.rightSlidePanel.nativeElement.style.borderRadius = "0px";
else else
this.rightSlidePanel.nativeElement.style.borderRadius = "5px"; this.rightSlidePanel.nativeElement.style.borderRadius = "5px";
if(this.panelData.option == 'CART_OPT')
this.rightSlidePanel.nativeElement.style.maxHeight = "390px";
else
this.rightSlidePanel.nativeElement.style.maxHeight = "";
var el = document.querySelectorAll(".square-button");
if(this.panelData.option == 'MENU_OPT')
el[0].classList.add('onSelect');
if(this.panelData.option == 'CART_OPT')
el[1].classList.add('onSelect');
if(this.panelData.option == 'USER_OPT')
el[2].classList.add('onSelect');
disableScroll();
} }
private hideSidePanel() { private hideSidePanel() {
this.rightSlidePanel.nativeElement.style.display = "none"; this.rightSlidePanel.nativeElement.style.display = "none";
var el = document.querySelectorAll(".square-button"); var el = document.querySelectorAll(".square-button");
console.log('Query-Selector',el);
if(this.panelData.option == 'MENU_OPT') if(this.panelData.option == 'MENU_OPT')
el[0].classList.remove('onSelect'); el[0].classList.remove('onSelect');
if(this.panelData.option == 'CART_OPT') if(this.panelData.option == 'CART_OPT')
el[1].classList.remove('onSelect'); el[1].classList.remove('onSelect');
if(this.panelData.option == 'USER_OPT') if(this.panelData.option == 'USER_OPT')
el[2].classList.remove('onSelect'); el[2].classList.remove('onSelect');
enableScroll();
} }
private showOverlayPanel() { private showOverlayPanel() {
......
...@@ -12,15 +12,11 @@ import { Item } from '../../ecm-model/product-model'; ...@@ -12,15 +12,11 @@ import { Item } from '../../ecm-model/product-model';
import { ItemDetail } from '../../ecm-model/product-detail-model'; import { ItemDetail } from '../../ecm-model/product-detail-model';
import { ScrollService } from '../../scroll.service'; import { ScrollService } from '../../scroll.service';
import { EcmProductService } from './ecm-product.service';
import { EcmProductDetailService } from '../../ecm-product-details/ecm-product-detail.service';
@Component({ @Component({
selector: 'ecm-product', selector: 'ecm-product',
templateUrl: './ecm-product.component.html', templateUrl: './ecm-product.component.html',
styleUrls: ['./ecm-product.component.css'], styleUrls: ['./ecm-product.component.css']
providers: [EcmProductService, EcmProductDetailService]
}) })
export class EcmProductComponent implements OnInit { export class EcmProductComponent implements OnInit {
...@@ -46,7 +42,7 @@ export class EcmProductComponent implements OnInit { ...@@ -46,7 +42,7 @@ export class EcmProductComponent implements OnInit {
attribCode; attribCode;
constructor(private route: ActivatedRoute, private router:Router,public subcategoryService: EcmProductService,public productDetailService: EcmProductDetailService, private scroll_service: ScrollService, private store: Store<AppState>, private itemAction: ItemActions, private cartAction: CartActions) { } constructor(private route: ActivatedRoute, private router:Router, private scroll_service: ScrollService, private store: Store<AppState>, private itemAction: ItemActions, private cartAction: CartActions) { }
ngOnInit() { ngOnInit() {
window.scrollTo(0,0); window.scrollTo(0,0);
this.route.params.subscribe( params => { this.route.params.subscribe( params => {
...@@ -64,25 +60,10 @@ export class EcmProductComponent implements OnInit { ...@@ -64,25 +60,10 @@ export class EcmProductComponent implements OnInit {
} }
getItems( scatCode: string ) { getItems( scatCode: string ) {
this.items = this.store.select('items'); this.items = this.store.select('items');
/*
this.subcategoryService.getItems( scatCode ).subscribe(
items => {
this.items = items;
this.Items = this.items.length;
console.log( 'comp scatCode[' + scatCode + '] \n this.items[' + JSON.stringify( this.items ) + ']' );
},
);
*/
} }
storeItem(selectedItem){ storeItem(selectedItem){
console.log(selectedItem);
//this.store.dispatch({type: 'CLEAR_SUB_CATEGORY', payload: selectedSubCategory});
//this.store.dispatch({type: 'SUB_CATEGORY', payload: selectedSubCategory});
this.store.dispatch( this.itemAction.getItemSuccess(selectedItem) ); this.store.dispatch( this.itemAction.getItemSuccess(selectedItem) );
} }
...@@ -106,15 +87,6 @@ export class EcmProductComponent implements OnInit { ...@@ -106,15 +87,6 @@ export class EcmProductComponent implements OnInit {
cartData.itemQuantity = 1; cartData.itemQuantity = 1;
this.store.dispatch(this.cartAction.addToCartSuccess(item)); this.store.dispatch(this.cartAction.addToCartSuccess(item));
this.productDetailService.addToCart(cartData);
//Check Store data
this.store.select('cartItems').forEach(
value => {
console.log('Cart Items----');
console.log(value);
}
);
} }
showHide(){ showHide(){
......
...@@ -4,7 +4,6 @@ import { Store } from '@ngrx/store'; ...@@ -4,7 +4,6 @@ import { Store } from '@ngrx/store';
import { AppState } from '../../ecm-store/reducers'; import { AppState } from '../../ecm-store/reducers';
import { SubCategoryActions, ItemActions } from '../../ecm-store/actions'; import { SubCategoryActions, ItemActions } from '../../ecm-store/actions';
import { EcmSubCategoryService } from './ecm-sub-category.service';
import { ScrollService } from '../../scroll.service'; import { ScrollService } from '../../scroll.service';
import { Category } from '../../ecm-model/category-model'; import { Category } from '../../ecm-model/category-model';
import { SubCategory } from '../../ecm-model/subcategory-model'; import { SubCategory } from '../../ecm-model/subcategory-model';
...@@ -15,8 +14,7 @@ import { Observable } from 'rxjs/Observable'; ...@@ -15,8 +14,7 @@ import { Observable } from 'rxjs/Observable';
@Component( { @Component( {
selector: 'ecm-sub-category', selector: 'ecm-sub-category',
templateUrl: './ecm-sub-category.component.html', templateUrl: './ecm-sub-category.component.html',
styleUrls: ['./ecm-sub-category.component.css'], styleUrls: ['./ecm-sub-category.component.css']
providers: [EcmSubCategoryService]
}) })
export class EcmSubCategoryComponent implements OnInit { export class EcmSubCategoryComponent implements OnInit {
...@@ -34,7 +32,7 @@ export class EcmSubCategoryComponent implements OnInit { ...@@ -34,7 +32,7 @@ export class EcmSubCategoryComponent implements OnInit {
private category: Category; private category: Category;
private subcategory: SubCategory; private subcategory: SubCategory;
constructor( private route: ActivatedRoute, private router: Router, public subcategoryService: EcmSubCategoryService, private scroll_service: ScrollService, private store: Store<AppState>, private subCategoryAction: SubCategoryActions, private itemAction:ItemActions ) { } constructor( private route: ActivatedRoute, private router: Router, private scroll_service: ScrollService, private store: Store<AppState>, private subCategoryAction: SubCategoryActions, private itemAction:ItemActions ) { }
ngOnInit() { ngOnInit() {
window.scrollTo( 0, 0 ); window.scrollTo( 0, 0 );
this.route.params.subscribe( params => { this.route.params.subscribe( params => {
...@@ -50,39 +48,10 @@ export class EcmSubCategoryComponent implements OnInit { ...@@ -50,39 +48,10 @@ export class EcmSubCategoryComponent implements OnInit {
} }
getSubCategories( catCode: string ) { getSubCategories( catCode: string ) {
this.subcategories = this.store.select( 'subcategories' ); this.subcategories = this.store.select( 'subcategories' );
/*
this.subcategoryService.getSubCategories( catCode ).subscribe(
subcategories => {
this.subcategories = subcategories;
console.log( 'comp catCode[' + catCode + '] \n this.subcategories[' + JSON.stringify( this.subcategories ) + ']' );
let subCatLen = subcategories.length ? subcategories.length : 0;
console.log( 'SubCatLen:: ' + subCatLen );
if( subCatLen == 0 )
{
this.isCatItems = 'true';
this.subcategories = null;
console.log( 'Calling items of Category ::: ' + catCode );
this.store.dispatch({type: 'CLEAR_SUB_CATEGORY', payload: null}); //Just Remove Previous Data
this.getItems(catCode);
}
else
{
this.subcategories = subcategories;
this.items = null;
console.log( 'comp catCode[' + catCode + '] \n this.subcategories[' + JSON.stringify( this.subcategories ) + ']' );
}
},
);
*/
} }
storeSubCategory( selectedSubCategory ) { storeSubCategory( selectedSubCategory ) {
//this.store.dispatch({type: 'CLEAR_SUB_CATEGORY', payload: selectedSubCategory});
//this.store.dispatch({type: 'SUB_CATEGORY', payload: selectedSubCategory});
this.store.dispatch( this.itemAction.resetItemList() ); this.store.dispatch( this.itemAction.resetItemList() );
this.store.dispatch( this.itemAction.loadItems( selectedSubCategory.scatCode ) ); this.store.dispatch( this.itemAction.loadItems( selectedSubCategory.scatCode ) );
this.store.dispatch( this.subCategoryAction.getSubCategorySuccess( selectedSubCategory ) ); this.store.dispatch( this.subCategoryAction.getSubCategorySuccess( selectedSubCategory ) );
......
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
<div class="total-description"> <div class="total-description">
<div class="items-desc"> <div class="items-desc">
<span class="item-title" (click)="viewItem(item.itemCode)">Handmade <span class="item-title" (click)="viewItem(item.itemCode)">Handmade
Handicarft</span> <span class="item-shDescr">{{item.shDescr}}</span> Handicarft</span> <span class="item-shDescr">{{item.itemHeader.itemShDescr}}</span>
<span class="item-shDescr">{{item.descr}}</span> <span class="item-shDescr">{{item.descr}}</span>
<span class="item-seller">Sold by</span> <span class="item-sellerInfo">Handmade <span class="item-seller">Sold by</span> <span class="item-sellerInfo">Handmade
Handicarfts</span> Handicarfts</span>
</div> </div>
<div class="items-cost-rate"> <div class="items-cost-rate">
<span>Rs. {{item.costRate}}</span> <span>Rs. {{item.itemHeader.itemDiscountedRate}}</span>
</div> </div>
</div> </div>
......
...@@ -3,7 +3,6 @@ import { EcmWishListService } from './ecm-wish-list.service'; ...@@ -3,7 +3,6 @@ import { EcmWishListService } from './ecm-wish-list.service';
import { MdSnackBar } from '@angular/material'; import { MdSnackBar } from '@angular/material';
import { Item } from '../../ecm-model/product-model'; import { Item } from '../../ecm-model/product-model';
import { ItemDetail } from '../../ecm-model/product-detail-model'; import { ItemDetail } from '../../ecm-model/product-detail-model';
import { EcmProductDetailService } from '../../ecm-product-details/ecm-product-detail.service';
import { Http} from '@angular/http' import { Http} from '@angular/http'
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
...@@ -16,16 +15,13 @@ import { Observable } from 'rxjs/Observable'; ...@@ -16,16 +15,13 @@ import { Observable } from 'rxjs/Observable';
@Component({ @Component({
selector: 'app-ecm-wish-list', selector: 'app-ecm-wish-list',
templateUrl: './ecm-wish-list.component.html', templateUrl: './ecm-wish-list.component.html',
styleUrls: ['./ecm-wish-list.component.css'], styleUrls: ['./ecm-wish-list.component.css']
providers: [EcmProductDetailService]
}) })
export class EcmWishListComponent implements OnInit { export class EcmWishListComponent implements OnInit {
// wishListDetail: Item;
wishListItems: Observable<ItemDetail[]>; wishListItems: Observable<ItemDetail[]>;
errorMessage: string; errorMessage: string;
cartCount = 0;
constructor( public subcategoryService: EcmProductDetailService, private route: ActivatedRoute, private router: Router, public snackBar: MdSnackBar, public wishListService: EcmWishListService, private http: Http, private store: Store<AppState>, private wishListAction: WishListActions) { } constructor( private route: ActivatedRoute, private router: Router, public snackBar: MdSnackBar, public wishListService: EcmWishListService, private http: Http, private store: Store<AppState>, private wishListAction: WishListActions) { }
ngOnInit() { ngOnInit() {
this.getWishlistItems(); this.getWishlistItems();
...@@ -33,26 +29,10 @@ export class EcmWishListComponent implements OnInit { ...@@ -33,26 +29,10 @@ export class EcmWishListComponent implements OnInit {
getWishlistItems() { getWishlistItems() {
this.wishListItems = this.store.select( 'wishlistItems' ); this.wishListItems = this.store.select( 'wishlistItems' );
this.store.select( 'wishlist' ).forEach(
value => {
console.log( 'wishlist Items----' );
console.log( value );
}
);
} }
userActionUrl = '/ecm/service/feeds/wishlist';
deletewishlistItem( item ) { deletewishlistItem( item ) {
this.store.dispatch(this.wishListAction.deleteWishlistItemSuccess(item)); this.store.dispatch(this.wishListAction.deleteWishlistItemSuccess(item));
this.http.delete( this.userActionUrl + '/' + item.itemCode, {})
.subscribe( data => {
console.log( "deleted item in wishlist" );
}, error => {
console.log( error.json() );
});
this.getWishlistItems();
this.openSnackBar( 'Item Removed from your wishlist' ); this.openSnackBar( 'Item Removed from your wishlist' );
} }
...@@ -62,10 +42,6 @@ export class EcmWishListComponent implements OnInit { ...@@ -62,10 +42,6 @@ export class EcmWishListComponent implements OnInit {
}); });
} }
addToWishlist( data: Item ) {
this.subcategoryService.addToWishlist( data );
}
viewItem( itemCode ) { viewItem( itemCode ) {
this.router.navigate( ['/detail', itemCode] ); this.router.navigate( ['/detail', itemCode] );
} }
......
...@@ -33,7 +33,7 @@ export class EcmWishListService { ...@@ -33,7 +33,7 @@ export class EcmWishListService {
let options = new RequestOptions( { headers: headers }); let options = new RequestOptions( { headers: headers });
return this.http.get( this.wishListUrl, options ) return this.http.get( this.wishListUrl, options )
.map( this.extractData ) .map( (res) => this.extractData(res) )
.catch( this.handleError ); .catch( this.handleError );
} }
...@@ -54,9 +54,50 @@ export class EcmWishListService { ...@@ -54,9 +54,50 @@ export class EcmWishListService {
} }
private extractData( res: Response ) { private extractData( res: Response ) {
let body = res.json(); let respJson = res.json();
console.log( 'extractData[' + JSON.stringify( body ) + ']' ); console.log( 'extracData', respJson );
return body || {}; if ( respJson != null ) {
for ( let key of Object.keys( respJson ) ) {
console.log( "getItemDetail itemDetail ==> key: " + key )
let data = respJson[key];
try {
respJson[key] = JSON.parse( data );
console.log( "getItemDetail itemDetail try : " + respJson[key] );
}
catch ( e ) {
console.log( "getItemDetail itemDetail ==> key: ", data, typeof data === 'object' )
if ( typeof data === 'object' )
respJson[key] = this.formatObject( data );
else
respJson[key] = data;
console.log( "getItemDetail itemDetail catch : " + respJson[key] );
}
}
console.log( 'extractData[' + JSON.stringify( respJson ) + ']' );
}
return respJson || {};
}
formatObject( respJson: any ) {
console.log( 'formatObject', respJson );
if ( respJson != null ) {
for ( let key of Object.keys( respJson ) ) {
console.log( "formatObject itemDetail ==> key: " + key )
let data = respJson[key];
try {
respJson[key] = JSON.parse( data );
console.log( "formatObject itemDetail try : " + respJson[key] );
}
catch ( e ) {
respJson[key] = data;
console.log( "formatObject itemDetail catch : " + respJson[key] );
}
}
console.log( 'formatObject[' + JSON.stringify( respJson ) + ']' );
}
return respJson || {};
} }
private handleError( error: Response | any ) { private handleError( error: Response | any ) {
......
...@@ -21,15 +21,12 @@ export class RatingComponent implements OnInit { ...@@ -21,15 +21,12 @@ export class RatingComponent implements OnInit {
constructor() { } constructor() { }
ngOnInit() { ngOnInit() {
console.log('Rating: ' +this.rate);
if(this.ratingDetail) if(this.ratingDetail)
{ {
this.overallRatings.forEach(( rating, i ) => { this.overallRatings.forEach(( rating, i ) => {
this.totalRatings = this.totalRatings + rating; this.totalRatings = this.totalRatings + rating;
}); });
} }
} }
update(value) { update(value) {
......
...@@ -296,19 +296,25 @@ function preventDefaultForScrollKeys(e) { ...@@ -296,19 +296,25 @@ function preventDefaultForScrollKeys(e) {
} }
function disableScroll() { function disableScroll() {
/*
if (window.addEventListener) // older FF if (window.addEventListener) // older FF
window.addEventListener('DOMMouseScroll', preventDefault, false); window.addEventListener('DOMMouseScroll', preventDefault, false);
window.onwheel = preventDefault; // modern standard window.onwheel = preventDefault; // modern standard
window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE
window.ontouchmove = preventDefault; // mobile window.ontouchmove = preventDefault; // mobile
document.onkeydown = preventDefaultForScrollKeys; document.onkeydown = preventDefaultForScrollKeys;
*/
document.body.style.overflow = 'hidden';
} }
function enableScroll() { function enableScroll() {
/*
if (window.removeEventListener) if (window.removeEventListener)
window.removeEventListener('DOMMouseScroll', preventDefault, false); window.removeEventListener('DOMMouseScroll', preventDefault, false);
window.onmousewheel = document.onmousewheel = null; window.onmousewheel = document.onmousewheel = null;
window.onwheel = null; window.onwheel = null;
window.ontouchmove = null; window.ontouchmove = null;
document.onkeydown = null; document.onkeydown = null;
*/
document.body.style.overflow = 'visible';
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment