Commit 13e5962cdafd9960d5bb8bd21d74cff73316243c
Exists in
master
and in
2 other branches
Merge branch 'master' into 'master'
Master See merge request !9
Showing
4 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -101,6 +101,10 @@ angular.module('focaAbmChofer') |
101 | 101 | if (key === 13) $scope.focused++; |
102 | 102 | }; |
103 | 103 | |
104 | + focaAbmChoferService.getTiposDocumento().then(function(res) { | |
105 | + $scope.tiposDocumento = res.data; | |
106 | + }); | |
107 | + | |
104 | 108 | //SETEO BOTONERA LATERAL |
105 | 109 | $timeout(function() { |
106 | 110 | focaBotoneraLateralService.showSalir(false); |
... | ... | @@ -144,7 +148,6 @@ angular.module('focaAbmChofer') |
144 | 148 | |
145 | 149 | $scope.guardar = function(key) { |
146 | 150 | key = (typeof key === 'undefined') ? 13 : key; |
147 | - | |
148 | 151 | if(key === 13) { |
149 | 152 | validaDni().then(function() { |
150 | 153 | $scope.chofer.idTransportista = $routeParams.idTransportista; |
... | ... | @@ -161,16 +164,11 @@ angular.module('focaAbmChofer') |
161 | 164 | function validaDni() { |
162 | 165 | return new Promise(function(resolve, reject) { |
163 | 166 | focaAbmChoferService |
164 | - .getChoferPorTransportista(parseInt($routeParams.idTransportista)) | |
167 | + .getChoferPorDni($scope.chofer.dni) | |
165 | 168 | .then(function(res) { |
166 | - //Valida si existe dni | |
167 | - var existe = res.data.filter(function(chofer) { | |
168 | - return chofer.dni === $scope.chofer.dni && | |
169 | - chofer.id !== $scope.chofer.id; | |
170 | - }); | |
171 | - | |
172 | - if(existe.length) { | |
173 | - reject(existe); | |
169 | + if(res.data.id && | |
170 | + $scope.chofer.id !== res.data.id) { | |
171 | + reject(res.data); | |
174 | 172 | }else { |
175 | 173 | resolve(); |
176 | 174 | } |
src/js/service.js
... | ... | @@ -10,6 +10,9 @@ angular.module('focaAbmChofer') |
10 | 10 | getChoferPorTransportista: function(id) { |
11 | 11 | return $http.get(API_ENDPOINT.URL + '/chofer/transportista/' + id); |
12 | 12 | }, |
13 | + getChoferPorDni: function(dni) { | |
14 | + return $http.post(API_ENDPOINT.URL + '/chofer/dni', {dni: dni}); | |
15 | + }, | |
13 | 16 | guardarChofer: function(chofer) { |
14 | 17 | return $http.post(API_ENDPOINT.URL + '/chofer', {chofer: chofer}); |
15 | 18 | }, |
... | ... | @@ -22,6 +25,9 @@ angular.module('focaAbmChofer') |
22 | 25 | deleteChofer: function(id) { |
23 | 26 | return $http.delete(API_ENDPOINT.URL + '/chofer/' + id); |
24 | 27 | }, |
28 | + getTiposDocumento: function() { | |
29 | + return $http.get(API_ENDPOINT.URL + '/tipo-documento'); | |
30 | + }, | |
25 | 31 | transportistaSeleccionado: {} |
26 | 32 | }; |
27 | 33 | }]); |
src/views/foca-abm-choferes-item.html
... | ... | @@ -24,6 +24,16 @@ |
24 | 24 | </div> |
25 | 25 | </div> |
26 | 26 | <div class="form-group row"> |
27 | + <label class="offset-sm-1 col-sm-2 col-form-label">Tipo documento</label> | |
28 | + <div class="col-sm-4"> | |
29 | + <select | |
30 | + class="form-control" | |
31 | + ng-options="tipoDocumento.id as tipoDocumento.descripcion for tipoDocumento in tiposDocumento track by tipoDocumento.id" | |
32 | + ng-model="chofer.idTipoDocumento"> | |
33 | + </select> | |
34 | + </div> | |
35 | + </div> | |
36 | + <div class="form-group row"> | |
27 | 37 | <label class="offset-sm-1 col-sm-2 col-form-label">DNI</label> |
28 | 38 | <div class="col-sm-4"> |
29 | 39 | <input |
src/views/foca-abm-choferes-listado.html
... | ... | @@ -9,14 +9,14 @@ |
9 | 9 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> |
10 | 10 | <div class="row px-5 py-2 botonera-secundaria"> |
11 | 11 | <div class="col-12"> |
12 | - <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> | |
12 | + <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> | |
13 | 13 | </div> |
14 | 14 | </div> |
15 | 15 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> |
16 | 16 | <thead> |
17 | 17 | <tr> |
18 | 18 | <th>Nombre</th> |
19 | - <th>DNI</th> | |
19 | + <th>Documento</th> | |
20 | 20 | <th>Teléfono</th> |
21 | 21 | <th class="text-center"> |
22 | 22 | <button |