Commit 788bd1e8 authored by prumde's avatar prumde

Updated


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