Commit 401217953c9e68604fc62ab4a537d4fd90451be7
1 parent
b19b525bb5
Exists in
develop
fix scope
Showing
3 changed files
with
12 additions
and
12 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -223,17 +223,17 @@ angular.module('focaAbmChofer') |
| 223 | 223 | $location.path('/chofer/' + chofer.id + '/' + chofer.idTransportista); |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - $scope.validarDatosChofer = function() { | |
| 226 | + $scope.validarDatosChofer = function(chofer) { | |
| 227 | 227 | // No permito numero ni caracteres especiles en nombre de chofer |
| 228 | - if (!/^([a-zA-ZÀ-ÿ ])*$/.test($scope.chofer.nombre)) { | |
| 229 | - focaModalService.alert('el campo Nombre no debe incluir números o símbolos') | |
| 230 | - $scope.chofer.nombre = '' | |
| 228 | + if (!/^([a-zA-ZÀ-ÿ ])*$/.test(chofer.nombre)) { | |
| 229 | + focaModalService.alert('el campo Nombre no debe incluir números o símbolos'); | |
| 230 | + $scope.chofer.nombre = ''; | |
| 231 | 231 | return |
| 232 | 232 | } |
| 233 | 233 | // Solo numeros en el campo documento |
| 234 | - if (!/^([0-9])*$/.test($scope.chofer.dni)) { | |
| 235 | - focaModalService.alert('el campo DNI solo puede incluir números') | |
| 236 | - $scope.chofer.dni = '' | |
| 234 | + if (!/^([0-9])*$/.test(chofer.dni)) { | |
| 235 | + focaModalService.alert('el campo DNI solo puede incluir números'); | |
| 236 | + $scope.chofer.dni = ''; | |
| 237 | 237 | return |
| 238 | 238 | } |
| 239 | 239 | } |
src/views/foca-abm-choferes-item.html
src/views/foca-abm-choferes-listado.html
| ... | ... | @@ -39,7 +39,7 @@ |
| 39 | 39 | type="text" |
| 40 | 40 | teclado-virtual |
| 41 | 41 | ng-model="chofer.nombre" |
| 42 | - ng-keyup="validarDatosChofer()" | |
| 42 | + ng-keyup="validarDatosChofer(chofer)" | |
| 43 | 43 | ng-required="true" |
| 44 | 44 | ng-keypress="next($event.keyCode)" |
| 45 | 45 | foca-focus="focused == 1" |
| ... | ... | @@ -65,7 +65,7 @@ |
| 65 | 65 | maxlength="12" |
| 66 | 66 | minlength="2" |
| 67 | 67 | ng-model="chofer.dni" |
| 68 | - ng-keyup="validarDatosChofer()" | |
| 68 | + ng-keyup="validarDatosChofer(chofer)" | |
| 69 | 69 | ng-required="true" |
| 70 | 70 | ng-keypress="next($event.keyCode)" |
| 71 | 71 | foca-focus="focused == 2" |
| ... | ... | @@ -106,7 +106,7 @@ |
| 106 | 106 | class="form-control" |
| 107 | 107 | type="text" |
| 108 | 108 | teclado-virtual |
| 109 | - ng-keyup="validarDatosChofer()" | |
| 109 | + ng-keyup="validarDatosChofer(chofer)" | |
| 110 | 110 | ng-model="chofer.nombre" |
| 111 | 111 | ng-required="true" |
| 112 | 112 | ng-keypress="next($event.keyCode)" |
| ... | ... | @@ -132,7 +132,7 @@ |
| 132 | 132 | type="text" |
| 133 | 133 | teclado-virtual |
| 134 | 134 | ng-model="chofer.dni" |
| 135 | - ng-keyup="validarDatosChofer()" | |
| 135 | + ng-keyup="validarDatosChofer(chofer)" | |
| 136 | 136 | ng-required="true" |
| 137 | 137 | ng-keypress="next($event.keyCode)" |
| 138 | 138 | foca-focus="focused == 2" |