Commit dae6c344a14815233185ac150456afab6a3e7e1a
1 parent
47c894fca1
Exists in
develop
acotar dni
Showing
2 changed files
with
4 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 | return |
| 73 | } else if (chofer.dni < 7 || chofer.dni > 12) { | ||
| 74 | focaModalService.alert('Ingrese un Documento válido'); | ||
| 73 | } | 75 | } |
| 74 | validaDni(chofer); | 76 | validaDni(chofer); |
| 75 | console.log('Todo ok, guardar chofer'); | 77 | console.log('Todo ok, guardar chofer'); |
| 76 | }; | 78 | }; |
| 77 | 79 | ||
| 78 | $scope.tipoDocumento = function (idTipoDocumento) { | 80 | $scope.tipoDocumento = function (idTipoDocumento) { |
| 79 | var value = ''; | 81 | var value = ''; |
| 80 | switch (parseInt(idTipoDocumento)) { | 82 | switch (parseInt(idTipoDocumento)) { |
| 81 | case 96 : | 83 | case 96 : |
| 82 | value = 'DNI'; | 84 | value = 'DNI'; |
| 83 | break; | 85 | break; |
| 84 | case 80 : | 86 | case 80 : |
| 85 | value = 'CUIT'; | 87 | value = 'CUIT'; |
| 86 | break; | 88 | break; |
| 87 | case 86 : | 89 | case 86 : |
| 88 | value = 'CUIL'; | 90 | value = 'CUIL'; |
| 89 | break; | 91 | break; |
| 90 | default: | 92 | default: |
| 91 | value = ''; | 93 | value = ''; |
| 92 | break; | 94 | break; |
| 93 | } | 95 | } |
| 94 | return value; | 96 | return value; |
| 95 | }; | 97 | }; |
| 96 | 98 | ||
| 97 | $scope.volver = function (chofer, key) { | 99 | $scope.volver = function (chofer, key) { |
| 98 | if (chofer.idTransportista === undefined) { | 100 | if (chofer.idTransportista === undefined) { |
| 99 | $scope.choferes.shift(); | 101 | $scope.choferes.shift(); |
| 100 | $scope.crear = true; | 102 | $scope.crear = true; |
| 101 | chofer.editando = false; | 103 | chofer.editando = false; |
| 102 | return; | 104 | return; |
| 103 | } else if (chofer.id !== 0 || !$scope.crear) { | 105 | } else if (chofer.id !== 0 || !$scope.crear) { |
| 104 | $scope.choferes[key] = $scope.inicial; | 106 | $scope.choferes[key] = $scope.inicial; |
| 105 | $scope.choferes[key].editando = false; | 107 | $scope.choferes[key].editando = false; |
| 106 | } | 108 | } |
| 107 | $scope.crear = true; | 109 | $scope.crear = true; |
| 108 | }; | 110 | }; |
| 109 | 111 | ||
| 110 | $scope.guardar = function() { | 112 | $scope.guardar = function() { |
| 111 | $scope.choferes.forEach( function (chofer) { | 113 | $scope.choferes.forEach( function (chofer) { |
| 112 | if (chofer.id === 0) { | 114 | if (chofer.id === 0) { |
| 113 | delete chofer.id; | 115 | delete chofer.id; |
| 114 | } | 116 | } |
| 115 | delete chofer.transportista; | 117 | delete chofer.transportista; |
| 116 | delete chofer.editando; | 118 | delete chofer.editando; |
| 117 | }); | 119 | }); |
| 118 | focaAbmChoferService | 120 | focaAbmChoferService |
| 119 | .guardarChoferes($scope.choferes) | 121 | .guardarChoferes($scope.choferes) |
| 120 | .then(salir) | 122 | .then(salir) |
| 121 | .catch(e => { | 123 | .catch(e => { |
| 122 | console.error(e); | 124 | console.error(e); |
| 123 | focaModalService.alert('Hubo un error al guardar'); | 125 | focaModalService.alert('Hubo un error al guardar'); |
| 124 | }); | 126 | }); |
| 125 | }; | 127 | }; |
| 126 | 128 | ||
| 127 | $scope.solicitarConfirmacion = function(chofer) { | 129 | $scope.solicitarConfirmacion = function(chofer) { |
| 128 | focaModalService.confirm('¿Está seguro que desea borrar el chofer ' + | 130 | focaModalService.confirm('¿Está seguro que desea borrar el chofer ' + |
| 129 | chofer.nombre + ' ?').then(function(confirmed) { | 131 | chofer.nombre + ' ?').then(function(confirmed) { |
| 130 | if (confirmed) { | 132 | if (confirmed) { |
| 131 | chofer.desactivado = true; | 133 | chofer.desactivado = true; |
| 132 | } | 134 | } |
| 133 | }); | 135 | }); |
| 134 | }; | 136 | }; |
| 135 | 137 | ||
| 136 | $scope.seleccionarTransportista = function() { | 138 | $scope.seleccionarTransportista = function() { |
| 137 | var parametrosModal = { | 139 | var parametrosModal = { |
| 138 | titulo: 'Búsqueda de Transportista', | 140 | titulo: 'Búsqueda de Transportista', |
| 139 | query: '/transportista', | 141 | query: '/transportista', |
| 140 | columnas: [ | 142 | columnas: [ |
| 141 | { | 143 | { |
| 142 | nombre: 'Código', | 144 | nombre: 'Código', |
| 143 | propiedad: 'COD' | 145 | propiedad: 'COD' |
| 144 | }, | 146 | }, |
| 145 | { | 147 | { |
| 146 | nombre: 'Nombre', | 148 | nombre: 'Nombre', |
| 147 | propiedad: 'NOM' | 149 | propiedad: 'NOM' |
| 148 | }, | 150 | }, |
| 149 | { | 151 | { |
| 150 | nombre: 'CUIT', | 152 | nombre: 'CUIT', |
| 151 | propiedad: 'CUIT' | 153 | propiedad: 'CUIT' |
| 152 | } | 154 | } |
| 153 | ] | 155 | ] |
| 154 | }; | 156 | }; |
| 155 | focaModalService.modal(parametrosModal).then( | 157 | focaModalService.modal(parametrosModal).then( |
| 156 | function(transportista) { | 158 | function(transportista) { |
| 157 | $scope.crear = true; | 159 | $scope.crear = true; |
| 158 | elegirTransportista(transportista); | 160 | elegirTransportista(transportista); |
| 159 | focaAbmChoferService.transportistaSeleccionado = transportista; | 161 | focaAbmChoferService.transportistaSeleccionado = transportista; |
| 160 | }, function() {} | 162 | }, function() {} |
| 161 | ); | 163 | ); |
| 162 | }; | 164 | }; |
| 163 | 165 | ||
| 164 | function elegirTransportista(transportista) { | 166 | function elegirTransportista(transportista) { |
| 165 | buscar(transportista.COD); | 167 | buscar(transportista.COD); |
| 166 | var codigo = ('00000' + transportista.COD).slice(-5); | 168 | var codigo = ('00000' + transportista.COD).slice(-5); |
| 167 | $scope.idTransportista = transportista.COD; | 169 | $scope.idTransportista = transportista.COD; |
| 168 | $timeout(function() { | 170 | $timeout(function() { |
| 169 | $scope.$broadcast('addCabecera', { | 171 | $scope.$broadcast('addCabecera', { |
| 170 | label: 'Transportista:', | 172 | label: 'Transportista:', |
| 171 | valor: codigo + ' - ' + transportista.NOM | 173 | valor: codigo + ' - ' + transportista.NOM |
| 172 | }); | 174 | }); |
| 173 | }); | 175 | }); |
| 174 | } | 176 | } |
| 175 | 177 | ||
| 176 | function buscar(id) { | 178 | function buscar(id) { |
| 177 | focaAbmChoferService.getChoferPorTransportista(id).then(function(res) { | 179 | focaAbmChoferService.getChoferPorTransportista(id).then(function(res) { |
| 178 | $scope.choferes = res.data; | 180 | $scope.choferes = res.data; |
| 179 | }); | 181 | }); |
| 180 | } | 182 | } |
| 181 | 183 | ||
| 182 | function salir() { | 184 | function salir() { |
| 183 | focaAbmChoferService.transportistaSeleccionado = {}; | 185 | focaAbmChoferService.transportistaSeleccionado = {}; |
| 184 | $location.path('/'); | 186 | $location.path('/'); |
| 185 | } | 187 | } |
| 186 | 188 | ||
| 187 | function validaDni(chofer) { | 189 | function validaDni(chofer) { |
| 188 | if (!chofer.dni) { | 190 | if (!chofer.dni) { |
| 189 | focaModalService.alert('Ingrese DNI'); | 191 | focaModalService.alert('Ingrese DNI'); |
| 190 | return; | 192 | return; |
| 191 | } else if (!chofer.telefono) { | 193 | } else if (!chofer.telefono) { |
| 192 | focaModalService.alert('Ingrese teléfono'); | 194 | focaModalService.alert('Ingrese teléfono'); |
| 193 | return; | 195 | return; |
| 194 | } | 196 | } |
| 195 | 197 | ||
| 196 | return new Promise(function(resolve, reject) { | 198 | return new Promise(function(resolve, reject) { |
| 197 | focaAbmChoferService | 199 | focaAbmChoferService |
| 198 | .getChoferPorDni(chofer.dni) | 200 | .getChoferPorDni(chofer.dni) |
| 199 | .then(function(res) { | 201 | .then(function(res) { |
| 200 | if (res.data.id && | 202 | if (res.data.id && |
| 201 | chofer.id !== res.data.id) { | 203 | chofer.id !== res.data.id) { |
| 202 | reject(res.data); | 204 | reject(res.data); |
| 203 | } else { | 205 | } else { |
| 204 | resolve(); | 206 | resolve(); |
| 205 | } | 207 | } |
| 206 | }) | 208 | }) |
| 207 | .then(function() { | 209 | .then(function() { |
| 208 | chofer.idTransportista = focaAbmChoferService | 210 | chofer.idTransportista = focaAbmChoferService |
| 209 | .transportistaSeleccionado.COD; | 211 | .transportistaSeleccionado.COD; |
| 210 | delete chofer.transportista; | 212 | delete chofer.transportista; |
| 211 | }, function() { | 213 | }, function() { |
| 212 | focaModalService.alert('Dni existente'); | 214 | focaModalService.alert('Dni existente'); |
| 213 | $scope.editando = true; | 215 | $scope.editando = true; |
| 214 | }); | 216 | }); |
| 215 | $scope.crear = true; | 217 | $scope.crear = true; |
| 216 | chofer.editando = false; | 218 | chofer.editando = false; |
| 217 | }); | 219 | }); |
| 218 | } | 220 | } |
| 219 | 221 | ||
| 220 | if ($localStorage.chofer) { | 222 | if ($localStorage.chofer) { |
| 221 | var chofer = JSON.parse($localStorage.chofer); | 223 | var chofer = JSON.parse($localStorage.chofer); |
| 222 | if (!chofer.id) { chofer.id = 0; } | 224 | if (!chofer.id) { chofer.id = 0; } |
| 223 | $location.path('/chofer/' + chofer.id + '/' + chofer.idTransportista); | 225 | $location.path('/chofer/' + chofer.id + '/' + chofer.idTransportista); |
| 224 | } | 226 | } |
| 225 | 227 | ||
| 226 | $scope.validarChoferNombre = function(chofer) { | 228 | $scope.validarChoferNombre = function(chofer) { |
| 227 | // No permito numero ni caracteres especiles en nombre de chofer | 229 | // No permito numero ni caracteres especiles en nombre de chofer |
| 228 | if (!/^([a-zA-ZÀ-ÿ ])*$/.test(chofer.nombre)) { | 230 | if (!/^([a-zA-ZÀ-ÿ ])*$/.test(chofer.nombre)) { |
| 229 | focaModalService.alert('el campo Nombre no debe incluir números o símbolos'); | 231 | focaModalService.alert('el campo Nombre no debe incluir números o símbolos'); |
| 230 | chofer.nombre = ''; | 232 | chofer.nombre = ''; |
| 231 | return | 233 | return |
| 232 | } | 234 | } |
| 233 | } | 235 | } |
| 234 | $scope.validarChoferDni = function(chofer) { | 236 | $scope.validarChoferDni = function(chofer) { |
| 235 | // Solo numeros en el campo documento | 237 | // Solo numeros en el campo documento |
| 236 | if (!/^([0-9])*$/.test(chofer.dni)) { | 238 | if (!/^([0-9])*$/.test(chofer.dni)) { |
| 237 | focaModalService.alert('el campo DNI solo puede incluir números'); | 239 | focaModalService.alert('el campo DNI solo puede incluir números'); |
| 238 | chofer.dni = ''; | 240 | chofer.dni = ''; |
| 239 | return | 241 | return |
| 240 | } | 242 | } |
| 241 | } | 243 | } |
| 242 | } | 244 | } |
| 243 | ]); | 245 | ]); |
| 244 | 246 |
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="validarChoferNombre(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="validarChoferDni(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="validarChoferNombre(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 | limite-numeros-max="12" | ||
| 136 | maxlength="12" | ||
| 135 | ng-keyup="validarChoferDni(chofer)" | 137 | ng-keyup="validarChoferDni(chofer)" |
| 136 | ng-required="true" | 138 | ng-required="true" |
| 137 | ng-keypress="next($event.keyCode)" | 139 | ng-keypress="next($event.keyCode)" |
| 138 | foca-focus="focused == 2" | 140 | foca-focus="focused == 2" |
| 139 | ng-focus="focused = 2" | 141 | ng-focus="focused = 2" |
| 140 | esc-key="volver(chofer, key)" | 142 | esc-key="volver(chofer, key)" |
| 141 | > | 143 | > |
| 142 | </td> | 144 | </td> |
| 143 | </td> | 145 | </td> |
| 144 | <td ng-bind="chofer.telefono" ng-hide="chofer.editando"></td> | 146 | <td ng-bind="chofer.telefono" ng-hide="chofer.editando"></td> |
| 145 | <td align="center" ng-show="chofer.editando"> | 147 | <td align="center" ng-show="chofer.editando"> |
| 146 | <input | 148 | <input |
| 147 | class="form-control" | 149 | class="form-control" |
| 148 | foca-tipo-input | 150 | foca-tipo-input |
| 149 | teclado-virtual | 151 | teclado-virtual |
| 150 | solo-positivos | 152 | solo-positivos |
| 151 | limite-numeros-max="10" | 153 | limite-numeros-max="10" |
| 152 | maxlength="10" | 154 | maxlength="10" |
| 153 | ng-model="chofer.telefono" | 155 | ng-model="chofer.telefono" |
| 154 | ng-required="true" | 156 | ng-required="true" |
| 155 | foca-focus="focused == 3" | 157 | foca-focus="focused == 3" |
| 156 | ng-focus="focused = 3" | 158 | ng-focus="focused = 3" |
| 157 | string-toNumber | 159 | string-toNumber |
| 158 | esc-key="volver(chofer, key)" | 160 | esc-key="volver(chofer, key)" |
| 159 | > | 161 | > |
| 160 | </td> | 162 | </td> |
| 161 | <td class="text-center" ng-hide="chofer.editando"> | 163 | <td class="text-center" ng-hide="chofer.editando"> |
| 162 | <button | 164 | <button |
| 163 | class="btn btn-outline-dark boton-accion" | 165 | class="btn btn-outline-dark boton-accion" |
| 164 | title="Editar" | 166 | title="Editar" |
| 165 | ng-click="editar(chofer)" | 167 | ng-click="editar(chofer)" |
| 166 | > | 168 | > |
| 167 | <i class="fa fa-pencil"></i> | 169 | <i class="fa fa-pencil"></i> |
| 168 | </button> | 170 | </button> |
| 169 | <button | 171 | <button |
| 170 | class="btn btn-outline-dark boton-accion" | 172 | class="btn btn-outline-dark boton-accion" |
| 171 | title="Eliminar" | 173 | title="Eliminar" |
| 172 | ng-click="solicitarConfirmacion(chofer)" | 174 | ng-click="solicitarConfirmacion(chofer)" |
| 173 | > | 175 | > |
| 174 | <i class="fa fa-trash"></i> | 176 | <i class="fa fa-trash"></i> |
| 175 | </button> | 177 | </button> |
| 176 | </td> | 178 | </td> |
| 177 | <td align="center" ng-show="chofer.editando"> | 179 | <td align="center" ng-show="chofer.editando"> |
| 178 | <button | 180 | <button |
| 179 | class="btn btn-outline-dark boton-accion" | 181 | class="btn btn-outline-dark boton-accion" |
| 180 | ng-click="agregarChofer(chofer)" | 182 | ng-click="agregarChofer(chofer)" |
| 181 | > | 183 | > |
| 182 | <i class="fa fa-save"></i> | 184 | <i class="fa fa-save"></i> |
| 183 | </button> | 185 | </button> |
| 184 | <button | 186 | <button |
| 185 | class="btn btn-outline-dark boton-accion" | 187 | class="btn btn-outline-dark boton-accion" |
| 186 | ng-click="volver(chofer, key)" | 188 | ng-click="volver(chofer, key)" |
| 187 | > | 189 | > |
| 188 | <i class="fa fa-undo" aria-hidden="true"></i> | 190 | <i class="fa fa-undo" aria-hidden="true"></i> |
| 189 | </button> | 191 | </button> |
| 190 | </td> | 192 | </td> |
| 191 | </tr> | 193 | </tr> |
| 192 | </body> | 194 | </body> |
| 193 | </table> | 195 | </table> |
| 194 | </div> | 196 | </div> |
| 195 | </div> | 197 | </div> |
| 196 | 198 |