Commit 95666e84591e418bf6678b484ecf5af8275a651e
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
parametro en ruta para identificar actividad See merge request modulos-npm/foca-admin-seguimiento!2
Showing
4 changed files
Show diff stats
.jshintrc
... | ... | @@ -53,7 +53,7 @@ |
53 | 53 | "unused": true, |
54 | 54 | |
55 | 55 | // Para que funcione en angular |
56 | - "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], | |
56 | + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe", "L"], | |
57 | 57 | /* |
58 | 58 | * RELAXING OPTIONS |
59 | 59 | * ================= |
src/js/controller.js
1 | 1 | angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [ |
2 | - '$scope', 'focaAdminSeguimientoService', '$location', | |
3 | - function($scope, focaAdminSeguimientoService, $location) { | |
2 | + '$scope', 'focaAdminSeguimientoService', '$location', '$routeParams', | |
3 | + function($scope, focaAdminSeguimientoService, $location, $routeParams) { | |
4 | + $scope.actividad = ''; | |
5 | + | |
6 | + if ($routeParams.parametro === 'nota-pedido') { | |
7 | + $scope.actividad = 'Nota de pedido'; | |
8 | + } | |
9 | + | |
10 | + if ($routeParams.parametro === 'hoja-ruta') { | |
11 | + $scope.actividad = 'Entrega de producto'; | |
12 | + } | |
13 | + | |
14 | + console.info($scope.actividad); | |
4 | 15 | $scope.marcadores = []; |
16 | + | |
5 | 17 | focaAdminSeguimientoService.obtenerActividad().then(function(datos) { |
6 | 18 | $scope.marcadores = datos.data; |
7 | 19 | }); |
20 | + | |
8 | 21 | $scope.salir = function() { |
9 | 22 | $location.path('/'); |
10 | 23 | }; |
src/js/osm-directive.js
... | ... | @@ -8,13 +8,11 @@ angular.module('focaAdminSeguimiento').directive('osm', function() { |
8 | 8 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); |
9 | 9 | }, |
10 | 10 | controller: ['$scope', '$filter', function($scope, $filter) { |
11 | - $scope.$watch('marcadores', function(valorNuevo) { | |
12 | - marcadores = $scope.marcadores; | |
13 | - mapa = $scope.map; | |
11 | + $scope.$watch('marcadores', function() { | |
14 | 12 | angular.forEach($scope.marcadores, function(marcador) { |
15 | 13 | L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map) |
16 | 14 | .bindPopup( |
17 | - "Actividad: " + marcador.actividad + '<br/>' + | |
15 | + 'Actividad: ' + marcador.actividad + '<br/>' + | |
18 | 16 | 'Fecha: ' + $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + |
19 | 17 | ' ' + marcador.fecha.slice(11,19) + '<br/>' + |
20 | 18 | marcador.observaciones |
src/js/route.js
1 | 1 | angular.module('focaAdminSeguimiento') |
2 | 2 | .config(['$routeProvider', function($routeProvider) { |
3 | - $routeProvider.when('/admin-seguimiento', { | |
3 | + $routeProvider.when('/admin-seguimiento/:parametro', { | |
4 | 4 | controller: 'focaAdminSeguimientoController', |
5 | 5 | templateUrl: 'src/views/foca-admin-seguimiento.html' |
6 | 6 | }); |