merge
authorJulie Hill Roa <julie.hill.roa@gmail.com>
Thu, 3 Dec 2015 12:45:57 +0000 (13:45 +0100)
committerJulie Hill Roa <julie.hill.roa@gmail.com>
Thu, 3 Dec 2015 12:45:57 +0000 (13:45 +0100)
src/components/map/map.html
src/components/map/map.ts

index ad19e7d..127bc7d 100644 (file)
@@ -1 +1,32 @@
 <div id="map"></div>
+
+<div id="divModal" role="dialog">
+    <div class="modal-dialog modal-sm">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" (click)="closeModal()">&times;</button>
+                <h4 class="modal-title">Add new</h4>
+            </div>
+            <div class="modal-body">
+                <p>Do you want to add new a facility?</p>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-default" (click)="addUnit()">Yes</button>
+            </div>
+        </div>
+    </div>
+</div>
+<div id="expandModal" role="dialog">
+    <div class="modal-dialog modal-sm">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type class="close" (click)="closeExpandModal()" )>&times;</button>
+            </div>
+            <div class="modal-body">
+                <button (click)="seeDetails()">See details</button>
+                <button (click)="drillDown()">Drill down</button>
+                <button (click)="drillUp()">Drill up</button>
+            </div>
+        </div>
+    </div>
+</div>
index f93be3b..427a2a7 100644 (file)
@@ -12,6 +12,8 @@ import {Headers, Http} from 'angular2/http';
 
 export class Map {
 
+    hideModal: any;
+    expandModal:any;
     map:Object;
     http:Http;
     LEVEL:number;
@@ -34,6 +36,27 @@ export class Map {
         this.currentPos = null;
         this.uprunned = false;
         // this.COLORS = {'red','brown',',yellow','green',',pink','purple','gray','black'};
+        this.hideModal = document.getElementById("divModal").style.visibility = "hidden";
+        this.expandModal = document.getElementById("expandModal").style.visibility = "hidden";
+
+    }
+
+    showModal(){
+        return this.hideModal = document.getElementById("divModal").style.visibility = "visible";
+    }
+
+    closeModal(){
+        console.log("hei");
+        return this.hideModal = document.getElementById("divModal").style.visibility = "hidden";
+
+    }
+
+    showExpandModal(){
+        return this.hideModal = document.getElementById("expandModal").style.visibility = "visible";
+    }
+
+    closeExpandModal(){
+        return this.hideModal = document.getElementById("expandModal").style.visibility = "hidden";
 
     }
 
@@ -88,8 +111,6 @@ export class Map {
 
         map.setCenter(pos, 0);
         map.setZoom(7);
-
-
     }
 
     logError(error) {
@@ -175,7 +196,7 @@ export class Map {
                 };
 
             }
-            console.log("her er iden: " +unit.properties.id);
+
             this.map.data.addGeoJson(unit);
             this.map.data.setStyle(function(feature) {
                 let color = 'gray';
@@ -201,20 +222,11 @@ export class Map {
                 if (instance.runned == false && instance.LEVEL < 4) {
                     instance.setRunned(true);
 
-                    let infowindow = new google.maps.InfoWindow({
-                        //TODO: Style this
-                        content: '<div> <button >DrillUP</button>' +
-                        ' <button ">DrillDOWN</button>' +
-                        '<button ">SEEINFO</button></div>'
-                    });
-
-                    infowindow.setPosition(event.latlng);
-                    // infowindow.open(instance.map);
+                    instance.showExpandModal();
 
                     let id = event.feature.O.id;
                     instance.setParent(id);
 
-
                     instance.map.data.forEach(function (feature) {
                         if (!(feature.O.id == id && instance.LEVEL == 3)) {
                             instance.map.data.remove(feature);
@@ -226,10 +238,7 @@ export class Map {
                     instance.getData('/' + id + '/children', instance);
                 } else if (instance.runned == false && instance.LEVEL >= 4) {
                     instance.setRunned(true);
-                    let infowindowNew = new google.maps.InfoWindow({
-                        //TODO: Style this
-                        content: '<div>Du you want to add a new OrgUnit here ?    <button onclick="addUnit()">Yes</button></div>'
-                    });
+
                     instance.setcurrentPos(event.latLng);
 
                     var marker = new google.maps.Marker({
@@ -244,13 +253,7 @@ export class Map {
                     });
 
                     marker.setMap(instance.map);
-
-                    infowindowNew.open(instance.map, marker);
-
-                    infowindowNew.addListener('closeclick', function (e) {
-                        instance.setRunned(false);
-                        marker.setMap(null);
-                    });
+                    instance.showModal();
 
                     instance.addUnit();