Project

General

Profile

1
import {Component, Input, ViewChild} from '@angular/core';
2
import {ActivatedRoute} from '@angular/router';
3
import {AlertModal} from '../../utils/modal/alert';
4
import {ErrorCodes} from '../../utils/properties/errorCodes';
5

    
6
@Component({
7
    selector: 'search-dataprovider-map',
8
    template: `
9
    <!-- <a class="uk-icon" [href]="mapUrl" target="_blank"> -->
10
    <a  *ngIf="mapUrl && searchUtils.status != errorCodes.LOADING"
11
        [attr.uk-tooltip]="''" [title]="'Show all '+mapTooltipType+' in map'"
12
        (click)="openMapModal()" class="clickable">
13
      <span class="uk-icon">
14
        <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="location" ratio="1"><path fill="none" stroke="#000" stroke-width="1.01" d="M10,0.5 C6.41,0.5 3.5,3.39 3.5,6.98 C3.5,11.83 10,19 10,19 C10,19 16.5,11.83 16.5,6.98 C16.5,3.39 13.59,0.5 10,0.5 L10,0.5 Z"></path><circle fill="none" stroke="#000" cx="10" cy="6.8" r="2.3"></circle></svg>
15
      </span>
16
    </a>
17
    <span *ngIf="mapUrl && (!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING)"
18
          class="cursor-not-allowed ">
19
      <span class="uk-icon">
20
        <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="location" ratio="1"><path fill="none" stroke="#000" stroke-width="1.01" d="M10,0.5 C6.41,0.5 3.5,3.39 3.5,6.98 C3.5,11.83 10,19 10,19 C10,19 16.5,11.83 16.5,6.98 C16.5,3.39 13.59,0.5 10,0.5 L10,0.5 Z"></path><circle fill="none" stroke="#000" cx="10" cy="6.8" r="2.3"></circle></svg>
21
      </span>
22
    </span>
23
    <!-- </a> -->
24
    <modal-alert #AlertModalMap>
25
      <i-frame [url]="mapUrl" width="100%" height="900"></i-frame>
26
    </modal-alert>
27
    `
28
})
29

    
30
export class SearchDataproviderMapComponent {
31
    @Input() searchUtils;
32
    @Input() oldTotalResults:number = 0;
33
    @Input() loadPaging: boolean = true;
34
    @Input() totalResults:number = 0;
35
    @Input() mapUrl: string;
36
    @Input() mapTooltipType: string ="";
37
    @ViewChild('AlertModalMap') alertModalMap: AlertModal;
38

    
39
    public errorCodes:ErrorCodes = new ErrorCodes();
40

    
41
    constructor (private route: ActivatedRoute) {}
42

    
43
    ngOnInit() {}
44

    
45
    ngOnDestroy() {}
46

    
47
    openMapModal() {
48
        this.alertModalMap.cancelButton = true;
49
        this.alertModalMap.okButton = false;
50
        this.alertModalMap.alertTitle = "Map of Content Providers";
51
        this.alertModalMap.message = "";
52
        this.alertModalMap.cancelButtonText = "Close";
53
        this.alertModalMap.open();
54
    }
55
}
(16-16/45)