diff --git a/src/js/controller.js b/src/js/controller.js index e2bad39..c37a3cd 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -148,6 +148,24 @@ angular.module('focaHojaRuta') } return true; }; + $scope.estaPendiente = function () { + var pendiente = false; + $scope.hojaRuta.remitos.forEach(function (remito) { + if (pendiente === false) { + var aDescargado = false; + for (var i = 0; i < remito.articulosRemito.length; i++) { + if (remito.articulosRemito[i].cantidadDescargada > 0) + aDescargado = true; + } + pendiente = (!aDescargado && remito.rechazado == null) ? true : false; + } + }); + if (pendiente) { + focaModalService.alert('Todavia hay remitos pendientes'); + return; + } + $scope.terminarHojaRuta(); + }; $rootScope.$on('estadoRed', function (event, value) { $scope.estadoRed = value; }); diff --git a/src/views/lista-hoja-ruta.html b/src/views/lista-hoja-ruta.html index 80c76c5..70ef526 100644 --- a/src/views/lista-hoja-ruta.html +++ b/src/views/lista-hoja-ruta.html @@ -94,13 +94,13 @@ ng-show="articulosDescargados(remito.articulosRemito)" class="btn btn-secondary my-1 rounded" type="button"> - + @@ -156,7 +156,7 @@ Salir Terminar