controller.js
1.55 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
angular.module('focaAutorizarHojaRuta')
.controller('focaAutorizarHojaRutaCtrl', [
'$scope',
'focaAutorizarHojaRutaService',
'focaBotoneraLateralService',
'$filter',
function($scope, focaAutorizarHojaRutaService, focaBotoneraLateralService, $filter) {
$scope.now = Date.now();
$scope.notasPedido = []
$scope.fechaDesde = new Date();
$scope.fechaHasta = new Date();
focaBotoneraLateralService.showSalir(true);
var month = $scope.fechaDesde.getMonth() - 1 < 0 ? 12 : $scope.fechaDesde.getMonth() - 1;
$scope.fechaDesde.setMonth(month);
focaAutorizarHojaRutaService.getNotasPedido($scope.fechaDesde.toISOString().split('.')[0],
$scope.fechaHasta.toISOString().split('.')[0]).then(function(res) {
$scope.notasPedido = res.data.slice(0, 4);
});
$scope.getSeleccionados = function() {
var seleccionados = $filter('filter')($scope.notasPedido, { checked: true });
return seleccionados.length;
}
$scope.seleccionarTodo = function() {
$scope.notasPedido.forEach(function (notaPedido) {
notaPedido.checked = !$scope.checkedAll;
});
}
$scope.verNotaPedido = function(notaPedido) {
alert('En desarrollo');
};
$scope.autorizar = function() {
alert('En Desarrollo');
};
}]);