Commit 72d611b6 authored by prumde's avatar prumde

Updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174374 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 98b8894b
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 { EcmStoreModel } from '../ecm-store/ecm-store.model';
import { ItemDetail } from '../ecm-model/product-detail-model';
interface IBreadcrumb { interface IBreadcrumb {
label: string; label: string;
url: string; url: string;
} }
@Component({ @Component( {
selector: 'app-ecm-breadcrumbs', selector: 'ecm-breadcrumbs',
templateUrl: './ecm-breadcrumbs.component.html', templateUrl: './ecm-breadcrumbs.component.html',
styleUrls: ['./ecm-breadcrumbs.component.css'] styleUrls: ['./ecm-breadcrumbs.component.css']
}) })
export class EcmBreadcrumbsComponent implements OnInit { export class EcmBreadcrumbsComponent implements OnInit {
@Input() itemDetail: ItemDetail;
@Input() pageName;
breadcrumbs: IBreadcrumb[] = [];
@Input() pageName; constructor( private _location: Location, private store: Store<EcmStoreModel> ) { }
breadcrumbs:IBreadcrumb[] = [];
ngOnInit() {
constructor( private _location: Location, private store: Store<EcmStoreModel>) { } if ( this.pageName == 'SUB_CATEGORY' ) {
let storeCategory;
ngOnInit() { let category_shDescr;
if(this.pageName == 'SUB_CATEGORY')
{ this.store.select( 'CATEGORY' ).forEach( value => storeCategory = value );
let storeCategory; category_shDescr = storeCategory.shDescr
let category_shDescr;
this.breadcrumbs = [];
this.store.select('CATEGORY').forEach( this.breadcrumbs.push( {
value => storeCategory=value label: 'Home',
); url: '/home'
category_shDescr = storeCategory.shDescr });
this.breadcrumbs.push( {
this.breadcrumbs = []; label: category_shDescr,
this.breadcrumbs.push( { url: 'javascript:void(0)'
label: 'Home', });
url: '/home'
} ); }
this.breadcrumbs.push( {
label: category_shDescr, if ( this.pageName == 'ITEMS' ) {
url: 'javascript:void(0)' let storeCategory;
} ); let storeSubCategory;
} let catCode;
let catShDescr;
if(this.pageName == 'ITEMS') let subcatShDescr;
{
let storeCategory; this.store.select( 'SUBCATEGORY' ).forEach( value => storeSubCategory = value );
let storeSubCategory; if ( storeSubCategory ) {
catCode = storeSubCategory.catCode;
let catCode; subcatShDescr = storeSubCategory.shDescr;
let catShDescr; }
let subcatShDescr;
console.log( "Breadcrumbs==>" );
this.store.select('SUBCATEGORY').forEach( console.log( catCode );
value => storeSubCategory = value
); this.store.select( 'CATEGORY' ).forEach( value => storeCategory = value );
catCode = storeSubCategory.catCode; if ( storeCategory ) {
subcatShDescr = storeSubCategory.shDescr; catShDescr = storeCategory.shDescr;
}
console.log("Breadcrumbs==>");
console.log(catCode); this.breadcrumbs = [];
this.breadcrumbs.push( {
this.store.select('CATEGORY').forEach( label: 'Home',
value => storeCategory=value url: '/home'
); });
catShDescr = storeCategory.shDescr; this.breadcrumbs.push( {
label: catShDescr,
this.breadcrumbs = []; url: '/categories/' + catCode
this.breadcrumbs.push( { });
label: 'Home', this.breadcrumbs.push( {
url: '/home' label: subcatShDescr,
} ); url: 'javascript:void(0)'
this.breadcrumbs.push( { });
label: catShDescr,
url: '/list/SUB_CATEGORY/' + catCode }
} );
this.breadcrumbs.push( { if ( this.pageName == 'SEARCH' ) {
label: subcatShDescr, this.breadcrumbs = [];
url: 'javascript:void(0)' this.breadcrumbs.push( {
} ); label: 'Home',
url: '/home'
});
//Use for Detail Page this.breadcrumbs.push( {
/* label: 'Search',
this.breadcrumbs.push( { url: 'javascript:void(0)'
label: subcategory.shDescr, });
params: ['ITEMS',scatCode], }
url: '/list'
} );*/ if ( this.pageName == 'DETAIL' ) {
let catCode = this.itemDetail.itemCategory.catCode;
} let scatCode = this.itemDetail.itemSubCategory.scatCode ;
if(this.pageName == 'SEARCH') let catShDescr = this.itemDetail.itemCategory.shDescr;
{ let subcatShDescr = this.itemDetail.itemSubCategory.shDescr;
this.breadcrumbs = [];
this.breadcrumbs.push( { this.breadcrumbs = [];
label: 'Home', this.breadcrumbs.push( {
url: '/home' label: 'Home',
} ); url: '/home'
this.breadcrumbs.push( { });
label: 'Search', this.breadcrumbs.push( {
url: 'javascript:void(0)' label: catShDescr,
} ); url: '/categories/' + catCode
} });
this.breadcrumbs.push( {
} label: subcatShDescr,
url: '/products/' + scatCode
backClicked() { });
this._location.back(); // this.breadcrumbs.push( {
} // label: itemShDescr,
// // url: '/details/' + itemCode
// url: 'javascript:void(0)'
// });
}
}
backClicked() {
//TODO : Pagewise Back click
this._location.back();
}
} }
<div class="ecm-content"> <div class="ecm-content">
<ecm-trend> </ecm-trend> <ecm-trend-product> </ecm-trend-product>
<ecm-category> </ecm-category> <ecm-category> </ecm-category>
</div> </div>
...@@ -2,11 +2,15 @@ h4{ ...@@ -2,11 +2,15 @@ h4{
color: #8F8F8F; color: #8F8F8F;
} }
.categories-section { .search-result-section {
padding-top: 70px !important; position: relative;
display: block;
top: 60px !important;
padding: 0; padding: 0;
margin: 0; margin: 0;
margin-bottom: 60px;
background-color: #FFF; background-color: #FFF;
min-height: calc( 100% - 295px);
} }
.ecm-pagination-section { .ecm-pagination-section {
padding-top: 10px; padding-top: 10px;
...@@ -110,9 +114,11 @@ option{ ...@@ -110,9 +114,11 @@ option{
.ecm-section-info { .ecm-section-info {
padding: 10px; padding: 10px;
} }
.ecm-error-info { .ecm-error-info {
padding-top: 70px; text-align: center;
}
.ecm-error-info h4{
color: #ccc;
} }
.ecm-spinner { .ecm-spinner {
......
<ecm-header [isFixedHeader]=false> </ecm-header> <ecm-header [isFixedHeader]=false> </ecm-header>
<app-ecm-breadcrumbs [pageName]="'SEARCH'"> </app-ecm-breadcrumbs> <ecm-breadcrumbs [pageName]="'SEARCH'"> </ecm-breadcrumbs>
<div class="ecm-progress-bar" *ngIf="loading"> <div class="ecm-progress-bar" *ngIf="loading && !serverError">
<div class="ecm-progress-title"> Loading </div> <div class="ecm-progress-title"> Loading </div>
<md-progress-spinner <md-progress-spinner
class="ecm-spinner" class="ecm-spinner"
...@@ -12,46 +12,52 @@ ...@@ -12,46 +12,52 @@
</md-progress-spinner> </md-progress-spinner>
</div> </div>
<div *ngIf="items && resultFound"> <section class="search-result-section">
<section class="categories-section"> <div class="ecm-error-info" *ngIf="serverError">
<div class="row row-category"> <h2>Something goes wrong. Please try searching for something else </h2>
<div class="ecm-result-header"> </div>
<span class="ecm-result-info" *ngIf="myCity">{{numFound}} Results Found for {{value}} in {{myCity}}</span>
<span class="ecm-result-info" *ngIf="!myCity">{{numFound}} Results Found for {{value}}</span> <div class="ecm-error-info" *ngIf="!resultFound && !serverError">
<select (change)="sortBy($event.target.value)"> <h2> Sorry, no results found for {{value}} in {{myCity}} </h2>
<h4> Please check the spelling or try searching for something else </h4>
</div>
<div *ngIf="items && resultFound" class="row row-category">
<div class="ecm-result-header">
<span class="ecm-result-info" *ngIf="myCity">{{numFound}} Results Found for {{value}} in {{myCity}}</span>
<span class="ecm-result-info" *ngIf="!myCity">{{numFound}} Results Found for {{value}}</span>
<select (change)="sortBy($event.target.value)">
<option>Rating</option> <option>Rating</option>
<option>Price: High to Low</option> <option>Price: High to Low</option>
<option>Price: Low to High</option> <option>Price: Low to High</option>
</select> </select>
<span class="ecm-sort-by">Sort By &nbsp; </span> <span class="ecm-sort-by">Sort By &nbsp; </span>
</div> </div>
<div class="small-12 medium-6 large-4 column end "*ngFor="let item of items"> <div class="small-12 medium-6 large-4 column end " *ngFor="let item of items">
<ecm-card [itemData]="item"> </ecm-card> <ecm-card [itemData]="item"> </ecm-card>
</div> </div>
<span *ngIf="resultFound" > <span *ngIf="resultFound">
<div class="ecm-pagination-section"> <div class="ecm-pagination-section">
<span class="ecm-pages-info">Page {{activePage}} of {{pageCount}}</span> <span class="ecm-pages-info">Page {{activePage}} of
<span class="prev-button" [ngClass]="{disabled:activePage === 1}" (click)="loadPrevious()"><img class="arrow_logo" src="v_left_arrow_38_38.png"></span> {{pageCount}}</span>
<span #page> <span class="prev-button"
<span *ngFor="let a of createPages(); let i = index" [ngClass]="{active:(i+1) === activePage}" class="ecm-page" (click)="goToPage(i)"> [ngClass]="{disabled:activePage === 1}" (click)="loadPrevious()">
<span>{{i+1}}</span> <img class="arrow_logo" src="v_left_arrow_38_38.png">
</span> </span>
</span> <span #page>
<span class="next-button" [ngClass]="{disabled:activePage === pageCount}" (click)="loadNext()"><img class="arrow_logo" src="v_right_arrow_38_38.png"></span> <span *ngFor="let a of createPages(); let i = index" [ngClass]="{active:(i+1) === activePage}" class="ecm-page" (click)="goToPage(i)">
</div> <span>{{i+1}}</span>
</span> </span>
</span>
<span class="next-button" [ngClass]="{disabled:activePage === pageCount}" (click)="loadNext()">
<img class="arrow_logo" src="v_right_arrow_38_38.png">
</span>
</div>
</span>
</div> </div>
</section> </section>
</div>
<div class="ecm-error-info" *ngIf="!resultFound">
<h1>No Results Found for {{value}} in {{myCity}}</h1>
</div>
<div class="ecm-error-info" *ngIf="serverError">
<h1> Server Error </h1>
</div>
<ecm-footer> </ecm-footer> <ecm-footer> </ecm-footer>
import { Component, OnInit, ViewChild,EventEmitter } from '@angular/core'; import { Component, OnInit, ViewChild,EventEmitter } from '@angular/core';
import { SearchService } from './search.service'; import { SearchService } from './search.service';
import {Http, Response, Headers} from '@angular/http'; import { Http, Response, Headers } from '@angular/http';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { Item } from '../../ecm-category/category-model'; import { Item } from '../../ecm-model/product-model';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch'; import 'rxjs/add/operator/catch';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
@Component({ @Component({
selector: 'app-ecm-search-result', selector: 'ecm-search-result',
templateUrl: './ecm-search-result.component.html', templateUrl: './ecm-search-result.component.html',
styleUrls: ['./ecm-search-result.component.css'] styleUrls: ['./ecm-search-result.component.css']
}) })
......
import { Category, SubCategory, Item } from '../ecm-category/category-model'; import { Category } from '../ecm-model/category-model';
import { SubCategory } from '../ecm-model/subcategory-model';
import { Item } from '../ecm-model/product-model';
export class EcmStoreModel { export class EcmStoreModel {
CATEGORY: Category; CATEGORY: Category;
......
...@@ -28,6 +28,10 @@ export function ITEM (state: any = null, {type, payload}) { ...@@ -28,6 +28,10 @@ export function ITEM (state: any = null, {type, payload}) {
switch (type) { switch (type) {
case 'ITEM': case 'ITEM':
return payload; return payload;
case 'CLEAR_ITEM':
return state=null;
default: default:
return state; return state;
} }
......
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