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 { ...@@ -8,11 +8,22 @@ export class EcmLocationService {
pincode; pincode;
add:any; add:any;
public location: EcmLocation; public location: EcmLocation;
city;
loc_data;
constructor( public http: Http) {} 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() { getCitydata() {
let localCity = localStorage.getItem('city'); let localCity = localStorage.getItem('city');
if([null, undefined, ""].indexOf(localCity,0) != -1){ if([null, undefined, ""].indexOf(localCity,0) != -1){
//navigator.geolocation.getCurrentPosition(this.successCallback,this.errorCallback,this.options); //navigator.geolocation.getCurrentPosition(this.successCallback,this.errorCallback,this.options);
...@@ -22,7 +33,7 @@ export class EcmLocationService { ...@@ -22,7 +33,7 @@ export class EcmLocationService {
this.http.post('https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyBo62AVqqkEz5Ys9D-dQWE_VF4lVpHaFy0',options).subscribe( this.http.post('https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyBo62AVqqkEz5Ys9D-dQWE_VF4lVpHaFy0',options).subscribe(
response => { response => {
if(response.status == 200){ if(response.status == 200){
let data = response.json(); let data = response.json();
console.log('data.......'+data.location.lng); console.log('data.......'+data.location.lng);
this.successCallback(data); this.successCallback(data);
} }
...@@ -40,16 +51,28 @@ export class EcmLocationService { ...@@ -40,16 +51,28 @@ export class EcmLocationService {
return this.add; return this.add;
} }
getCity(){
return this.city;
}
displayLocation = (latitude,longitude) => { displayLocation = (latitude,longitude) => {
this.http.get('https://maps.googleapis.com/maps/api/geocode/json?latlng='+latitude+','+longitude+'&sensor=true').subscribe( this.http.get('https://maps.googleapis.com/maps/api/geocode/json?latlng='+latitude+','+longitude+'&sensor=true').subscribe(
response => { response => {
if(response.status == 200){ if(response.status == 200){
let data = response.json(); 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; location['address'] = data.results[0].formatted_address;
this.add=data.results[0].formatted_address; this.add=data.results[0].formatted_address;
// console.log(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)); localStorage.setItem('location', JSON.stringify(location));
EmitterService.get("selectedCity").emit(location['city']); EmitterService.get("selectedCity").emit(location['city']);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
padding-top: 5px;
} }
.ecm-card-info-subhead { .ecm-card-info-subhead {
font-size: 12px; font-size: 12px;
...@@ -112,6 +113,29 @@ p { ...@@ -112,6 +113,29 @@ p {
line-height: 1.3; 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{ .thumbnail{
width: 350px !important; width: 350px !important;
......
<div *ngIf="item" class="ecm-card" (click)="openItem()" style="cursor: pointer;"> <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"> <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-footer">
<div class="ecm-card-info"> <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 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 *ngFor="let a of createRatings(item.rating);">&#x2605;</span>
</span> </span>
</div> </div>
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<a class="ecm-card-action" routerLink="/view" routerLinkActive="active">View</a> <a class="ecm-card-action" routerLink="/view" routerLinkActive="active">View</a>
<a class="ecm-card-action top share" routerLink="/share" routerLinkActive="active"></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>
</div> </div>
......
...@@ -6,13 +6,18 @@ h4{ ...@@ -6,13 +6,18 @@ h4{
padding: 0; padding: 0;
margin: 0; margin: 0;
padding-top: 100px; padding-top: 100px;
padding-top: 50px; padding-top: 70px;
background-color: #FFF; background-color: #FFF;
} }
.ecm-pagination-section { .ecm-pagination-section {
padding-top: 10px; padding-top: 10px;
padding-left: 15px; padding-left: 15px;
padding-right: 15px; padding-right: 15px;
width:100%;
padding-left: 15px;
padding-bottom: 50px;
overflow: hidden;
text-align: center;
} }
.ecm-section-info-title { .ecm-section-info-title {
font-size: 26px; font-size: 26px;
...@@ -33,14 +38,18 @@ h4{ ...@@ -33,14 +38,18 @@ h4{
} }
.ecm-page { .ecm-page {
width: 15px; width: 25px;
height: 15px; height: 25px;
font-size: 15px; font-size: 15px;
padding: 5px; line-height: 15px;
text-align: center; padding: 5px;
border-radius: 100%; margin: 5px;
color: mediumvioletred; text-align: center;
cursor: pointer; border-radius: 100%;
color: mediumvioletred;
cursor: pointer;
position: relative;
display: inline-block;
} }
.ecm-page:HOVER { .ecm-page:HOVER {
background-color: mediumvioletred; background-color: mediumvioletred;
...@@ -53,7 +62,7 @@ h4{ ...@@ -53,7 +62,7 @@ h4{
} }
.arrow_logo{ .arrow_logo{
height: 25px; height: 30px;
} }
select{ select{
...@@ -77,5 +86,92 @@ select{ ...@@ -77,5 +86,92 @@ select{
} }
option{ 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> <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"> <div *ngIf="items">
<section class="categories-section"> <section class="categories-section">
<div class="row row-category"> <div class="row row-category">
<div class="ecm-result-header"> <div class="ecm-result-header">
<span style="color: #444; font-size: 15px">{{items.response.numFound}} Results Found for {{value}}</span> <span *ngIf="!resultFound">
<select> <h2>No Results Found for {{value}} in {{myCity}}</h2>
<option value="volvo">Popularity</option> </span>
<option value="saab">Price: High to Low</option>
<option value="opel">Price: Low to High</option> <span *ngIf="resultFound" >
</select> <span class="ecm-result-info">{{numFound}} Results Found for {{value}} in {{myCity}}</span>
<span style="float: right; color: #444; font-size: 15px;">Sort By &nbsp; </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>
<div class="small-12 medium-6 large-4 column end "*ngFor="let item of items?.response?.docs"> <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> <app-ecm-search-item [item]="item"></app-ecm-search-item>
</div> </div>
<div style="width:100%; padding-left: 15px;padding-bottom: 50px;overflow: hidden;text-align: center;" class="ecm-pagination-section"> <span *ngIf="resultFound" >
<span style="color: #444; float: left; font-size: 15px; padding-top: 5px;">Page {{activePage}} of {{pageCount}}</span> <div class="ecm-pagination-section">
<button [disabled]="isInvalidPrev()" (click)="loadPrevious()"><img class="arrow_logo" src="v_left_arrow_38_38.png"></button> <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 #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> </span>
<button [disabled]="isInvalidNext()" (click)="loadNext()"><img class="arrow_logo" src="v_right_arrow_38_38.png"></button> <button [disabled]="isInvalidNext()" (click)="loadNext()"><img class="arrow_logo" src="v_right_arrow_38_38.png"></button>
</div> </div>
</span>
</div> </div>
</section> </section>
</div> </div>
<ecm-footer> </ecm-footer> <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 { 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 { IBreadcrumb } from '../../ecm-category/category-model';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
...@@ -18,45 +19,79 @@ export class EcmSearchResultComponent implements OnInit { ...@@ -18,45 +19,79 @@ export class EcmSearchResultComponent implements OnInit {
numFound; numFound;
pageCount; pageCount;
activePage; activePage;
myCity;
resultFound:boolean;
sortType="rating desc";
solrUrl= '/ecm/service/solr/local2do/';
breadcrumbs:IBreadcrumb[] = [];
@ViewChild('page') page; @ViewChild('page') page;
constructor(private search_service: SearchService, private http:Http, private route:ActivatedRoute) {} constructor(private search_service: SearchService, private http:Http, private route:ActivatedRoute) {}
ngOnInit() { 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.route.params.subscribe( params => {
this.unHighlightPrev();
this.value = params['value']; this.value = params['value'];
var URL= '/ecm/service/solr/local2do/'+this.value+'/json/0';
this.activePage=1; this.activePage=1;
this.isInvalidNext(); this.isInvalidNext();
window.scrollTo(0,0); window.scrollTo(0,0);
this.http.get(URL) this.start=0;
.map(res => res.json()) this.fetchItems();
.subscribe(data => this.items = data,
() => console.log('Completed'));
this.start=0;
} }
); );
} }
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) if(this.items)
{ {
this.numFound=this.items.response.numFound; this.numFound=this.items.response.numFound;
if(this.numFound==0)
{
this.resultFound = false;
}
else
{
this.resultFound = true;
}
this.pageCount=Math.ceil((this.numFound/10)); this.pageCount=Math.ceil((this.numFound/10));
if(this.page) this.highlightSelected();
this.highlightSelected();
}
if(this.numFound>(this.start+10))
{
return false;
} }
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 { ...@@ -80,11 +115,7 @@ export class EcmSearchResultComponent implements OnInit {
this.highlightSelected(); this.highlightSelected();
if(this.numFound>(this.start)) if(this.numFound>(this.start))
{ {
var URL= '/ecm/service/solr/local2do/'+this.value+'/json/'+this.start; this.fetchItems();
this.http.get(URL)
.map(res => res.json())
.subscribe(data => this.items = data,
() => console.log('Completed'));
} }
} }
...@@ -98,11 +129,7 @@ export class EcmSearchResultComponent implements OnInit { ...@@ -98,11 +129,7 @@ export class EcmSearchResultComponent implements OnInit {
if(this.numFound>(this.start)) if(this.numFound>(this.start))
{ {
var URL= '/ecm/service/solr/local2do/'+this.value+'/json/'+this.start; this.fetchItems();
this.http.get(URL)
.map(res => res.json())
.subscribe(data => this.items = data,
() => console.log('Completed'));
} }
} }
...@@ -117,30 +144,50 @@ export class EcmSearchResultComponent implements OnInit { ...@@ -117,30 +144,50 @@ export class EcmSearchResultComponent implements OnInit {
goToPage(value){ goToPage(value){
window.scrollTo(0,0); window.scrollTo(0,0);
this.isInvalidNext(); this.isInvalidNext();
this.start=(value+1)*10; this.start=((value+1)*10)-10;
this.unHighlightPrev(); this.unHighlightPrev();
this.activePage=value+1; this.activePage=value+1;
this.highlightSelected(); this.highlightSelected();
if(this.numFound>(this.start)) if(this.numFound>(this.start))
{ {
var URL= '/ecm/service/solr/local2do/'+this.value+'/json/'+this.start; this.fetchItems();
this.http.get(URL)
.map(res => res.json())
.subscribe(data => this.items = data,
() => console.log('Completed'));
} }
} }
highlightSelected(){ highlightSelected(){
this.page.nativeElement.children[this.activePage-1].style.backgroundColor='mediumvioletred'; if(this.page)
this.page.nativeElement.children[this.activePage-1].style.color='#fff'; {
this.page.nativeElement.children[this.activePage-1].disabled = true; 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(){ unHighlightPrev(){
this.page.nativeElement.children[this.activePage-1].style.backgroundColor=''; if(this.page)
this.page.nativeElement.children[this.activePage-1].style.color='mediumvioletred'; {
this.page.nativeElement.children[this.activePage-1].disabled = false; 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 @@ ...@@ -110,11 +110,11 @@
/*Fixed Header Search Input*/ /*Fixed Header Search Input*/
.sb-search { .sb-search {
position: relative; position: relative;
margin-top: 4px; margin-top: 9px;
margin-right: 10px; margin-right: 10px;
width: 0%; width: 0%;
min-width: 32px; min-width: 32px;
height: 32px; height: 40px;
float: right; float: right;
overflow: hidden; overflow: hidden;
-webkit-transition: width 0.4s; -webkit-transition: width 0.4s;
...@@ -127,14 +127,14 @@ ...@@ -127,14 +127,14 @@
top: 0; top: 0;
right: 0; right: 0;
border: 0; border: 0;
border-radius: 5px; border-radius: 2px;
outline: none; outline: none;
background-color: mediumvioletred; background-color: mediumvioletred;
width: 100%; width: 100%;
height: 32px; height: 40px;
margin: 0; margin: 0;
z-index: 16; z-index: 16;
padding: 0px 65px 0 10px; padding: 0px 65px 2px 10px;
font-size: 12px; font-size: 12px;
color: #fff; color: #fff;
box-shadow: none; box-shadow: none;
...@@ -156,39 +156,39 @@ ...@@ -156,39 +156,39 @@
color: #2c3e50; color: #2c3e50;
} }
*/ */
.sb-icon-search, .sb-search-submit { .sb-icon-search, .sb-search-reset {
width: 32px; width: 38px;
height: 32px; height: 38px;
display: block; display: block;
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 15px;
padding: 0; padding: 0;
margin: 0; margin: -7px;
line-height: 32px; line-height: 32px;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
} }
.sb-search-submit { .sb-search-reset {
background: #fff; /* IE needs this */ background: white;
background-color: mediumvioletred; border: none;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; outline: none;
/* IE 8 */ z-index: -1;
filter: alpha(opacity = 0); /* IE 5-7 */ width: 20px;
opacity: 0; height: 20px;
color: transparent; top: 0;
border: none; margin: 0;
outline: none; margin: 10px 5px 10px 5px;
z-index: -1; line-height: inherit;
} }
.sb-icon-search { .sb-icon-search {
color: #fff; color: #fff;
z-index: 90; z-index: 90;
/*background-image: url(../../assets/images/w_search_38_38.png);*/ /*background-image: url(../../assets/images/w_search_38_38.png);*/
background-image: url(../../assets/images/svg/w_search_38_38.svg); background-image: url(../../assets/images/svg/w_search_38_38.svg);
background-position: 5px 4px; background-position: 0px 0px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 24px 24px; background-size: 30px 30px;
border: none; border: none;
outline: none; outline: none;
} }
...@@ -201,21 +201,27 @@ ...@@ -201,21 +201,27 @@
} }
.sb-search.sb-search-open .sb-search-input { .sb-search.sb-search-open .sb-search-input {
border: none; border: none;
border-radius: 5px; border-radius: 2px;
background-color: #fff; background-color: #fff;
color: black; color: black;
padding-left: 40px; padding-left: 50px;
z-index: 16; z-index: 16;
} }
.sb-search.sb-search-open .sb-icon-search { .sb-search.sb-search-open .sb-icon-search {
border: none; border: none;
border-radius: 5px; border-radius: 5px;
background-image: url(../../assets/images/v_search_38_38.png); background-image: url(../../assets/images/v_search_38_38.png);
left: 5px; left: 16px;
padding-left: 40px; padding-left: 40px;
z-index: 16; 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; z-index: 90;
} }
.hide { .hide {
......
<form *ngIf="headerState === 'relative'" action="#" method="post"id="search-form" [@searchInputTrans]="compFadeState"> <form *ngIf="headerState === 'relative'" action="#" method="post"id="search-form" [@searchInputTrans]="compFadeState">
<span class="search-page-border"> <span class="search-page-border">
<input #myInput type="text"placeholder="Search Food, Tour, Events and More..."class="search-terms" name="search-terms" /> <input #myInput type="text"placeholder="Search Food, Tour, Events and More..."class="search-terms" name="search-terms" />
<span class="search-which-border"> <span class="search-which-border">
<div class="locate-me">Locate Me</div> <div #locateMeButton class="locate-me">Locate Me</div>
<div class="locate-handle" (click)="getAddress();" ></div> <div class="locate-handle" (click)="getAddress();" ></div>
<img class="img-locate"title="Locate Me" /> <img class="img-locate"title="Locate Me" />
<select name="search-which" class="search-which"> <select name="search-which" class="search-which">
<option value="members">Mumbai</option> <option value="members">Mumbai</option>
<option value="groups">Pune</option> <option value="groups">Pune</option>
<option value="forums">Nashik</option> <option value="forums">Nashik</option>
<option value="posts">Nagpur</option> <option value="posts">Nagpur</option>
</select> </select>
</span> </span>
</span> </span>
<input type="submit" name="search-submit" class="search-submit" value="Search" (click)="search(myInput.value)"/> <input type="submit" name="search-submit" class="search-submit" value="Search" (click)="search(myInput.value)"/>
</form> </form>
<div *ngIf="headerState === 'fixed'" id="sb-search" class="sb-search"> <div *ngIf="headerState === 'fixed'" id="sb-search" class="sb-search">
<form> <form>
<input #myInput class="sb-search-input" placeholder="Search ..." type="text"value="" name="search" id="search"> <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> <span class="sb-icon-search"></span>
</form> </form>
</div> </div>
...@@ -31,6 +31,7 @@ import { Router } from '@angular/router'; ...@@ -31,6 +31,7 @@ import { Router } from '@angular/router';
export class ECMSearchComponent implements OnInit { export class ECMSearchComponent implements OnInit {
@Input('compFadeState') compFadeState: string = 'false'; @Input('compFadeState') compFadeState: string = 'false';
@Input('headerState') headerState: string = 'relative'; @Input('headerState') headerState: string = 'relative';
@ViewChild('locateMeButton') locateMeButton;
@ViewChild('myInput') searchBar; @ViewChild('myInput') searchBar;
public selectedCity: string; public selectedCity: string;
public pincode; public pincode;
...@@ -42,25 +43,30 @@ export class ECMSearchComponent implements OnInit { ...@@ -42,25 +43,30 @@ export class ECMSearchComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.selectedCity = localStorage.getItem('city'); this.selectedCity = localStorage.getItem('city');
this.search_key=this.search_service.getSearch(); this.search_key=this.search_service.getSearch();
} }
ngAfterViewChecked() { ngAfterViewChecked() {
if(this.form_add) if(this.form_add)
{ this.searchBar.nativeElement.value=this.form_add;
this.searchBar.nativeElement.value=this.form_add;
}
} }
ngAfterViewInit() { ngAfterViewInit() {
if(this.search_key && this.searchBar) 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() { getAddress() {
this._ngLocation.getCitydata(); this._ngLocation.getCitydata();
EmitterService.get("selectedCity").subscribe( data =>{ 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