Commit 0ddc35a93ff5871af1636d7235fa9b5b5ce4baba
1 parent
dadd2b7555
Exists in
master
and in
1 other branch
móvil
Showing
1 changed file
with
16 additions
and
7 deletions
 
Show diff stats
src/js/controller.js
| ... | ... | @@ -122,7 +122,12 @@ angular.module('focaModalDetalleHojaRuta') | 
| 122 | 122 | |
| 123 | 123 | $scope.aDescargar = []; | 
| 124 | 124 | $scope.remito.observaciones = ''; | 
| 125 | - $scope.articuloSeleccionado.descargado = true; | |
| 125 | + | |
| 126 | + if ($scope.articuloSeleccionado.cantidadDescargada === | |
| 127 | + $scope.articuloSeleccionado.cantidad ) { | |
| 128 | + | |
| 129 | + $scope.articuloSeleccionado.descargado = true; | |
| 130 | + } | |
| 126 | 131 | |
| 127 | 132 | var siguienteArticulo = $scope.remito.articulosRemito.filter( | 
| 128 | 133 | function(articulo) { | 
| ... | ... | @@ -182,9 +187,13 @@ angular.module('focaModalDetalleHojaRuta') | 
| 182 | 187 | } | 
| 183 | 188 | ); | 
| 184 | 189 | modalInstance.result.then(function() { | 
| 185 | - success(); | |
| 190 | + success().then(function() { | |
| 191 | + $uibModalInstance.close($scope.remito); | |
| 192 | + }); | |
| 186 | 193 | }, function() { | 
| 187 | - success(); | |
| 194 | + success().then(function() { | |
| 195 | + $uibModalInstance.close($scope.remito); | |
| 196 | + }); | |
| 188 | 197 | }); | 
| 189 | 198 | }; | 
| 190 | 199 | |
| ... | ... | @@ -220,23 +229,24 @@ angular.module('focaModalDetalleHojaRuta') | 
| 220 | 229 | focaModalService.alert('Hubo un error ' + error); | 
| 221 | 230 | } | 
| 222 | 231 | function success() { | 
| 223 | - focaModalService.alert('Operación realizada con éxito'); | |
| 224 | 232 | $scope.cargando = false; | 
| 233 | + return focaModalService.alert('Operación realizada con éxito'); | |
| 225 | 234 | } | 
| 226 | 235 | |
| 227 | 236 | var articuloAChequear = $scope.remito.articulosRemito.filter( | 
| 228 | 237 | function(articulo) { | 
| 229 | 238 | return !articulo.descargado; | 
| 230 | 239 | }); | 
| 240 | + | |
| 231 | 241 | if (!articuloAChequear.length || $scope.remito.rechazado) { | 
| 232 | 242 | $scope.readonly = true; | 
| 233 | 243 | $scope.cambio($scope.remito.articulosRemito[0]); | 
| 234 | 244 | } else { | 
| 235 | 245 | $scope.cambio(articuloAChequear[0]); | 
| 236 | 246 | } | 
| 247 | + | |
| 237 | 248 | } | 
| 238 | - ] | |
| 239 | - ) | |
| 249 | + ]) | |
| 240 | 250 | .controller('focaModalActualizarPuntoDescargaController', | 
| 241 | 251 | [ | 
| 242 | 252 | '$scope', | 
| ... | ... | @@ -290,7 +300,6 @@ angular.module('focaModalDetalleHojaRuta') | 
| 290 | 300 | .then(function(res) { | 
| 291 | 301 | $uibModalInstance.close(res.data); | 
| 292 | 302 | }); | 
| 293 | - | |
| 294 | 303 | }; | 
| 295 | 304 | |
| 296 | 305 | } |