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 {
private SERVICE_URL = '/ecm/service/category/detail/'; // URL to web service
constructor (private http: Http,) {}
constructor (private http: Http) {}
getItemDetail (itemCode : string): Observable<ItemDetail> {
......@@ -74,5 +74,19 @@ export class EcmProductDetailService {
console.log( error.json() );
});
}
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 {
}
}
else if( activity == 'ADD_WISHLIST' ) {
this.addToWishlist();
this.addToWishlist(data);
this.router.navigate(['/wishList']);
this.showSnackbar('Item Added to your Wishlist');
}
else if( activity == 'BOOK_NOW' ) {
......@@ -149,9 +150,10 @@ export class EcmProductDetailsComponent implements OnInit {
);
}
addToWishlist() {
}
addToWishlist(data:any) {
// this.store.dispatch({ type: INCREMENT, payload: cartData });
this.productDetailService.addToWishlist(data);
}
showSnackbar(message) {
this.snackBar.open(message, '', {duration: 2000});
......
......@@ -595,4 +595,11 @@ md-card {
margin-top: -7px;
margin-left: -7px;
margin-right: 29px;
}
.wishButton{
float: right;
z-index: 1;
padding-top: 18px;
background: none;
color: mediumvioletred;
}
\ No newline at end of file
......@@ -4,9 +4,15 @@
<div class="row">
<!-- ------------------------HANDICRAFT-IMAGE START HERE-------------------------------- -->
<div class="small-12 medium-6 large-6 columns image">
<div class="md-card-image">
<ecm-image [refId]='itemDetail.itemCode' [refSer]="'M-ITEM'" [object]="'ITEM'" [isSingleImage] = "true" class="product-image"></ecm-image>
</div>
<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">
<ecm-image [refId]='itemDetail.itemCode' [refSer]="'M-ITEM'" [object]="'ITEM'" [isSingleImage] = "true" class="product-image"></ecm-image>
</div>
</div>
<!-- ----------------------HANDICRAFT-DETAILS START HERE-------------------------------- -->
......
......@@ -85,6 +85,20 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface {
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() {
var userInfo = localStorage.getItem( 'userInfo' );
if ( userInfo !== 'undefined' && userInfo !== null && userInfo !== 'null' )
......
......@@ -98,17 +98,20 @@ export class EcmCartComponent implements OnInit, AfterViewChecked {
cartData.costRate = data.costRate;
this.store.dispatch({ type: 'UPDATE_QUANTITY', payload: cartData });
this.openSnackBar( 'Quantity increased of ' + data.shDescr );
this.productDetailService.addToCart(cartData);
this.openSnackBar( data.shDescr + ' Added to your Cart ' );
}
decrement(data : Item) {
data.itemQuantity--;
let cartData = new Item;
cartData.itemCode = data.itemCode;
cartData.itemQuantity = data.itemQuantity;
cartData.costRate = data.costRate;
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) {
......
......@@ -56,6 +56,7 @@ export class EcmCheckoutComponent implements OnInit {
}
ngOnInit() {
window.scrollTo(0,0);
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