Commit 76b62243 authored by prumde's avatar prumde

Updates for Search


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174341 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0130b114
...@@ -184,7 +184,8 @@ ...@@ -184,7 +184,8 @@
.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-position: 5px 4px; background-position: 5px 4px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 24px 24px; background-size: 24px 24px;
......
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
</select> </select>
</span> </span>
</span> </span>
<input type="submit" name="search-submit" class="search-submit"value="Search" /> <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 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=""> <input class="sb-search-submit" type="submit" value="" (click)="search(myInput.value)">
<span class="sb-icon-search"></span> <span class="sb-icon-search"></span>
</form> </form>
</div> </div>
...@@ -2,6 +2,8 @@ import { Component, OnInit,ViewChild,ElementRef, Input, trigger, state, animate, ...@@ -2,6 +2,8 @@ import { Component, OnInit,ViewChild,ElementRef, Input, trigger, state, animate,
import { EventEmitter } from '@angular/core'; import { EventEmitter } from '@angular/core';
import { EcmLocation } from './ecm-location'; import { EcmLocation } from './ecm-location';
import { EcmLocationService } from './ecm-location.service'; import { EcmLocationService } from './ecm-location.service';
import { SearchService } from './ecm-search-result/search.service';
import { Router } from '@angular/router';
@Component({ @Component({
selector: 'ecm-search', selector: 'ecm-search',
...@@ -29,27 +31,42 @@ import { EcmLocationService } from './ecm-location.service'; ...@@ -29,27 +31,42 @@ import { EcmLocationService } from './ecm-location.service';
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('myInput') form_address; @ViewChild('myInput') searchBar;
public selectedCity: string; public selectedCity: string;
public pincode; public pincode;
public form_add; public form_add;
search_key;
selectedPlace = 'Mumbai'; selectedPlace = 'Mumbai';
constructor(private _ngLocation: EcmLocationService) { } constructor(private _ngLocation: EcmLocationService, private search_service: SearchService, private router: Router) {}
ngOnInit() { ngOnInit() {
this.selectedCity = localStorage.getItem('city'); this.selectedCity = localStorage.getItem('city');
this.search_key=this.search_service.getSearch();
} }
ngAfterViewChecked() { ngAfterViewChecked() {
if(this.form_add) if(this.form_add)
this.form_address.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;
} }
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();
}); });
}
search(value) {
this.search_service.setSearch(value.trim());
this.router.navigate(['/search',value.trim()]);
} }
} }
......
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