Commit bccae4161bd25db81bdb79afbf70d07bfcebf584
1 parent
76108ce85b
Exists in
master
ok validacion al editar precio y cantidad articulos remito
Showing
2 changed files
with
7 additions
and
7 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -869,14 +869,15 @@ angular.module('focaCrearRemito') .controller('remitoController', |
869 | 869 | }; |
870 | 870 | |
871 | 871 | $scope.editarArticulo = function(key, articulo) { |
872 | - if(key === 13) { | |
873 | - if(articulo.cantidad === null || articulo.cantidad === 0 || | |
874 | - articulo.cantidad === undefined) { | |
875 | - focaModalService.alert('El valor debe ser al menos 1'); | |
872 | + if (key === 13) { | |
873 | + if (!articulo.cantidad || !articulo.precio) { | |
874 | + focaModalService.alert('Los valores deben ser al menos 1'); | |
875 | + return; | |
876 | + } else if (articulo.cantidad < 0 || articulo.precio < 0) { | |
877 | + focaModalService.alert('Los valores no pueden ser negativos'); | |
876 | 878 | return; |
877 | 879 | } |
878 | - articulo.editCantidad = false; | |
879 | - articulo.editPrecio = false; | |
880 | + articulo.editCantidad = articulo.editPrecio = false; | |
880 | 881 | } |
881 | 882 | }; |
882 | 883 |
src/views/remito.html