1 |
50169
|
argiro.kok
|
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
2 |
|
|
import {Observable} from 'rxjs/Observable';
|
3 |
|
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
4 |
|
|
import {Router} from '@angular/router';
|
5 |
|
|
|
6 |
|
|
@Component({
|
7 |
|
|
selector: 'search-form',
|
8 |
|
|
template: `
|
9 |
|
|
|
10 |
|
|
<form [class]="(isDisabled)?'uk-margin uk-text-center uk-margin-top uk-disabled':'uk-margin uk-text-center uk-margin-top'">
|
11 |
53353
|
argiro.kok
|
<input type="text" class="uk-input uk-width-xlarge" [placeholder]="placeholderText" aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
12 |
|
|
<button *ngIf="!link" (click)="keywordChanged()" type="submit" class=" uk-button portal-button">
|
13 |
|
|
<span class="uk-icon" ><svg width="30" height="30" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1.5"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg></span>
|
14 |
50169
|
argiro.kok
|
</button>
|
15 |
53353
|
argiro.kok
|
<button *ngIf="link" (click)="goTo()" type="submit" class=" uk-button portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom ">
|
16 |
|
|
<span class="uk-icon" ><svg width="30" height="30" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1.5"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg></span>
|
17 |
50169
|
argiro.kok
|
</button>
|
18 |
|
|
</form>
|
19 |
|
|
`
|
20 |
|
|
})
|
21 |
|
|
|
22 |
|
|
export class SearchFormComponent {
|
23 |
|
|
@Input() isDisabled: boolean = false;
|
24 |
|
|
@Input() keyword: string = '';
|
25 |
|
|
@Input() generalSearch: boolean = false;
|
26 |
|
|
@Input() placeholderText: string = "Type keywords";
|
27 |
|
|
@Input() link: boolean = false;
|
28 |
|
|
public routerHelper:RouterHelper = new RouterHelper();
|
29 |
|
|
|
30 |
|
|
@Output() keywordChange = new EventEmitter();
|
31 |
|
|
|
32 |
|
|
constructor (private _router:Router) {
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
ngOnInit() {
|
36 |
|
|
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
keywordChanged() {
|
40 |
|
|
console.info("inside form: "+this.keyword);
|
41 |
|
|
this.keywordChange.emit({
|
42 |
|
|
value: this.keyword
|
43 |
|
|
});
|
44 |
|
|
}
|
45 |
|
|
goTo() {
|
46 |
|
|
this._router.navigate(['/search/find'], { queryParams: this.routerHelper.createQueryParam('keyword',this.keyword) });
|
47 |
|
|
}
|
48 |
|
|
}
|