Commit 937e9b44 authored by prumde's avatar prumde

Updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174440 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 50a63b7f
...@@ -12,7 +12,7 @@ export class EcmProductDetailService { ...@@ -12,7 +12,7 @@ export class EcmProductDetailService {
private SERVICE_URL = '/ecm/service/category/detail/'; // URL to web service private SERVICE_URL = '/ecm/service/category/detail/'; // URL to web service
constructor (private http: Http,) {} constructor (private http: Http) {}
getItemDetail (itemCode : string): Observable<ItemDetail> { getItemDetail (itemCode : string): Observable<ItemDetail> {
...@@ -75,4 +75,18 @@ export class EcmProductDetailService { ...@@ -75,4 +75,18 @@ export class EcmProductDetailService {
}); });
} }
addToWishlist(itemCode) {
console.log( "StoreInWishList Called" );
console.log(JSON.stringify(itemCode));
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() );
});
}
} }
...@@ -111,7 +111,8 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -111,7 +111,8 @@ export class EcmProductDetailsComponent implements OnInit {
} }
} }
else if( activity == 'ADD_WISHLIST' ) { else if( activity == 'ADD_WISHLIST' ) {
this.addToWishlist(); this.addToWishlist(data);
this.router.navigate(['/wishList']);
this.showSnackbar('Item Added to your Wishlist'); this.showSnackbar('Item Added to your Wishlist');
} }
else if( activity == 'BOOK_NOW' ) { else if( activity == 'BOOK_NOW' ) {
...@@ -149,8 +150,9 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -149,8 +150,9 @@ export class EcmProductDetailsComponent implements OnInit {
); );
} }
addToWishlist() { addToWishlist(data:any) {
// this.store.dispatch({ type: INCREMENT, payload: cartData });
this.productDetailService.addToWishlist(data);
} }
showSnackbar(message) { showSnackbar(message) {
......
...@@ -596,3 +596,10 @@ md-card { ...@@ -596,3 +596,10 @@ md-card {
margin-left: -7px; margin-left: -7px;
margin-right: 29px; margin-right: 29px;
} }
.wishButton{
float: right;
z-index: 1;
padding-top: 18px;
background: none;
color: mediumvioletred;
}
\ No newline at end of file
...@@ -4,6 +4,12 @@ ...@@ -4,6 +4,12 @@
<div class="row"> <div class="row">
<!-- ------------------------HANDICRAFT-IMAGE START HERE-------------------------------- --> <!-- ------------------------HANDICRAFT-IMAGE START HERE-------------------------------- -->
<div class="small-12 medium-6 large-6 columns image"> <div class="small-12 medium-6 large-6 columns image">
<div>
<md-button-toggle class="wishButton" #wish>
<md-icon style="color: mediumvioletred;" *ngIf="!wish.checked" (click)="checkWishlistUser();">favorite_border</md-icon>
<md-icon style="color: mediumvioletred;" *ngIf="wish.checked">favorite</md-icon>
</md-button-toggle>
</div>
<div class="md-card-image"> <div class="md-card-image">
<ecm-image [refId]='itemDetail.itemCode' [refSer]="'M-ITEM'" [object]="'ITEM'" [isSingleImage] = "true" class="product-image"></ecm-image> <ecm-image [refId]='itemDetail.itemCode' [refSer]="'M-ITEM'" [object]="'ITEM'" [isSingleImage] = "true" class="product-image"></ecm-image>
</div> </div>
......
...@@ -85,6 +85,20 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface { ...@@ -85,6 +85,20 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface {
window.scrollTo(0, offsetTop + 60); window.scrollTo(0, offsetTop + 60);
} }
checkWishlistUser() {
var userInfo = localStorage.getItem( 'userInfo' );
if ( userInfo !== 'undefined' && userInfo !== null && userInfo !== 'null' )
{
this.doActivity.emit({activity:'ADD_WISHLIST', data: this.itemDetail.itemCode });
console.log("ITEM ADDED TO WISHLIST OF CART ITEMS "+this.itemDetail.itemCode );
}
else
{
console.log("checkUser-else");
this.showSignInPanel.emit();
}
}
checkUser() { checkUser() {
var userInfo = localStorage.getItem( 'userInfo' ); var userInfo = localStorage.getItem( 'userInfo' );
if ( userInfo !== 'undefined' && userInfo !== null && userInfo !== 'null' ) if ( userInfo !== 'undefined' && userInfo !== null && userInfo !== 'null' )
......
...@@ -98,17 +98,20 @@ export class EcmCartComponent implements OnInit, AfterViewChecked { ...@@ -98,17 +98,20 @@ export class EcmCartComponent implements OnInit, AfterViewChecked {
cartData.costRate = data.costRate; cartData.costRate = data.costRate;
this.store.dispatch({ type: 'UPDATE_QUANTITY', payload: cartData }); this.store.dispatch({ type: 'UPDATE_QUANTITY', payload: cartData });
this.openSnackBar( 'Quantity increased of ' + data.shDescr );
this.productDetailService.addToCart(cartData); this.productDetailService.addToCart(cartData);
this.openSnackBar( data.shDescr + ' Added to your Cart ' );
} }
decrement(data : Item) { decrement(data : Item) {
data.itemQuantity--; data.itemQuantity--;
let cartData = new Item; let cartData = new Item;
cartData.itemCode = data.itemCode; cartData.itemCode = data.itemCode;
cartData.itemQuantity = data.itemQuantity;
cartData.costRate = data.costRate;
this.store.dispatch({ type: 'UPDATE_QUANTITY', payload: cartData }); this.store.dispatch({ type: 'UPDATE_QUANTITY', payload: cartData });
this.openSnackBar( data.shDescr + ' Removed from your Cart' ); this.openSnackBar( 'Quantity decreased of ' + data.shDescr );
this.productDetailService.addToCart(cartData);
} }
checkQantity(item) { checkQantity(item) {
......
...@@ -56,6 +56,7 @@ export class EcmCheckoutComponent implements OnInit { ...@@ -56,6 +56,7 @@ export class EcmCheckoutComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
window.scrollTo(0,0);
this.getCartItems(); this.getCartItems();
} }
......
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