Commit 1f9869ff74ea4bcfd431f83054ad5d09a2555799
1 parent
fd4384d16b
Exists in
master
and in
2 other branches
Agregar Choferes
Showing
3 changed files
with
264 additions
and
138 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', '$filter', | ||
| 5 | function($scope, focaAbmChoferService, $location, $uibModal, focaModalService, | 6 | function($scope, focaAbmChoferService, $location, $uibModal, focaModalService, |
| 6 | focaBotoneraLateralService, $timeout, $localStorage) { | 7 | focaBotoneraLateralService, $timeout, $localStorage, $routeParams, $filter) { |
| 7 | 8 | ||
| 9 | $scope.focused = 1; | ||
| 8 | $scope.now = new Date(); | 10 | $scope.now = new Date(); |
| 11 | $scope.nuevo = $routeParams.id === '0'; | ||
| 9 | $scope.filters = ''; | 12 | $scope.filters = ''; |
| 10 | $scope.choferes = []; | 13 | $scope.choferes = []; |
| 14 | $scope.creando = false; | ||
| 15 | $scope.crear = false; | ||
| 16 | $scope.transportistas = []; | ||
| 11 | $scope.botonera = [{ | 17 | $scope.botonera = [{ |
| 12 | label: 'Transportista', | 18 | label: 'Transportista', |
| 13 | image: 'cliente.png' | 19 | image: 'cliente.png' |
| 14 | }]; | 20 | }]; |
| 21 | $scope.next = function(key) { | ||
| 22 | if (key === 13) $scope.focused++; | ||
| 23 | }; | ||
| 15 | 24 | ||
| 16 | //SETEO BOTONERA LATERAL | 25 | //SETEO BOTONERA LATERAL |
| 17 | $timeout(function() { | 26 | $timeout(function() { |
| 18 | focaBotoneraLateralService.showSalir(false); | 27 | focaBotoneraLateralService.showSalir(false); |
| 19 | focaBotoneraLateralService.showPausar(false); | 28 | focaBotoneraLateralService.showPausar(false); |
| 20 | focaBotoneraLateralService.showCancelar(false); | 29 | focaBotoneraLateralService.showCancelar(false); |
| 21 | focaBotoneraLateralService.showGuardar(false); | 30 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
| 22 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 31 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
| 23 | }); | 32 | }); |
| 24 | 33 | ||
| 25 | if (focaAbmChoferService.transportistaSeleccionado.COD) { | 34 | if (focaAbmChoferService.transportistaSeleccionado.COD) { |
| 26 | elegirTransportista(focaAbmChoferService.transportistaSeleccionado); | 35 | elegirTransportista(focaAbmChoferService.transportistaSeleccionado); |
| 27 | } | 36 | } |
| 28 | 37 | ||
| 29 | $scope.editar = function(id) { | 38 | focaAbmChoferService.getTiposDocumento().then(function(res) { |
| 30 | $location.path('/chofer/' + id + '/' + $scope.idTransportista); | 39 | $scope.tiposDocumento = res.data; |
| 40 | }); | ||
| 41 | |||
| 42 | $scope.crearChofer = function () { | ||
| 43 | var chofer = { | ||
| 44 | id: 0, | ||
| 45 | nombre: '', | ||
| 46 | telefono: '', | ||
| 47 | editando: true, | ||
| 48 | }; | ||
| 49 | $scope.choferes.unshift(chofer); | ||
| 50 | $scope.crear = false; | ||
| 51 | }; | ||
| 52 | |||
| 53 | $scope.editar = function(chofer) { | ||
| 54 | $scope.choferes.forEach(function(chofer) { | ||
| 55 | chofer.editando = false; | ||
| 56 | $scope.crear = false; | ||
| 57 | }); | ||
| 58 | chofer.editando = true; | ||
| 59 | $scope.inicial = angular.copy(chofer); | ||
| 60 | }; | ||
| 61 | |||
| 62 | $scope.agregarChofer = function (chofer) { | ||
| 63 | if (!chofer) { | ||
| 64 | focaModalService.alert('Ingrese nombre'); | ||
| 65 | return; | ||
| 66 | } else if (!chofer.idTipoDocumento) { | ||
| 67 | focaModalService.alert('Ingrese tipo documento'); | ||
| 68 | return; | ||
| 69 | } else if (!chofer.dni) { | ||
| 70 | focaModalService.alert('Ingrese DNI'); | ||
| 71 | return; | ||
| 72 | } else if (!chofer.telefono) { | ||
| 73 | focaModalService.alert('Ingrese teléfono'); | ||
| 74 | return; | ||
| 75 | } | ||
| 76 | |||
| 77 | validaDni(chofer).then(function() { | ||
| 78 | chofer.idTransportista = focaAbmChoferService.transportistaSeleccionado.COD; | ||
| 79 | delete chofer.transportista; | ||
| 80 | }, function() { | ||
| 81 | focaModalService.alert('Dni existente'); | ||
| 82 | $scope.editando = true; | ||
| 83 | }); | ||
| 84 | $scope.crear = true; | ||
| 85 | chofer.editando = false; | ||
| 86 | }; | ||
| 87 | |||
| 88 | $scope.tipoDocumento = function (idTipoDocumento) { | ||
| 89 | var value = ''; | ||
| 90 | switch (parseInt(idTipoDocumento)) { | ||
| 91 | case 96 : | ||
| 92 | value = 'DNI'; | ||
| 93 | break; | ||
| 94 | case 80 : | ||
| 95 | value = 'CUIT'; | ||
| 96 | break; | ||
| 97 | case 86 : | ||
| 98 | value = 'CUIL'; | ||
| 99 | break; | ||
| 100 | default: | ||
| 101 | value = ''; | ||
| 102 | break; | ||
| 103 | } | ||
| 104 | return value; | ||
| 105 | }; | ||
| 106 | |||
| 107 | $scope.volver = function (chofer, key) { | ||
| 108 | if (chofer.idTransportista === undefined) { | ||
| 109 | $scope.choferes.shift(); | ||
| 110 | $scope.crear = true; | ||
| 111 | chofer.editando = false; | ||
| 112 | return; | ||
| 113 | } else if (chofer.id !== 0 || !$scope.crear) { | ||
| 114 | $scope.choferes[key] = $scope.inicial; | ||
| 115 | $scope.choferes[key].editando = false; | ||
| 116 | } | ||
| 117 | $scope.crear = true; | ||
| 118 | }; | ||
| 119 | |||
| 120 | $scope.guardar = function() { | ||
| 121 | $scope.choferes.forEach( function (chofer) { | ||
| 122 | if (chofer.id === 0) { | ||
| 123 | delete chofer.id; | ||
| 124 | } | ||
| 125 | delete chofer.transportista; | ||
| 126 | delete chofer.editando; | ||
| 127 | }); | ||
| 128 | focaAbmChoferService.guardarChoferes($scope.choferes); | ||
| 31 | }; | 129 | }; |
| 32 | 130 | ||
| 33 | $scope.solicitarConfirmacion = function(chofer) { | 131 | $scope.solicitarConfirmacion = function(chofer) { |
| 34 | focaModalService.confirm('¿Está seguro que desea borrar el chofer ' + | 132 | focaModalService.confirm('¿Está seguro que desea borrar el chofer ' + |
| 35 | chofer.nombre + ' ?').then(function(confirmed) { | 133 | chofer.nombre + ' ?').then(function(confirmed) { |
| 36 | if (confirmed) { | 134 | if (confirmed) { |
| 37 | focaAbmChoferService.deleteChofer(chofer.id); | 135 | chofer.desactivado = true; |
| 38 | $scope.choferes.splice($scope.choferes.indexOf(chofer), 1); | ||
| 39 | } | 136 | } |
| 40 | }); | 137 | }); |
| 41 | }; | 138 | }; |
| 42 | 139 | ||
| 43 | $scope.seleccionarTransportista = function() { | 140 | $scope.seleccionarTransportista = function() { |
| 44 | var parametrosModal = { | 141 | var parametrosModal = { |
| 45 | titulo: 'Búsqueda de Transportista', | 142 | titulo: 'Búsqueda de Transportista', |
| 46 | query: '/transportista', | 143 | query: '/transportista', |
| 47 | columnas: [ | 144 | columnas: [ |
| 48 | { | 145 | { |
| 49 | nombre: 'Código', | 146 | nombre: 'Código', |
| 50 | propiedad: 'COD' | 147 | propiedad: 'COD' |
| 51 | }, | 148 | }, |
| 52 | { | 149 | { |
| 53 | nombre: 'Nombre', | 150 | nombre: 'Nombre', |
| 54 | propiedad: 'NOM' | 151 | propiedad: 'NOM' |
| 55 | }, | 152 | }, |
| 56 | { | 153 | { |
| 57 | nombre: 'CUIT', | 154 | nombre: 'CUIT', |
| 58 | propiedad: 'CUIT' | 155 | propiedad: 'CUIT' |
| 59 | } | 156 | } |
| 60 | ] | 157 | ] |
| 61 | }; | 158 | }; |
| 62 | focaModalService.modal(parametrosModal).then( | 159 | focaModalService.modal(parametrosModal).then( |
| 63 | function(transportista) { | 160 | function(transportista) { |
| 161 | $scope.crear = true; | ||
| 64 | elegirTransportista(transportista); | 162 | elegirTransportista(transportista); |
| 65 | focaAbmChoferService.transportistaSeleccionado = transportista; | 163 | focaAbmChoferService.transportistaSeleccionado = transportista; |
| 66 | }, function() {} | 164 | }, function() {} |
| 67 | ); | 165 | ); |
| 68 | }; | 166 | }; |
| 69 | 167 | ||
| 70 | function elegirTransportista(transportista) { | 168 | function elegirTransportista(transportista) { |
| 71 | buscar(transportista.COD); | 169 | buscar(transportista.COD); |
| 72 | var codigo = ('00000' + transportista.COD).slice(-5); | 170 | var codigo = ('00000' + transportista.COD).slice(-5); |
| 73 | $scope.idTransportista = transportista.COD; | 171 | $scope.idTransportista = transportista.COD; |
| 74 | $timeout(function() { | 172 | $timeout(function() { |
| 75 | $scope.$broadcast('addCabecera', { | 173 | $scope.$broadcast('addCabecera', { |
| 76 | label: 'Transportista:', | 174 | label: 'Transportista:', |
| 77 | valor: codigo + ' - ' + transportista.NOM | 175 | valor: codigo + ' - ' + transportista.NOM |
| 78 | }); | 176 | }); |
| 79 | }); | 177 | }); |
| 80 | } | 178 | } |
| 81 | 179 | ||
| 82 | function buscar(id) { | 180 | function buscar(id) { |
| 83 | focaAbmChoferService.getChoferPorTransportista(id).then(function(res) { | 181 | focaAbmChoferService.getChoferPorTransportista(id).then(function(res) { |
| 84 | $scope.choferes = res.data; | 182 | $scope.choferes = res.data; |
| 85 | }); | 183 | }); |
| 86 | } | 184 | } |
| 87 | 185 | ||
| 88 | function salir() { | 186 | function salir() { |
| 89 | focaAbmChoferService.transportistaSeleccionado = {}; | 187 | focaAbmChoferService.transportistaSeleccionado = {}; |
| 90 | $location.path('/'); | 188 | $location.path('/'); |
| 91 | } | 189 | } |
| 92 | 190 | ||
| 191 | function validaDni(chofer) { | ||
| 192 | return new Promise(function(resolve, reject) { | ||
| 193 | focaAbmChoferService | ||
| 194 | .getChoferPorDni(chofer.dni) | ||
| 195 | .then(function(res) { | ||
| 196 | if (res.data.id && | ||
| 197 | chofer.id !== res.data.id) { | ||
| 198 | reject(res.data); | ||
| 199 | } else { | ||
| 200 | resolve(); | ||
| 201 | } | ||
| 202 | }); | ||
| 203 | }); | ||
| 204 | } | ||
| 205 | |||
| 93 | if ($localStorage.chofer) { | 206 | if ($localStorage.chofer) { |
| 94 | var chofer = JSON.parse($localStorage.chofer); | 207 | var chofer = JSON.parse($localStorage.chofer); |
| 95 | if (!chofer.id) { chofer.id = 0; } | 208 | if (!chofer.id) { chofer.id = 0; } |
| 96 | $location.path('/chofer/' + chofer.id + '/' + chofer.idTransportista); | 209 | $location.path('/chofer/' + chofer.id + '/' + chofer.idTransportista); |
| 97 | } | 210 | } |
| 98 | } | ||
| 99 | ]) | ||
| 100 | .controller('focaAbmChoferController', [ | ||
| 101 | '$scope', 'focaAbmChoferService', '$routeParams', '$localStorage', '$filter', | ||
| 102 | '$location', 'focaBotoneraLateralService', '$timeout', 'focaModalService', '$window', | ||
| 103 | function($scope, focaAbmChoferService, $routeParams, $localStorage, $filter, | ||
| 104 | $location, focaBotoneraLateralService, $timeout, focaModalService){ | ||
| 105 | 211 | ||
| 106 | $scope.focused = 1; | 212 | /*$timeout(function() {getLSChofer();}); |
| 107 | $scope.nuevo = $routeParams.id === '0'; | ||
| 108 | $scope.chofer = {}; | ||
| 109 | $scope.transportistas = []; | ||
| 110 | $scope.now = new Date(); | ||
| 111 | $scope.next = function(key) { | ||
| 112 | if (key === 13) $scope.focused++; | ||
| 113 | }; | ||
| 114 | |||
| 115 | focaAbmChoferService.getTiposDocumento().then(function(res) { | ||
| 116 | $scope.tiposDocumento = res.data; | ||
| 117 | }); | ||
| 118 | |||
| 119 | //SETEO BOTONERA LATERAL | ||
| 120 | $timeout(function() { | ||
| 121 | focaBotoneraLateralService.showSalir(false); | ||
| 122 | focaBotoneraLateralService.showPausar(true); | ||
| 123 | focaBotoneraLateralService.showCancelar(false); | ||
| 124 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | ||
| 125 | focaBotoneraLateralService.addCustomButton('Salir', salir); | ||
| 126 | |||
| 127 | }); | ||
| 128 | |||
| 129 | $timeout(function() {getLSChofer();}); | ||
| 130 | |||
| 131 | if ($scope.nuevo) { | ||
| 132 | focaAbmChoferService | ||
| 133 | .getTransportistaPorId($routeParams.idTransportista) | ||
| 134 | .then(function(res) { | ||
| 135 | var codigo = ('00000' + res.data.COD).slice(-5); | ||
| 136 | $scope.chofer.idTransportista = res.data.COD; | ||
| 137 | $scope.chofer.transportista = res.data; | ||
| 138 | $scope.$broadcast('addCabecera', { | ||
| 139 | label: 'Transportista:', | ||
| 140 | valor: codigo + ' - ' + res.data.NOM |
src/js/service.js
| 1 | angular.module('focaAbmChofer') | 1 | angular.module('focaAbmChofer') |
| 2 | .factory('focaAbmChoferService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 2 | .factory('focaAbmChoferService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
| 3 | return { | 3 | return { |
| 4 | getChoferes: function() { | 4 | getChoferes: function() { |
| 5 | return $http.get(API_ENDPOINT.URL + '/chofer'); | 5 | return $http.get(API_ENDPOINT.URL + '/chofer'); |
| 6 | }, | 6 | }, |
| 7 | getChofer: function(id) { | 7 | getChofer: function(id) { |
| 8 | return $http.get(API_ENDPOINT.URL + '/chofer/' + id); | 8 | return $http.get(API_ENDPOINT.URL + '/chofer/' + id); |
| 9 | }, | 9 | }, |
| 10 | getChoferPorTransportista: function(id) { | 10 | getChoferPorTransportista: function(id) { |
| 11 | return $http.get(API_ENDPOINT.URL + '/chofer/transportista/' + id); | 11 | return $http.get(API_ENDPOINT.URL + '/chofer/transportista/' + id); |
| 12 | }, | 12 | }, |
| 13 | getChoferPorDni: function(dni) { | 13 | getChoferPorDni: function(dni) { |
| 14 | return $http.post(API_ENDPOINT.URL + '/chofer/dni', {dni: dni}); | 14 | return $http.post(API_ENDPOINT.URL + '/chofer/dni', {dni: dni}); |
| 15 | }, | 15 | }, |
| 16 | guardarChofer: function(chofer) { | 16 | guardarChofer: function(chofer) { |
| 17 | return $http.post(API_ENDPOINT.URL + '/chofer', {chofer: chofer}); | 17 | return $http.post(API_ENDPOINT.URL + '/chofer', {chofer: chofer}); |
| 18 | }, | 18 | }, |
| 19 | guardarChoferes: function(choferes) { | ||
| 20 | return $http.post(API_ENDPOINT.URL + '/chofer', {choferes: choferes}); | ||
| 21 | }, | ||
| 19 | getTransportistas: function() { | 22 | getTransportistas: function() { |
| 20 | return $http.get(API_ENDPOINT.URL + '/transportista'); | 23 | return $http.get(API_ENDPOINT.URL + '/transportista'); |
| 21 | }, | 24 | }, |
| 22 | getTransportistaPorId: function(id) { | 25 | getTransportistaPorId: function(id) { |
| 23 | return $http.get(API_ENDPOINT.URL + '/transportista/' + id); | 26 | return $http.get(API_ENDPOINT.URL + '/transportista/' + id); |
| 24 | }, | 27 | }, |
| 25 | deleteChofer: function(id) { | 28 | deleteChofer: function(id) { |
| 26 | return $http.delete(API_ENDPOINT.URL + '/chofer/' + id); | 29 | return $http.delete(API_ENDPOINT.URL + '/chofer/' + id); |
| 27 | }, | 30 | }, |
| 28 | getTiposDocumento: function() { | 31 | getTiposDocumento: function() { |
| 29 | return $http.get(API_ENDPOINT.URL + '/tipo-documento'); | 32 | return $http.get(API_ENDPOINT.URL + '/tipo-documento'); |
| 30 | }, | 33 | }, |
| 31 | transportistaSeleccionado: {} | 34 | transportistaSeleccionado: {} |
| 32 | }; | 35 | }; |
| 33 | }]); | 36 | }]); |
| 34 | 37 |
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>Documento</th> | 20 | <th>Documento</th> |
| 20 | <th>Teléfono</th> | 21 | <th>Teléfono</th> |
| 21 | <th class="text-center"> | 22 | <th class="text-center"> |
| 22 | <button | 23 | <button |
| 23 | ng-disabled="!idTransportista" | ||
| 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="editar(0)"> | 26 | ng-click="crearChofer()" |
| 27 | ng-disabled="!crear" | ||
| 28 | > | ||
| 27 | <i class="fa fa-plus"></i> | 29 | <i class="fa fa-plus"></i> |
| 28 | </button> | 30 | </button> |
| 29 | </th> | 31 | </th> |
| 30 | </tr> | 32 | </tr> |
| 31 | </thead> | 33 | </thead> |
| 32 | <tbody> | 34 | <tbody> |
| 33 | <tr ng-repeat="chofer in choferes | filter:filters"> | 35 | <tr ng-show="creando"> |
| 34 | <td ng-bind="chofer.nombre"></td> | 36 | <td align="center"> |
| 35 | <td ng-bind="chofer.dni"></td> | 37 | <input |
| 36 | <td ng-bind="chofer.telefono"></td> | 38 | class="form-control" |
| 37 | <td class="text-center"> | 39 | type="text" |
| 40 | teclado-virtual | ||
| 41 | ng-model="chofer.nombre" | ||
| 42 | ng-required="true" | ||
| 43 | ng-keypress="next($event.keyCode)" | ||
| 44 | foca-focus="focused == 1" | ||
| 45 | ng-focus="focused = 1" | ||
| 46 | > | ||
| 47 | </td> | ||
| 48 | <td align="center"> | ||
| 49 | <div class="col-sm-4"> | ||
| 50 | <select | ||
| 51 | class="form-control" | ||
| 52 | ng-options="tipoDocumento.id as tipoDocumento.descripcion for tipoDocumento in tiposDocumento track by tipoDocumento.id" | ||
| 53 | ng-model="chofer.idTipoDocumento"> | ||
| 54 | </select> | ||
| 55 | </div> | ||
| 56 | </td> | ||
| 57 | <td align="center"> | ||
| 58 | <input | ||
| 59 | class="form-control" | ||
| 60 | foca-tipo-input | ||
| 61 | teclado-virtual | ||
| 62 | solo-positivos | ||
| 63 | limite-numeros-max="15" | ||
| 64 | ng-model="chofer.dni" | ||
| 65 | ng-required="true" | ||
| 66 | ng-keypress="next($event.keyCode)" | ||
| 67 | foca-focus="focused == 2" | ||
| 68 | ng-focus="focused = 2" | ||
| 69 | ng-disabled="!nuevo" | ||
| 70 | string-toNumber | ||
| 71 | > | ||
| 72 | </td> | ||
| 73 | <td align="center"> | ||
| 74 | <input | ||
| 75 | class="form-control" | ||
| 76 | foca-tipo-input | ||
| 77 | teclado-virtual | ||
| 78 | solo-positivos | ||
| 79 | limite-numeros-max="15" | ||
| 80 | ng-model="chofer.telefono" | ||
| 81 | ng-required="true" | ||
| 82 | foca-focus="focused == 3" | ||
| 83 | ng-focus="focused = 3" | ||
| 84 | string-toNumber | ||
| 85 | > | ||
| 86 | </td> | ||
| 87 | <td align="center"> | ||
| 88 | <button | ||
| 89 | class="btn btn-outline-dark boton-accion" | ||
| 90 | ng-click="agregarChofer()" | ||
| 91 | > | ||
| 92 | <i class="fa fa-save"></i> | ||
| 93 | </button> | ||
| 94 | </td> | ||
| 95 | </tr> | ||
| 96 | |||
| 97 | <tr ng-repeat="(key, chofer) in choferes | filter:filters" ng-hide="chofer.desactivado"> | ||
| 98 | <td ng-bind="chofer.nombre" ng-hide="chofer.editando"></td> | ||
| 99 | <td align="center" ng-show="chofer.editando"> | ||
| 100 | <input | ||
| 101 | class="form-control" | ||
| 102 | type="text" | ||
| 103 | teclado-virtual | ||
| 104 | ng-model="chofer.nombre" | ||
| 105 | ng-required="true" | ||
| 106 | ng-keypress="next($event.keyCode)" | ||
| 107 | foca-focus="focused == 1" | ||
| 108 | ng-focus="focused = 1" | ||
| 109 | esc-key="volver(chofer, key)" | ||
| 110 | > | ||
| 111 | </td> | ||
| 112 | <td ng-bind="tipoDocumento(chofer.idTipoDocumento)" ng-hide="chofer.editando"></td> | ||
| 113 | <td align="center" ng-show="chofer.editando"> | ||
| 114 | <div class="col-sm-15"> | ||
| 115 | <select | ||
| 116 | class="form-control" | ||
| 117 | ng-options="tipoDocumento.id as tipoDocumento.descripcion for tipoDocumento in tiposDocumento track by tipoDocumento.id" | ||
| 118 | ng-model="chofer.idTipoDocumento"> | ||
| 119 | </select> | ||
| 120 | </div> | ||
| 121 | </td> | ||
| 122 | <td ng-bind="chofer.dni" ng-hide="chofer.editando"> | ||
| 123 | <td align="center" ng-show="chofer.editando"> | ||
| 124 | <input | ||
| 125 | class="form-control" | ||
| 126 | type="text" | ||
| 127 | teclado-virtual | ||
| 128 | ng-model="chofer.dni" | ||
| 129 | ng-required="true" | ||
| 130 | ng-keypress="next($event.keyCode)" | ||
| 131 | foca-focus="focused == 2" | ||
| 132 | ng-focus="focused = 2" | ||
| 133 | esc-key="volver(chofer, key)" | ||
| 134 | > | ||
| 135 | </td> | ||
| 136 | </td> | ||
| 137 | <td ng-bind="chofer.telefono" ng-hide="chofer.editando"></td> | ||
| 138 | <td align="center" ng-show="chofer.editando"> | ||
| 139 | <input | ||
| 140 | class="form-control" | ||
| 141 | foca-tipo-input | ||
| 142 | teclado-virtual | ||
| 143 | solo-positivos | ||
| 144 | limite-numeros-max="15" | ||
| 145 | ng-model="chofer.telefono" | ||
| 146 | ng-required="true" | ||
| 147 | foca-focus="focused == 3" | ||
| 148 | ng-focus="focused = 3" | ||
| 149 | string-toNumber | ||
| 150 | esc-key="volver(chofer, key)" | ||
| 151 | > | ||
| 152 | </td> | ||
| 153 | <td class="text-center" ng-hide="chofer.editando"> | ||
| 38 | <button | 154 | <button |
| 39 | class="btn btn-outline-dark boton-accion" | 155 | class="btn btn-outline-dark boton-accion" |
| 40 | title="Editar" | 156 | title="Editar" |
| 41 | ng-click="editar(chofer.id)" | 157 | ng-click="editar(chofer)" |
| 42 | > | 158 | > |
| 43 | <i class="fa fa-pencil"></i> | 159 | <i class="fa fa-pencil"></i> |
| 44 | </button> | 160 | </button> |
| 45 | <button | 161 | <button |
| 46 | class="btn btn-outline-dark boton-accion" | 162 | class="btn btn-outline-dark boton-accion" |
| 47 | title="Eliminar" | 163 | title="Eliminar" |
| 48 | ng-click="solicitarConfirmacion(chofer)" | 164 | ng-click="solicitarConfirmacion(chofer)" |
| 49 | > | 165 | > |
| 50 | <i class="fa fa-trash"></i> | 166 | <i class="fa fa-trash"></i> |
| 51 | </button> | 167 | </button> |
| 52 | </td> | 168 | </td> |
| 169 | <td align="center" ng-show="chofer.editando"> | ||
| 170 | <button | ||
| 171 | class="btn btn-outline-dark boton-accion" | ||
| 172 | ng-click="agregarChofer(chofer)" | ||
| 173 | > | ||
| 174 | <i class="fa fa-save"></i> | ||
| 175 | </button> | ||
| 176 | <button | ||
| 177 | class="btn btn-outline-dark boton-accion" | ||
| 178 | ng-click="volver(chofer, key)" | ||
| 179 | > | ||
| 180 | <i class="fa fa-undo" aria-hidden="true"></i> | ||
| 181 | </button> | ||
| 182 | </td> | ||
| 53 | </tr> | 183 | </tr> |
| 54 | </body> | 184 | </body> |
| 55 | </table> | 185 | </table> |
| 56 | </div> | 186 | </div> |
| 57 | </div> | 187 | </div> |