Commit 47c894fca13218091d9e0dbc727f1c4623fc5c54

Authored by Luis Suarez
1 parent 0fe898fc64
Exists in develop

separar funciones, tlf length

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