From 70ec99690f62f0ba5d8c2d6e1fd1aafc63c79676 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Tue, 14 Nov 2017 17:12:19 +0000 Subject: [PATCH] test page added --- src/app/dashboard/dashboard.module.ts | 2 + src/app/dashboard/dashboard.routing.ts | 6 ++ src/app/dashboard/trail-map-2.component.html | 41 ++++++++++++ src/app/dashboard/trail-map-2.component.ts | 70 ++++++++++++++++++++ src/app/layouts/full-layout.component.html | 5 ++ 5 files changed, 124 insertions(+) create mode 100644 src/app/dashboard/trail-map-2.component.html create mode 100644 src/app/dashboard/trail-map-2.component.ts diff --git a/src/app/dashboard/dashboard.module.ts b/src/app/dashboard/dashboard.module.ts index b7ff4c3..e2c051a 100644 --- a/src/app/dashboard/dashboard.module.ts +++ b/src/app/dashboard/dashboard.module.ts @@ -20,6 +20,7 @@ import { PayrollLogComponent } from './payroll-log.component'; import { LeaderboardComponent } from './leaderboard.component'; import { MapComponent } from './map.component'; import { TrailMapComponent } from './trail-map.component'; +import { TrailMapComponent2 } from './trail-map-2.component'; import { GraphWidget } from '../widgets/graph-widget.component'; import { OrgBarSnippetComponent } from '../snippets/org-snippet-bar.component'; @@ -66,6 +67,7 @@ import { environment } from '../../environments/environment'; LeaderboardResultComponent, MapComponent, TrailMapComponent, + TrailMapComponent2, FeedbackComponent, GraphWidget, OrgBarSnippetComponent, diff --git a/src/app/dashboard/dashboard.routing.ts b/src/app/dashboard/dashboard.routing.ts index 46b9df3..6e481e7 100644 --- a/src/app/dashboard/dashboard.routing.ts +++ b/src/app/dashboard/dashboard.routing.ts @@ -16,6 +16,7 @@ import { PayrollLogComponent } from './payroll-log.component'; import { LeaderboardComponent } from './leaderboard.component'; import { MapComponent } from './map.component'; import { TrailMapComponent } from './trail-map.component'; +import { TrailMapComponent2 } from './trail-map-2.component'; // Using child path to allow for FullLayout theming const routes: Routes = [ @@ -68,6 +69,11 @@ const routes: Routes = [ component: TrailMapComponent, data: { title: 'Story Trail' }, }, + { + path: 'story-trail-2', + component: TrailMapComponent2, + data: { title: 'Story Trail 2' }, + }, { path: 'payroll-log', component: PayrollLogComponent, diff --git a/src/app/dashboard/trail-map-2.component.html b/src/app/dashboard/trail-map-2.component.html new file mode 100644 index 0000000..f5beebf --- /dev/null +++ b/src/app/dashboard/trail-map-2.component.html @@ -0,0 +1,41 @@ +
+
+
+
+
+ Purchase Map + Required Data marked in bold. +
+
+
+ +
+
+ + + + + + + + +
+
+
+
+
+
diff --git a/src/app/dashboard/trail-map-2.component.ts b/src/app/dashboard/trail-map-2.component.ts new file mode 100644 index 0000000..5a5c1aa --- /dev/null +++ b/src/app/dashboard/trail-map-2.component.ts @@ -0,0 +1,70 @@ +import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { Http, Response } from '@angular/http'; +import { ApiService } from '../providers/api-service'; +import { AgmCoreModule } from '@agm/core'; +import 'rxjs/add/operator/map'; + +@Component({ + templateUrl: 'trail-map-2.component.html', +}) +export class TrailMapComponent2 implements OnInit { + + lat: number = 54.0466; + lng: number = -2.8007; + zoom: number = 12; + + dataReceived: string = 'yes'; + + markers: Array<{latitude: number, longitude: number, name: string}>; + + map: any; + + constructor( + private http: Http, + private api: ApiService, + ) { } + + ngOnInit(): void { } + + public onMapReady(map: any) { + this.map = map; + } + + public onMarkerClick() { + + } + + public viewBoundsChanged() { + console.log("finding bounds"); + const resp = this.map.getBounds(); + console.log("found bounds"); + console.log(resp.getNorthEast().lat()); + console.log(resp.getNorthEast().lng()); + console.log(resp.getSouthWest().lat()); + console.log(resp.getSouthWest().lng()); + const mapData = { + north_east: { + latitude: resp.getNorthEast().lat(), + longitude: resp.getNorthEast().lng() + }, + south_west: { + latitude: resp.getSouthWest().lat(), + longitude: resp.getSouthWest().lng() + }, + } + this.api.getMapData(mapData).subscribe( + result => { + this.dataReceived = 'yes'; + this.markers = result.suppliers; + }, + error => { + // this.dataReceived = 'no'; + console.log('Retrieval Error'); + console.log( error._body ); + } + ); + } + + + +} diff --git a/src/app/layouts/full-layout.component.html b/src/app/layouts/full-layout.component.html index 069a864..101a079 100644 --- a/src/app/layouts/full-layout.component.html +++ b/src/app/layouts/full-layout.component.html @@ -50,6 +50,11 @@ Story Trail +