Commit c480d0935fd3ecabb7f3198167589e4cf0b47801

Authored by Eric Fernandez
1 parent 5fa8100a87
Exists in master

code review

src/js/controller.js
1 angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaController', [ 1 angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaController', [
2 '$scope', 'focaLogisticaPedidoRutaService', '$location', '$uibModal', '$filter', 2 '$scope', 'focaLogisticaPedidoRutaService', '$location', '$uibModal', '$filter',
3 'focaModalService', 'focaBotoneraLateralService', '$interval', 3 'focaModalService', 'focaBotoneraLateralService', '$interval',
4 function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter, 4 function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter,
5 focaModalService, focaBotoneraLateralService, $interval 5 focaModalService, focaBotoneraLateralService, $interval
6 ) { 6 ) {
7 $scope.actividad = 'Logistica'; 7 $scope.actividad = 'Logistica';
8 8
9 //Datos Pantalla 9 //Datos Pantalla
10 $scope.titulo = 'Logistica de Pedidos'; 10 $scope.titulo = 'Logistica de Pedidos';
11 $scope.botonera = ['Transportista']; 11 $scope.botonera = ['Transportista'];
12 var cabecera = ''; 12 var cabecera = '';
13 13
14 $scope.idVendedor = 0; 14 $scope.idVendedor = 0;
15 $scope.marcadores = []; 15 $scope.marcadores = [];
16 $scope.vehiculos = []; 16 $scope.vehiculos = [];
17 getSeguimiento(); 17 getSeguimiento();
18 $scope.arrastrando = false; 18 $scope.arrastrando = false;
19 $scope.general = function() { 19 $scope.general = function() {
20 $scope.idVendedor = 0; 20 $scope.idVendedor = 0;
21 getSeguimiento(); 21 getSeguimiento();
22 }; 22 };
23 23
24 //SETEO BOTONERA LATERAL 24 //SETEO BOTONERA LATERAL
25 focaBotoneraLateralService.showSalir(true); 25 focaBotoneraLateralService.showSalir(true);
26 focaBotoneraLateralService.showPausar(false); 26 focaBotoneraLateralService.showPausar(false);
27 focaBotoneraLateralService.showGuardar(false); 27 focaBotoneraLateralService.showGuardar(false);
28 28
29 29
30 $scope.general = function() { 30 $scope.general = function() {
31 $scope.idVendedor = 0; 31 $scope.idVendedor = 0;
32 getSeguimiento(); 32 getSeguimiento();
33 $scope.$broadcast('removeCabecera', cabecera); 33 $scope.$broadcast('removeCabecera', cabecera);
34 $scope.$broadcast('addCabecera',{ 34 $scope.$broadcast('addCabecera',{
35 label: 'General', 35 label: 'General',
36 valor: '' 36 valor: ''
37 }); 37 });
38 }; 38 };
39 39
40 $scope.cargar = function(idVehiculo, punto) { 40 $scope.cargar = function(idVehiculo, punto) {
41 var idRemito; 41 var idRemito;
42 if (punto === -1) { 42 if(punto === -1) {
43 idRemito = -1; 43 idRemito = -1;
44 }else { 44 }else {
45 idRemito = JSON.parse(punto).notaPedido.remito.id; 45 idRemito = JSON.parse(punto).notaPedido.remito.id;
46 } 46 }
47 var modalInstance = $uibModal.open( 47 var modalInstance = $uibModal.open(
48 { 48 {
49 ariaLabelledBy: 'Busqueda de Vehiculo', 49 ariaLabelledBy: 'Busqueda de Vehiculo',
50 templateUrl: 'foca-detalle-vehiculo.html', 50 templateUrl: 'foca-detalle-vehiculo.html',
51 controller: 'focaDetalleVehiculo', 51 controller: 'focaDetalleVehiculo',
52 size: 'lg', 52 size: 'lg',
53 resolve: { 53 resolve: {
54 idVehiculo: function() {return idVehiculo;}, 54 idVehiculo: function() {return idVehiculo;},
55 idRemito: function() {return idRemito;} 55 idRemito: function() {return idRemito;}
56 } 56 }
57 } 57 }
58 ); 58 );
59 modalInstance.result.then(function() { 59 modalInstance.result.then(function() {
60 }, function() { 60 }, function() {
61 }); 61 });
62 }; 62 };
63 63
64 $scope.quitarVehiculo = function(vehiculo) { 64 $scope.quitarVehiculo = function(vehiculo) {
65 focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + 65 focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' +
66 vehiculo.codigo + '?').then(function() { 66 vehiculo.codigo + '?').then(function() {
67 eliminarVehiculo(vehiculo); 67 eliminarVehiculo(vehiculo);
68 }); 68 });
69 }; 69 };
70 70
71 $scope.hacerHojaRuta = function(vehiculo) { 71 $scope.hacerHojaRuta = function(vehiculo) {
72 var modalInstance = $uibModal.open( 72 var modalInstance = $uibModal.open(
73 { 73 {
74 ariaLabelledBy: 'Creación hoja ruta', 74 ariaLabelledBy: 'Creación hoja ruta',
75 templateUrl: 'foca-modal-crear-hoja-ruta.html', 75 templateUrl: 'foca-modal-crear-hoja-ruta.html',
76 controller: 'focaModalCrearHojaRuta', 76 controller: 'focaModalCrearHojaRuta',
77 size: 'lg', 77 size: 'lg',
78 resolve: { 78 resolve: {
79 idVehiculo: function() {return vehiculo.id;} 79 idVehiculo: function() {return vehiculo.id;}
80 } 80 }
81 } 81 }
82 ); 82 );
83 modalInstance.result.then(function() { 83 modalInstance.result.then(function() {
84 84
85 }, function() { 85 }, function() {
86 //usar cuando se cancela el modal 86 //usar cuando se cancela el modal
87 }); 87 });
88 }; 88 };
89 89
90 $scope.arrastra = function() { 90 $scope.arrastra = function() {
91 $scope.arrastrando = true; 91 $scope.arrastrando = true;
92 $scope.$digest(); 92 $scope.$digest();
93 }; 93 };
94 94
95 $scope.noArrastra = function() { 95 $scope.noArrastra = function() {
96 $scope.arrastrando = false; 96 $scope.arrastrando = false;
97 $scope.$digest(); 97 $scope.$digest();
98 }; 98 };
99 99
100 $scope.individual = function() { 100 $scope.individual = function() {
101 $scope.idVendedor = -1; 101 $scope.idVendedor = -1;
102 }; 102 };
103 103
104 $scope.mostrarDetalle = function() { 104 $scope.mostrarDetalle = function() {
105 $scope.detalle = true; 105 $scope.detalle = true;
106 }; 106 };
107 107
108 $scope.salir = function() { 108 $scope.salir = function() {
109 $location.path('/'); 109 $location.path('/');
110 }; 110 };
111 111
112 $scope.search = function(key) { 112 $scope.search = function(key) {
113 if (key === 13) { 113 if (key === 13) {
114 $scope.idVendedor = $scope.idVendedorInput; 114 $scope.idVendedor = $scope.idVendedorInput;
115 getSeguimiento(); 115 getSeguimiento();
116 $scope.$broadcast('removeCabecera', 'General'); 116 $scope.$broadcast('removeCabecera', 'General');
117 $scope.$broadcast('addCabecera', { 117 $scope.$broadcast('addCabecera', {
118 label: cabecera, 118 label: cabecera,
119 valor: $scope.idVendedorInput 119 valor: $scope.idVendedorInput
120 }); 120 });
121 } 121 }
122 }; 122 };
123 123
124 $scope.fecha = function() { 124 $scope.fecha = function() {
125 getSeguimiento(); 125 getSeguimiento();
126 }; 126 };
127 127
128 $scope.seleccionarTransportista = function() { 128 $scope.seleccionarTransportista = function() {
129 var modalInstance = $uibModal.open( 129 var modalInstance = $uibModal.open(
130 { 130 {
131 ariaLabelledBy: 'Busqueda de Transportista', 131 ariaLabelledBy: 'Busqueda de Transportista',
132 templateUrl: 'modal-proveedor.html', 132 templateUrl: 'modal-proveedor.html',
133 controller: 'focaModalProveedorCtrl', 133 controller: 'focaModalProveedorCtrl',
134 size: 'lg', 134 size: 'lg',
135 resolve: { 135 resolve: {
136 transportista: function() { 136 transportista: function() {
137 return true; 137 return true;
138 } 138 }
139 } 139 }
140 } 140 }
141 ); 141 );
142 modalInstance.result.then(function(transportista) { 142 modalInstance.result.then(function(transportista) {
143 $scope.seleccionarVehiculo(transportista.COD); 143 $scope.seleccionarVehiculo(transportista.COD);
144 }); 144 });
145 }; 145 };
146 146
147 $scope.seleccionarVehiculo = function(idTransportista) { 147 $scope.seleccionarVehiculo = function(idTransportista) {
148 var modalInstance = $uibModal.open( 148 var modalInstance = $uibModal.open(
149 { 149 {
150 ariaLabelledBy: 'Busqueda de Vehiculo', 150 ariaLabelledBy: 'Busqueda de Vehiculo',
151 templateUrl: 'modal-vehiculo.html', 151 templateUrl: 'modal-vehiculo.html',
152 controller: 'focaModalVehiculoController', 152 controller: 'focaModalVehiculoController',
153 size: 'lg', 153 size: 'lg',
154 resolve: { 154 resolve: {
155 idTransportista: function() {return idTransportista;} 155 idTransportista: function() {return idTransportista;}
156 } 156 }
157 } 157 }
158 ); 158 );
159 159
160 modalInstance.result.then( 160 modalInstance.result.then(
161 function(vehiculo) { 161 function(vehiculo) {
162 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); 162 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id});
163 if(existe.length) { 163 if(existe.length) {
164 focaModalService.alert('El vehiculo ya ha sido cargado'); 164 focaModalService.alert('El vehiculo ya ha sido cargado');
165 return; 165 return;
166 } 166 }
167 if(!vehiculo.cisternas.length) { 167 if(!vehiculo.cisternas.length) {
168 focaModalService.alert('El vehiculo no tiene cisternas'); 168 focaModalService.alert('El vehiculo no tiene cisternas');
169 return; 169 return;
170 } 170 }
171 $scope.vehiculos.push(vehiculo); 171 $scope.vehiculos.push(vehiculo);
172 }, function() { 172 }, function() {
173 // funcion ejecutada cuando se cancela el modal 173 // funcion ejecutada cuando se cancela el modal
174 } 174 }
175 ); 175 );
176 }; 176 };
177 177
178 function getSeguimiento() { 178 function getSeguimiento() {
179 var desde = new Date('1900/01/01'); 179 var desde = new Date('1900/01/01');
180 var hasta = new Date('2099/01/01'); 180 var hasta = new Date('2099/01/01');
181 if ($scope.now) { 181 if ($scope.now) {
182 var now = $scope.now; 182 var now = $scope.now;
183 desde = new Date(new Date(now.setHours(0)).setMinutes(0)); 183 desde = new Date(new Date(now.setHours(0)).setMinutes(0));
184 desde = desde.setDate(desde.getDate() - 1); 184 desde = desde.setDate(desde.getDate() - 1);
185 desde = new Date(desde); 185 desde = new Date(desde);
186 } 186 }
187 var datos = { 187 var datos = {
188 actividad: $scope.actividad, 188 actividad: $scope.actividad,
189 idUsuario: $scope.idVendedor, 189 idUsuario: $scope.idVendedor,
190 fechaDesde: desde, 190 fechaDesde: desde,
191 fechaHasta: hasta 191 fechaHasta: hasta
192 }; 192 };
193 193
194 $scope.datosBuscados = { 194 $scope.datosBuscados = {
195 actividad: $scope.actividad, 195 actividad: $scope.actividad,
196 individual: $scope.idVendedor ? true : false 196 individual: $scope.idVendedor ? true : false
197 }; 197 };
198 198
199 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { 199 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) {
200 if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { 200 if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) {
201 $scope.marcadores = datos.data; 201 $scope.marcadores = datos.data;
202 } 202 }
203 }); 203 });
204 } 204 }
205 205
206 function eliminarVehiculo(vehiculo) { 206 function eliminarVehiculo(vehiculo) {
207 focaLogisticaPedidoRutaService.getRemitos(vehiculo.id).then(function(res) { 207 focaLogisticaPedidoRutaService.getRemitos(vehiculo.id).then(function(res) {
208 if(!focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data).length) { 208 if(!focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data).length) {
209 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); 209 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1);
210 }else { 210 }else {
211 focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + 211 focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' +
212 'tiene remitos asociados').then(function() { 212 'tiene remitos asociados').then(function() {
213 $scope.hacerHojaRuta(vehiculo); 213 $scope.hacerHojaRuta(vehiculo);
214 }); 214 });
215 } 215 }
216 }); 216 });
217 } 217 }
218 $interval(function() { 218 $interval(function() {
219 getSeguimiento(); 219 getSeguimiento();
220 }, 5000); 220 }, 5000);
221 } 221 }
222 ]); 222 ]);
223 223
src/js/controllerDetalleVehiculo.js
1 angular.module('focaLogisticaPedidoRuta') 1 angular.module('focaLogisticaPedidoRuta')
2 .controller('focaDetalleVehiculo', 2 .controller('focaDetalleVehiculo',
3 ['$scope', 3 ['$scope',
4 '$uibModalInstance', 4 '$uibModalInstance',
5 'idVehiculo', 5 'idVehiculo',
6 'idRemito', 6 'idRemito',
7 'focaModalService', 7 'focaModalService',
8 '$filter', 8 '$filter',
9 'focaLogisticaPedidoRutaService', 9 'focaLogisticaPedidoRutaService',
10 function($scope, $uibModalInstance, idVehiculo, idRemito, focaModalService, $filter, 10 function($scope, $uibModalInstance, idVehiculo, idRemito, focaModalService, $filter,
11 focaLogisticaPedidoRutaService 11 focaLogisticaPedidoRutaService
12 ) { 12 ) {
13 //seteo variables 13 //seteo variables
14 $scope.idRemito = idRemito; 14 $scope.idRemito = idRemito;
15 $scope.articulos = []; 15 $scope.articulos = [];
16 $scope.vehiculo = {}; 16 $scope.vehiculo = {};
17 $scope.remito = {}; 17 $scope.remito = {};
18 $scope.aCargar = []; 18 $scope.aCargar = [];
19 var cisternaMovimientos = []; 19 var cisternaMovimientos = [];
20 focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then( 20 focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then(
21 function(res) { 21 function(res) {
22 $scope.vehiculo = res.data; 22 $scope.vehiculo = res.data;
23 } 23 }
24 ); 24 );
25 if (idRemito !== -1) { 25 if(idRemito !== -1) {
26 focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito).then( 26 focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito).then(
27 function(res) { 27 function(res) {
28 $scope.remito = res.data; 28 $scope.remito = res.data;
29 if($scope.remito.idUsuarioProceso) { 29 if($scope.remito.idUsuarioProceso) {
30 focaModalService.alert('El remito esta siendo cargado por otro usario'); 30 focaModalService.alert('El remito esta siendo cargado por otro usario');
31 $uibModalInstance.close(); 31 $uibModalInstance.close();
32 } 32 }
33 $scope.articulos = res.data.articulosRemito; 33 $scope.articulos = res.data.articulosRemito;
34 } 34 }
35 ); 35 );
36 } 36 }
37 $scope.aceptar = function() { 37 $scope.aceptar = function() {
38 $scope.cargando = true; 38 $scope.cargando = true;
39 var cisternaCargas = []; 39 var cisternaCargas = [];
40 for (var i = 0; i < $scope.vehiculo.cisternas.length; i++) { 40 for (var i = 0; i < $scope.vehiculo.cisternas.length; i++) {
41 delete $scope.vehiculo.cisternas[i].cisternaCarga.articulo; 41 delete $scope.vehiculo.cisternas[i].cisternaCarga.articulo;
42 cisternaCargas.push($scope.vehiculo.cisternas[i].cisternaCarga); 42 cisternaCargas.push($scope.vehiculo.cisternas[i].cisternaCarga);
43 } 43 }
44 var cisterna = { 44 var cisterna = {
45 cisternaMovimientos: cisternaMovimientos, 45 cisternaMovimientos: cisternaMovimientos,
46 cisternaCargas: cisternaCargas, 46 cisternaCargas: cisternaCargas,
47 idVehiculo: $scope.vehiculo.id 47 idVehiculo: $scope.vehiculo.id
48 }; 48 };
49 focaLogisticaPedidoRutaService.guardarCisternas(cisterna, $scope.remito.id) 49 focaLogisticaPedidoRutaService.guardarCisternas(cisterna, $scope.remito.id)
50 .then(function() { 50 .then(function() {
51 focaModalService.alert('Cisternas cargadas con éxito').then(function() { 51 focaModalService.alert('Cisternas cargadas con éxito').then(function() {
52 $scope.cargando = false; 52 $scope.cargando = false;
53 $uibModalInstance.close(); 53 $uibModalInstance.close();
54 }); 54 });
55 }).catch(function(error) { 55 }).catch(function(error) {
56 $scope.cargando = false; 56 $scope.cargando = false;
57 $uibModalInstance.close(); 57 $uibModalInstance.close();
58 if (error.status === 403.1) { 58 if (error.status === 403.1) {
59 focaModalService.alert('ERROR: El vehículo esta en uso'); 59 focaModalService.alert('ERROR: El vehículo esta en uso');
60 } 60 }
61 if(error.status === 403.2) { 61 if(error.status === 403.2) {
62 focaModalService.alert('ERROR: Otro usario ya cargó este remito'); 62 focaModalService.alert('ERROR: Otro usario ya cargó este remito');
63 return; 63 return;
64 } 64 }
65 focaModalService.alert('Hubo un error al cargar las cisternas'); 65 focaModalService.alert('Hubo un error al cargar las cisternas');
66 }); 66 });
67 }; 67 };
68 68
69 $scope.cancelar = function() { 69 $scope.cancelar = function() {
70 $uibModalInstance.close(); 70 $uibModalInstance.close();
71 }; 71 };
72 72
73 $scope.cargarACisternas = function(vehiculo) { 73 $scope.cargarACisternas = function(vehiculo) {
74 for(var i = 0; i < vehiculo.cisternas.length; i++) { 74 for(var i = 0; i < vehiculo.cisternas.length; i++) {
75 var cisterna = vehiculo.cisternas[i]; 75 var cisterna = vehiculo.cisternas[i];
76 var aCargar = parseFloat($scope.aCargar[i]); 76 var aCargar = parseFloat($scope.aCargar[i]);
77 //validaciones 77 //validaciones
78 if(!aCargar) { 78 if(!aCargar) {
79 continue; 79 continue;
80 } 80 }
81 if(aCargar > cisterna.disponible) { 81 if(aCargar > cisterna.disponible) {
82 focaModalService.alert('La cantidad cargada supera la capacidad de la' + 82 focaModalService.alert('La cantidad cargada supera la capacidad de la' +
83 'cisterna ' + cisterna.codigo); 83 'cisterna ' + cisterna.codigo);
84 return; 84 return;
85 } 85 }
86 //cargar 86 //cargar
87 if(cisterna.cisternaCarga.cantidad) { 87 if(cisterna.cisternaCarga.cantidad) {
88 cisterna.cisternaCarga.cantidad += aCargar; 88 cisterna.cisternaCarga.cantidad += aCargar;
89 }else { 89 }else {
90 cisterna.cisternaCarga.cantidad = aCargar; 90 cisterna.cisternaCarga.cantidad = aCargar;
91 cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo; 91 cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo;
92 } 92 }
93 cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad; 93 cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad;
94 94
95 cisterna.cisternaCarga.articulo = { 95 cisterna.cisternaCarga.articulo = {
96 DetArt: $scope.articuloSeleccionado.descripcion 96 DetArt: $scope.articuloSeleccionado.descripcion
97 }; 97 };
98 $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0] 98 $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0]
99 .cargado = true; 99 .cargado = true;
100 100
101 $scope.calcularPorcentaje(cisterna); 101 $scope.calcularPorcentaje(cisterna);
102 //Guardar 102 //Guardar
103 var now = new Date(); 103 var now = new Date();
104 var cisternaMovimiento = { 104 var cisternaMovimiento = {
105 fecha: now.toISOString().slice(0, 19).replace('T', ' '), 105 fecha: now.toISOString().slice(0, 19).replace('T', ' '),
106 cantidad: aCargar, 106 cantidad: aCargar,
107 metodo: 'carga', 107 metodo: 'carga',
108 idCisternaCarga: cisterna.cisternaCarga.id, 108 idCisternaCarga: cisterna.cisternaCarga.id,
109 idRemito: $scope.remito.id 109 idRemito: $scope.remito.id
110 }; 110 };
111 cisternaMovimientos.push(cisternaMovimiento); 111 cisternaMovimientos.push(cisternaMovimiento);
112 } 112 }
113 var articuloSiguiente = $scope.articulos.filter( 113 var articuloSiguiente = $scope.articulos.filter(
114 function(filter) { 114 function(filter) {
115 return filter.cargado !== true; 115 return filter.cargado !== true;
116 } 116 }
117 ); 117 );
118 if(articuloSiguiente.length > 0) { 118 if(articuloSiguiente.length > 0) {
119 $scope.cambioArticulo(articuloSiguiente[0]); 119 $scope.cambioArticulo(articuloSiguiente[0]);
120 } 120 }
121 $scope.aCargar = []; 121 $scope.aCargar = [];
122 }; 122 };
123 $scope.calcularPorcentaje = function(cisterna) { 123 $scope.calcularPorcentaje = function(cisterna) {
124 if(!cisterna.cisternaCarga.cantidad) { 124 if(!cisterna.cisternaCarga.cantidad) {
125 cisterna.cisternaCarga.cantidad = 0; 125 cisterna.cisternaCarga.cantidad = 0;
126 } 126 }
127 var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / 127 var porcentaje = (cisterna.cisternaCarga.cantidad * 100 /
128 cisterna.capacidad) + '%'; 128 cisterna.capacidad) + '%';
129 var elementHtml = document.getElementById(cisterna.id); 129 var elementHtml = document.getElementById(cisterna.id);
130 if(elementHtml) { 130 if(elementHtml) {
131 elementHtml.style.width = porcentaje; 131 elementHtml.style.width = porcentaje;
132 } 132 }
133 }; 133 };
134 $scope.cambioArticulo = function(articulo) { 134 $scope.cambioArticulo = function(articulo) {
135 articulo.checked = true; 135 articulo.checked = true;
136 $scope.articuloSeleccionado = articulo; 136 $scope.articuloSeleccionado = articulo;
137 }; 137 };
138 $scope.actualizarArticulo = function () { 138 $scope.actualizarArticulo = function () {
139 $scope.articuloSeleccionado.cantidadCargada = 0; 139 $scope.articuloSeleccionado.cantidadCargada = 0;
140 for (var i = 0; i < $scope.aCargar.length; i++) { 140 for (var i = 0; i < $scope.aCargar.length; i++) {
141 $scope.articuloSeleccionado.cantidadCargada += 141 $scope.articuloSeleccionado.cantidadCargada +=
142 parseFloat($scope.aCargar[i]) || 0; 142 parseFloat($scope.aCargar[i]) || 0;
143 } 143 }
144 }; 144 };
145 $scope.tieneArticulosPendientes = function() { 145 $scope.tieneArticulosPendientes = function() {
146 var articulosDescargados = $scope.articulos.filter(function(filter) { 146 var articulosDescargados = $scope.articulos.filter(function(filter) {
147 return filter.cargado === true; 147 return filter.cargado === true;
148 }); 148 });
149 if(articulosDescargados.length === $scope.articulos.length) { 149 if(articulosDescargados.length === $scope.articulos.length) {
150 return false; 150 return false;
151 } 151 }
152 return true; 152 return true;
153 }; 153 };
154 }]); 154 }]);
155 155