Commit 6009b472 authored by prumde's avatar prumde

Updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174443 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0f74d22d
...@@ -77,7 +77,7 @@ export class EcmProductDetailService { ...@@ -77,7 +77,7 @@ export class EcmProductDetailService {
addToWishlist(itemCode) { addToWishlist(itemCode) {
console.log( "StoreInWishList Called" ); console.log( "StoreInWishList Called" );
console.log(JSON.stringify(itemCode));
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 });
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
<ecm-breadcrumbs *ngIf="itemDetail" [pageName]="'DETAIL'" [itemDetail]='itemDetail'></ecm-breadcrumbs> <ecm-breadcrumbs *ngIf="itemDetail" [pageName]="'DETAIL'" [itemDetail]='itemDetail'></ecm-breadcrumbs>
<div class="row"> <div class="row">
<ecm-template *ngIf="ecmTemplate" [itemDetail] = "itemDetail" [ecmTemplate] = "ecmTemplate" (scrollToReviews)="scrollToReviews();" (showSignInPanel) = "showSignInPanel();" (doActivity) = "doActivity($event);"> <ecm-template *ngIf="ecmTemplate" [itemDetail] = "itemDetail" [ecmTemplate] = "ecmTemplate" (scrollToReviews)="scrollToReviews();" (doActivity) = "doActivity($event);">
</ecm-template> </ecm-template>
</div> </div>
<div class="row" *ngIf="noOfReviews != 0" #reviewsAndRating> <div class="row" *ngIf="noOfReviews != 0" #reviewsAndRating>
<ecm-product-review [itemDetail] = "itemDetail" (showSignInPanel) = "showSignInPanel();"></ecm-product-review> <ecm-product-review [itemDetail] = "itemDetail" (doActivity) = "doActivity($event);"></ecm-product-review>
</div> </div>
<ecm-related-items *ngIf="itemDetail" [scatCode]="scatCode"> </ecm-related-items> <ecm-related-items *ngIf="itemDetail" [scatCode]="scatCode"> </ecm-related-items>
......
...@@ -8,6 +8,7 @@ import { UPDATE_QUANTITY, ADD_TO_CART, REMOVE } from '../ecm-store/ecm-store'; ...@@ -8,6 +8,7 @@ import { UPDATE_QUANTITY, ADD_TO_CART, REMOVE } from '../ecm-store/ecm-store';
import { EcmProductDetailService } from './ecm-product-detail.service'; import { EcmProductDetailService } from './ecm-product-detail.service';
import { ScrollService } from '../scroll.service'; import { ScrollService } from '../scroll.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 { EcmTemplateItem,EcmTemplateComponent } from './ecm-template/ecm-template.component'; import { EcmTemplateItem,EcmTemplateComponent } from './ecm-template/ecm-template.component';
...@@ -20,6 +21,9 @@ import { EcmRelatedItemsComponent } from '../ecm-view/ecm-related-items/ecm-rela ...@@ -20,6 +21,9 @@ import { EcmRelatedItemsComponent } from '../ecm-view/ecm-related-items/ecm-rela
import { ECMCart } from '../ecm-model/cart-model'; import { ECMCart } from '../ecm-model/cart-model';
import { Item } from '../ecm-model/product-model'; import { Item } from '../ecm-model/product-model';
import { ECMHeaderComponent } from '../ecm-header/ecm-header.component'; import { ECMHeaderComponent } from '../ecm-header/ecm-header.component';
import { Reviews } from '../ecm-model/product-review.model';
import {MdDialog, MdDialogRef, MdDialogConfig, MD_DIALOG_DATA} from '@angular/material';
import { ECMWriteReviewDialog } from './ecm-product-review.component';
export const ECM_TEMPLATES: any = { export const ECM_TEMPLATES: any = {
'ecm-outing' : new EcmTemplateItem(EcmOutingComponent), 'ecm-outing' : new EcmTemplateItem(EcmOutingComponent),
...@@ -44,8 +48,9 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -44,8 +48,9 @@ export class EcmProductDetailsComponent implements OnInit {
itemDetail: ItemDetail; itemDetail: ItemDetail;
scatCode; scatCode;
noOfReviews; noOfReviews;
userReview: Reviews;
constructor(private route: ActivatedRoute, private router:Router, public productDetailService: EcmProductDetailService, public snackBar: MdSnackBar, private store: Store<EcmStoreModel>) { } constructor(private route: ActivatedRoute, private router:Router, public productDetailService: EcmProductDetailService, public snackBar: MdSnackBar, private store: Store<EcmStoreModel>, private productreviewService: EcmProductReviewService, public dialog: MdDialog) { }
ngOnInit() { ngOnInit() {
this.route.params.subscribe( params => { this.route.params.subscribe( params => {
...@@ -111,10 +116,16 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -111,10 +116,16 @@ export class EcmProductDetailsComponent implements OnInit {
} }
} }
else if( activity == 'ADD_WISHLIST' ) { else if( activity == 'ADD_WISHLIST' ) {
this.addToWishlist(data); if(this.checkUser() !== 'undefined' && this.checkUser() !== null && this.checkUser() !== 'null')
this.router.navigate(['/wishList']); {
this.addToWishlist(data.itemCode);
this.showSnackbar('Item Added to your Wishlist'); this.showSnackbar('Item Added to your Wishlist');
} }
else
{
this.showSignInPanel();
}
}
else if( activity == 'BOOK_NOW' ) { else if( activity == 'BOOK_NOW' ) {
this.showSnackbar('Book Now - Redirect to Checkout'); this.showSnackbar('Book Now - Redirect to Checkout');
} }
...@@ -123,10 +134,35 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -123,10 +134,35 @@ export class EcmProductDetailsComponent implements OnInit {
this.addToCart(data.itemCode); this.addToCart(data.itemCode);
this.showSnackbar('Item Added to your Cart'); this.showSnackbar('Item Added to your Cart');
} }
//Redirect to Checkout
//this.showSnackbar('Buy Now - Redirect to Checkout');
this.router.navigate(['/checkout']); this.router.navigate(['/checkout']);
} }
else if( activity == 'WRITE_REVIEW') {
if(this.checkUser() !== 'undefined' && this.checkUser() !== null && this.checkUser() !== 'null')
{
if(data.firstReview)
{
let dialogRef = this.dialog.open( ECMWriteReviewDialog, {
data: {
detail: this.itemDetail,
userId: JSON.parse(this.checkUser()).LOGIN_CODE
}
});
}
else
{
this.productreviewService.getUserReview(this.itemDetail.itemCode).subscribe(
userReview => {
this.userReview = userReview;
if(this.userReview)
this.openReviewDialog(this.checkUser());
});
}
}
else
{
this.showSignInPanel();
}
}
} }
addToCart(data:any) { addToCart(data:any) {
...@@ -150,9 +186,9 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -150,9 +186,9 @@ export class EcmProductDetailsComponent implements OnInit {
); );
} }
addToWishlist(data:any) { addToWishlist(itemCode) {
// this.store.dispatch({ type: INCREMENT, payload: cartData }); // this.store.dispatch({ type: INCREMENT, payload: cartData });
this.productDetailService.addToWishlist(data); this.productDetailService.addToWishlist(itemCode);
} }
showSnackbar(message) { showSnackbar(message) {
...@@ -178,4 +214,27 @@ export class EcmProductDetailsComponent implements OnInit { ...@@ -178,4 +214,27 @@ export class EcmProductDetailsComponent implements OnInit {
this.header.userAction(); this.header.userAction();
} }
checkUser(){
var userInfo = localStorage.getItem( 'userInfo' );
if ( userInfo !== 'undefined' && userInfo !== null && userInfo !== 'null' )
{
return userInfo;
}
else
{
return userInfo;
}
}
openReviewDialog(userInfo){
console.log("Complete Fecth Review");
let dialogRef = this.dialog.open( ECMWriteReviewDialog, {
data: {
detail: this.itemDetail,
userReview: this.userReview,
userId: JSON.parse(userInfo).LOGIN_CODE
}
});
}
} }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<rating [ratingDetail]="itemDetail.itemRatings" (filterBy)="filter($event);"></rating> <rating [ratingDetail]="itemDetail.itemRatings" (filterBy)="filter($event);"></rating>
</div> </div>
<div class="large-3 columns ecm-write-review"> <div class="large-3 columns ecm-write-review">
<button md-button class="write-review-button" (click)="checkUser();"> <button md-button class="write-review-button" (click)="doActivity.emit({activity:'WRITE_REVIEW', data: {} });">
<i class="material-icons edit">&#xE254;</i> <i class="material-icons edit">&#xE254;</i>
<span md-button class="write-review-text"> Write a Review </span> <span md-button class="write-review-text"> Write a Review </span>
</button> </button>
......
...@@ -13,7 +13,7 @@ import { FormBuilder, Validators,NgForm } from '@angular/forms'; ...@@ -13,7 +13,7 @@ import { FormBuilder, Validators,NgForm } from '@angular/forms';
export class EcmProductReviewComponent implements OnChanges { export class EcmProductReviewComponent implements OnChanges {
@Input() itemDetail: ItemDetail; @Input() itemDetail: ItemDetail;
@Output() showSignInPanel = new EventEmitter(); @Output() doActivity = new EventEmitter();
solrUrl = '/ecm/service/solr/local2do/'; solrUrl = '/ecm/service/solr/local2do/';
reviews: Reviews[]; reviews: Reviews[];
tabSort: string = "reviewDate desc"; tabSort: string = "reviewDate desc";
...@@ -150,34 +150,6 @@ export class EcmProductReviewComponent implements OnChanges { ...@@ -150,34 +150,6 @@ export class EcmProductReviewComponent implements OnChanges {
this.fetchReviews(); this.fetchReviews();
} }
checkUser() {
var userInfo = localStorage.getItem( 'userInfo' );
if ( userInfo !== 'undefined' && userInfo !== null && userInfo !== 'null' )
{
this.productreviewService.getUserReview(this.itemDetail.itemCode).subscribe(
userReview => {
this.userReview = userReview;
if(this.userReview)
this.openReviewDialog(userInfo);
});
}
else
{
this.showSignInPanel.emit();
}
}
openReviewDialog(userInfo){
console.log("Complete Fecth Review");
let dialogRef = this.dialog.open( ECMWriteReviewDialog, {
data: {
detail: this.itemDetail,
userReview: this.userReview,
userId: JSON.parse(userInfo).LOGIN_CODE
}
});
}
} }
@Component( { @Component( {
......
...@@ -15,7 +15,6 @@ export class EcmCelebrationComponent implements OnInit, EcmTemplateInterface { ...@@ -15,7 +15,6 @@ export class EcmCelebrationComponent implements OnInit, EcmTemplateInterface {
@Input() itemDetail: ItemDetail; @Input() itemDetail: ItemDetail;
@Output() scrollToReviews = new EventEmitter(); @Output() scrollToReviews = new EventEmitter();
@Output() doActivity = new EventEmitter(); @Output() doActivity = new EventEmitter();
@Output() showSignInPanel = new EventEmitter();
@ViewChild( 'recentView' ) recentView: EcmRecentViewComponent; @ViewChild( 'recentView' ) recentView: EcmRecentViewComponent;
userActionUrl = '/ecm/service/feeds/cart'; userActionUrl = '/ecm/service/feeds/cart';
......
...@@ -18,7 +18,6 @@ export class EcmFoodComponent implements OnInit, EcmTemplateInterface { ...@@ -18,7 +18,6 @@ export class EcmFoodComponent implements OnInit, EcmTemplateInterface {
@Input() itemDetail: ItemDetail; @Input() itemDetail: ItemDetail;
@Output() scrollToReviews = new EventEmitter(); @Output() scrollToReviews = new EventEmitter();
@Output() doActivity = new EventEmitter(); @Output() doActivity = new EventEmitter();
@Output() showSignInPanel = new EventEmitter();
@ViewChild( 'recentView' ) recentView: EcmRecentViewComponent; @ViewChild( 'recentView' ) recentView: EcmRecentViewComponent;
userActionUrl = '/ecm/service/feeds/cart'; userActionUrl = '/ecm/service/feeds/cart';
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
<!-- ------------------------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> <div>
<md-button-toggle class="wishButton" #wish> <md-button-toggle class="wishButton">
<md-icon style="color: mediumvioletred;" *ngIf="!wish.checked" (click)="checkWishlistUser();">favorite_border</md-icon> <md-icon style="color: mediumvioletred;" *ngIf="!inWishlist" (click)="addToWishlist();">favorite_border</md-icon>
<md-icon style="color: mediumvioletred;" *ngIf="wish.checked">favorite</md-icon> <md-icon style="color: mediumvioletred;" *ngIf="inWishlist">favorite</md-icon>
</md-button-toggle> </md-button-toggle>
</div> </div>
<div class="md-card-image"> <div class="md-card-image">
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<span class="seller-name">{{itemDetail.itemDetail1.sellerInfo.name}}</span><br> <span class="seller-name">{{itemDetail.itemDetail1.sellerInfo.name}}</span><br>
<a class="link-reviews"> <a class="link-reviews">
<span *ngIf="itemDetail.itemRatings.AVG_RATING == 0 && itemDetail.itemRatings.NO_OF_REVIEWS == 0 " class="review-msg-title" (click)="checkUser();"> <span *ngIf="itemDetail.itemRatings.AVG_RATING == 0 && itemDetail.itemRatings.NO_OF_REVIEWS == 0 " class="review-msg-title" (click)="doActivity.emit({activity:'WRITE_REVIEW', data: {'firstReview': true} });">
Be the first to Review this product Be the first to Review this product
</span> </span>
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<rating [rate]="itemDetail.itemRatings.AVG_RATING"></rating> <rating [rate]="itemDetail.itemRatings.AVG_RATING"></rating>
<span class="ecm-itemAvgRating">{{itemDetail.itemRatings.AVG_RATING}} Ratings</span> <span class="ecm-itemAvgRating">{{itemDetail.itemRatings.AVG_RATING}} Ratings</span>
<span *ngIf="itemDetail.itemRatings.NO_OF_REVIEWS != 0" class="ecm-itemNumOfReviews">{{itemDetail.itemRatings.NO_OF_REVIEWS}} Reviews</span> <span *ngIf="itemDetail.itemRatings.NO_OF_REVIEWS != 0" class="ecm-itemNumOfReviews">{{itemDetail.itemRatings.NO_OF_REVIEWS}} Reviews</span>
<span *ngIf="itemDetail.itemRatings.NO_OF_REVIEWS == 0" class="ecm-itemNumOfReviews" (click)="checkUser();">Be the first to Review this product</span> <span *ngIf="itemDetail.itemRatings.NO_OF_REVIEWS == 0" class="ecm-itemNumOfReviews" (click)="doActivity.emit({activity:'WRITE_REVIEW', data: {'firstReview': true} });">Be the first to Review this product</span>
</span> </span>
</a> </a>
......
...@@ -21,12 +21,12 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface { ...@@ -21,12 +21,12 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface {
@Input() itemDetail: ItemDetail; @Input() itemDetail: ItemDetail;
@Output() scrollToReviews = new EventEmitter(); @Output() scrollToReviews = new EventEmitter();
@Output() doActivity = new EventEmitter(); @Output() doActivity = new EventEmitter();
@Output() showSignInPanel = new EventEmitter();
@ViewChild( 'recentView' ) recentView: EcmRecentViewComponent; @ViewChild( 'recentView' ) recentView: EcmRecentViewComponent;
@ViewChild('itemDetails') itemDetails: ElementRef; @ViewChild('itemDetails') itemDetails: ElementRef;
@Input() isAddToCart: boolean = false; @Input() isAddToCart: boolean = false;
clientWidth: any; clientWidth: any;
itemCode; itemCode;
inWishlist;
//isCartItem = false; //isCartItem = false;
//@Input() itemData: Item; //@Input() itemData: Item;
...@@ -56,6 +56,15 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface { ...@@ -56,6 +56,15 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface {
{ {
this.isAddToCart = false; this.isAddToCart = false;
} }
if(this.itemDetail.productStatus.inWishlist == "Y")
{
this.inWishlist = true;
}
else if(this.itemDetail.productStatus.inWishlist == "N")
{
this.inWishlist = false;
}
} }
ngAfterViewInit() { ngAfterViewInit() {
...@@ -85,39 +94,8 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface { ...@@ -85,39 +94,8 @@ export class EcmHandicraftComponent implements OnInit, EcmTemplateInterface {
window.scrollTo(0, offsetTop + 60); window.scrollTo(0, offsetTop + 60);
} }
checkWishlistUser() { addToWishlist() {
var userInfo = localStorage.getItem( 'userInfo' ); this.inWishlist = true;
if ( userInfo !== 'undefined' && userInfo !== null && userInfo !== 'null' ) this.doActivity.emit({activity:'ADD_WISHLIST', data: {'itemCode' : this.itemDetail.itemCode} });
{
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' )
{
let dialogRef = this.dialog.open( ECMWriteReviewDialog, {
data: {
detail: this.itemDetail,
userId: JSON.parse(userInfo).LOGIN_CODE
}
});
}
else
{
console.log("checkUser-else");
this.showSignInPanel.emit();
}
}
} }
\ No newline at end of file
...@@ -19,7 +19,6 @@ export class EcmOutingComponent implements OnInit, EcmTemplateInterface { ...@@ -19,7 +19,6 @@ export class EcmOutingComponent implements OnInit, EcmTemplateInterface {
@Input() itemDetail: ItemDetail; @Input() itemDetail: ItemDetail;
@Output() scrollToReviews = new EventEmitter(); @Output() scrollToReviews = new EventEmitter();
@Output() doActivity = new EventEmitter(); @Output() doActivity = new EventEmitter();
@Output() showSignInPanel = new EventEmitter();
@ViewChild( 'recentView' ) recentView: EcmRecentViewComponent; @ViewChild( 'recentView' ) recentView: EcmRecentViewComponent;
counterValue = 1; counterValue = 1;
......
...@@ -22,7 +22,6 @@ export interface EcmTemplateInterface { ...@@ -22,7 +22,6 @@ export interface EcmTemplateInterface {
itemDetail: ItemDetail; itemDetail: ItemDetail;
scrollToReviews: any; scrollToReviews: any;
doActivity: any; doActivity: any;
showSignInPanel: any;
} }
@Component({ @Component({
...@@ -34,7 +33,6 @@ export class EcmTemplateComponent implements OnChanges { ...@@ -34,7 +33,6 @@ export class EcmTemplateComponent implements OnChanges {
@Output() scrollToReviews = new EventEmitter(); @Output() scrollToReviews = new EventEmitter();
@Output() doActivity = new EventEmitter(); @Output() doActivity = new EventEmitter();
@Output() showSignInPanel = new EventEmitter();
@Input('ecmTemplate') ecmTemplate: EcmTemplateItem; @Input('ecmTemplate') ecmTemplate: EcmTemplateItem;
@Input('itemDetail') itemDetail:ItemDetail; @Input('itemDetail') itemDetail:ItemDetail;
...@@ -59,7 +57,6 @@ export class EcmTemplateComponent implements OnChanges { ...@@ -59,7 +57,6 @@ export class EcmTemplateComponent implements OnChanges {
(<EcmTemplateInterface>componentRef.instance).itemDetail = ecmTemplateItem.itemDetail; (<EcmTemplateInterface>componentRef.instance).itemDetail = ecmTemplateItem.itemDetail;
(<EcmTemplateInterface>componentRef.instance).scrollToReviews = this.scrollToReviews; (<EcmTemplateInterface>componentRef.instance).scrollToReviews = this.scrollToReviews;
(<EcmTemplateInterface>componentRef.instance).doActivity = this.doActivity; (<EcmTemplateInterface>componentRef.instance).doActivity = this.doActivity;
(<EcmTemplateInterface>componentRef.instance).showSignInPanel = this.showSignInPanel;
} }
ngOnChanges(){ ngOnChanges(){
......
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