Commit efdfb0b11e1fb083453c2e37cdece8dc68582e3d
1 parent
c79b804663
Exists in
master
and in
1 other branch
limit 4 notes2
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
src/js/controller.js
| 1 | angular.module('focaAutorizarHojaRuta') | 1 | angular.module('focaAutorizarHojaRuta') |
| 2 | .controller('focaAutorizarHojaRutaCtrl', [ | 2 | .controller('focaAutorizarHojaRutaCtrl', [ |
| 3 | '$scope', | 3 | '$scope', |
| 4 | 'focaAutorizarHojaRutaService', | 4 | 'focaAutorizarHojaRutaService', |
| 5 | 'focaBotoneraLateralService', | 5 | 'focaBotoneraLateralService', |
| 6 | '$filter', | 6 | '$filter', |
| 7 | function($scope, focaAutorizarHojaRutaService, focaBotoneraLateralService, $filter) { | 7 | function($scope, focaAutorizarHojaRutaService, focaBotoneraLateralService, $filter) { |
| 8 | 8 | ||
| 9 | $scope.now = Date.now(); | 9 | $scope.now = Date.now(); |
| 10 | $scope.notasPedido = [] | 10 | $scope.notasPedido = [] |
| 11 | 11 | ||
| 12 | $scope.fechaDesde = new Date(); | 12 | $scope.fechaDesde = new Date(); |
| 13 | $scope.fechaHasta = new Date(); | 13 | $scope.fechaHasta = new Date(); |
| 14 | 14 | ||
| 15 | focaBotoneraLateralService.showSalir(true); | 15 | focaBotoneraLateralService.showSalir(true); |
| 16 | 16 | ||
| 17 | var month = $scope.fechaDesde.getMonth() - 1 < 0 ? 12 : $scope.fechaDesde.getMonth() - 1; | 17 | var month = $scope.fechaDesde.getMonth() - 1 < 0 ? 12 : $scope.fechaDesde.getMonth() - 1; |
| 18 | $scope.fechaDesde.setMonth(month); | 18 | $scope.fechaDesde.setMonth(month); |
| 19 | 19 | ||
| 20 | focaAutorizarHojaRutaService.getNotasPedido($scope.fechaDesde.toISOString().split('.')[0], | 20 | focaAutorizarHojaRutaService.getNotasPedido($scope.fechaDesde.toISOString().split('.')[0], |
| 21 | $scope.fechaHasta.toISOString().split('.')[0]).then(function(res) { | 21 | $scope.fechaHasta.toISOString().split('.')[0]).then(function(res) { |
| 22 | $scope.notasPedido = res.data.slice(0, 7); | 22 | $scope.notasPedido = res.data.slice(0, 4); |
| 23 | }); | 23 | }); |
| 24 | 24 | ||
| 25 | $scope.getSeleccionados = function() { | 25 | $scope.getSeleccionados = function() { |
| 26 | var seleccionados = $filter('filter')($scope.notasPedido, { checked: true }); | 26 | var seleccionados = $filter('filter')($scope.notasPedido, { checked: true }); |
| 27 | 27 | ||
| 28 | return seleccionados.length; | 28 | return seleccionados.length; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | $scope.seleccionarTodo = function() { | 31 | $scope.seleccionarTodo = function() { |
| 32 | $scope.notasPedido.forEach(function (notaPedido) { | 32 | $scope.notasPedido.forEach(function (notaPedido) { |
| 33 | notaPedido.checked = !$scope.checkedAll; | 33 | notaPedido.checked = !$scope.checkedAll; |
| 34 | }); | 34 | }); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | $scope.verNotaPedido = function(notaPedido) { | 37 | $scope.verNotaPedido = function(notaPedido) { |
| 38 | alert('En desarrollo'); | 38 | alert('En desarrollo'); |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | $scope.autorizar = function() { | 41 | $scope.autorizar = function() { |
| 42 | alert('En Desarrollo'); | 42 | alert('En Desarrollo'); |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | }]); | 45 | }]); |
| 46 | 46 |