Commit b19b525bb560d03e1b272c7514a1faece01f5c4a
1 parent
41554db9b8
Exists in
develop
fix
Showing
2 changed files
with
5 additions
and
0 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaAbmChofer') | 1 | angular.module('focaAbmChofer') |
2 | .controller('focaAbmChoferesController', [ | 2 | .controller('focaAbmChoferesController', [ |
3 | '$scope', 'focaAbmChoferService', '$location', '$uibModal', | 3 | '$scope', 'focaAbmChoferService', '$location', '$uibModal', |
4 | 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$localStorage', | 4 | 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$localStorage', |
5 | '$routeParams', | 5 | '$routeParams', |
6 | function($scope, focaAbmChoferService, $location, $uibModal, focaModalService, | 6 | function($scope, focaAbmChoferService, $location, $uibModal, focaModalService, |
7 | focaBotoneraLateralService, $timeout, $localStorage, $routeParams) { | 7 | focaBotoneraLateralService, $timeout, $localStorage, $routeParams) { |
8 | 8 | ||
9 | $scope.focused = 1; | 9 | $scope.focused = 1; |
10 | $scope.now = new Date(); | 10 | $scope.now = new Date(); |
11 | $scope.nuevo = $routeParams.id === '0'; | 11 | $scope.nuevo = $routeParams.id === '0'; |
12 | $scope.filters = ''; | 12 | $scope.filters = ''; |
13 | $scope.choferes = []; | 13 | $scope.choferes = []; |
14 | $scope.creando = false; | 14 | $scope.creando = false; |
15 | $scope.crear = false; | 15 | $scope.crear = false; |
16 | $scope.transportistas = []; | 16 | $scope.transportistas = []; |
17 | $scope.botonera = [{ | 17 | $scope.botonera = [{ |
18 | label: 'Transportista', | 18 | label: 'Transportista', |
19 | image: 'cliente.png' | 19 | image: 'cliente.png' |
20 | }]; | 20 | }]; |
21 | $scope.next = function(key) { | 21 | $scope.next = function(key) { |
22 | if (key === 13) $scope.focused++; | 22 | if (key === 13) $scope.focused++; |
23 | }; | 23 | }; |
24 | 24 | ||
25 | //SETEO BOTONERA LATERAL | 25 | //SETEO BOTONERA LATERAL |
26 | $timeout(function() { | 26 | $timeout(function() { |
27 | focaBotoneraLateralService.showSalir(false); | 27 | focaBotoneraLateralService.showSalir(false); |
28 | focaBotoneraLateralService.showPausar(false); | 28 | focaBotoneraLateralService.showPausar(false); |
29 | focaBotoneraLateralService.showCancelar(false); | 29 | focaBotoneraLateralService.showCancelar(false); |
30 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | 30 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
31 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 31 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
32 | }); | 32 | }); |
33 | 33 | ||
34 | if (focaAbmChoferService.transportistaSeleccionado.COD) { | 34 | if (focaAbmChoferService.transportistaSeleccionado.COD) { |
35 | elegirTransportista(focaAbmChoferService.transportistaSeleccionado); | 35 | elegirTransportista(focaAbmChoferService.transportistaSeleccionado); |
36 | } | 36 | } |
37 | 37 | ||
38 | focaAbmChoferService.getTiposDocumento().then(function(res) { | 38 | focaAbmChoferService.getTiposDocumento().then(function(res) { |
39 | $scope.tiposDocumento = res.data; | 39 | $scope.tiposDocumento = res.data; |
40 | }); | 40 | }); |
41 | 41 | ||
42 | $scope.crearChofer = function () { | 42 | $scope.crearChofer = function () { |
43 | var chofer = { | 43 | var chofer = { |
44 | id: 0, | 44 | id: 0, |
45 | nombre: '', | 45 | nombre: '', |
46 | telefono: '', | 46 | telefono: '', |
47 | editando: true, | 47 | editando: true, |
48 | desactivado: false | 48 | desactivado: false |
49 | }; | 49 | }; |
50 | $scope.choferes.unshift(chofer); | 50 | $scope.choferes.unshift(chofer); |
51 | $scope.crear = false; | 51 | $scope.crear = false; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | $scope.editar = function(chofer) { | 54 | $scope.editar = function(chofer) { |
55 | $scope.choferes.forEach(function(chofer) { | 55 | $scope.choferes.forEach(function(chofer) { |
56 | chofer.editando = false; | 56 | chofer.editando = false; |
57 | $scope.crear = false; | 57 | $scope.crear = false; |
58 | }); | 58 | }); |
59 | chofer.editando = true; | 59 | chofer.editando = true; |
60 | $scope.inicial = angular.copy(chofer); | 60 | $scope.inicial = angular.copy(chofer); |
61 | }; | 61 | }; |
62 | 62 | ||
63 | $scope.agregarChofer = function (chofer) { | 63 | $scope.agregarChofer = function (chofer) { |
64 | if (!chofer.nombre) { | 64 | if (!chofer.nombre) { |
65 | focaModalService.alert('Ingrese nombre'); | 65 | focaModalService.alert('Ingrese nombre'); |
66 | return; | 66 | return; |
67 | } else if (!chofer.idTipoDocumento) { | 67 | } else if (!chofer.idTipoDocumento) { |
68 | focaModalService.alert('Ingrese tipo documento'); | 68 | focaModalService.alert('Ingrese tipo documento'); |
69 | return; | 69 | return; |
70 | } else if (!/^([\d]{7,10})$/.test(chofer.telefono)) { | 70 | } else if (!/^([\d]{7,10})$/.test(chofer.telefono)) { |
71 | focaModalService.alert('El campo Teléfono debe tener de 7 a 10 digitos'); | 71 | focaModalService.alert('El campo Teléfono debe tener de 7 a 10 digitos'); |
72 | return | ||
72 | } | 73 | } |
73 | validaDni(chofer); | 74 | validaDni(chofer); |
74 | console.log('Todo ok, guardar chofer'); | 75 | console.log('Todo ok, guardar chofer'); |
75 | }; | 76 | }; |
76 | 77 | ||
77 | $scope.tipoDocumento = function (idTipoDocumento) { | 78 | $scope.tipoDocumento = function (idTipoDocumento) { |
78 | var value = ''; | 79 | var value = ''; |
79 | switch (parseInt(idTipoDocumento)) { | 80 | switch (parseInt(idTipoDocumento)) { |
80 | case 96 : | 81 | case 96 : |
81 | value = 'DNI'; | 82 | value = 'DNI'; |
82 | break; | 83 | break; |
83 | case 80 : | 84 | case 80 : |
84 | value = 'CUIT'; | 85 | value = 'CUIT'; |
85 | break; | 86 | break; |
86 | case 86 : | 87 | case 86 : |
87 | value = 'CUIL'; | 88 | value = 'CUIL'; |
88 | break; | 89 | break; |
89 | default: | 90 | default: |
90 | value = ''; | 91 | value = ''; |
91 | break; | 92 | break; |
92 | } | 93 | } |
93 | return value; | 94 | return value; |
94 | }; | 95 | }; |
95 | 96 | ||
96 | $scope.volver = function (chofer, key) { | 97 | $scope.volver = function (chofer, key) { |
97 | if (chofer.idTransportista === undefined) { | 98 | if (chofer.idTransportista === undefined) { |
98 | $scope.choferes.shift(); | 99 | $scope.choferes.shift(); |
99 | $scope.crear = true; | 100 | $scope.crear = true; |
100 | chofer.editando = false; | 101 | chofer.editando = false; |
101 | return; | 102 | return; |
102 | } else if (chofer.id !== 0 || !$scope.crear) { | 103 | } else if (chofer.id !== 0 || !$scope.crear) { |
103 | $scope.choferes[key] = $scope.inicial; | 104 | $scope.choferes[key] = $scope.inicial; |
104 | $scope.choferes[key].editando = false; | 105 | $scope.choferes[key].editando = false; |
105 | } | 106 | } |
106 | $scope.crear = true; | 107 | $scope.crear = true; |
107 | }; | 108 | }; |
108 | 109 | ||
109 | $scope.guardar = function() { | 110 | $scope.guardar = function() { |
110 | $scope.choferes.forEach( function (chofer) { | 111 | $scope.choferes.forEach( function (chofer) { |
111 | if (chofer.id === 0) { | 112 | if (chofer.id === 0) { |
112 | delete chofer.id; | 113 | delete chofer.id; |
113 | } | 114 | } |
114 | delete chofer.transportista; | 115 | delete chofer.transportista; |
115 | delete chofer.editando; | 116 | delete chofer.editando; |
116 | }); | 117 | }); |
117 | focaAbmChoferService | 118 | focaAbmChoferService |
118 | .guardarChoferes($scope.choferes) | 119 | .guardarChoferes($scope.choferes) |
119 | .then(salir) | 120 | .then(salir) |
120 | .catch(e => { | 121 | .catch(e => { |
121 | console.error(e); | 122 | console.error(e); |
122 | focaModalService.alert('Hubo un error al guardar'); | 123 | focaModalService.alert('Hubo un error al guardar'); |
123 | }); | 124 | }); |
124 | }; | 125 | }; |
125 | 126 | ||
126 | $scope.solicitarConfirmacion = function(chofer) { | 127 | $scope.solicitarConfirmacion = function(chofer) { |
127 | focaModalService.confirm('¿Está seguro que desea borrar el chofer ' + | 128 | focaModalService.confirm('¿Está seguro que desea borrar el chofer ' + |
128 | chofer.nombre + ' ?').then(function(confirmed) { | 129 | chofer.nombre + ' ?').then(function(confirmed) { |
129 | if (confirmed) { | 130 | if (confirmed) { |
130 | chofer.desactivado = true; | 131 | chofer.desactivado = true; |
131 | } | 132 | } |
132 | }); | 133 | }); |
133 | }; | 134 | }; |
134 | 135 | ||
135 | $scope.seleccionarTransportista = function() { | 136 | $scope.seleccionarTransportista = function() { |
136 | var parametrosModal = { | 137 | var parametrosModal = { |
137 | titulo: 'Búsqueda de Transportista', | 138 | titulo: 'Búsqueda de Transportista', |
138 | query: '/transportista', | 139 | query: '/transportista', |
139 | columnas: [ | 140 | columnas: [ |
140 | { | 141 | { |
141 | nombre: 'Código', | 142 | nombre: 'Código', |
142 | propiedad: 'COD' | 143 | propiedad: 'COD' |
143 | }, | 144 | }, |
144 | { | 145 | { |
145 | nombre: 'Nombre', | 146 | nombre: 'Nombre', |
146 | propiedad: 'NOM' | 147 | propiedad: 'NOM' |
147 | }, | 148 | }, |
148 | { | 149 | { |
149 | nombre: 'CUIT', | 150 | nombre: 'CUIT', |
150 | propiedad: 'CUIT' | 151 | propiedad: 'CUIT' |
151 | } | 152 | } |
152 | ] | 153 | ] |
153 | }; | 154 | }; |
154 | focaModalService.modal(parametrosModal).then( | 155 | focaModalService.modal(parametrosModal).then( |
155 | function(transportista) { | 156 | function(transportista) { |
156 | $scope.crear = true; | 157 | $scope.crear = true; |
157 | elegirTransportista(transportista); | 158 | elegirTransportista(transportista); |
158 | focaAbmChoferService.transportistaSeleccionado = transportista; | 159 | focaAbmChoferService.transportistaSeleccionado = transportista; |
159 | }, function() {} | 160 | }, function() {} |
160 | ); | 161 | ); |
161 | }; | 162 | }; |
162 | 163 | ||
163 | function elegirTransportista(transportista) { | 164 | function elegirTransportista(transportista) { |
164 | buscar(transportista.COD); | 165 | buscar(transportista.COD); |
165 | var codigo = ('00000' + transportista.COD).slice(-5); | 166 | var codigo = ('00000' + transportista.COD).slice(-5); |
166 | $scope.idTransportista = transportista.COD; | 167 | $scope.idTransportista = transportista.COD; |
167 | $timeout(function() { | 168 | $timeout(function() { |
168 | $scope.$broadcast('addCabecera', { | 169 | $scope.$broadcast('addCabecera', { |
169 | label: 'Transportista:', | 170 | label: 'Transportista:', |
170 | valor: codigo + ' - ' + transportista.NOM | 171 | valor: codigo + ' - ' + transportista.NOM |
171 | }); | 172 | }); |
172 | }); | 173 | }); |
173 | } | 174 | } |
174 | 175 | ||
175 | function buscar(id) { | 176 | function buscar(id) { |
176 | focaAbmChoferService.getChoferPorTransportista(id).then(function(res) { | 177 | focaAbmChoferService.getChoferPorTransportista(id).then(function(res) { |
177 | $scope.choferes = res.data; | 178 | $scope.choferes = res.data; |
178 | }); | 179 | }); |
179 | } | 180 | } |
180 | 181 | ||
181 | function salir() { | 182 | function salir() { |
182 | focaAbmChoferService.transportistaSeleccionado = {}; | 183 | focaAbmChoferService.transportistaSeleccionado = {}; |
183 | $location.path('/'); | 184 | $location.path('/'); |
184 | } | 185 | } |
185 | 186 | ||
186 | function validaDni(chofer) { | 187 | function validaDni(chofer) { |
187 | if (!chofer.dni) { | 188 | if (!chofer.dni) { |
188 | focaModalService.alert('Ingrese DNI'); | 189 | focaModalService.alert('Ingrese DNI'); |
189 | return; | 190 | return; |
190 | } else if (!chofer.telefono) { | 191 | } else if (!chofer.telefono) { |
191 | focaModalService.alert('Ingrese teléfono'); | 192 | focaModalService.alert('Ingrese teléfono'); |
192 | return; | 193 | return; |
193 | } | 194 | } |
194 | 195 | ||
195 | return new Promise(function(resolve, reject) { | 196 | return new Promise(function(resolve, reject) { |
196 | focaAbmChoferService | 197 | focaAbmChoferService |
197 | .getChoferPorDni(chofer.dni) | 198 | .getChoferPorDni(chofer.dni) |
198 | .then(function(res) { | 199 | .then(function(res) { |
199 | if (res.data.id && | 200 | if (res.data.id && |
200 | chofer.id !== res.data.id) { | 201 | chofer.id !== res.data.id) { |
201 | reject(res.data); | 202 | reject(res.data); |
202 | } else { | 203 | } else { |
203 | resolve(); | 204 | resolve(); |
204 | } | 205 | } |
205 | }) | 206 | }) |
206 | .then(function() { | 207 | .then(function() { |
207 | chofer.idTransportista = focaAbmChoferService | 208 | chofer.idTransportista = focaAbmChoferService |
208 | .transportistaSeleccionado.COD; | 209 | .transportistaSeleccionado.COD; |
209 | delete chofer.transportista; | 210 | delete chofer.transportista; |
210 | }, function() { | 211 | }, function() { |
211 | focaModalService.alert('Dni existente'); | 212 | focaModalService.alert('Dni existente'); |
212 | $scope.editando = true; | 213 | $scope.editando = true; |
213 | }); | 214 | }); |
214 | $scope.crear = true; | 215 | $scope.crear = true; |
215 | chofer.editando = false; | 216 | chofer.editando = false; |
216 | }); | 217 | }); |
217 | } | 218 | } |
218 | 219 | ||
219 | if ($localStorage.chofer) { | 220 | if ($localStorage.chofer) { |
220 | var chofer = JSON.parse($localStorage.chofer); | 221 | var chofer = JSON.parse($localStorage.chofer); |
221 | if (!chofer.id) { chofer.id = 0; } | 222 | if (!chofer.id) { chofer.id = 0; } |
222 | $location.path('/chofer/' + chofer.id + '/' + chofer.idTransportista); | 223 | $location.path('/chofer/' + chofer.id + '/' + chofer.idTransportista); |
223 | } | 224 | } |
224 | 225 | ||
225 | $scope.validarDatosChofer = function() { | 226 | $scope.validarDatosChofer = function() { |
226 | // No permito numero ni caracteres especiles en nombre de chofer | 227 | // No permito numero ni caracteres especiles en nombre de chofer |
227 | if (!/^([a-zA-ZÀ-ÿ ])*$/.test($scope.chofer.nombre)) { | 228 | if (!/^([a-zA-ZÀ-ÿ ])*$/.test($scope.chofer.nombre)) { |
228 | focaModalService.alert('el campo Nombre no debe incluir números o símbolos') | 229 | focaModalService.alert('el campo Nombre no debe incluir números o símbolos') |
229 | $scope.chofer.nombre = '' | 230 | $scope.chofer.nombre = '' |
231 | return | ||
230 | } | 232 | } |
231 | // Solo numeros en el campo documento | 233 | // Solo numeros en el campo documento |
232 | if (!/^([0-9])*$/.test($scope.chofer.dni)) { | 234 | if (!/^([0-9])*$/.test($scope.chofer.dni)) { |
233 | focaModalService.alert('el campo DNI solo puede incluir números') | 235 | focaModalService.alert('el campo DNI solo puede incluir números') |
234 | $scope.chofer.dni = '' | 236 | $scope.chofer.dni = '' |
237 | return | ||
235 | } | 238 | } |
236 | } | 239 | } |
237 | } | 240 | } |
238 | ]); | 241 | ]); |
239 | 242 |
src/views/foca-abm-choferes-listado.html
1 | <div class="row"> | 1 | <div class="row"> |
2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
3 | titulo="'Choferes'" | 3 | titulo="'Choferes'" |
4 | fecha="now" | 4 | fecha="now" |
5 | class="mb-0 col-lg-12" | 5 | class="mb-0 col-lg-12" |
6 | ></foca-cabecera-facturador> | 6 | ></foca-cabecera-facturador> |
7 | </div> | 7 | </div> |
8 | <div class="row"> | 8 | <div class="row"> |
9 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> | 9 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> |
10 | <div class="row px-5 py-2 botonera-secundaria"> | 10 | <div class="row px-5 py-2 botonera-secundaria"> |
11 | <div class="col-12"> | 11 | <div class="col-12"> |
12 | <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> | 12 | <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> | 15 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> |
16 | <thead> | 16 | <thead> |
17 | <tr> | 17 | <tr> |
18 | <th>Nombre</th> | 18 | <th>Nombre</th> |
19 | <th>Tipo</th> | 19 | <th>Tipo</th> |
20 | <th>Documento</th> | 20 | <th>Documento</th> |
21 | <th>Teléfono</th> | 21 | <th>Teléfono</th> |
22 | <th class="text-center"> | 22 | <th class="text-center"> |
23 | <button | 23 | <button |
24 | title="Agregar" | 24 | title="Agregar" |
25 | class="btn btn-outline-debo boton-accion" | 25 | class="btn btn-outline-debo boton-accion" |
26 | ng-click="crearChofer()" | 26 | ng-click="crearChofer()" |
27 | ng-disabled="!crear" | 27 | ng-disabled="!crear" |
28 | > | 28 | > |
29 | <i class="fa fa-plus"></i> | 29 | <i class="fa fa-plus"></i> |
30 | </button> | 30 | </button> |
31 | </th> | 31 | </th> |
32 | </tr> | 32 | </tr> |
33 | </thead> | 33 | </thead> |
34 | <tbody> | 34 | <tbody> |
35 | <tr ng-show="creando"> | 35 | <tr ng-show="creando"> |
36 | <td align="center"> | 36 | <td align="center"> |
37 | <input | 37 | <input |
38 | class="form-control" | 38 | class="form-control" |
39 | type="text" | 39 | type="text" |
40 | teclado-virtual | 40 | teclado-virtual |
41 | ng-model="chofer.nombre" | 41 | ng-model="chofer.nombre" |
42 | ng-keyup="validarDatosChofer()" | 42 | ng-keyup="validarDatosChofer()" |
43 | ng-required="true" | 43 | ng-required="true" |
44 | ng-keypress="next($event.keyCode)" | 44 | ng-keypress="next($event.keyCode)" |
45 | foca-focus="focused == 1" | 45 | foca-focus="focused == 1" |
46 | ng-focus="focused = 1" | 46 | ng-focus="focused = 1" |
47 | > | 47 | > |
48 | </td> | 48 | </td> |
49 | <td align="center"> | 49 | <td align="center"> |
50 | <div class="col-sm-4"> | 50 | <div class="col-sm-4"> |
51 | <select | 51 | <select |
52 | class="form-control" | 52 | class="form-control" |
53 | ng-options="tipoDocumento.id as tipoDocumento.descripcion for tipoDocumento in tiposDocumento track by tipoDocumento.id" | 53 | ng-options="tipoDocumento.id as tipoDocumento.descripcion for tipoDocumento in tiposDocumento track by tipoDocumento.id" |
54 | ng-model="chofer.idTipoDocumento"> | 54 | ng-model="chofer.idTipoDocumento"> |
55 | </select> | 55 | </select> |
56 | </div> | 56 | </div> |
57 | </td> | 57 | </td> |
58 | <td align="center"> | 58 | <td align="center"> |
59 | <input | 59 | <input |
60 | class="form-control" | 60 | class="form-control" |
61 | foca-tipo-input | 61 | foca-tipo-input |
62 | teclado-virtual | 62 | teclado-virtual |
63 | solo-positivos | 63 | solo-positivos |
64 | limite-numeros-max="12" | 64 | limite-numeros-max="12" |
65 | maxlength="12" | 65 | maxlength="12" |
66 | minlength="2" | 66 | minlength="2" |
67 | ng-model="chofer.dni" | 67 | ng-model="chofer.dni" |
68 | ng-keyup="validarDatosChofer()" | 68 | ng-keyup="validarDatosChofer()" |
69 | ng-required="true" | 69 | ng-required="true" |
70 | ng-keypress="next($event.keyCode)" | 70 | ng-keypress="next($event.keyCode)" |
71 | foca-focus="focused == 2" | 71 | foca-focus="focused == 2" |
72 | ng-focus="focused = 2" | 72 | ng-focus="focused = 2" |
73 | ng-disabled="!nuevo" | 73 | ng-disabled="!nuevo" |
74 | string-toNumber | 74 | string-toNumber |
75 | > | 75 | > |
76 | </td> | 76 | </td> |
77 | <td align="center"> | 77 | <td align="center"> |
78 | <input | 78 | <input |
79 | class="form-control" | 79 | class="form-control" |
80 | foca-tipo-input | 80 | foca-tipo-input |
81 | teclado-virtual | 81 | teclado-virtual |
82 | solo-positivos | 82 | solo-positivos |
83 | limite-numeros-max="10" | 83 | limite-numeros-max="10" |
84 | maxlength="10" | 84 | maxlength="10" |
85 | ng-model="chofer.telefono" | 85 | ng-model="chofer.telefono" |
86 | ng-required="true" | 86 | ng-required="true" |
87 | foca-focus="focused == 3" | 87 | foca-focus="focused == 3" |
88 | ng-focus="focused = 3" | 88 | ng-focus="focused = 3" |
89 | string-toNumber | 89 | string-toNumber |
90 | > | 90 | > |
91 | </td> | 91 | </td> |
92 | <td align="center"> | 92 | <td align="center"> |
93 | <button | 93 | <button |
94 | class="btn btn-outline-dark boton-accion" | 94 | class="btn btn-outline-dark boton-accion" |
95 | ng-click="agregarChofer()" | 95 | ng-click="agregarChofer()" |
96 | > | 96 | > |
97 | <i class="fa fa-save"></i> | 97 | <i class="fa fa-save"></i> |
98 | </button> | 98 | </button> |
99 | </td> | 99 | </td> |
100 | </tr> | 100 | </tr> |
101 | 101 | ||
102 | <tr ng-repeat="(key, chofer) in choferes | filter:filters" ng-hide="chofer.desactivado"> | 102 | <tr ng-repeat="(key, chofer) in choferes | filter:filters" ng-hide="chofer.desactivado"> |
103 | <td ng-bind="chofer.nombre" ng-hide="chofer.editando"></td> | 103 | <td ng-bind="chofer.nombre" ng-hide="chofer.editando"></td> |
104 | <td align="center" ng-show="chofer.editando"> | 104 | <td align="center" ng-show="chofer.editando"> |
105 | <input | 105 | <input |
106 | class="form-control" | 106 | class="form-control" |
107 | type="text" | 107 | type="text" |
108 | teclado-virtual | 108 | teclado-virtual |
109 | ng-keyup="validarDatosChofer()" | ||
109 | ng-model="chofer.nombre" | 110 | ng-model="chofer.nombre" |
110 | ng-required="true" | 111 | ng-required="true" |
111 | ng-keypress="next($event.keyCode)" | 112 | ng-keypress="next($event.keyCode)" |
112 | foca-focus="focused == 1" | 113 | foca-focus="focused == 1" |
113 | ng-focus="focused = 1" | 114 | ng-focus="focused = 1" |
114 | esc-key="volver(chofer, key)" | 115 | esc-key="volver(chofer, key)" |
115 | > | 116 | > |
116 | </td> | 117 | </td> |
117 | <td ng-bind="tipoDocumento(chofer.idTipoDocumento)" ng-hide="chofer.editando"></td> | 118 | <td ng-bind="tipoDocumento(chofer.idTipoDocumento)" ng-hide="chofer.editando"></td> |
118 | <td align="center" ng-show="chofer.editando"> | 119 | <td align="center" ng-show="chofer.editando"> |
119 | <div class="col-sm-15"> | 120 | <div class="col-sm-15"> |
120 | <select | 121 | <select |
121 | class="form-control" | 122 | class="form-control" |
122 | ng-options="tipoDocumento.id as tipoDocumento.descripcion for tipoDocumento in tiposDocumento track by tipoDocumento.id" | 123 | ng-options="tipoDocumento.id as tipoDocumento.descripcion for tipoDocumento in tiposDocumento track by tipoDocumento.id" |
123 | ng-model="chofer.idTipoDocumento"> | 124 | ng-model="chofer.idTipoDocumento"> |
124 | </select> | 125 | </select> |
125 | </div> | 126 | </div> |
126 | </td> | 127 | </td> |
127 | <td ng-bind="chofer.dni" ng-hide="chofer.editando"> | 128 | <td ng-bind="chofer.dni" ng-hide="chofer.editando"> |
128 | <td align="center" ng-show="chofer.editando"> | 129 | <td align="center" ng-show="chofer.editando"> |
129 | <input | 130 | <input |
130 | class="form-control" | 131 | class="form-control" |
131 | type="text" | 132 | type="text" |
132 | teclado-virtual | 133 | teclado-virtual |
133 | ng-model="chofer.dni" | 134 | ng-model="chofer.dni" |
135 | ng-keyup="validarDatosChofer()" | ||
134 | ng-required="true" | 136 | ng-required="true" |
135 | ng-keypress="next($event.keyCode)" | 137 | ng-keypress="next($event.keyCode)" |
136 | foca-focus="focused == 2" | 138 | foca-focus="focused == 2" |
137 | ng-focus="focused = 2" | 139 | ng-focus="focused = 2" |
138 | esc-key="volver(chofer, key)" | 140 | esc-key="volver(chofer, key)" |
139 | > | 141 | > |
140 | </td> | 142 | </td> |
141 | </td> | 143 | </td> |
142 | <td ng-bind="chofer.telefono" ng-hide="chofer.editando"></td> | 144 | <td ng-bind="chofer.telefono" ng-hide="chofer.editando"></td> |
143 | <td align="center" ng-show="chofer.editando"> | 145 | <td align="center" ng-show="chofer.editando"> |
144 | <input | 146 | <input |
145 | class="form-control" | 147 | class="form-control" |
146 | foca-tipo-input | 148 | foca-tipo-input |
147 | teclado-virtual | 149 | teclado-virtual |
148 | solo-positivos | 150 | solo-positivos |
149 | limite-numeros-max="15" | 151 | limite-numeros-max="15" |
150 | ng-model="chofer.telefono" | 152 | ng-model="chofer.telefono" |
151 | ng-required="true" | 153 | ng-required="true" |
152 | foca-focus="focused == 3" | 154 | foca-focus="focused == 3" |
153 | ng-focus="focused = 3" | 155 | ng-focus="focused = 3" |
154 | string-toNumber | 156 | string-toNumber |
155 | esc-key="volver(chofer, key)" | 157 | esc-key="volver(chofer, key)" |
156 | > | 158 | > |
157 | </td> | 159 | </td> |
158 | <td class="text-center" ng-hide="chofer.editando"> | 160 | <td class="text-center" ng-hide="chofer.editando"> |
159 | <button | 161 | <button |
160 | class="btn btn-outline-dark boton-accion" | 162 | class="btn btn-outline-dark boton-accion" |
161 | title="Editar" | 163 | title="Editar" |
162 | ng-click="editar(chofer)" | 164 | ng-click="editar(chofer)" |
163 | > | 165 | > |
164 | <i class="fa fa-pencil"></i> | 166 | <i class="fa fa-pencil"></i> |
165 | </button> | 167 | </button> |
166 | <button | 168 | <button |
167 | class="btn btn-outline-dark boton-accion" | 169 | class="btn btn-outline-dark boton-accion" |
168 | title="Eliminar" | 170 | title="Eliminar" |
169 | ng-click="solicitarConfirmacion(chofer)" | 171 | ng-click="solicitarConfirmacion(chofer)" |
170 | > | 172 | > |
171 | <i class="fa fa-trash"></i> | 173 | <i class="fa fa-trash"></i> |
172 | </button> | 174 | </button> |
173 | </td> | 175 | </td> |
174 | <td align="center" ng-show="chofer.editando"> | 176 | <td align="center" ng-show="chofer.editando"> |
175 | <button | 177 | <button |
176 | class="btn btn-outline-dark boton-accion" | 178 | class="btn btn-outline-dark boton-accion" |
177 | ng-click="agregarChofer(chofer)" | 179 | ng-click="agregarChofer(chofer)" |
178 | > | 180 | > |
179 | <i class="fa fa-save"></i> | 181 | <i class="fa fa-save"></i> |
180 | </button> | 182 | </button> |
181 | <button | 183 | <button |
182 | class="btn btn-outline-dark boton-accion" | 184 | class="btn btn-outline-dark boton-accion" |
183 | ng-click="volver(chofer, key)" | 185 | ng-click="volver(chofer, key)" |
184 | > | 186 | > |
185 | <i class="fa fa-undo" aria-hidden="true"></i> | 187 | <i class="fa fa-undo" aria-hidden="true"></i> |
186 | </button> | 188 | </button> |
187 | </td> | 189 | </td> |
188 | </tr> | 190 | </tr> |
189 | </body> | 191 | </body> |
190 | </table> | 192 | </table> |
191 | </div> | 193 | </div> |
192 | </div> | 194 | </div> |
193 | 195 |