From e3db37839652868180c3f6e5ed1e9482b04cd09b Mon Sep 17 00:00:00 2001
From: piratefinn <toyou1995@gmail.com>
Date: Fri, 8 Dec 2017 13:26:18 +0000
Subject: [PATCH] changed code for trail map

---
 src/app/dashboard/trail-map.component.html          |   8 ++++++--
 src/app/dashboard/trail-map.component.ts            |   9 +++++++--
 src/app/providers/api-service.ts                    |   6 +++---
 .../lis-map-pin.png}                                | Bin
 src/assets/img/{ => association}/lis_logo.png       | Bin
 5 files changed, 16 insertions(+), 7 deletions(-)
 rename src/assets/img/{map-pin-lis.png => association/lis-map-pin.png} (100%)
 rename src/assets/img/{ => association}/lis_logo.png (100%)

diff --git a/src/app/dashboard/trail-map.component.html b/src/app/dashboard/trail-map.component.html
index 06818fa..e55329c 100644
--- a/src/app/dashboard/trail-map.component.html
+++ b/src/app/dashboard/trail-map.component.html
@@ -5,6 +5,10 @@
         <div class="card-header">
           <strong>Lancaster Independent Story</strong>
           <small>Required Data marked in <strong>bold</strong>.</small>
+          <select type="text" [(ngModel)]="assocMap" (ngModelChange)="viewBoundsChanged()">
+            <option value="lis" selected>Lancaster Independent Story</option>
+            <option value="esta">Esta</option>
+          </select>
         </div>
         <div class="modal fade" bsModal #statusModal="bs-modal" [config]="{backdrop: false, animated: false}"
              tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
@@ -45,7 +49,7 @@
           <agm-marker-cluster maxZoom="13" imagePath="https://raw.githubusercontent.com/googlemaps/v3-utility-library/master/markerclustererplus/images/m">
             <agm-marker
                 *ngFor="let m of markers"
-                [iconUrl]="'/assets/img/map-pin-lis.png'"
+                [iconUrl]="'/assets/img/association/' + assocMap + '-map-pin.png'"
                 [latitude]="m.latitude"
                 [longitude]="m.longitude"
                 [openInfoWindow]="false"
@@ -55,7 +59,7 @@
         </agm-map>
         <ng-template #template>
           <div class="modal-header d-flex justify-content-between">
-            <img src="assets/img/lis_logo.png" class="w-15" alt="lis logo"><h4 class="modal-title">{{clickedMarker.name}}</h4>
+            <img src="{{assocLogo}}" class="w-15" alt="lis logo"><h4 class="modal-title">{{clickedMarker.name}}</h4>
             <button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()">
               <span aria-hidden="true">&times;</span>
             </button>
diff --git a/src/app/dashboard/trail-map.component.ts b/src/app/dashboard/trail-map.component.ts
index 2e32241..6bc3ee5 100644
--- a/src/app/dashboard/trail-map.component.ts
+++ b/src/app/dashboard/trail-map.component.ts
@@ -15,6 +15,8 @@ export class TrailMapComponent implements OnInit, AfterViewInit {
   zoom: number = 12;
   public modalRef: BsModalRef;
   clickedMarker: any;
+  assocMap = 'lis';
+  assocLogo: string;
 
   dataReceived: string = 'loading';
 
@@ -25,7 +27,9 @@ export class TrailMapComponent implements OnInit, AfterViewInit {
   constructor(
     private api: ApiService,
     private modalService: BsModalService,
-  ) {}
+  ) {
+    this.assocLogo = 'assets/img/association/' + this.assocMap + '_logo.png';
+  }
 
   ngOnInit(): void { }
 
@@ -64,8 +68,9 @@ export class TrailMapComponent implements OnInit, AfterViewInit {
         latitude:  resp.getSouthWest().lat(),
         longitude: resp.getSouthWest().lng()
       },
+      association: this.assocMap,
     }
-    this.api.getLisData(mapData).subscribe(
+    this.api.getAssocData(mapData).subscribe(
       result => {
         this.myStatusModal.hide();
         this.markers = result.locations;
diff --git a/src/app/providers/api-service.ts b/src/app/providers/api-service.ts
index f4903e9..9533acd 100644
--- a/src/app/providers/api-service.ts
+++ b/src/app/providers/api-service.ts
@@ -276,11 +276,11 @@ export class ApiService {
     );
   }
 
-  // Load LIS Data
-  public getLisData(data) {
+  // Load Association Data
+  public getAssocData(data) {
     data.session_key = this.sessionKey;
     return this.http.post<any>(
-    this.apiUrl + '/v1/supplier/location/lis',
+    this.apiUrl + '/v1/supplier/location/trail',
     data
     );
   }
diff --git a/src/assets/img/map-pin-lis.png b/src/assets/img/association/lis-map-pin.png
similarity index 100%
rename from src/assets/img/map-pin-lis.png
rename to src/assets/img/association/lis-map-pin.png
diff --git a/src/assets/img/lis_logo.png b/src/assets/img/association/lis_logo.png
similarity index 100%
rename from src/assets/img/lis_logo.png
rename to src/assets/img/association/lis_logo.png