diff --git a/src/js/controller.js b/src/js/controller.js index e696b6f..498d20e 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -9,8 +9,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ config(); function config() { - $scope.tmpCantidad = Number; - $scope.tmpPrecio = Number; + $scope.tmpCantidad = '0'; $scope.botonera = crearFacturaService.getBotonera(); $scope.botoneraProductos = []; $scope.isNumber = angular.isNumber; @@ -792,12 +791,13 @@ angular.module('focaCrearFactura').controller('facturaController', [ $scope.editarArticulo = function (key, articulo, tmpCantidad) { if (key === 13) { - if (!articulo.cantidad && !tmpCantidad) { + if (!articulo.cantidad && tmpCantidad.length === 0) { focaModalService.alert('Los valores deben ser al menos 1'); return; } else if (tmpCantidad === '0') { focaModalService.alert('Esta ingresando un producto con valor 0'); - } else if (articulo.cantidad < 0) { + return; + } else if (parseInt(tmpCantidad) < 0) { focaModalService.alert('Los valores no pueden ser negativos'); return; } diff --git a/src/views/factura.html b/src/views/factura.html index f1cca35..65026c4 100644 --- a/src/views/factura.html +++ b/src/views/factura.html @@ -119,7 +119,7 @@