From 4a331a3475d421b748a5ee9e5dce991254362e8a Mon Sep 17 00:00:00 2001 From: piratefinn Date: Thu, 23 Nov 2017 17:16:46 +0000 Subject: [PATCH] fixed modals to use new endpoint and scrapped old pages --- src/app/dashboard/dashboard.module.ts | 2 - src/app/dashboard/dashboard.routing.ts | 6 -- src/app/dashboard/map.component.ts | 2 +- src/app/dashboard/trail-map-2.component.html | 52 ------------ src/app/dashboard/trail-map-2.component.ts | 79 ------------------- src/app/dashboard/trail-map.component.html | 26 +++--- src/app/dashboard/trail-map.component.ts | 25 ++++-- src/app/layouts/full-layout.component.html | 5 -- src/app/providers/api-service.ts | 9 +++ src/assets/img/lis_logo.png | Bin 0 -> 266484 bytes src/scss/_custom.scss | 4 + 11 files changed, 51 insertions(+), 159 deletions(-) delete mode 100644 src/app/dashboard/trail-map-2.component.html delete mode 100644 src/app/dashboard/trail-map-2.component.ts create mode 100644 src/assets/img/lis_logo.png diff --git a/src/app/dashboard/dashboard.module.ts b/src/app/dashboard/dashboard.module.ts index 2d4f415..e312843 100644 --- a/src/app/dashboard/dashboard.module.ts +++ b/src/app/dashboard/dashboard.module.ts @@ -21,7 +21,6 @@ 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'; @@ -69,7 +68,6 @@ 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 6e481e7..46b9df3 100644 --- a/src/app/dashboard/dashboard.routing.ts +++ b/src/app/dashboard/dashboard.routing.ts @@ -16,7 +16,6 @@ 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 = [ @@ -69,11 +68,6 @@ 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/map.component.ts b/src/app/dashboard/map.component.ts index 41ba36e..5af9c41 100644 --- a/src/app/dashboard/map.component.ts +++ b/src/app/dashboard/map.component.ts @@ -52,7 +52,7 @@ export class MapComponent implements OnInit { this.markers = result.suppliers; }, error => { - // this.dataReceived = 'no'; + this.dataReceived = 'no'; console.log('Retrieval Error'); console.log( error._body ); } diff --git a/src/app/dashboard/trail-map-2.component.html b/src/app/dashboard/trail-map-2.component.html deleted file mode 100644 index f5835e7..0000000 --- a/src/app/dashboard/trail-map-2.component.html +++ /dev/null @@ -1,52 +0,0 @@ -
-
-
-
-
- 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 deleted file mode 100644 index 0019f16..0000000 --- a/src/app/dashboard/trail-map-2.component.ts +++ /dev/null @@ -1,79 +0,0 @@ -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({ - templateUrl: 'trail-map-2.component.html', -}) -export class TrailMapComponent2 implements OnInit { - - lat: number = 54.0466; - lng: number = -2.8007; - zoom: number = 12; - public modalRef: BsModalRef; - clickedMarker: any; - - dataReceived: string = 'yes'; - - markers: Array<{latitude: number, longitude: number, name: string}>; - - map: any; - - constructor( - private api: ApiService, - private modalService: BsModalService, - ) {} - - ngOnInit(): void { } - - public onMapReady(map: any) { - this.map = map; - } - - openModal(template: TemplateRef) { - this.modalRef = this.modalService.show(template); - } - - public onMarkerClick(clickedMarker, template: TemplateRef) { - console.log(clickedMarker); - this.clickedMarker = clickedMarker; - this.openModal(template); - } - - 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/dashboard/trail-map.component.html b/src/app/dashboard/trail-map.component.html index 590a6ef..d457e99 100644 --- a/src/app/dashboard/trail-map.component.html +++ b/src/app/dashboard/trail-map.component.html @@ -27,18 +27,26 @@ *ngFor="let m of markers" [iconUrl]="'/assets/img/map-pin-lis.png'" [latitude]="m.latitude" - [longitude]="m.longitude"> - - -

{{m.name}}

- avatar-image -
-
+ [longitude]="m.longitude" + [openInfoWindow]="false" + (markerClick)="onMarkerClick(m, template)"> + + + + diff --git a/src/app/dashboard/trail-map.component.ts b/src/app/dashboard/trail-map.component.ts index 7aed178..b6d2c8b 100644 --- a/src/app/dashboard/trail-map.component.ts +++ b/src/app/dashboard/trail-map.component.ts @@ -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) { + this.modalRef = this.modalService.show(template); + } + + public onMarkerClick(clickedMarker, template: TemplateRef) { + 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 ); } diff --git a/src/app/layouts/full-layout.component.html b/src/app/layouts/full-layout.component.html index 101a079..069a864 100644 --- a/src/app/layouts/full-layout.component.html +++ b/src/app/layouts/full-layout.component.html @@ -50,11 +50,6 @@ Story Trail -