From 0c6a8b9725daea9eced4d805d9ce33ed74548078 Mon Sep 17 00:00:00 2001 From: mpuebla Date: Mon, 8 Jul 2019 10:05:45 -0300 Subject: [PATCH] Agregado condicion para boton terminar. --- src/js/controller.js | 18 ++++++++++++++++++ src/views/lista-hoja-ruta.html | 6 +++--- 2 files changed, 21 insertions(+), 3 deletions(-) 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 -- 1.9.1