diff --git a/.jshintrc b/.jshintrc index d8cbb07..af0b861 100644 --- a/.jshintrc +++ b/.jshintrc @@ -53,7 +53,7 @@ "unused": true, // Para que funcione en angular - "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe", "L"], /* * RELAXING OPTIONS * ================= diff --git a/src/js/controller.js b/src/js/controller.js index 0ce7a85..2f0bf26 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -1,10 +1,23 @@ angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [ - '$scope', 'focaAdminSeguimientoService', '$location', - function($scope, focaAdminSeguimientoService, $location) { + '$scope', 'focaAdminSeguimientoService', '$location', '$routeParams', + function($scope, focaAdminSeguimientoService, $location, $routeParams) { + $scope.actividad = ''; + + if ($routeParams.parametro === 'nota-pedido') { + $scope.actividad = 'Nota de pedido'; + } + + if ($routeParams.parametro === 'hoja-ruta') { + $scope.actividad = 'Entrega de producto'; + } + + console.info($scope.actividad); $scope.marcadores = []; + focaAdminSeguimientoService.obtenerActividad().then(function(datos) { $scope.marcadores = datos.data; }); + $scope.salir = function() { $location.path('/'); }; diff --git a/src/js/osm-directive.js b/src/js/osm-directive.js index ddb611f..ff43adb 100644 --- a/src/js/osm-directive.js +++ b/src/js/osm-directive.js @@ -8,13 +8,11 @@ angular.module('focaAdminSeguimiento').directive('osm', function() { L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); }, controller: ['$scope', '$filter', function($scope, $filter) { - $scope.$watch('marcadores', function(valorNuevo) { - marcadores = $scope.marcadores; - mapa = $scope.map; + $scope.$watch('marcadores', function() { angular.forEach($scope.marcadores, function(marcador) { L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map) .bindPopup( - "Actividad: " + marcador.actividad + '
' + + 'Actividad: ' + marcador.actividad + '
' + 'Fecha: ' + $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + marcador.fecha.slice(11,19) + '
' + marcador.observaciones diff --git a/src/js/route.js b/src/js/route.js index cccd2a2..c869d47 100644 --- a/src/js/route.js +++ b/src/js/route.js @@ -1,6 +1,6 @@ angular.module('focaAdminSeguimiento') .config(['$routeProvider', function($routeProvider) { - $routeProvider.when('/admin-seguimiento', { + $routeProvider.when('/admin-seguimiento/:parametro', { controller: 'focaAdminSeguimientoController', templateUrl: 'src/views/foca-admin-seguimiento.html' });