Commit 7965aabb276384b6aaffcd9f25acb6dfc3858fb4
1 parent
8fe8fa36ae
Exists in
master
Validacion precios
Showing
1 changed file
with
16 additions
and
1 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -102,6 +102,20 @@ angular.module('focaAbmPreciosCondiciones') |
| 102 | 102 | $location.path('/precio-condicion'); |
| 103 | 103 | }; |
| 104 | 104 | $scope.guardar = function() { |
| 105 | + | |
| 106 | + console.log($scope.precioCondicion); | |
| 107 | + | |
| 108 | + if (!$scope.precioCondicion.nombre) { | |
| 109 | + focaModalService.alert('Ingrese nombre'); | |
| 110 | + return; | |
| 111 | + } else if (!$scope.precioCondicion.descripcion) { | |
| 112 | + focaModalService.alert('Ingrese descripcion'); | |
| 113 | + return; | |
| 114 | + } else if (!$scope.precioCondicion.idListaPrecio) { | |
| 115 | + focaModalService.alert('Seleccione precio'); | |
| 116 | + return; | |
| 117 | + } | |
| 118 | + | |
| 105 | 119 | var promises = []; |
| 106 | 120 | var precioCondicion = $scope.precioCondicion; |
| 107 | 121 | precioCondicion.idListaPrecio = precioCondicion.listaPrecio.ID; |
| ... | ... | @@ -188,7 +202,8 @@ angular.module('focaAbmPreciosCondiciones') |
| 188 | 202 | size: 'lg' |
| 189 | 203 | } |
| 190 | 204 | ); |
| 191 | - modalInstance.result.then(function(listaPrecio) { | |
| 205 | + modalInstance.result.then(function(listaPrecio) { | |
| 206 | + $scope.precioCondicion.idListaPrecio = listaPrecio.ID; | |
| 192 | 207 | $scope.precioCondicion.listaPrecio = listaPrecio; |
| 193 | 208 | $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES; |
| 194 | 209 | $scope.focused = 4; |