Commit 66061beaa86ca65b638c0a707168393da5694e09
1 parent
ee4262c6e8
Exists in
master
and in
2 other branches
Validacion Chofer
Showing
1 changed file
with
14 additions
and
2 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -133,7 +133,7 @@ angular.module('focaAbmChofer') |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | focaAbmChoferService.getChofer($routeParams.id).then(function(res) { |
| 136 | - if(res.data) { | |
| 136 | + if (res.data) { | |
| 137 | 137 | var codigo = ('00000' + res.data.transportista.COD).slice(-5); |
| 138 | 138 | $scope.chofer = res.data; |
| 139 | 139 | $scope.$broadcast('addCabecera', { |
| ... | ... | @@ -151,7 +151,19 @@ angular.module('focaAbmChofer') |
| 151 | 151 | $location.path('/chofer'); |
| 152 | 152 | }; |
| 153 | 153 | |
| 154 | - $scope.guardar = function(key) { | |
| 154 | + $scope.guardar = function(key) { | |
| 155 | + | |
| 156 | + if (!$scope.chofer.nombre) { | |
| 157 | + focaModalService.alert('Ingrese nombre'); | |
| 158 | + return; | |
| 159 | + } else if (!$scope.chofer.idTipoDocumento) { | |
| 160 | + focaModalService.alert('Seleccione tipo de documento'); | |
| 161 | + return; | |
| 162 | + } else if (!$scope.chofer.dni){ | |
| 163 | + focaModalService.alert('Ingrese DNI'); | |
| 164 | + return; | |
| 165 | + } | |
| 166 | + | |
| 155 | 167 | key = (typeof key === 'undefined') ? 13 : key; |
| 156 | 168 | if(key === 13) { |
| 157 | 169 | validaDni().then(function() { |