Commit b0cec811 authored by prumde's avatar prumde

Updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174347 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 29208b67
......@@ -8,11 +8,22 @@ export class EcmLocationService {
pincode;
add:any;
public location: EcmLocation;
city;
loc_data;
constructor( public http: Http) {}
search(nameKey, myArray){
for (var i=0; i < myArray.length; i++) {
if (myArray[i].types[0] === nameKey) {
return myArray[i];
}
}
}
getCitydata() {
let localCity = localStorage.getItem('city');
if([null, undefined, ""].indexOf(localCity,0) != -1){
//navigator.geolocation.getCurrentPosition(this.successCallback,this.errorCallback,this.options);
......@@ -22,7 +33,7 @@ export class EcmLocationService {
this.http.post('https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyBo62AVqqkEz5Ys9D-dQWE_VF4lVpHaFy0',options).subscribe(
response => {
if(response.status == 200){
let data = response.json();
let data = response.json();
console.log('data.......'+data.location.lng);
this.successCallback(data);
}
......@@ -40,16 +51,28 @@ export class EcmLocationService {
return this.add;
}
getCity(){
return this.city;
}
displayLocation = (latitude,longitude) => {
this.http.get('https://maps.googleapis.com/maps/api/geocode/json?latlng='+latitude+','+longitude+'&sensor=true').subscribe(
response => {
if(response.status == 200){
let data = response.json();
this.loc_data=data;
console.log(data);
if(data)
{
var resultObject = this.search("locality", data.results[0].address_components);
this.city=resultObject.long_name;
}
localStorage.setItem('mycity',this.city);
location['address'] = data.results[0].formatted_address;
this.add=data.results[0].formatted_address;
// console.log(data.results[0].formatted_address);
// console.log(this.add);
//console.log(this.add);
}
localStorage.setItem('location', JSON.stringify(location));
EmitterService.get("selectedCity").emit(location['city']);
......
......@@ -35,6 +35,7 @@
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
padding-top: 5px;
}
.ecm-card-info-subhead {
font-size: 12px;
......@@ -112,6 +113,29 @@ p {
line-height: 1.3;
}
.ecm-ratings{
top: 10px !important;
font-size: 15px;
color: rgb(500, 150, 50);
font-size: large;
display: block;
line-height: 12px;
position: relative;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
white-space: normal;
top: 5px;
}
.ecm-rupee{
color:#888;
}
#item{
cursor: pointer;
}
/*
.thumbnail{
width: 350px !important;
......
<div *ngIf="item" class="ecm-card" (click)="openItem()" style="cursor: pointer;">
<img class="ecm-card-img"src="/ecm/assets/images/items/{{item.item_code}}.png"alt="Item image">
<div *ngIf="item" class="ecm-card" id="item" (click)="openItem()">
<img class="ecm-card-img" src="/ecm/assets/images/items/{{item.item_code}}.png" alt="Item image">
<div class="ecm-card-footer">
<div class="ecm-card-info">
<span class="ecm-card-info-title" style="padding-top: 5px;">{{item.item_descr}}</span>
<span id="item" class="ecm-card-info-title">{{item.item_descr}}</span>
<span class="ecm-card-info-subhead">{{item.cat_sh_descr}} - {{item.scat_sh_descr}}</span>
<span style="top: 10px; font-size: 15px; color: rgb(500, 150, 50); font-size: large;" class="ecm-card-info-subhead">
<span class="ecm-ratings">
<span *ngFor="let a of createRatings(item.rating);">&#x2605;</span>
</span>
</div>
......@@ -13,7 +13,7 @@
<a class="ecm-card-action" routerLink="/view" routerLinkActive="active">View</a>
<a class="ecm-card-action top share" routerLink="/share" routerLinkActive="active"></a>
-->
<div class="ecm-card-price"><span style="color:#888;"></span>{{item.cost_rate}}</div>
<div class="ecm-card-price"><span class="ecm-rupee"></span>{{item.cost_rate}}</div>
</div>
</div>
......
......@@ -6,13 +6,18 @@ h4{
padding: 0;
margin: 0;
padding-top: 100px;
padding-top: 50px;
padding-top: 70px;
background-color: #FFF;
}
.ecm-pagination-section {
padding-top: 10px;
padding-left: 15px;
padding-right: 15px;
width:100%;
padding-left: 15px;
padding-bottom: 50px;
overflow: hidden;
text-align: center;
}
.ecm-section-info-title {
font-size: 26px;
......@@ -33,14 +38,18 @@ h4{
}
.ecm-page {
width: 15px;
height: 15px;
font-size: 15px;
padding: 5px;
text-align: center;
border-radius: 100%;
color: mediumvioletred;
cursor: pointer;
width: 25px;
height: 25px;
font-size: 15px;
line-height: 15px;
padding: 5px;
margin: 5px;
text-align: center;
border-radius: 100%;
color: mediumvioletred;
cursor: pointer;
position: relative;
display: inline-block;
}
.ecm-page:HOVER {
background-color: mediumvioletred;
......@@ -53,7 +62,7 @@ h4{
}
.arrow_logo{
height: 25px;
height: 30px;
}
select{
......@@ -77,5 +86,92 @@ select{
}
option{
color: #444;
color: white;
background-color: mediumvioletred;
}
.ecm-pages-info{
color: #444;
float: left;
font-size: 15px;
padding-top: 5px;
}
.ecm-sort-by{
float: right;
color: #444;
font-size: 15px;
}
.ecm-result-info{
color: #444;
font-size: 15px
}
/* BreadCrumbs */
.ecm-breadcrumbs {
/* font-size: .85em; */
color: #000;
line-height: 1.5;
/* margin: 20px; */
padding-left: 0;
margin: 0;
list-style-type: none;
}
.ecm-breadcrumbs li {
display: inline;
list-style-type: none;
margin-left: 0;
}
.ecm-breadcrumbs li:before {
content: "/";
padding-left: 5px;
padding-right: 5px;
color: mediumvioletred;
}
.ecm-breadcrumbs li:first-child:before {
content: "";
padding-right: 5px;
}
.ecm-breadcrumbs li a {
background-color: transparent;
color: mediumvioletred;
text-decoration: none;
cursor: pointer;
}
.ecm-breadcrumbs li a:hover {
color: rgba(199, 21, 133, 0.45);
}
.row.sub-heading {
top: 60px;
position: relative;
background: #ffffff;
max-width: 100rem;
padding-left: 3rem;
box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.1);
}
.img-back-32 {
/*content: url(../../assets/images/w_user_32_32.png);*/
content: url(../../../assets/images/svg/back_32_32.svg);
}
.fixed-header-back {
position: absolute;
padding: 0;
height: 20px !important;
width: 20px !important;
box-shadow: 0 0 0 3px rgba(0 ,0 ,0, 0.1), inset 0 0 0px 20px rgba(0 ,0, 0, 0.1);
cursor: pointer;
border-radius: 100%;
margin-left: -2rem !important;
}
.ecm-section-info {
padding: 10px;
}
\ No newline at end of file
<ecm-header [isFixedHeader]=false> </ecm-header>
<div class="row sub-heading">
<div class="ecm-section-info" >
<img class="fixed-header-back img-back-32" (click) = "backClicked();" />
<ul class="ecm-breadcrumbs">
<li *ngFor="let breadcrumb of breadcrumbs">
<a [routerLink]="[breadcrumb.url]">{{breadcrumb.label}}</a>
</li>
</ul>
</div>
</div>
<div *ngIf="items">
<section class="categories-section">
<div class="row row-category">
<div class="ecm-result-header">
<span style="color: #444; font-size: 15px">{{items.response.numFound}} Results Found for {{value}}</span>
<select>
<option value="volvo">Popularity</option>
<option value="saab">Price: High to Low</option>
<option value="opel">Price: Low to High</option>
</select>
<span style="float: right; color: #444; font-size: 15px;">Sort By &nbsp; </span>
<span *ngIf="!resultFound">
<h2>No Results Found for {{value}} in {{myCity}}</h2>
</span>
<span *ngIf="resultFound" >
<span class="ecm-result-info">{{numFound}} Results Found for {{value}} in {{myCity}}</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>
</span>
</div>
<div class="small-12 medium-6 large-4 column end "*ngFor="let item of items?.response?.docs">
<app-ecm-search-item [item]="item"></app-ecm-search-item>
</div>
<div style="width:100%; padding-left: 15px;padding-bottom: 50px;overflow: hidden;text-align: center;" class="ecm-pagination-section">
<span style="color: #444; float: left; font-size: 15px; padding-top: 5px;">Page {{activePage}} of {{pageCount}}</span>
<button [disabled]="isInvalidPrev()" (click)="loadPrevious()"><img class="arrow_logo" src="v_left_arrow_38_38.png"></button>
</div>
<span *ngIf="resultFound" >
<div class="ecm-pagination-section">
<span class="ecm-pages-info">Page {{activePage}} of {{pageCount}}</span>
<button [disabled]="isInvalidPrev()" (click)="loadPrevious()"><img class="arrow_logo" src="v_left_arrow_38_38.png"></button>
<span #page>
<span *ngFor="let a of createPages(); let i = index" class="ecm-page" (click)="goToPage(i)">{{i+1}}</span>
<span *ngFor="let a of createPages(); let i = index" class="ecm-page" (click)="goToPage(i)">
<span>{{i+1}}</span>
</span>
</span>
<button [disabled]="isInvalidNext()" (click)="loadNext()"><img class="arrow_logo" src="v_right_arrow_38_38.png"></button>
</div>
<button [disabled]="isInvalidNext()" (click)="loadNext()"><img class="arrow_logo" src="v_right_arrow_38_38.png"></button>
</div>
</span>
</div>
</section>
</div>
<ecm-footer> </ecm-footer>
<!--
<ecm-header [isFixedHeader]=false> </ecm-header>
<div class="column row">
<hr>
<div class="tabs-content">
<div class="tabs-panel is-active" id="panel1">
<span *ngIf="items">
<h4>{{items.response.numFound}} Results Found for {{value}}</h4>
</span>
<span *ngIf="!items">
<h4>No Results Found for {{value}}</h4>
</span>
<div *ngFor="let item of items?.response?.docs">
<app-ecm-result-item [item]="item"></app-ecm-result-item>
</div>
<button [disabled]="isInvalid()" (click)="loadNext()" class="button small expanded">Next</button>
</div>
</div>
</div>
<ecm-footer> </ecm-footer>
-->
\ No newline at end of file
import { Component, OnInit, ViewChild } from '@angular/core';
import { Component, OnInit, ViewChild,EventEmitter } from '@angular/core';
import { SearchService } from './search.service';
import {Http, Response, Headers} from '@angular/http';
import { ActivatedRoute } from '@angular/router';
import { IBreadcrumb } from '../../ecm-category/category-model';
import 'rxjs/add/operator/map';
......@@ -18,45 +19,79 @@ export class EcmSearchResultComponent implements OnInit {
numFound;
pageCount;
activePage;
myCity;
resultFound:boolean;
sortType="rating desc";
solrUrl= '/ecm/service/solr/local2do/';
breadcrumbs:IBreadcrumb[] = [];
@ViewChild('page') page;
constructor(private search_service: SearchService, private http:Http, private route:ActivatedRoute) {}
ngOnInit() {
this.breadcrumbs = [];
this.breadcrumbs.push( {
label: 'Home',
url: '/home'
} );
this.breadcrumbs.push( {
label: 'Search',
url: 'javascript:void(0)'
} );
this.myCity = localStorage.getItem('mycity');
this.route.params.subscribe( params => {
this.unHighlightPrev();
this.value = params['value'];
var URL= '/ecm/service/solr/local2do/'+this.value+'/json/0';
this.activePage=1;
this.isInvalidNext();
window.scrollTo(0,0);
this.http.get(URL)
.map(res => res.json())
.subscribe(data => this.items = data,
() => console.log('Completed'));
this.start=0;
this.start=0;
this.fetchItems();
}
);
}
isInvalidNext(){
fetchItems(){
var solrUrl= this.solrUrl+this.value+'/json/'+this.start+'/'+this.sortType;
this.http.get(solrUrl)
.map(res => res.json())
.subscribe(data => this.items = data,
() => console.log("Completed"));
}
ngAfterContentChecked(){
if(this.items)
{
this.numFound=this.items.response.numFound;
if(this.numFound==0)
{
this.resultFound = false;
}
else
{
this.resultFound = true;
}
this.pageCount=Math.ceil((this.numFound/10));
if(this.page)
this.highlightSelected();
}
if(this.numFound>(this.start+10))
{
return false;
this.highlightSelected();
}
else
}
isInvalidNext(){
if(this.items)
{
return true;
if(this.numFound>(this.start+10))
{
return false;
}
else
{
return true;
}
}
}
......@@ -80,11 +115,7 @@ export class EcmSearchResultComponent implements OnInit {
this.highlightSelected();
if(this.numFound>(this.start))
{
var URL= '/ecm/service/solr/local2do/'+this.value+'/json/'+this.start;
this.http.get(URL)
.map(res => res.json())
.subscribe(data => this.items = data,
() => console.log('Completed'));
this.fetchItems();
}
}
......@@ -98,11 +129,7 @@ export class EcmSearchResultComponent implements OnInit {
if(this.numFound>(this.start))
{
var URL= '/ecm/service/solr/local2do/'+this.value+'/json/'+this.start;
this.http.get(URL)
.map(res => res.json())
.subscribe(data => this.items = data,
() => console.log('Completed'));
this.fetchItems();
}
}
......@@ -117,30 +144,50 @@ export class EcmSearchResultComponent implements OnInit {
goToPage(value){
window.scrollTo(0,0);
this.isInvalidNext();
this.start=(value+1)*10;
this.start=((value+1)*10)-10;
this.unHighlightPrev();
this.activePage=value+1;
this.highlightSelected();
if(this.numFound>(this.start))
{
var URL= '/ecm/service/solr/local2do/'+this.value+'/json/'+this.start;
this.http.get(URL)
.map(res => res.json())
.subscribe(data => this.items = data,
() => console.log('Completed'));
this.fetchItems();
}
}
highlightSelected(){
this.page.nativeElement.children[this.activePage-1].style.backgroundColor='mediumvioletred';
this.page.nativeElement.children[this.activePage-1].style.color='#fff';
this.page.nativeElement.children[this.activePage-1].disabled = true;
if(this.page)
{
if(this.page.nativeElement.children[this.activePage-1])
{
this.page.nativeElement.children[this.activePage-1].style.backgroundColor='mediumvioletred';
this.page.nativeElement.children[this.activePage-1].style.color='#fff';
this.page.nativeElement.children[this.activePage-1].disabled = true;
}
}
}
unHighlightPrev(){
this.page.nativeElement.children[this.activePage-1].style.backgroundColor='';
this.page.nativeElement.children[this.activePage-1].style.color='mediumvioletred';
this.page.nativeElement.children[this.activePage-1].disabled = false;
if(this.page)
{
if(this.page.nativeElement.children[this.activePage-1])
{
this.page.nativeElement.children[this.activePage-1].style.backgroundColor='';
this.page.nativeElement.children[this.activePage-1].style.color='mediumvioletred';
this.page.nativeElement.children[this.activePage-1].disabled = false;
}
}
}
sortBy(value){
console.log(value);
if(value=='Rating')
this.sortType='rating desc';
if(value=='Price: High to Low')
this.sortType='cost_rate desc';
if(value=='Price: Low to High')
this.sortType='cost_rate asc';
this.fetchItems();
}
}
......@@ -110,11 +110,11 @@
/*Fixed Header Search Input*/
.sb-search {
position: relative;
margin-top: 4px;
margin-top: 9px;
margin-right: 10px;
width: 0%;
min-width: 32px;
height: 32px;
height: 40px;
float: right;
overflow: hidden;
-webkit-transition: width 0.4s;
......@@ -127,14 +127,14 @@
top: 0;
right: 0;
border: 0;
border-radius: 5px;
border-radius: 2px;
outline: none;
background-color: mediumvioletred;
width: 100%;
height: 32px;
height: 40px;
margin: 0;
z-index: 16;
padding: 0px 65px 0 10px;
padding: 0px 65px 2px 10px;
font-size: 12px;
color: #fff;
box-shadow: none;
......@@ -156,39 +156,39 @@
color: #2c3e50;
}
*/
.sb-icon-search, .sb-search-submit {
width: 32px;
height: 32px;
.sb-icon-search, .sb-search-reset {
width: 38px;
height: 38px;
display: block;
position: absolute;
right: 0;
top: 0;
top: 15px;
padding: 0;
margin: 0;
margin: -7px;
line-height: 32px;
text-align: center;
cursor: pointer;
}
.sb-search-submit {
background: #fff; /* IE needs this */
background-color: mediumvioletred;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
/* IE 8 */
filter: alpha(opacity = 0); /* IE 5-7 */
opacity: 0;
color: transparent;
border: none;
outline: none;
z-index: -1;
.sb-search-reset {
background: white;
border: none;
outline: none;
z-index: -1;
width: 20px;
height: 20px;
top: 0;
margin: 0;
margin: 10px 5px 10px 5px;
line-height: inherit;
}
.sb-icon-search {
color: #fff;
z-index: 90;
/*background-image: url(../../assets/images/w_search_38_38.png);*/
background-image: url(../../assets/images/svg/w_search_38_38.svg);
background-position: 5px 4px;
background-position: 0px 0px;
background-repeat: no-repeat;
background-size: 24px 24px;
background-size: 30px 30px;
border: none;
outline: none;
}
......@@ -201,21 +201,27 @@
}
.sb-search.sb-search-open .sb-search-input {
border: none;
border-radius: 5px;
border-radius: 2px;
background-color: #fff;
color: black;
padding-left: 40px;
padding-left: 50px;
z-index: 16;
}
.sb-search.sb-search-open .sb-icon-search {
border: none;
border-radius: 5px;
background-image: url(../../assets/images/v_search_38_38.png);
left: 5px;
left: 16px;
padding-left: 40px;
z-index: 16;
top: 12px;
}
.sb-search
{
padding:9px;
padding-left: 0px;
}
.sb-search.sb-search-open .sb-search-submit {
.sb-search.sb-search-open .sb-search-reset {
z-index: 90;
}
.hide {
......
<form *ngIf="headerState === 'relative'" action="#" method="post"id="search-form" [@searchInputTrans]="compFadeState">
<span class="search-page-border">
<input #myInput type="text"placeholder="Search Food, Tour, Events and More..."class="search-terms" name="search-terms" />
<span class="search-which-border">
<div class="locate-me">Locate Me</div>
<div class="locate-handle" (click)="getAddress();" ></div>
<img class="img-locate"title="Locate Me" />
<select name="search-which" class="search-which">
<option value="members">Mumbai</option>
<option value="groups">Pune</option>
<option value="forums">Nashik</option>
<option value="posts">Nagpur</option>
</select>
</span>
<span class="search-which-border">
<div #locateMeButton class="locate-me">Locate Me</div>
<div class="locate-handle" (click)="getAddress();" ></div>
<img class="img-locate"title="Locate Me" />
<select name="search-which" class="search-which">
<option value="members">Mumbai</option>
<option value="groups">Pune</option>
<option value="forums">Nashik</option>
<option value="posts">Nagpur</option>
</select>
</span>
</span>
<input type="submit" name="search-submit" class="search-submit" value="Search" (click)="search(myInput.value)"/>
</form>
<div *ngIf="headerState === 'fixed'" id="sb-search" class="sb-search">
<form>
<input #myInput class="sb-search-input" placeholder="Search ..." type="text"value="" name="search" id="search">
<input class="sb-search-submit" type="submit" value="" (click)="search(myInput.value)">
<input class="sb-search-reset" type="reset" value="x" >
<input style="width: 0%" type="submit" (click)="search(myInput.value)">
<span class="sb-icon-search"></span>
</form>
</div>
......@@ -31,6 +31,7 @@ import { Router } from '@angular/router';
export class ECMSearchComponent implements OnInit {
@Input('compFadeState') compFadeState: string = 'false';
@Input('headerState') headerState: string = 'relative';
@ViewChild('locateMeButton') locateMeButton;
@ViewChild('myInput') searchBar;
public selectedCity: string;
public pincode;
......@@ -42,25 +43,30 @@ export class ECMSearchComponent implements OnInit {
ngOnInit() {
this.selectedCity = localStorage.getItem('city');
this.search_key=this.search_service.getSearch();
}
ngAfterViewChecked() {
if(this.form_add)
{
this.searchBar.nativeElement.value=this.form_add;
}
this.searchBar.nativeElement.value=this.form_add;
}
ngAfterViewInit() {
if(this.search_key && this.searchBar)
this.searchBar.nativeElement.value=this.search_key;
this.searchBar.nativeElement.value=this.search_key;
if(localStorage.getItem('mycity'))
if(this.locateMeButton)
this.locateMeButton.nativeElement.textContent=localStorage.getItem('mycity');
}
getAddress() {
this._ngLocation.getCitydata();
EmitterService.get("selectedCity").subscribe( data =>{
this.form_add=this._ngLocation.getAddress();
//this.form_add=this._ngLocation.getAddress();
let myLocation=this._ngLocation.getAddress();
localStorage.setItem('myLocation',myLocation);
this.locateMeButton.nativeElement.textContent=this._ngLocation.getCity();
});
}
......
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