controller.js
1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [
'$scope', 'focaAdminSeguimientoService', '$location', '$routeParams',
function($scope, focaAdminSeguimientoService, $location, $routeParams) {
$scope.actividad = '';
$scope.now = new Date();
if ($routeParams.parametro === 'nota-pedido') {
$scope.actividad = 'Nota de pedido';
}
if ($routeParams.parametro === 'hoja-ruta') {
$scope.actividad = 'Entrega de producto';
}
$scope.idUsuario = 0;
$scope.marcadores = [];
getSeguimiento();
$scope.general = function() {
$scope.idUsuario = 0;
getSeguimiento();
};
$scope.individual = function() {
$scope.idUsuario = -1;
};
$scope.salir = function() {
$location.path('/');
};
$scope.search = function(key) {
if (key === 13) {
$scope.idUsuario = $scope.idUsuarioInput;
getSeguimiento();
}
};
$scope.fecha = function() {
getSeguimiento();
};
function getSeguimiento () {
var datos = {
actividad: $scope.actividad,
idUsuario: $scope.idUsuario,
fechaDesde: $scope.now,
fechaHasta: $scope.now
};
focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) {
$scope.marcadores = datos.data;
});
}
}
]);