diff --git a/package.json b/package.json index 72a83b2..ac643dc 100644 --- a/package.json +++ b/package.json @@ -67,4 +67,4 @@ "pump": "^3.0.0", "ui-bootstrap4": "^3.0.5" } -} +} \ No newline at end of file diff --git a/src/js/controller.js b/src/js/controller.js index a41f1f3..9ccc5c7 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -984,18 +984,23 @@ angular.module('focaCrearRemito').controller('remitoController', $scope.editarArticulo = function (key, articulo, tmpCantidad, tmpPrecio) { if (key === 13) { if (!articulo.cantidad || !articulo.precio || !tmpCantidad || !tmpPrecio) { - focaModalService.alert('Los valores deben ser al menos 1'); + focaModalService.alert('Debes introducir algún valor'); return; } else if (tmpCantidad === '0' || tmpPrecio === '0') { focaModalService.alert('Esta ingresando un producto con valor 0'); - } else if (articulo.cantidad < 0 || articulo.precio < 0) { + return; + } else if (tmpCantidad < 0 || tmpPrecio < 0) { focaModalService.alert('Los valores no pueden ser negativos'); return; + } else if (!Number.isInteger(tmpCantidad)) { + focaModalService.alert('Debes introducir un número entero'); + return; + } else { + articulo.cantidad = tmpCantidad; + articulo.precio = tmpPrecio; + $scope.getTotal(); + articulo.editCantidad = articulo.editPrecio = false; } - articulo.cantidad = tmpCantidad; - articulo.precio = tmpPrecio; - $scope.getTotal(); - articulo.editCantidad = articulo.editPrecio = false; } };