fixed modals to use new endpoint and scrapped old pages
This commit is contained in:
parent
f261fce7f5
commit
fdd14c2fae
11 changed files with 51 additions and 159 deletions
|
@ -1,6 +1,8 @@
|
|||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { Component, OnInit, Input, Output, EventEmitter, TemplateRef } from '@angular/core';
|
||||
import { ApiService } from '../providers/api-service';
|
||||
import { AgmCoreModule } from '@agm/core';
|
||||
import { BsModalService } from 'ngx-bootstrap/modal';
|
||||
import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
|
||||
import 'rxjs/add/operator/map';
|
||||
|
||||
@Component({
|
||||
|
@ -11,6 +13,8 @@ export class TrailMapComponent implements OnInit {
|
|||
lat: number = 54.0466;
|
||||
lng: number = -2.8007;
|
||||
zoom: number = 12;
|
||||
public modalRef: BsModalRef;
|
||||
clickedMarker: any;
|
||||
|
||||
dataReceived: string = 'yes';
|
||||
|
||||
|
@ -20,7 +24,8 @@ export class TrailMapComponent implements OnInit {
|
|||
|
||||
constructor(
|
||||
private api: ApiService,
|
||||
) { }
|
||||
private modalService: BsModalService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void { }
|
||||
|
||||
|
@ -28,6 +33,16 @@ export class TrailMapComponent implements OnInit {
|
|||
this.map = map;
|
||||
}
|
||||
|
||||
openModal(template: TemplateRef<any>) {
|
||||
this.modalRef = this.modalService.show(template);
|
||||
}
|
||||
|
||||
public onMarkerClick(clickedMarker, template: TemplateRef<any>) {
|
||||
console.log(clickedMarker);
|
||||
this.clickedMarker = clickedMarker;
|
||||
this.openModal(template);
|
||||
}
|
||||
|
||||
public viewBoundsChanged() {
|
||||
console.log("finding bounds");
|
||||
const resp = this.map.getBounds();
|
||||
|
@ -46,13 +61,13 @@ export class TrailMapComponent implements OnInit {
|
|||
longitude: resp.getSouthWest().lng()
|
||||
},
|
||||
}
|
||||
this.api.getMapData(mapData).subscribe(
|
||||
this.api.getLisData(mapData).subscribe(
|
||||
result => {
|
||||
this.dataReceived = 'yes';
|
||||
this.markers = result.suppliers;
|
||||
this.markers = result.locations;
|
||||
},
|
||||
error => {
|
||||
// this.dataReceived = 'no';
|
||||
this.dataReceived = 'no';
|
||||
console.log('Retrieval Error');
|
||||
console.log( error._body );
|
||||
}
|
||||
|
|
Reference in a new issue