Commit 30768fec authored by prumde's avatar prumde

Updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174191 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 47d471d3
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import {Location, LocationStrategy, PathLocationStrategy} from '@angular/common'; import {Location, LocationStrategy, PathLocationStrategy} from '@angular/common';
import { EcmCartService } from './ecm-view/ecm-cart/ecm-cart.service';
import {AppState} from './ecm-store/reducers';
import {CartActions} from './ecm-store/actions';
import {CategoryActions} from './ecm-store/actions';
import { Store } from '@ngrx/store';
@Component({ @Component({
selector: 'ecm-root', selector: 'ecm-root',
templateUrl: './app.component.html', templateUrl: './app.component.html',
...@@ -11,7 +14,7 @@ import { EcmCartService } from './ecm-view/ecm-cart/ecm-cart.service'; ...@@ -11,7 +14,7 @@ import { EcmCartService } from './ecm-view/ecm-cart/ecm-cart.service';
export class AppComponent { export class AppComponent {
title = 'Proteus ECM'; title = 'Proteus ECM';
location: Location; location: Location;
constructor(location: Location, public cartService: EcmCartService) { constructor(location: Location, private store: Store<AppState>, private cartActions: CartActions, private categoryAction: CategoryActions) {
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();
...@@ -21,7 +24,8 @@ export class AppComponent { ...@@ -21,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.cartService.setCartItems(); this.store.dispatch(this.cartActions.loadCartItems());
this.store.dispatch(this.categoryAction.loadCategories());
} }
get(name){ get(name){
var retVal = 'undefined'; var retVal = 'undefined';
......
import { Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { EcmStoreModel } from '../ecm-store/ecm-store.model'; import {AppState} from '../ecm-store/reducers';
import { ItemDetail } from '../ecm-model/product-detail-model'; import { ItemDetail } from '../ecm-model/product-detail-model';
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';
...@@ -24,68 +24,38 @@ export class EcmBreadcrumbsComponent implements OnInit { ...@@ -24,68 +24,38 @@ export class EcmBreadcrumbsComponent implements OnInit {
@Input() pageName; @Input() pageName;
breadcrumbs: IBreadcrumb[] = []; breadcrumbs: IBreadcrumb[] = [];
category : Observable<Category>; category;
subcategory : Observable<SubCategory>; subcategory;
item : Observable<Item>; item : Observable<Item>;
constructor( private _location: Location, private store: Store<EcmStoreModel> ) { } constructor( private _location: Location, private store: Store<AppState> ) { }
ngOnInit() { ngOnInit() {
if ( this.pageName == 'SUB_CATEGORY' ) { if ( this.pageName == 'SUB_CATEGORY' ) {
let storeCategory; let storeCategory;
let category_shDescr; let category_shDescr;
this.store.select( 'CATEGORY' ).forEach( value => storeCategory = value ); this.store.select('category')
category_shDescr = storeCategory.shDescr .subscribe( category => this.category = category );
this.breadcrumbs = []; this.breadcrumbs = [];
this.breadcrumbs.push( { this.breadcrumbs.push( {
label: 'Home', label: 'Home',
url: '/home' url: '/home'
}); });
this.breadcrumbs.push( { this.breadcrumbs.push( {
label: category_shDescr, label: this.category.shDescr,
url: 'javascript:void(0)' url: 'javascript:void(0)'
}); });
/*
this.category = this.store.select('CATEGORY');
this.category.subscribe( storeCategory => {
let category_shDescr = storeCategory!.shDescr;
console.log('>>>category_shDescr ::' + category_shDescr);
this.breadcrumbs = [];
this.breadcrumbs.push( {
label: 'Home',
url: '/home'
});
this.breadcrumbs.push( {
label: category_shDescr,
url: 'javascript:void(0)'
});
});
*/
} }
if ( this.pageName == 'ITEMS' ) { if ( this.pageName == 'ITEMS' ) {
let storeCategory;
let storeSubCategory;
let catCode;
let catShDescr;
let subcatShDescr;
this.store.select( 'SUBCATEGORY' ).forEach( value => storeSubCategory = value );
if ( storeSubCategory ) {
catCode = storeSubCategory.catCode;
subcatShDescr = storeSubCategory.shDescr;
}
console.log( "Breadcrumbs==>" );
console.log( catCode );
this.store.select( 'CATEGORY' ).forEach( value => storeCategory = value ); this.store.select('category')
if ( storeCategory ) { .subscribe( category => this.category = category );
catShDescr = storeCategory.shDescr;
} this.store.select('subcategory')
.subscribe( subcategory => this.subcategory = subcategory );
this.breadcrumbs = []; this.breadcrumbs = [];
this.breadcrumbs.push( { this.breadcrumbs.push( {
...@@ -93,45 +63,13 @@ export class EcmBreadcrumbsComponent implements OnInit { ...@@ -93,45 +63,13 @@ export class EcmBreadcrumbsComponent implements OnInit {
url: '/home' url: '/home'
}); });
this.breadcrumbs.push( { this.breadcrumbs.push( {
label: catShDescr, label: this.category.shDescr,
url: '/categories/' + catCode url: '/categories/' + this.subcategory.catCode
}); });
this.breadcrumbs.push( { this.breadcrumbs.push( {
label: subcatShDescr, label: this.subcategory.shDescr,
url: 'javascript:void(0)' url: 'javascript:void(0)'
}); });
/*
this.category = this.store.select('CATEGORY');
this.category.subscribe( storeCategory => {
let catCode = storeCategory!.catCode;
let category_shDescr = storeCategory!.shDescr;
console.log('>>>catCode ::' + catCode);
console.log('>>>category_shDescr ::' + category_shDescr);
this.breadcrumbs = [];
this.breadcrumbs.push( {
label: 'Home',
url: '/home'
});
this.breadcrumbs.push( {
label: category_shDescr,
url: '/categories/' + catCode
});
this.subcategory = this.store.select('SUBCATEGORY');
this.subcategory.subscribe( storeSubCategory => {
let subcatShDescr = storeSubCategory!.shDescr;
this.breadcrumbs.push( {
label: subcatShDescr,
url: 'javascript:void(0)'
});
});
});
*/
} }
if ( this.pageName == 'SEARCH' ) { if ( this.pageName == 'SEARCH' ) {
...@@ -208,8 +146,6 @@ export class EcmBreadcrumbsComponent implements OnInit { ...@@ -208,8 +146,6 @@ export class EcmBreadcrumbsComponent implements OnInit {
}); });
} }
} }
backClicked() { backClicked() {
......
...@@ -147,6 +147,7 @@ p { ...@@ -147,6 +147,7 @@ p {
#ecm-item { #ecm-item {
cursor: pointer; cursor: pointer;
height: 300px;
} }
#ecm-item-info { #ecm-item-info {
......
...@@ -179,12 +179,21 @@ ecm-search{ ...@@ -179,12 +179,21 @@ ecm-search{
/*Fixed Header Menu*/ /*Fixed Header Menu*/
.fixed-header-nav{ .fixed-header-nav{
top: 13px; /* top: 13px;
left: 1.5rem;
position: fixed;
z-index: 4;
*/
/* height: 45px; */
/* top: 0;
left: 0;
position: fixed;
z-index: 4;*/
height: 100%;
top: 13px;
left: 1.5rem; left: 1.5rem;
position: fixed; position: fixed;
z-index: 4; z-index: 4;
/* height: 100%; */
height: 45px;
} }
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
.ecm-card > ecm-image > .ecm-image > img .ecm-card > ecm-image > .ecm-image > img
{ {
height: 330px; /* height: 330px; */
height: 230px;
} }
.ecm-image-icon { .ecm-image-icon {
......
...@@ -15,8 +15,8 @@ a { ...@@ -15,8 +15,8 @@ a {
.container { .container {
position: relative; position: relative;
margin: 0; margin: 0;
width: 300px; /*width: 300px;*/
/* height: 534px; */ height: 534px;
background-color: #533557; background-color: #533557;
background-color: transparent; background-color: transparent;
overflow: hidden; overflow: hidden;
...@@ -34,7 +34,6 @@ a { ...@@ -34,7 +34,6 @@ a {
} }
#toggle:checked ~ .container { #toggle:checked ~ .container {
background-color: blue; background-color: blue;
width: 300px !important;
} }
#toggle:checked ~ .toggle-container .button-toggle { #toggle:checked ~ .toggle-container .button-toggle {
box-shadow: 0 0 0 700px rgba(0, 0, 0, 0.1), inset 0 0 0 20px box-shadow: 0 0 0 700px rgba(0, 0, 0, 0.1), inset 0 0 0 20px
...@@ -102,11 +101,12 @@ a { ...@@ -102,11 +101,12 @@ a {
/* Toggle button */ /* Toggle button */
.button-toggle { .button-toggle {
top: 0; top: 0;
position: absolute; position: absolute;
display: inline-block; /* display: inline-block; */
width: 20px; width: 20px;
height: 20px; height: 20px;
margin: 10px 15px 15px 5px; margin: 10px 15px 15px 5px;
/* margin: 10px 15px 15px 25px; */
background-color: transparent; background-color: transparent;
border: none; border: none;
cursor: pointer; cursor: pointer;
......
...@@ -4,8 +4,8 @@ import { MdSnackBar } from '@angular/material'; ...@@ -4,8 +4,8 @@ import { MdSnackBar } from '@angular/material';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { EcmStoreModel } from '../ecm-store/ecm-store.model'; import {AppState} from '../ecm-store/reducers';
import { UPDATE_QUANTITY, ADD_TO_CART, REMOVE, ADD_TO_WISHLIST,REMOVE_WISLIST } from '../ecm-store/ecm-store'; import {CartActions} from '../ecm-store/actions';
import { EcmProductDetailService } from './ecm-product-detail.service'; import { EcmProductDetailService } from './ecm-product-detail.service';
import { ScrollService } from '../scroll.service'; import { ScrollService } from '../scroll.service';
...@@ -53,7 +53,7 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -53,7 +53,7 @@ export class EcmProductDetailsComponent implements OnInit {
attribVal; attribVal;
attribCode; attribCode;
constructor(private route: ActivatedRoute, private router:Router, public productDetailService: EcmProductDetailService, public snackBar: MdSnackBar, private store: Store<EcmStoreModel>, private productreviewService: EcmProductReviewService, public dialog: MdDialog) { } constructor(private route: ActivatedRoute, private router:Router, public productDetailService: EcmProductDetailService, public snackBar: MdSnackBar, private store: Store<AppState>, private productreviewService: EcmProductReviewService, public dialog: MdDialog, private cartActions: CartActions) { }
ngOnInit() { ngOnInit() {
this.route.params.subscribe( params => { this.route.params.subscribe( params => {
...@@ -114,7 +114,7 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -114,7 +114,7 @@ export class EcmProductDetailsComponent implements OnInit {
this.router.navigate(['/cart']); this.router.navigate(['/cart']);
} }
else { //ADD TO CART else { //ADD TO CART
this.addToCart(data.itemCode); this.addToCart(data.item);
this.showSnackbar('Item Added to your Cart'); this.showSnackbar('Item Added to your Cart');
} }
} }
...@@ -174,13 +174,13 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -174,13 +174,13 @@ export class EcmProductDetailsComponent implements OnInit {
} }
} }
addToCart(itemCode) { addToCart(item) {
this.getAttributeType(itemCode); //this.getAttributeType(itemCode);
let cartData = new Item; //let cartData = new Item;
cartData.itemCode = itemCode; //cartData.itemCode = itemCode;
cartData.itemQuantity = 1; //cartData.itemQuantity = 1;
cartData.costRate = this.itemDetail.itemHeader.itemCostRate; /*cartData.costRate = this.itemDetail.itemHeader.itemCostRate;
cartData.descr = this.itemDetail.itemHeader.itemDescr; cartData.descr = this.itemDetail.itemHeader.itemDescr;
cartData.shDescr = this.itemDetail.itemHeader.itemShDescr; cartData.shDescr = this.itemDetail.itemHeader.itemShDescr;
if(this.attribCode == "COLOR"){ if(this.attribCode == "COLOR"){
...@@ -189,13 +189,14 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -189,13 +189,14 @@ export class EcmProductDetailsComponent implements OnInit {
else if(this.attribCode == "SIZE"){ else if(this.attribCode == "SIZE"){
cartData.phyAttribId1 = this.attribVal; cartData.phyAttribId1 = this.attribVal;
} }
*/
this.store.dispatch(this.cartActions.addToCartSuccess(item));
this.store.dispatch({ type: ADD_TO_CART, payload: cartData }); //this.store.dispatch({ type: ADD_TO_CART, payload: cartData });
this.productDetailService.addToCart(cartData); //this.productDetailService.addToCart(cartData);
//Check Store data //Check Store data
this.store.select('cart').forEach( this.store.select('cartItems').forEach(
value => { value => {
console.log('Cart Items----'); console.log('Cart Items----');
console.log(value); console.log(value);
...@@ -207,18 +208,18 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -207,18 +208,18 @@ export class EcmProductDetailsComponent implements OnInit {
addToWishlist( itemCode ) { addToWishlist( itemCode ) {
let cartData = new Item; let cartData = new Item;
cartData.itemCode = itemCode; cartData.itemCode = itemCode;
cartData.costRate = this.itemDetail.itemHeader.itemCostRate; cartData.costRate = this.itemDetail.itemHeader.itemDiscountedRate;
cartData.descr = this.itemDetail.itemHeader.itemDescr; cartData.descr = this.itemDetail.itemHeader.itemDescr;
cartData.shDescr = this.itemDetail.itemHeader.itemShDescr; cartData.shDescr = this.itemDetail.itemHeader.itemShDescr;
this.store.dispatch({ type: ADD_TO_WISHLIST, payload: cartData }); //this.store.dispatch({ type: ADD_TO_WISHLIST, payload: cartData });
this.productDetailService.addToWishlist( itemCode ); this.productDetailService.addToWishlist( itemCode );
} }
removeFromWishlist( itemCode ) { removeFromWishlist( itemCode ) {
let cartData = new Item; let cartData = new Item;
cartData.itemCode = itemCode; cartData.itemCode = itemCode;
this.store.dispatch({ type: REMOVE_WISLIST, payload: cartData }); //this.store.dispatch({ type: REMOVE_WISLIST, payload: cartData });
this.productDetailService.removeFromWishlist( itemCode ); this.productDetailService.removeFromWishlist( itemCode );
} }
......
...@@ -308,6 +308,8 @@ md-card { ...@@ -308,6 +308,8 @@ md-card {
} }
.submit-review-btn, .cancel-review-btn { .submit-review-btn, .cancel-review-btn {
background: #fff;
color: mediumvioletred;
max-width: 190px; max-width: 190px;
height: 50px; height: 50px;
font-size: 15px; font-size: 15px;
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<div class="item-descount-rate-section"> <div class="item-descount-rate-section">
<span class="item-descount-rate"> <span class="item-descount-rate">
Rs. {{itemDetail.itemHeader.itemDiscountedRate}} Rs. {{itemDetail.itemHeader.itemDiscountedRate}}
</span> </span>
</div> </div>
<div> <div>
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
<div [ngClass]="{'buy-cart-button': ( clientWidth > 640 ) , 'mobi-buy-cart-button': ( clientWidth < 639 ) }" > <div [ngClass]="{'buy-cart-button': ( clientWidth > 640 ) , 'mobi-buy-cart-button': ( clientWidth < 639 ) }" >
<button md-button class="button medium-btn Add_to_cart" <button md-button class="button medium-btn Add_to_cart"
(click)="doActivity.emit({activity:'ADD_CART', data: {'itemCode' : itemDetail.itemCode, 'isAddToCart' : isAddToCart}}); isAddToCart= true;">{{ isAddToCart ? 'Go to Cart' : 'Add to Cart' }}</button> (click)="doActivity.emit({activity:'ADD_CART', data: {'item' : itemDetail, 'isAddToCart' : isAddToCart}}); isAddToCart= true;">{{ isAddToCart ? 'Go to Cart' : 'Add to Cart' }}</button>
<button md-button class="button medium-btn Buy_now" (click)="doActivity.emit({activity:'BUY_NOW', data: {'itemCode' : itemDetail.itemCode, 'isAddToCart' : isAddToCart} });">Buy <button md-button class="button medium-btn Buy_now" (click)="doActivity.emit({activity:'BUY_NOW', data: {'itemCode' : itemDetail.itemCode, 'isAddToCart' : isAddToCart} });">Buy
Now</button> Now</button>
</div> </div>
......
...@@ -5,12 +5,12 @@ import { Router, ActivatedRoute } from '@angular/router'; ...@@ -5,12 +5,12 @@ import { Router, ActivatedRoute } from '@angular/router';
import { Http } from '@angular/http'; import { Http } from '@angular/http';
import { EcmCartComponent } from '../../ecm-view/ecm-cart/ecm-cart.component'; import { EcmCartComponent } from '../../ecm-view/ecm-cart/ecm-cart.component';
import { Item } from '../../ecm-model/product-model'; import { Item } from '../../ecm-model/product-model';
import {MdDialog, MdDialogRef, MdDialogConfig, MD_DIALOG_DATA} from '@angular/material'; import { MdDialog, MdDialogRef, MdDialogConfig, MD_DIALOG_DATA } from '@angular/material';
import { RESIZE_EVENT } from '../../ecm-store/ecm-resize'; import { RESIZE_EVENT } from '../../ecm-store/ecm-resize';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { EcmStoreModel } from '../../ecm-store/ecm-store.model'; import { AppState } from '../../ecm-store/reducers';
import { EcmRecentViewComponent } from '../../ecm-view/ecm-recent-view/ecm-recent-view.component'; import { EcmRecentViewComponent } from '../../ecm-view/ecm-recent-view/ecm-recent-view.component';
import { ECMWriteReviewDialog } from '../ecm-product-review.component'; import { ECMWriteReviewDialog } from '../ecm-product-review.component';
...@@ -41,7 +41,7 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface { ...@@ -41,7 +41,7 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface {
Overview = "Champions Yacht Club specializes in offering luxury boating and yachting experiences in Goa with a large fleet of Catamarans, Boats, Cruisers & Yachts in Goa. We do Rocking birthday parties, anniversary bashes, island excursions & barbeques, fishing expeditions, snorkeling, corporate parties and more. We ensure you have a luxury experience in yachts that will leave a memory of a lifetime"; Overview = "Champions Yacht Club specializes in offering luxury boating and yachting experiences in Goa with a large fleet of Catamarans, Boats, Cruisers & Yachts in Goa. We do Rocking birthday parties, anniversary bashes, island excursions & barbeques, fishing expeditions, snorkeling, corporate parties and more. We ensure you have a luxury experience in yachts that will leave a memory of a lifetime";
constructor( private route: ActivatedRoute, private router: Router, private http: Http, public dialog: MdDialog, private store: Store<EcmStoreModel> ) { } constructor( private route: ActivatedRoute, private router: Router, private http: Http, public dialog: MdDialog, private store: Store<AppState> ) { }
ngOnInit() { ngOnInit() {
...@@ -56,7 +56,7 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface { ...@@ -56,7 +56,7 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface {
this.clientWidth = data; this.clientWidth = data;
}); });
this.cartItems = this.store.select('cart'); this.cartItems = this.store.select('cartItems');
this.cartItems.subscribe( cartItems => { this.cartItems.subscribe( cartItems => {
if(cartItems.find(x => x.itemCode === this.itemDetail.itemCode)) if(cartItems.find(x => x.itemCode === this.itemDetail.itemCode))
this.isAddToCart = true; this.isAddToCart = true;
......
...@@ -3,13 +3,13 @@ import { Http, Headers,RequestOptions } from '@angular/http'; ...@@ -3,13 +3,13 @@ import { Http, Headers,RequestOptions } from '@angular/http';
import { EcmLocation } from './ecm-location'; import { EcmLocation } from './ecm-location';
import { EventEmitter } from '@angular/core'; import { EventEmitter } from '@angular/core';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState } from '../ecm-store/reducers';
import { EcmStoreModel } from '../ecm-store/ecm-store.model'; import { LocationActions } from '../ecm-store/actions/location';
@Injectable() @Injectable()
export class EcmLocationService { export class EcmLocationService {
constructor( public http: Http, private store: Store<EcmStoreModel>) {} constructor( public http: Http, private store: Store<AppState>, private locationAction:LocationActions) {}
find(nameKey, myArray){ find(nameKey, myArray){
for (var i=0; i < myArray.length; i++) { for (var i=0; i < myArray.length; i++) {
...@@ -89,8 +89,8 @@ export class EcmLocationService { ...@@ -89,8 +89,8 @@ export class EcmLocationService {
ecmLocation.address = data.results[0].formatted_address; ecmLocation.address = data.results[0].formatted_address;
} }
this.store.dispatch({type: 'CLEAR_LOCATION'}); //this.store.dispatch(this.locationAction.resetBlankLocation());
this.store.dispatch({type: 'ECMLOCATION', payload: ecmLocation}); this.store.dispatch(this.locationAction.getLocationSuccess(ecmLocation));
//EmitterService.get("selectedLocation").emit(ecmLocation); //EmitterService.get("selectedLocation").emit(ecmLocation);
//localStorage.setItem('mycity',this.city); //localStorage.setItem('mycity',this.city);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</md-autocomplete> </md-autocomplete>
<span class="search-which-border"> <span class="search-which-border">
<div class="locate-me">{{ userLocation ? userLocation.city : 'Locate Me' }}</div> <div class="locate-me">{{ userLocation.city ? userLocation.city : 'Locate Me' }}</div>
<div class="locate-handle" (click)="loacteMe();" ></div> <div class="locate-handle" (click)="loacteMe();" ></div>
<img class="img-locate" title="Locate Me" src="locate_20_20.png"/> <img class="img-locate" title="Locate Me" src="locate_20_20.png"/>
</span> </span>
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<div md-ripple class="location" (click)="loacteMe();"> <div md-ripple class="location" (click)="loacteMe();">
<img class="location-img-32" src="location_32_32.svg"/> <img class="location-img-32" src="location_32_32.svg"/>
<span class="location-text">{{ userLocation ? userLocation.address : 'Locate Me' }}</span> <span class="location-text">{{ userLocation.address ? userLocation.address : 'Locate Me' }}</span>
<i class="material-icons location-arrow">keyboard_arrow_down</i> <i class="material-icons location-arrow">keyboard_arrow_down</i>
</div> </div>
<input class="sb-search-submit" type="submit" (click)="search(myInput.value)"> <input class="sb-search-submit" type="submit" (click)="search(myInput.value)">
......
...@@ -6,10 +6,9 @@ import { SearchService } from './ecm-search-result/search.service'; ...@@ -6,10 +6,9 @@ import { SearchService } from './ecm-search-result/search.service';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
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 { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { EcmStoreModel } from '../ecm-store/ecm-store.model';
@Component({ @Component({
selector: 'ecm-search', selector: 'ecm-search',
templateUrl: './ecm-search.component.html', templateUrl: './ecm-search.component.html',
...@@ -50,7 +49,7 @@ export class ECMSearchComponent implements OnInit { ...@@ -50,7 +49,7 @@ export class ECMSearchComponent implements OnInit {
search_key; search_key;
selectedPlace = 'Mumbai'; selectedPlace = 'Mumbai';
constructor(private locationService: EcmLocationService, private search_service: SearchService, private router: Router, private store: Store<EcmStoreModel>) constructor(private locationService: EcmLocationService, private search_service: SearchService, private router: Router, private store: Store<AppState>)
{ {
this.stateCtrl.valueChanges.debounceTime(100).subscribe((val: any) => { this.stateCtrl.valueChanges.debounceTime(100).subscribe((val: any) => {
console.log("Selected Value[" +val+ "]"); console.log("Selected Value[" +val+ "]");
......
...@@ -4,8 +4,8 @@ import { Observable } from 'rxjs/Observable'; ...@@ -4,8 +4,8 @@ import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/catch'; import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { EcmStoreModel } from '../ecm-store/ecm-store.model'; import { AppState } from '../ecm-store/reducers';
import { RESET,RESET_WISHLIST } from '../ecm-store/ecm-store'; import { CartActions } 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 { EcmCartService } from '../ecm-view/ecm-cart/ecm-cart.service';
...@@ -31,7 +31,7 @@ export class EcmSigninComponent implements OnInit { ...@@ -31,7 +31,7 @@ export class EcmSigninComponent implements OnInit {
loginErrorMsg: string; loginErrorMsg: string;
@Output() closePanel = new EventEmitter(); @Output() closePanel = new EventEmitter();
constructor(public signinService: ECMSigninService, private store: Store<EcmStoreModel>, public cartService: EcmCartService, public wishListService: EcmWishListService) { } constructor(public signinService: ECMSigninService, private store: Store<AppState>, private cartActions:CartActions, public cartService: EcmCartService, public wishListService: EcmWishListService) { }
ngOnInit() { ngOnInit() {
} }
...@@ -77,16 +77,13 @@ export class EcmSigninComponent implements OnInit { ...@@ -77,16 +77,13 @@ export class EcmSigninComponent implements OnInit {
this.userData = JSON.parse( result.Response.results ); this.userData = JSON.parse( result.Response.results );
this.userData.jti = this._username; this.userData.jti = this._username;
this.store.dispatch({ type: RESET });
this.store.dispatch({ type: RESET_WISHLIST });
//Fetch User Data and Store in cache //Fetch User Data and Store in cache
this.signinService.fetchUserData().subscribe( this.signinService.fetchUserData().subscribe(
response => { response => {
console.log('response[' + response + ']'); console.log('response[' + response + ']');
if(response){ if(response){
this.cartService.setCartItems(); this.store.dispatch(this.cartActions.loadCartItems());
this.wishListService.setWishlistItems(); //this.wishListService.setWishlistItems();
} }
}); });
......
...@@ -3,8 +3,8 @@ import { ECMSigninService } from '../ecm-signin/ecm-signin.service'; ...@@ -3,8 +3,8 @@ import { ECMSigninService } from '../ecm-signin/ecm-signin.service';
import { EcmCartService } from '../ecm-view/ecm-cart/ecm-cart.service'; import { EcmCartService } from '../ecm-view/ecm-cart/ecm-cart.service';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { EcmStoreModel } from '../ecm-store/ecm-store.model'; import { AppState } from '../ecm-store/reducers';
import { RESET,RESET_WISHLIST } from '../ecm-store/ecm-store'; import { CartActions } from '../ecm-store/actions';
declare var getContentPlugin: any; declare var getContentPlugin: any;
...@@ -25,7 +25,7 @@ export class EcmUserOptionComponent implements OnInit { ...@@ -25,7 +25,7 @@ export class EcmUserOptionComponent implements OnInit {
userData: any; userData: any;
//profileImageLink : string; //profileImageLink : string;
constructor( public signinService: ECMSigninService, private store: Store<EcmStoreModel>, public cartService: EcmCartService ) { } constructor( public signinService: ECMSigninService, private store: Store<AppState>, public cartService: EcmCartService, private cartAction: CartActions) { }
ngOnInit() { ngOnInit() {
var userInfo = localStorage.getItem( 'userInfo' ); var userInfo = localStorage.getItem( 'userInfo' );
...@@ -82,8 +82,7 @@ export class EcmUserOptionComponent implements OnInit { ...@@ -82,8 +82,7 @@ export class EcmUserOptionComponent implements OnInit {
logout() { logout() {
localStorage.removeItem( 'userInfo' ); localStorage.removeItem( 'userInfo' );
this.store.dispatch({ type: RESET }); this.store.dispatch(this.cartAction.resetCart());
this.store.dispatch({ type: RESET_WISHLIST });
this.signinService.sendLogout( this.userData.jti, this.userData.TOKEN_ID ).subscribe( this.signinService.sendLogout( this.userData.jti, this.userData.TOKEN_ID ).subscribe(
result => { result => {
...@@ -93,9 +92,8 @@ export class EcmUserOptionComponent implements OnInit { ...@@ -93,9 +92,8 @@ export class EcmUserOptionComponent implements OnInit {
this.userData = null; this.userData = null;
localStorage.removeItem( 'userInfo' ); localStorage.removeItem( 'userInfo' );
this.store.dispatch({ type: RESET }); this.store.dispatch(this.cartAction.resetCart());
this.store.dispatch({ type: RESET_WISHLIST }); this.store.dispatch(this.cartAction.loadCartItems());
this.cartService.setCartItems();
} }
else if ( result.Response.status == 'error' ) { else if ( result.Response.status == 'error' ) {
this.userData = null; this.userData = null;
...@@ -106,8 +104,7 @@ export class EcmUserOptionComponent implements OnInit { ...@@ -106,8 +104,7 @@ export class EcmUserOptionComponent implements OnInit {
console.log( 'comp errorMessage[' + errorMessage + ']' ); console.log( 'comp errorMessage[' + errorMessage + ']' );
} }
); );
this.store.dispatch(this.cartAction.loadCartItems());
this.cartService.setCartItems();
} }
} }
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
[refSer]="'M-ITEM'" [object]="'ITEM'" [isSingleImage]="true" [refSer]="'M-ITEM'" [object]="'ITEM'" [isSingleImage]="true"
[isThumbnail]="true"></ecm-image></td> [isThumbnail]="true"></ecm-image></td>
<td class="itemdescription" (click)="closePanel.emit(viewItem(item.itemCode))"> <td class="itemdescription" (click)="closePanel.emit(viewItem(item.itemCode))">
<span class="item-descr-span">{{item.shDescr}}</span> <span class="item-descr-span">{{item.itemHeader.itemShDescr}}</span>
</td> </td>
<td style="padding: 10px;">Rs. {{item.costRate}}</td> <td style="padding: 10px;">Rs. {{item.itemHeader.itemDiscountedRate}}</td>
<td (click)="confirmDialog(item)" style="cursor: pointer;"><span <td (click)="confirmDialog(item)" style="cursor: pointer;"><span
class="delete-icon" md-ripple>x</span></td> class="delete-icon" md-ripple>x</span></td>
</tr> </tr>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<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> <span Handicarft</span> <span class="item-shDescr">{{item.itemHeader.itemShDescr}}</span> <span
class="item-seller">Sold by</span> <span class="item-sellerInfo">Handmade class="item-seller">Sold by</span> <span class="item-sellerInfo">Handmade
Handicarfts</span> Handicarfts</span>
</div> </div>
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
</button> </button>
</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 class="wish-remove-dipslay"> <div class="wish-remove-dipslay">
<span class="wishList-items" (click)="wishList()">Add to <span class="wishList-items" (click)="wishList()">Add to
......
...@@ -7,9 +7,8 @@ import { EcmCategoryComponent } from '../ecm-category/ecm-category.component'; ...@@ -7,9 +7,8 @@ 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 { EcmStoreModel } from '../../ecm-store/ecm-store.model'; import {CartActions} from '../../ecm-store/actions';
import { UPDATE_QUANTITY, REMOVE } from '../../ecm-store/ecm-store';
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';
...@@ -25,12 +24,12 @@ import { Router, ActivatedRoute } from '@angular/router'; ...@@ -25,12 +24,12 @@ import { Router, ActivatedRoute } from '@angular/router';
providers: [EcmProductDetailService] providers: [EcmProductDetailService]
}) })
export class EcmCartComponent implements OnInit, AfterViewChecked { export class EcmCartComponent implements OnInit, AfterViewChecked {
cartItemsDetail: Item[]; cartItemsDetail: ItemDetail[];
cartCount = 0; cartCount = 0;
catCode; catCode;
displayItem = 3; displayItem = 3;
totalPrice: number = 0; totalPrice: number = 0;
cartItems : Observable<Item[]>; cartItems : Observable<ItemDetail[]>;
disableScrollDown = false disableScrollDown = false
...@@ -40,25 +39,25 @@ export class EcmCartComponent implements OnInit, AfterViewChecked { ...@@ -40,25 +39,25 @@ 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<EcmStoreModel> ) { } 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 cartActions: CartActions) { }
ngOnInit() { ngOnInit() {
this.getCartItem(); this.getCartItem();
this.scrollToBottom(); this.scrollToBottom();
} }
ngAfterViewChecked() { ngAfterViewChecked() {
this.scrollToBottom(); this.scrollToBottom();
} }
getCartItem() { getCartItem() {
this.cartItems = this.store.select('cart'); this.cartItems = this.store.select('cartItems');
this.cartItems.subscribe( cartItems => { this.cartItems.subscribe( cartItems => {
this.totalPrice = 0; this.totalPrice = 0;
cartItems.forEach( cartItems.forEach(
item => { item => {
this.totalPrice = this.totalPrice + (parseFloat( item.costRate ) * item.itemQuantity); this.totalPrice = this.totalPrice + (parseFloat( item.itemHeader.itemDiscountedRate ) * item.itemQuantity);
} }
); );
}); });
...@@ -68,7 +67,8 @@ export class EcmCartComponent implements OnInit, AfterViewChecked { ...@@ -68,7 +67,8 @@ 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.store.dispatch({ type: REMOVE, payload: item });
this.http.delete( this.userActionUrl + '/' + item.itemCode, {}) this.http.delete( this.userActionUrl + '/' + item.itemCode, {})
...@@ -77,6 +77,9 @@ export class EcmCartComponent implements OnInit, AfterViewChecked { ...@@ -77,6 +77,9 @@ export class EcmCartComponent implements OnInit, AfterViewChecked {
}, error => { }, error => {
console.log( error.json() ); console.log( error.json() );
}); });
*/
this.store.dispatch(this.cartActions.deleteCartItem(item));
this.getCartItem(); this.getCartItem();
this.openSnackBar('Item Removed from your Cart' ); this.openSnackBar('Item Removed from your Cart' );
...@@ -86,32 +89,31 @@ export class EcmCartComponent implements OnInit, AfterViewChecked { ...@@ -86,32 +89,31 @@ export class EcmCartComponent implements OnInit, AfterViewChecked {
this.router.navigate( ['/cart'] ); this.router.navigate( ['/cart'] );
} }
increment(item : Item) {
increment(item : ItemDetail) {
item.itemQuantity++; item.itemQuantity++;
this.addToCart(item);
}
addToCart(data : Item) {
let cartData = new Item; let cartData = new Item;
cartData.itemCode = data.itemCode; cartData.itemCode = item.itemCode;
cartData.itemQuantity = data.itemQuantity; cartData.itemQuantity = item.itemQuantity;
cartData.costRate = data.costRate; //cartData.costRate = item.itemHeader.itemDiscountedRate;
this.store.dispatch({ type: 'UPDATE_QUANTITY', payload: cartData }); //this.store.dispatch({ type: 'UPDATE_QUANTITY', payload: cartData });
this.openSnackBar( 'Quantity increased of ' + data.shDescr ); this.store.dispatch(this.cartActions.updateCart(cartData));
this.productDetailService.addToCart(cartData); this.openSnackBar( 'Quantity increased of ' + item.itemHeader.itemShDescr );
//this.productDetailService.addToCart(cartData);
} }
decrement(data : Item) { decrement(item : ItemDetail) {
data.itemQuantity--; item.itemQuantity--;
let cartData = new Item; let cartData = new Item;
cartData.itemCode = data.itemCode; cartData.itemCode = item.itemCode;
cartData.itemQuantity = data.itemQuantity; cartData.itemQuantity = item.itemQuantity;
cartData.costRate = data.costRate; // cartData.costRate = item.itemHeader.itemDiscountedRate;
this.store.dispatch({ type: 'UPDATE_QUANTITY', payload: cartData }); //this.store.dispatch({ type: 'UPDATE_QUANTITY', payload: cartData });
this.openSnackBar( 'Quantity decreased of ' + data.shDescr ); this.store.dispatch(this.cartActions.updateCart(cartData));
this.productDetailService.addToCart(cartData); this.openSnackBar( 'Quantity decreased of ' + item.itemHeader.itemShDescr );
//this.productDetailService.addToCart(cartData);
} }
checkQantity(item) { checkQantity(item) {
......
...@@ -3,20 +3,20 @@ import { Http, Response, Headers, RequestOptions } from '@angular/http'; ...@@ -3,20 +3,20 @@ import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/catch'; import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import { Item } from '../../ecm-model/product-model'; import { ItemDetail } from '../../ecm-model/product-detail-model';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { ADD_TO_CART } from '../../ecm-store/ecm-store';
import { EcmStoreModel } from '../../ecm-store/ecm-store.model'; import {AppState} from '../../ecm-store/reducers';
import {CartActions} from '../../ecm-store/actions';
@Injectable() @Injectable()
export class EcmCartService { export class EcmCartService {
private userActionUrl = '/ecm/service/feeds/cart'; private userActionUrl = '/ecm/service/feeds/cart';
public itemCode; public itemCode;
cartItems: Item[]; cartItems: ItemDetail[];
constructor(private http: Http, private store: Store<EcmStoreModel>) { } constructor(private http: Http, private store: Store<AppState>, private cartActions: CartActions) { }
setCartItems(){ setCartItems(){
this.fetchCartItems().subscribe( this.fetchCartItems().subscribe(
...@@ -24,28 +24,105 @@ private userActionUrl = '/ecm/service/feeds/cart'; ...@@ -24,28 +24,105 @@ 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({ type: ADD_TO_CART, payload: item });
this.store.dispatch(this.cartActions.addToCart(item));
}) })
} }
}); });
} }
fetchCartItems(): Observable<Item[]> { fetchCartItems(): Observable<ItemDetail[]> {
let headers = new Headers( { 'Content-Type': 'application/json' }); let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers }); let options = new RequestOptions( { headers: headers });
return this.http.get( this.userActionUrl, options ) return this.http.get( this.userActionUrl, options )
.map( this.extractData ) .map( (res) => this.extractData(res) );
.catch( this.handleError );
} }
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 });
return this.http.post( '/ecm/service/feeds/cart', JSON.stringify(cartData) , options)
.map( (res) => this.extractData(res) );
}
private extractData(res: Response) { updateCart( cartData ) {
let body = res.json(); console.log( "StoreInCart Called" );
console.log('extractData[' + JSON.stringify(body) + ']'); console.log(JSON.stringify(cartData));
return body || { }; let headers = new Headers( { 'Content-Type': 'application/json' });
let options = new RequestOptions( { headers: headers });
return this.http.post( '/ecm/service/feeds/cart', JSON.stringify(cartData) , options)
.map( (res) => this.extractData(res) );
} }
deleteCartItem( item ) {
console.log( "deleteCartItem Called" );
return this.http.delete( this.userActionUrl + '/' + item.itemCode, {})
.map(res => res.json());
}
private extractData(res: Response) {
let respJson = res.json();
console.log('extracData',respJson);
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) {
// In a real world app, we might use a remote logging infrastructure // In a real world app, we might use a remote logging infrastructure
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<span class="ecm-section-info-title">Categories</span> <span class="ecm-section-info-title">Categories</span>
<span class="ecm-section-info-subhead">Explore top Authentic Regional Foods, Outings, Celebrations around {{selectedPlace}}</span> <span class="ecm-section-info-subhead">Explore top Authentic Regional Foods, Outings, Celebrations around {{selectedPlace}}</span>
</div> </div>
<div class="small-12 medium-6 large-4 column end "*ngFor="let _category of categories"> <div class="small-12 medium-6 large-4 column end "*ngFor="let _category of categories | async">
<ecm-card (storeData)="storeCategory(_category)" [category]="_category"></ecm-card> <ecm-card (storeData)="storeCategory(_category)" [category]="_category"></ecm-card>
</div> </div>
<div></div> <div></div>
......
import { Component, OnInit, HostListener } from '@angular/core'; import { Component, OnInit, HostListener } from '@angular/core';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState } from '../../ecm-store/reducers';
import { CategoryActions, SubCategoryActions } from '../../ecm-store/actions';
import { EcmCategoryService } from './ecm-category.service'; import { EcmCategoryService } from './ecm-category.service';
import { ScrollService } from '../../scroll.service'; import { ScrollService } from '../../scroll.service';
import { EcmStoreModel } from '../../ecm-store/ecm-store.model';
import { Category } from '../../ecm-model/category-model'; import { Category } from '../../ecm-model/category-model';
import { Observable } from 'rxjs/Observable';
@Component({ @Component({
selector: 'ecm-category', selector: 'ecm-category',
templateUrl: './ecm-category.component.html', templateUrl: './ecm-category.component.html',
...@@ -15,7 +18,7 @@ import { Category } from '../../ecm-model/category-model'; ...@@ -15,7 +18,7 @@ import { Category } from '../../ecm-model/category-model';
export class EcmCategoryComponent implements OnInit { export class EcmCategoryComponent implements OnInit {
errorMessage: string; errorMessage: string;
selectedPlace = 'Mumbai'; selectedPlace = 'Mumbai';
categories: Category[]; categories: Observable<Category[]>;
position: any;; position: any;;
@HostListener("window:scroll", []) @HostListener("window:scroll", [])
...@@ -23,38 +26,46 @@ export class EcmCategoryComponent implements OnInit { ...@@ -23,38 +26,46 @@ export class EcmCategoryComponent implements OnInit {
this.position=window.pageYOffset; this.position=window.pageYOffset;
} }
constructor(public categoryService: EcmCategoryService, private scroll_service: ScrollService, private store: Store<EcmStoreModel>) { } constructor(public categoryService: EcmCategoryService, private scroll_service: ScrollService, private store: Store<AppState>, private categoryAction:CategoryActions, private subCategoryAction: SubCategoryActions) { }
ngOnInit() { ngOnInit() {
this.getCategories(); this.getCategories();
} }
ngOnDestroy(){ ngOnDestroy() {
this.scroll_service.setCatPos(this.position); this.scroll_service.setCatPos(this.position);
} }
ngAfterViewInit(){ ngAfterViewInit() {
var pos=this.scroll_service.getCatPos(); var pos=this.scroll_service.getCatPos();
window.scrollTo(0,pos); window.scrollTo(0,pos);
console.log("AfterContenet Init of Category"); console.log("AfterContenet Init of Category");
} }
getCategories() { getCategories() {
this.categoryService.getCategories().subscribe(
categories => { this.categories = this.store.select('categories');
this.categories = categories;
console.log('comp categories[' + JSON.stringify( categories ) + '] \n this.categories[' + JSON.stringify( this.categories ) + ']'); /*
}, this.categoryService.getCategories().subscribe(
error => { categories => {
this.errorMessage = <any>error; this.categories = categories;
console.log('comp errorMessage[' + this.errorMessage + ']'); 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); console.log(selectedCategory);
this.store.dispatch({type: 'CLEAR_CATEGORY', payload: selectedCategory}); //this.store.dispatch({type: 'CLEAR_CATEGORY', payload: selectedCategory});
this.store.dispatch({type: 'CATEGORY', payload: selectedCategory}); //this.store.dispatch({type: 'CATEGORY', payload: selectedCategory});
this.store.dispatch( this.subCategoryAction.loadSubCategories( selectedCategory.catCode ) );
this.store.dispatch(this.categoryAction.getCategorySuccess(selectedCategory));
} }
} }
...@@ -3,8 +3,9 @@ import { FormBuilder, Validators,NgForm } from '@angular/forms'; ...@@ -3,8 +3,9 @@ import { FormBuilder, Validators,NgForm } from '@angular/forms';
import { EcmCartService } from '../ecm-cart/ecm-cart.service'; import { EcmCartService } from '../ecm-cart/ecm-cart.service';
import { Item } from '../../ecm-model/product-model'; import { Item } from '../../ecm-model/product-model';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { EcmStoreModel } from '../../ecm-store/ecm-store.model'; import {AppState} from '../../ecm-store/reducers';
@Component( { @Component( {
selector: 'ecm-checkout', selector: 'ecm-checkout',
...@@ -24,7 +25,7 @@ export class EcmCheckoutComponent implements OnInit { ...@@ -24,7 +25,7 @@ export class EcmCheckoutComponent implements OnInit {
years; years;
cartItems: Observable<Item[]>; cartItems: Observable<Item[]>;
constructor(private formBuilder: FormBuilder, public cartService: EcmCartService, private store: Store<EcmStoreModel>) { constructor(private formBuilder: FormBuilder, public cartService: EcmCartService, private store: Store<AppState>) {
this.countries = [ this.countries = [
{ viewValue: 'India' }, { viewValue: 'India' },
{ viewValue: 'UAE' }, { viewValue: 'UAE' },
...@@ -66,7 +67,7 @@ export class EcmCheckoutComponent implements OnInit { ...@@ -66,7 +67,7 @@ export class EcmCheckoutComponent implements OnInit {
} }
getCartItems() { getCartItems() {
this.cartItems = this.store.select('cart'); this.cartItems = this.store.select('cartItems');
this.cartItems.subscribe( cartItems => { this.cartItems.subscribe( cartItems => {
this.totalPrice = 0; this.totalPrice = 0;
......
...@@ -5,17 +5,22 @@ ...@@ -5,17 +5,22 @@
padding-top: 70px; padding-top: 70px;
} }
.ecm-section-info { .ecm-section-info {
padding: 10px; padding: 0 10px 15px 10px;
border-bottom: 1px solid #f2f2f2;
} }
.ecm-section-info-title { .ecm-section-info-title {
font-size: 26px; /* font-size: 26px;
color: #444; color: #444;
display: block; display: block; */
font-size: 20px;
color: black;
display: inline;
} }
.ecm-section-info-subhead { .ecm-section-info-subhead {
font-size: 16px; font-size: 16px;
color: #888; color: #888;
display: block; /* display: block; */
display: inline
} }
.end { .end {
padding-top: 15px; padding-top: 15px;
...@@ -112,4 +117,176 @@ ...@@ -112,4 +117,176 @@
color: mediumvioletred; color: mediumvioletred;
font-size: 20px; font-size: 20px;
} }
/* loading section end */ /* loading section end */
\ No newline at end of file
.filter-pane{
position: relative;
width: 100%;
height: 100%;
display: inline-block;
min-height: 600px;
text-align: center;
}
.item-card {
position: relative;
}
.item-card:hover {
/* -webkit-filter: contrast(100%) brightness(95%); */
/* filter: contrast(100%) brightness(95%); */
}
.item-card-overlay {
display: none;
}
.item-card-overlay-action{
color: mediumvioletred;
line-height: 60px;
background: #fff;
padding: 10px;
border-radius: 2px;
font-size: 12px;
font-weight: 600;
}
.item-card-overlay-action > i {
vertical-align: sub;
font-size: 16px;
}
.item-card:hover > .item-card-overlay {
position: absolute;
z-index: 1;
display: block;
text-align: center;
width: calc( 100% - 30px);
height: 60px;
top: 120px;
cursor: pointer;
}
@media screen and (max-width: 750px){
.filter-pane{
min-height: 60px;
}
.ecm-items-details{
margin-top: 0px !important;
}
.ecm-filter-details{
margin-top: 0px !important;
}
.ecm-section-info{
border: 2px solid ghostwhite;
}
.ecm-item-card-detail{
border: 2px solid ghostwhite;
}
}
.ecm-total-items{
font-size: 14px;
color: dimgray;
}
.ecm-items-details{
/*margin-top: -39px;*/
border-left: 1px solid #f2f2f2;
}
.ecm-item-card-detail {
display: inline-block;
border-right: 0px;
border-bottom: 0px;
}
.ecm-filter-details{
/*margin-top: -24px;*/
padding: 0;
}
.ecm-items-section {
display: inline-block;
padding: 0;
}
.filter-header {
padding-top: 20px;
padding-bottom: 16px;
border-bottom: 1px solid #f2f2f2;
}
.filter-hader-title {
border-bottom: 3px solid #c71585;
padding-bottom: 16px;
}
.ecm-input-container {
padding-bottom: 20px;
}
.price-title {
padding-left: 25px;
padding-top: 10px;
padding-bottom: 10px;
text-align: left;
cursor: pointer;
/*Background Image*/
background-image: url("../../../assets/images/down_arrow.png");
background-position: right 14px;
background-repeat: no-repeat;
background-size: 16px 16px;
margin-right: 15px;
}
.price-slider {
height: 48px !important;
min-width: 250px !important;
}
.amount-range {
height: 35px;
}
.min-value {
float: left;
padding-left: 20px;
font-size: 0.8rem;
}
.max-value {
float: right;
padding-right: 20px;
font-size: 0.8rem;
}
.min-val-input {
width: 90px;
height: 35px;
margin-left: 20px;
display: inline-block;
padding-left: 10px;
}
.max-val-input {
width: 90px;
height: 35px;
margin-right: 20px;
padding-left: 10px;
}
.find-button {
padding: 0;
display: initial;
min-width: 45px;
color: mediumvioletred;
box-shadow: 0 0px 5px 1px rgba(0,0,0,.1);
border-radius: 3px;
margin-right: 5px;
}
.value-divider {
width: 20px;
height: 35px;
display: inline-block;
font-size: 22px;
line-height: 35px;
}
.container {
border-bottom: 1px solid #f2f2f2;
}
...@@ -19,15 +19,59 @@ ...@@ -19,15 +19,59 @@
<div *ngIf="items"> <div *ngIf="items">
<section class="subcategories-section"> <section class="subcategories-section">
<div class="row row-subcategory"> <div class="row">
<div class="ecm-section-info"> <md-card class="ecm-items-section">
<span class="ecm-section-info-title">{{subcategory?.shDescr}}</span> <div class="small-12 medium-3 large-3 column ecm-filter-details">
<span class="ecm-section-info-subhead">{{subcategory?.descr}}</span> <div class = "filter-pane">
<div class="filter-header">
<span class="filter-hader-title">Filter By</span>
</div>
<div class="container">
<div class="price-title" (click)="showHide();">Price</div>
<div *ngIf="show">
<md-slider min="500" max="35000" class="price-slider" (input)="onInputChange($event);"></md-slider>
<div class="amount-range">
<span class="min-value">Rs. {{minVal}}</span>
<span class="max-value">Rs. {{maxVal}}</span>
</div>
<div class="ecm-input-container">
<input type="text" class="min-val-input" placeholder="500" [(ngModel)]="minVal">
<span class="value-divider">-</span>
<input type="text" class="max-val-input" placeholder="35000" [(ngModel)]="maxVal">
<button md-button class="find-button">Find</button>
</div>
</div>
</div>
</div> </div>
<div class="small-12 medium-6 large-4 column end "*ngFor="let _item of items">
<!--<ecm-item-caption [itemData]="_item"></ecm-item-caption> -->
<ecm-card [itemData]="_item" [extraParam]="extra_param"></ecm-card>
</div> </div>
<div class="small-12 medium-9 large-9 column end ecm-items-details">
<div class="row">
<div class="ecm-section-info">
<span class="ecm-section-info-title">{{subcategory?.shDescr}}</span>
<span class="ecm-total-items">( {{(items | async)?.length}} Items )</span>
<!-- <span class="ecm-section-info-subhead">{{subcategory?.descr}}</span> -->
</div>
<div class="ecm-item-card-detail">
<div class="small-12 medium-6 large-4 column end item-card"
*ngFor="let _item of items | async">
<div class="item-card-overlay" (click)="addToCart(_item)">
<span class="item-card-overlay-action" >
<i class="material-icons">shopping_cart</i>
{{ (_item.itemCode.indexOf('L2D014') == 0 ) ? 'Add to Cart' : 'Enroll Now'}}
</span>
</div>
<!--<ecm-item-caption [itemData]="_item"></ecm-item-caption> -->
<ecm-card [itemData]="_item" [extraParam]="extra_param"></ecm-card>
</div>
</div>
</div>
</div>
</md-card>
</div> </div>
</section> </section>
</div> </div>
......
import { Component, OnInit,HostListener } from '@angular/core'; import { Component, OnInit,HostListener } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { AppState } from '../../ecm-store/reducers';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { ItemActions } from '../../ecm-store/actions';
import { EcmProductService } from './ecm-product.service';
import { ScrollService } from '../../scroll.service';
import { EcmStoreModel } from '../../ecm-store/ecm-store.model';
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';
import { Item } from '../../ecm-model/product-model'; import { Item } from '../../ecm-model/product-model';
import { ItemDetail } from '../../ecm-model/product-detail-model';
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] providers: [EcmProductService, EcmProductDetailService]
}) })
export class EcmProductComponent implements OnInit { export class EcmProductComponent implements OnInit {
position=0; position=0;
isCatItems = 'false'; isCatItems = 'false';
show = false;
minVal = 500;
maxVal = 35000;
@HostListener("window:scroll", []) @HostListener("window:scroll", [])
onWindowScroll() { onWindowScroll() {
this.position=window.pageYOffset; this.position=window.pageYOffset;
} }
private items: Item[]; Items = 0;
private items: Observable<Item[]>;
private extra_param= { "catCode":'', "catShDesc":'',scatDesc:'' }; private extra_param= { "catCode":'', "catShDesc":'',scatDesc:'' };
private category : Category; private category : Category;
private subcategory : SubCategory; private subcategory : SubCategory;
itemDetail: ItemDetail;
attribVal;
attribCode;
constructor(private route: ActivatedRoute, private router:Router,public subcategoryService: EcmProductService, private scroll_service: ScrollService, private store: Store<EcmStoreModel>) { } constructor(private route: ActivatedRoute, private router:Router,public subcategoryService: EcmProductService,public productDetailService: EcmProductDetailService, private scroll_service: ScrollService, private store: Store<AppState>, private itemAction: ItemActions) { }
ngOnInit() { ngOnInit() {
window.scrollTo(0,0); window.scrollTo(0,0);
this.route.params.subscribe( params => { this.route.params.subscribe( params => {
...@@ -45,22 +59,31 @@ export class EcmProductComponent implements OnInit { ...@@ -45,22 +59,31 @@ export class EcmProductComponent implements OnInit {
//this.getSubCategory( viewKey ); //this.getSubCategory( viewKey );
this.fetchStore('SubCategory'); this.fetchStore('SubCategory');
this.getItems(scatCode); this.getItems(scatCode);
}); });
} }
getItems( scatCode: string ) { getItems( scatCode: string ) {
this.items = this.store.select('items');
/*
this.subcategoryService.getItems( scatCode ).subscribe( this.subcategoryService.getItems( scatCode ).subscribe(
items => { items => {
this.items = items; this.items = items;
this.Items = this.items.length;
console.log( 'comp scatCode[' + scatCode + '] \n this.items[' + JSON.stringify( this.items ) + ']' ); console.log( 'comp scatCode[' + scatCode + '] \n this.items[' + JSON.stringify( this.items ) + ']' );
}, },
); );
*/
} }
storeCategory(selectedSubCategory){ storeCategory(selectedItem){
console.log(selectedSubCategory); console.log(selectedItem);
this.store.dispatch({type: 'CLEAR_SUB_CATEGORY', payload: selectedSubCategory}); //this.store.dispatch({type: 'CLEAR_SUB_CATEGORY', payload: selectedSubCategory});
this.store.dispatch({type: 'SUB_CATEGORY', payload: selectedSubCategory}); //this.store.dispatch({type: 'SUB_CATEGORY', payload: selectedSubCategory});
this.store.dispatch( this.itemAction.getItem( selectedItem.itemCode ) );
} }
fetchStore( viewType: string){ fetchStore( viewType: string){
...@@ -82,4 +105,42 @@ export class EcmProductComponent implements OnInit { ...@@ -82,4 +105,42 @@ export class EcmProductComponent implements OnInit {
this.subcategory = storeSubCategory; this.subcategory = storeSubCategory;
} }
} }
addToCart(items) {
let cartData = new Item;
cartData.itemCode = items.itemCode;
cartData.itemQuantity = 1;
cartData.costRate = items.costRate;
cartData.descr = items.itemDescr;
cartData.shDescr = items.shDescr;
if(this.attribCode == "COLOR"){
cartData.phyAttribId3 = this.attribVal;
}
else if(this.attribCode == "SIZE"){
cartData.phyAttribId1 = this.attribVal;
}
//this.store.dispatch({ type: ADD_TO_CART, payload: cartData });
this.productDetailService.addToCart(cartData);
//Check Store data
this.store.select('cart').forEach(
value => {
console.log('Cart Items----');
console.log(value);
}
);
}
showHide(){
if(this.show)
this.show = false;
else
this.show = true;
}
onInputChange(event: any){
this.maxVal = event.value;
}
} }
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<span *ngIf="category" class="ecm-section-info-title">{{category?.shDescr}}</span> <span *ngIf="category" class="ecm-section-info-title">{{category?.shDescr}}</span>
<span *ngIf="category" class="ecm-section-info-subhead">{{category?.descr}}</span> <span *ngIf="category" class="ecm-section-info-subhead">{{category?.descr}}</span>
</div> </div>
<div class="small-12 medium-6 large-4 column end " *ngFor="let _subcategory of subcategories"> <div class="small-12 medium-6 large-4 column end " *ngFor="let _subcategory of subcategories | async">
<ecm-card (storeData)="storeCategory(_subcategory)" [subcategory]="_subcategory"></ecm-card> <ecm-card (storeData)="storeCategory(_subcategory)" [subcategory]="_subcategory"></ecm-card>
</div> </div>
</div> </div>
......
import { Component, OnInit,HostListener } from '@angular/core'; import { Component, OnInit, HostListener } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState } from '../../ecm-store/reducers';
import { SubCategoryActions, ItemActions } from '../../ecm-store/actions';
import { EcmSubCategoryService } from './ecm-sub-category.service'; import { EcmSubCategoryService } from './ecm-sub-category.service';
import { ScrollService } from '../../scroll.service'; import { ScrollService } from '../../scroll.service';
import { EcmStoreModel } from '../../ecm-store/ecm-store.model';
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';
import { Item } from '../../ecm-model/product-model'; import { Item } from '../../ecm-model/product-model';
@Component({ import { Observable } from 'rxjs/Observable';
selector: 'ecm-sub-category',
templateUrl: './ecm-sub-category.component.html', @Component( {
styleUrls: ['./ecm-sub-category.component.css'], selector: 'ecm-sub-category',
providers: [EcmSubCategoryService] templateUrl: './ecm-sub-category.component.html',
styleUrls: ['./ecm-sub-category.component.css'],
providers: [EcmSubCategoryService]
}) })
export class EcmSubCategoryComponent implements OnInit { export class EcmSubCategoryComponent implements OnInit {
position=0; position = 0;
isCatItems = 'false'; isCatItems = 'false';
@HostListener("window:scroll", []) @HostListener( "window:scroll", [] )
onWindowScroll() { onWindowScroll() {
this.position=window.pageYOffset; this.position = window.pageYOffset;
} }
private subcategories: Observable<SubCategory[]>;
private extra_param = { "catCode": '', "catShDesc": '', scatDesc: '' };
private category: Category;
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 ) { }
ngOnInit() {
window.scrollTo( 0, 0 );
this.route.params.subscribe( params => {
//let id: number = +params['id']; // (+) converts string 'id' to a number
// In a real app: dispatch action to load the details here.
let catCode = params['catCode'];
console.log( 'ngOnInit catCode[' + catCode + ']' );
console.log( "Subcat Listing..." );
console.log( window.location.pathname );
//this.fetchStore(catCode,'Category');
this.getSubCategories( catCode );
});
}
getSubCategories( catCode: string ) {
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 ) + ']' );
}
},
);
*/
}
storeCategory( selectedSubCategory ) {
//this.store.dispatch({type: 'CLEAR_SUB_CATEGORY', payload: selectedSubCategory});
//this.store.dispatch({type: 'SUB_CATEGORY', payload: selectedSubCategory});
this.store.dispatch( this.itemAction.loadItems( selectedSubCategory.scatCode ) );
this.store.dispatch( this.subCategoryAction.getSubCategorySuccess( selectedSubCategory ) );
}
private subcategories: SubCategory[]; fetchStore( viewKey: string, viewType: string ) {
private extra_param= { "catCode":'', "catShDesc":'',scatDesc:'' }; if ( viewType == 'Category' ) {
let storeCategory;
private category : Category; this.store.select( 'CATEGORY' ).forEach(
private subcategory : SubCategory; value => storeCategory = value
//private category: Observable<Array<Category>>; );
this.category = storeCategory;
}
constructor(private route: ActivatedRoute, private router:Router,public subcategoryService: EcmSubCategoryService, private scroll_service: ScrollService, private store: Store<EcmStoreModel>) { } if ( viewType == 'SubCategory' ) {
ngOnInit() { let storeSubCategory;
window.scrollTo(0,0); this.store.select( 'SUBCATEGORY' ).forEach(
this.route.params.subscribe( params => { value => { storeSubCategory = value; console.log( value ); }
//let id: number = +params['id']; // (+) converts string 'id' to a number );
// In a real app: dispatch action to load the details here. this.subcategory = storeSubCategory;
let catCode = params['catCode']; }
console.log( 'ngOnInit catCode[' + catCode + ']' );
console.log("Subcat Listing...");
console.log(window.location.pathname);
this.fetchStore(catCode,'Category');
this.getSubCategories(catCode);
});
}
getSubCategories( catCode: string ) {
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 ) + ']' );
}*/
},
);
}
storeCategory(selectedSubCategory){
console.log(selectedSubCategory);
this.store.dispatch({type: 'CLEAR_SUB_CATEGORY', payload: selectedSubCategory});
this.store.dispatch({type: 'SUB_CATEGORY', payload: selectedSubCategory});
}
fetchStore(viewKey: string, viewType: string){
if(viewType == 'Category')
{
let storeCategory;
this.store.select('CATEGORY').forEach(
value => storeCategory=value
);
this.category = storeCategory;
}
if(viewType == 'SubCategory')
{
let storeSubCategory;
this.store.select('SUBCATEGORY').forEach(
value => { storeSubCategory=value; console.log(value);}
);
this.subcategory = storeSubCategory;
}
} }
} }
...@@ -117,20 +117,24 @@ ...@@ -117,20 +117,24 @@
margin-bottom: 15px !important; margin-bottom: 15px !important;
} }
.counter-screen{ .counter-screen{
display: block !important; display: inline-block !important;
float: none !important;
} }
.items-cost-rate { .items-cost-rate {
text-align: left !important; text-align: left !important;
padding-top: 40px !important; padding-top: 40px !important;
} }
.wish-remove-dipslay{ .wish-remove-dipslay{
text-align: right !important; padding-top: 0px !important;
padding-top: 100px !important; padding-right: 0px !important;
} }
.item-image { .remove-items{
padding-left: 0px !important;
}
/* .item-image {
width: 16% !important; width: 16% !important;
bottom: 100px !important; bottom: 100px !important;
} } */
.counter{ .counter{
position: relative; position: relative;
padding-top: 18px; padding-top: 18px;
...@@ -230,10 +234,11 @@ ...@@ -230,10 +234,11 @@
/* width: 140px; /* width: 140px;
padding-top: 16px; padding-top: 16px;
position: relative; */ position: relative; */
width: 10%;
display: inline-block; display: inline-block;
position: relative; position: relative;
bottom: 96px; vertical-align: top;
width: 110px;
top: 30px;
} }
.change-color{ .change-color{
......
<div *ngIf="wishListItems | async"> <div *ngIf="(wishListItems | async)?.length == 0">
<ecm-header [isFixedHeader]=false> </ecm-header>
<ecm-breadcrumbs [pageName]="'WISHLIST'"></ecm-breadcrumbs>
<div class="row">
<div class="medium-12 large-12 columns" style="text-align: center; margin-top: 120px;">
<img class="empty-cart-img" src="/ecm/assets/images/svg/Empty Cart.svg">
<span class="empty-cart-title">Empty Wishlist</span> <span
class="border-line"></span> <span class="empty-cart-msg">Looks
like you haven't made your choice yet...</span>
</div>
</div>
<div style="margin-top: 155px;">
<ecm-footer></ecm-footer>
</div>
</div>
<div *ngIf="(wishListItems | async)?.length > 0">
<ecm-header [isFixedHeader]=false> </ecm-header> <ecm-header [isFixedHeader]=false> </ecm-header>
<ecm-breadcrumbs [pageName]="'WISHLIST'"></ecm-breadcrumbs> <ecm-breadcrumbs [pageName]="'WISHLIST'"></ecm-breadcrumbs>
<div class="row details-of-Cart"> <div class="row details-of-Cart">
...@@ -28,7 +45,7 @@ ...@@ -28,7 +45,7 @@
<div class="counter-screen"> <div class="counter-screen">
<div class="wish-remove-dipslay"> <div class="wish-remove-dipslay">
<!-- <span class="remove-items" (click)=" confirmDialog(item)" style="cursor: pointer;">Remove</span> --> <!-- <span class="remove-items" (click)=" confirmDialog(item)" style="cursor: pointer;">Remove</span> -->
<span class="remove-items" (click)="deletewishlistItem(item) "><i class="material-icons" style="font-size: 24px;color: mediumvioletred;">delete</i></span> <span class="remove-items" (click)="deletewishlistItem(item) ">Remove</span>
</div> </div>
</div> </div>
...@@ -40,4 +57,5 @@ ...@@ -40,4 +57,5 @@
</div> </div>
</md-card> </md-card>
</div> </div>
<ecm-footer></ecm-footer>
</div> </div>
...@@ -7,8 +7,7 @@ import { EcmProductDetailService } from '../../ecm-product-details/ecm-product-d ...@@ -7,8 +7,7 @@ import { EcmProductDetailService } from '../../ecm-product-details/ecm-product-d
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';
import { EcmStoreModel } from '../../ecm-store/ecm-store.model'; import { AppState } from '../../ecm-store/reducers';
import { REMOVE_WISLIST } from '../../ecm-store/ecm-store';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
...@@ -24,7 +23,7 @@ export class EcmWishListComponent implements OnInit { ...@@ -24,7 +23,7 @@ export class EcmWishListComponent implements OnInit {
errorMessage: string; errorMessage: string;
cartCount = 0; cartCount = 0;
constructor( public subcategoryService: EcmProductDetailService, private route: ActivatedRoute, private router: Router, public snackBar: MdSnackBar, public wishListService: EcmWishListService, private http: Http, private store: Store<EcmStoreModel> ) { } constructor( public subcategoryService: EcmProductDetailService, private route: ActivatedRoute, private router: Router, public snackBar: MdSnackBar, public wishListService: EcmWishListService, private http: Http, private store: Store<AppState> ) { }
ngOnInit() { ngOnInit() {
this.getWishlistItems(); this.getWishlistItems();
...@@ -43,7 +42,7 @@ export class EcmWishListComponent implements OnInit { ...@@ -43,7 +42,7 @@ export class EcmWishListComponent implements OnInit {
userActionUrl = '/ecm/service/feeds/wishlist'; userActionUrl = '/ecm/service/feeds/wishlist';
deletewishlistItem( item ) { deletewishlistItem( item ) {
this.store.dispatch( { type: REMOVE_WISLIST, payload: item }); //this.store.dispatch( { type: REMOVE_WISLIST, payload: item });
this.http.delete( this.userActionUrl + '/' + item.itemCode, {}) this.http.delete( this.userActionUrl + '/' + item.itemCode, {})
.subscribe( data => { .subscribe( data => {
......
...@@ -4,10 +4,9 @@ import { Observable } from 'rxjs/Observable'; ...@@ -4,10 +4,9 @@ import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/catch'; import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { ADD_TO_WISHLIST } from '../../ecm-store/ecm-store'; import { AppState } from '../../ecm-store/reducers';
import { Item } from '../../ecm-model/product-model'; import { Item } from '../../ecm-model/product-model';
import { EcmStoreModel } from '../../ecm-store/ecm-store.model';
@Injectable() @Injectable()
export class EcmWishListService { export class EcmWishListService {
...@@ -15,7 +14,7 @@ export class EcmWishListService { ...@@ -15,7 +14,7 @@ export class EcmWishListService {
private wishListUrl = '/ecm/service/feeds/wishlist'; // URL to web service private wishListUrl = '/ecm/service/feeds/wishlist'; // URL to web service
wishListItems: Item[]; wishListItems: Item[];
constructor( private http: Http, private store: Store<EcmStoreModel> ) { } constructor( private http: Http, private store: Store<AppState> ) { }
setWishlistItems() { setWishlistItems() {
this.fetchWishlistItems().subscribe( this.fetchWishlistItems().subscribe(
...@@ -23,7 +22,7 @@ export class EcmWishListService { ...@@ -23,7 +22,7 @@ export class EcmWishListService {
this.wishListItems = data; this.wishListItems = data;
if ( data && data != null ) { if ( data && data != null ) {
this.wishListItems.forEach( item => { this.wishListItems.forEach( item => {
this.store.dispatch( { type: ADD_TO_WISHLIST, payload: item }); //this.store.dispatch( { type: ADD_TO_WISHLIST, payload: item });
}) })
} }
}); });
......
...@@ -80,3 +80,8 @@ body { ...@@ -80,3 +80,8 @@ body {
button { button {
border: none; border: none;
} }
input:-webkit-autofill
{
-webkit-box-shadow: 0 0 0 30px white inset !important;
}
\ No newline at end of file
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