Map draft done
diff --git a/mCordPortal/src/app/services/rest.js b/mCordPortal/src/app/services/rest.js
deleted file mode 100644
index c2647c9..0000000
--- a/mCordPortal/src/app/services/rest.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-(function () {
-  "use strict";
-
-  function randomEnabled(){
-    var levels = ["enabled", "disabled"];
-    return levels[Math.round(Math.random())];
-  };
-
-
-  angular.module('mCord')
-  .factory('SetCSRFToken', function setCSRFToken($cookies) {
-    return {
-      request: function(request){
-        request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
-        request.headers['sessionId'] = $cookies.get('sessionid');
-        return request;
-      }
-    };
-  })
-  .service('User', function($http, $q, $cookies, cordConfig){
-    this.login = function(username, password){
-      var deferred = $q.defer();
-      var user;
-
-      // logging in the user
-      $http.post(cordConfig.url + '/api/utility/login/', {username: username, password: password})
-      .then(function(res){
-        $cookies.put('user', res.data.user);
-        $cookies.put('sessionid', res.data.xossessionid);
-        user = JSON.parse(res.data.user);
-        return $http.get(cordConfig.url + '/xos/tenantrootprivileges?user=' + user.id);
-      })
-      .then(function(subscribers){
-        // subscribers are an array because the way Django perform query
-        // but one user is related to only one subscriber
-
-        $cookies.put('subscriberId', subscribers.data[0].id);
-        deferred.resolve(user);
-      })
-      .catch(function(e){
-        deferred.reject(e);
-        throw new Error(e);
-      });
-
-      return deferred.promise;
-    };
-
-    this.isLoggedIn = function(){
-      var user = $cookies.get('user');
-      if( angular.isDefined(user)){
-        return true;
-      }
-      return false;
-    };
-
-    this.logout = function(){
-      var deferred = $q.defer();
-      var sessionId = $cookies.get('sessionid');
-      $http.post(cordConfig.url + '/xoslib/logout/', {xossessionid: sessionId})
-      .then(function(res){
-        $cookies.remove('user');
-        deferred.resolve();
-      })
-      .catch(function(e){
-        throw new Error(e);
-      });
-
-      return deferred.promise;
-    };
-  })
-  .service('Subscribers', function($resource, cordConfig){
-    return $resource(cordConfig.url + '/xoslib/rs/subscriber');
-  })
-  .service('SubscriberUsers', function($resource, $filter, cordConfig, Helpers){
-    return $resource(cordConfig.url + '/xoslib/rs/subscriber/:subscriberId/users/:id', {}, {
-      query: {
-        method: 'GET',
-        isArray: true,
-        cache: true,
-        interceptor: {
-          response: function(res){
-            // this is used to fake some data that are not XOS related,
-            // but can be provided by any external services
-
-            // add an icon to the user
-            res.data = res.data.map(function(user, i){
-              switch (i){
-                case 0:
-                  user['icon_id'] = 'student1';
-                  break
-                case 1:
-                  user['icon_id'] = 'student2';
-                  break
-                case 2:
-                  user['icon_id'] = 'student3';
-                  break
-                case 3:
-                  user['icon_id'] = 'student4';
-                  break
-              }
-
-              user.level = randomEnabled()
-
-              return user;
-            });
-
-            // add a random login date to the user
-            res.data.forEach(function(user){
-              if(!angular.isDefined(cordConfig.userActivity[user.id])){
-                var date = Helpers.randomDate(new Date(2015, 0, 1), new Date());
-                cordConfig.userActivity[user.id] = $filter('date')(date, 'mediumTime');
-              }
-            });
-            return res.data;
-          }
-        }
-      }
-    });
-  })
-  .service('SubscriberUsersUrlFilterLevel', function($q, $http, cordConfig){
-    this.updateUrlFilterLevel = function(subscriberId, userId, level){
-      var deferred = $q.defer();
-
-      $http.put(cordConfig.url + '/xoslib/rs/subscriber/' + subscriberId + '/users/' + userId + '/url_filter/' + level)
-      .then(function(res){
-        deferred.resolve(res);
-      })
-      .catch(function(e){
-        throw new Error(e);
-      });
-
-      return deferred.promise;
-    };
-  });
-}());
\ No newline at end of file
diff --git a/mCordPortal/src/app/services/rest/enodeb.js b/mCordPortal/src/app/services/rest/enodeb.js
new file mode 100644
index 0000000..bf6415c
--- /dev/null
+++ b/mCordPortal/src/app/services/rest/enodeb.js
@@ -0,0 +1,6 @@
+(function () {
+  angular.module('mCord')
+  .service('Enodeb', function($resource){
+    return $resource('http://private-c85424-progranrestapi.apiary-mock.com/api/enodeb/:id', {id: '@id'});
+  })
+})();
\ No newline at end of file
diff --git a/mCordPortal/src/app/services/users.js b/mCordPortal/src/app/services/users.js
new file mode 100644
index 0000000..6d3baef
--- /dev/null
+++ b/mCordPortal/src/app/services/users.js
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function () {
+  "use strict";
+
+  function randomEnabled(){
+    var levels = ["enabled", "disabled"];
+    return levels[Math.round(Math.random())];
+  };
+
+
+  angular.module('mCord')
+  .factory('SetCSRFToken', function setCSRFToken($cookies) {
+    return {
+      request: function(request){
+        request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
+        request.headers['sessionId'] = $cookies.get('sessionid');
+        return request;
+      }
+    };
+  })
+  .service('User', function($http, $q, $cookies, cordConfig){
+    this.login = function(username, password){
+      var deferred = $q.defer();
+      var user;
+
+      // logging in the user
+      $http.post(cordConfig.url + '/api/utility/login/', {username: username, password: password})
+      .then(function(res){
+        $cookies.put('user', res.data.user);
+        $cookies.put('sessionid', res.data.xossessionid);
+        user = JSON.parse(res.data.user);
+        return $http.get(cordConfig.url + '/xos/tenantrootprivileges?user=' + user.id);
+      })
+      .then(function(subscribers){
+        // subscribers are an array because the way Django perform query
+        // but one user is related to only one subscriber
+
+        $cookies.put('subscriberId', subscribers.data[0].id);
+        deferred.resolve(user);
+      })
+      .catch(function(e){
+        deferred.reject(e);
+        throw new Error(e);
+      });
+
+      return deferred.promise;
+    };
+
+    this.isLoggedIn = function(){
+      var user = $cookies.get('user');
+      if( angular.isDefined(user)){
+        return true;
+      }
+      return false;
+    };
+
+    this.logout = function(){
+      var deferred = $q.defer();
+      var sessionId = $cookies.get('sessionid');
+      $http.post(cordConfig.url + '/xoslib/logout/', {xossessionid: sessionId})
+      .then(function(res){
+        $cookies.remove('user');
+        deferred.resolve();
+      })
+      .catch(function(e){
+        throw new Error(e);
+      });
+
+      return deferred.promise;
+    };
+  });
+}());
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/home/e-node-map-panel.js b/mCordPortal/src/app/view/home/e-node-map-panel.js
new file mode 100644
index 0000000..a78ce12
--- /dev/null
+++ b/mCordPortal/src/app/view/home/e-node-map-panel.js
@@ -0,0 +1,21 @@
+(function () {
+  'use strict';
+
+  angular.module('mCord')
+    .directive('eNodeMapPanel', function () {
+      return {
+        restrict: 'E',
+        scope: {
+          eNodeB: '='
+        },
+        bindToController: true,
+        controllerAs: 'vm',
+        templateUrl: 'app/view/home/e-node-map-panel.tpl.html',
+        controller: function($scope){
+          this.close = () => {
+            delete this.eNodeB;
+          }
+        }
+      }
+    });
+}());
diff --git a/mCordPortal/src/app/view/home/e-node-map-panel.tpl.html b/mCordPortal/src/app/view/home/e-node-map-panel.tpl.html
new file mode 100644
index 0000000..6f93f24
--- /dev/null
+++ b/mCordPortal/src/app/view/home/e-node-map-panel.tpl.html
@@ -0,0 +1,58 @@
+<div class="container-fluid">
+  <div class="row details">
+    <div class="col-xs-6 title primary">
+      <h1>{{vm.eNodeB.eNBId}}</h1>
+    </div>
+    <div class="col-xs-6 text-right ip-address">
+      <a href="" ng-click="vm.close()">x</a><br>
+      <small>Ip Address:</small><br>
+      <small>{{vm.eNodeB.IpAddr}}</small>
+    </div>
+    <div class="col-xs-12">
+      <small>{{vm.eNodeB.Description}}</small>
+    </div>
+    <div class="col-xs-12 text-right">
+      <a href="" class="btn btn-primary-border">View Details</a>
+    </div>
+  </div>
+  <div class="row">
+    <div class="col-xs-12">
+      <div class="panel panel-primary">
+        <div class="panel-heading">
+          <h3 class="panel-title ng-binding">Profiles</h3>
+        </div>
+        <table class="table">
+          <tr>
+            <td>Profile 30</td>
+            <td>30%</td>
+            <td>May 12</td>
+            <td>May 15</td>
+          </tr>
+        </table>
+        <div class="panel-body ng-binding">
+          <div class="row">
+            <div class="col-xs-6">
+              <div class="btn btn-primary-border">Add Profile</div>
+            </div>
+            <div class="col-xs-6">
+              <div class="btn btn-primary-border">Create Profile</div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+  <div class="row">
+    <div class="col-xs-12">
+      <div class="panel panel-primary">
+        <div class="panel-heading">
+          <h3 class="panel-title ng-binding">Stats</h3>
+        </div>
+        <div class="panel-body ng-binding">
+          
+        </div>
+      </div>
+    </div>
+  </div>
+  <pre>{{vm.eNodeB | json}}</pre>
+</div>
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/home/e-node-map.js b/mCordPortal/src/app/view/home/e-node-map.js
new file mode 100644
index 0000000..56c1cb2
--- /dev/null
+++ b/mCordPortal/src/app/view/home/e-node-map.js
@@ -0,0 +1,38 @@
+/*global google: true */
+(function () {
+  'use strict';
+
+  angular.module('mCord')
+    .directive('eNodeMap', function () {
+      return {
+        restrict: 'E',
+        scope: {},
+        controllerAs: 'vm',
+        templateUrl: 'app/view/home/e-node-map.tpl.html',
+        controller: function($log, Enodeb, NgMap){
+
+          let bounds = new google.maps.LatLngBounds();
+
+          Enodeb.query().$promise
+          .then((enodes) => {
+            this.enodes = enodes;
+            this.selectedEnode = enodes[0];
+            enodes.forEach(node => {
+              const latlng = new google.maps.LatLng(node.GpsCoordinate.Latitude, node.GpsCoordinate.Longitude);
+              bounds.extend(latlng);
+            });
+            return NgMap.getMap();
+          })
+          .then((map) => {
+            map.setCenter(bounds.getCenter());
+            map.fitBounds(bounds);
+          });
+
+          this.showEnodeDetails = (marker, enode) => {
+            this.selectedEnode = enode;
+          };
+        }
+      }
+    });
+}());
+/*global google: false */
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/home/e-node-map.tpl.html b/mCordPortal/src/app/view/home/e-node-map.tpl.html
new file mode 100644
index 0000000..ed402ea
--- /dev/null
+++ b/mCordPortal/src/app/view/home/e-node-map.tpl.html
@@ -0,0 +1,5 @@
+<ng-map center="[0, 0]" map-type-control="false" street-view-control="false" zoom-control="false" scale-control="false">
+  <marker ng-repeat="enode in vm.enodes" position="[{{enode.GpsCoordinate.Latitude}}, {{enode.GpsCoordinate.Longitude}}]" on-click="vm.showEnodeDetails(enode)"></marker>
+</ng-map>
+
+<e-node-map-panel e-node-b="vm.selectedEnode" ng-class="{in: vm.selectedEnode}"></e-node-map-panel>
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/home/home.html b/mCordPortal/src/app/view/home/home.html
deleted file mode 100644
index 8fed31a..0000000
--- a/mCordPortal/src/app/view/home/home.html
+++ /dev/null
@@ -1 +0,0 @@
-<ng-map center="[40.74, -74.18]"></ng-map>
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/home/home.js b/mCordPortal/src/app/view/home/home.js
deleted file mode 100644
index 6e6b4a7..0000000
--- a/mCordPortal/src/app/view/home/home.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-(function () {
-  'use strict';
-
-  angular.module('mCord')
-    .directive('eNodeMap', function () {
-      return {
-        restric: 'E',
-        scope: {},
-        controllerAs: 'vm',
-        templateUrl: 'app/view/home/home.html',
-        controller: function($log){
-          $log.debug('Cord Home Ctrl has been created.');
-        }
-      }
-    });
-}());