Commit 5634823744b90fe8c3455d9aca92a6036fd2499c
1 parent
da15a2d281
Exists in
master
Agrego validaciones para no permitir cantidad en 0
Showing
1 changed file
with
11 additions
and
0 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -267,6 +267,12 @@ angular.module('focaCrearNotaPedido') |
| 267 | 267 | }; |
| 268 | 268 | $scope.agregarATabla = function(key) { |
| 269 | 269 | if(key === 13) { |
| 270 | + if($scope.articuloACargar.cantidad === undefined || | |
| 271 | + $scope.articuloACargar.cantidad === 0 || | |
| 272 | + $scope.articuloACargar.cantidad === null ){ | |
| 273 | + focaModalService.alert('El valor debe ser al menos 1'); | |
| 274 | + return; | |
| 275 | + } | |
| 270 | 276 | $scope.articulosTabla.unshift($scope.articuloACargar); |
| 271 | 277 | $scope.cargando = true; |
| 272 | 278 | } |
| ... | ... | @@ -276,6 +282,11 @@ angular.module('focaCrearNotaPedido') |
| 276 | 282 | }; |
| 277 | 283 | $scope.editarArticulo = function(key, articulo) { |
| 278 | 284 | if(key === 13) { |
| 285 | + if(articulo.cantidad === null || articulo.cantidad === 0 || | |
| 286 | + articulo.cantidad === undefined){ | |
| 287 | + focaModalService.alert('El valor debe ser al menos 1'); | |
| 288 | + return; | |
| 289 | + } | |
| 279 | 290 | articulo.edit = false; |
| 280 | 291 | } |
| 281 | 292 | }; |