Commit e80bc1985be3f32768fd1aabcd8f712864b0d70c
Exists in
master
and in
2 other branches
Merge branch 'develop' of http://git.focasoftware.com/npm/foca-abm-chofer
Showing
5 changed files
Show diff stats
spec/controllerSpec.js
| ... | ... | @@ -19,6 +19,7 @@ describe('Controladores de abm chofer', function() { |
| 19 | 19 | transportistaSeleccionado: function() { return; } |
| 20 | 20 | }, |
| 21 | 21 | $location: {}, |
| 22 | + $localStorage: {}, | |
| 22 | 23 | $uibModal: {}, |
| 23 | 24 | focaModalService: {}, |
| 24 | 25 | focaBotoneraLateralService: {}, |
| ... | ... | @@ -42,6 +43,7 @@ describe('Controladores de abm chofer', function() { |
| 42 | 43 | transportistaSeleccionado: function() { return; } |
| 43 | 44 | }, |
| 44 | 45 | $location: {}, |
| 46 | + $localStorage: {}, | |
| 45 | 47 | $uibModal: {}, |
| 46 | 48 | focaModalService: focaModalService, |
| 47 | 49 | focaBotoneraLateralService: {}, |
| ... | ... | @@ -75,6 +77,7 @@ describe('Controladores de abm chofer', function() { |
| 75 | 77 | $scope: scope, |
| 76 | 78 | focaAbmChoferService: focaAbmChoferService, |
| 77 | 79 | $location: {}, |
| 80 | + $localStorage: {}, | |
| 78 | 81 | $uibModal: {}, |
| 79 | 82 | focaModalService: focaModalService, |
| 80 | 83 | focaBotoneraLateralService: {}, |
| ... | ... | @@ -108,6 +111,7 @@ describe('Controladores de abm chofer', function() { |
| 108 | 111 | transportistaSeleccionado: function() { } |
| 109 | 112 | }, |
| 110 | 113 | $location: {}, |
| 114 | + $localStorage: {}, | |
| 111 | 115 | $uibModal: {}, |
| 112 | 116 | focaModalService: focaModalService, |
| 113 | 117 | focaBotoneraLateralService: {}, |
| ... | ... | @@ -129,7 +133,9 @@ describe('Controladores de abm chofer', function() { |
| 129 | 133 | it('Existe el controlador focaAbmChoferController', function() { |
| 130 | 134 | //arrange |
| 131 | 135 | var controlador = $controller('focaAbmChoferController', { |
| 132 | - $scope: {}, | |
| 136 | + $scope: { | |
| 137 | + $watch: function() {} | |
| 138 | + }, | |
| 133 | 139 | focaAbmChoferService: { |
| 134 | 140 | getTiposDocumento: function() { |
| 135 | 141 | return { |
| ... | ... | @@ -149,6 +155,7 @@ describe('Controladores de abm chofer', function() { |
| 149 | 155 | }, |
| 150 | 156 | $routeParams: {}, |
| 151 | 157 | $location: {}, |
| 158 | + $localStorage: {}, | |
| 152 | 159 | focaBotoneraLateralService: {}, |
| 153 | 160 | $timeout: function() { return; }, |
| 154 | 161 | focaModalService: {} |
| ... | ... | @@ -161,7 +168,9 @@ describe('Controladores de abm chofer', function() { |
| 161 | 168 | it('$scope.cancelar lleva a la ruta correcta', function() { |
| 162 | 169 | inject(function($location) { |
| 163 | 170 | //arrange |
| 164 | - var scope = {}; | |
| 171 | + var scope = { | |
| 172 | + $watch: function() {} | |
| 173 | + }; | |
| 165 | 174 | var controlador = $controller('focaAbmChoferController', { |
| 166 | 175 | $scope: scope, |
| 167 | 176 | focaAbmChoferService: { |
| ... | ... | @@ -183,6 +192,7 @@ describe('Controladores de abm chofer', function() { |
| 183 | 192 | }, |
| 184 | 193 | $routeParams: {}, |
| 185 | 194 | $location: $location, |
| 195 | + $localStorage: {}, | |
| 186 | 196 | focaBotoneraLateralService: {}, |
| 187 | 197 | $timeout: function() { return; }, |
| 188 | 198 | focaModalService: {} |
| ... | ... | @@ -200,7 +210,10 @@ describe('Controladores de abm chofer', function() { |
| 200 | 210 | it('$scope.guardar guarda chofer al validarDNI() da ok', function(done) { |
| 201 | 211 | |
| 202 | 212 | //arrange |
| 203 | - var scope = {}; | |
| 213 | + var scope = { | |
| 214 | + $watch: function(){}, | |
| 215 | + chofer: {} | |
| 216 | + }; | |
| 204 | 217 | var focaAbmChoferService = { |
| 205 | 218 | getTiposDocumento: function() { |
| 206 | 219 | return { |
| ... | ... | @@ -225,14 +238,19 @@ describe('Controladores de abm chofer', function() { |
| 225 | 238 | focaAbmChoferService: focaAbmChoferService, |
| 226 | 239 | $routeParams: {}, |
| 227 | 240 | $location: {}, |
| 241 | + $localStorage: {}, | |
| 228 | 242 | focaBotoneraLateralService: {}, |
| 229 | 243 | $timeout: function() { return; }, |
| 230 | - focaModalService: {} | |
| 244 | + focaModalService: { | |
| 245 | + alert: function() {} | |
| 246 | + } | |
| 231 | 247 | }); |
| 232 | 248 | console.info(controlador); |
| 233 | 249 | var resolveFake = { data: false }; |
| 234 | 250 | var promesaChoferPorDni = Promise.resolve(resolveFake); |
| 235 | - | |
| 251 | + scope.chofer.nombre = true; | |
| 252 | + scope.chofer.idTipoDocumento = true; | |
| 253 | + scope.chofer.dni = true; | |
| 236 | 254 | //act |
| 237 | 255 | spyOn(focaAbmChoferService, 'guardarChofer').and.returnValue({ then: function() { }}); |
| 238 | 256 | spyOn(focaAbmChoferService, 'getChoferPorDni').and.returnValue(promesaChoferPorDni); |
| ... | ... | @@ -250,7 +268,9 @@ describe('Controladores de abm chofer', function() { |
| 250 | 268 | it('$scope.guardar da alerta chofer al validarDNI() da reject', function(done) { |
| 251 | 269 | |
| 252 | 270 | //arrange |
| 253 | - var scope = {}; | |
| 271 | + var scope = { | |
| 272 | + $watch: function() {} | |
| 273 | + }; | |
| 254 | 274 | var focaModalService = { |
| 255 | 275 | alert: function() { } |
| 256 | 276 | }; |
| ... | ... | @@ -277,6 +297,7 @@ describe('Controladores de abm chofer', function() { |
| 277 | 297 | focaAbmChoferService: focaAbmChoferService, |
| 278 | 298 | $routeParams: {}, |
| 279 | 299 | $location: {}, |
| 300 | + $localStorage: {}, | |
| 280 | 301 | focaBotoneraLateralService: {}, |
| 281 | 302 | $timeout: function() { return; }, |
| 282 | 303 | focaModalService: focaModalService |
src/js/controller.js
| 1 | 1 | angular.module('focaAbmChofer') |
| 2 | 2 | .controller('focaAbmChoferesController', [ |
| 3 | 3 | '$scope', 'focaAbmChoferService', '$location', '$uibModal', |
| 4 | - 'focaModalService', 'focaBotoneraLateralService', '$timeout', | |
| 4 | + 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$localStorage', | |
| 5 | + '$routeParams', '$filter', | |
| 5 | 6 | function($scope, focaAbmChoferService, $location, $uibModal, focaModalService, |
| 6 | - focaBotoneraLateralService, $timeout) { | |
| 7 | + focaBotoneraLateralService, $timeout, $localStorage, $routeParams, $filter) { | |
| 7 | 8 | |
| 9 | + $scope.focused = 1; | |
| 8 | 10 | $scope.now = new Date(); |
| 11 | + $scope.nuevo = $routeParams.id === '0'; | |
| 9 | 12 | $scope.filters = ''; |
| 10 | 13 | $scope.choferes = []; |
| 14 | + $scope.creando = false; | |
| 15 | + $scope.crear = false; | |
| 16 | + $scope.transportistas = []; | |
| 11 | 17 | $scope.botonera = [{ |
| 12 | 18 | label: 'Transportista', |
| 13 | 19 | image: 'cliente.png' |
| 14 | 20 | }]; |
| 21 | + $scope.next = function(key) { | |
| 22 | + if (key === 13) $scope.focused++; | |
| 23 | + }; | |
| 15 | 24 | |
| 16 | 25 | //SETEO BOTONERA LATERAL |
| 17 | 26 | $timeout(function() { |
| 18 | 27 | focaBotoneraLateralService.showSalir(false); |
| 19 | 28 | focaBotoneraLateralService.showPausar(false); |
| 20 | 29 | focaBotoneraLateralService.showCancelar(false); |
| 21 | - focaBotoneraLateralService.showGuardar(false); | |
| 30 | + focaBotoneraLateralService.showGuardar(true, $scope.guardar); | |
| 22 | 31 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
| 23 | 32 | }); |
| 24 | - | |
| 25 | - if(focaAbmChoferService.transportistaSeleccionado.COD) { | |
| 33 | + | |
| 34 | + if (focaAbmChoferService.transportistaSeleccionado.COD) { | |
| 26 | 35 | elegirTransportista(focaAbmChoferService.transportistaSeleccionado); |
| 27 | 36 | } |
| 28 | 37 | |
| 29 | - $scope.editar = function(id) { | |
| 30 | - $location.path('/chofer/' + id + '/' + $scope.idTransportista); | |
| 38 | + focaAbmChoferService.getTiposDocumento().then(function(res) { | |
| 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.nombre) { | |
| 64 | + focaModalService.alert('Ingrese nombre'); | |
| 65 | + return; | |
| 66 | + } else if (!chofer.idTipoDocumento) { | |
| 67 | + focaModalService.alert('Ingrese tipo documento'); | |
| 68 | + return; | |
| 69 | + } | |
| 70 | + validaDni(chofer); | |
| 71 | + }; | |
| 72 | + | |
| 73 | + $scope.tipoDocumento = function (idTipoDocumento) { | |
| 74 | + var value = ''; | |
| 75 | + switch (parseInt(idTipoDocumento)) { | |
| 76 | + case 96 : | |
| 77 | + value = 'DNI'; | |
| 78 | + break; | |
| 79 | + case 80 : | |
| 80 | + value = 'CUIT'; | |
| 81 | + break; | |
| 82 | + case 86 : | |
| 83 | + value = 'CUIL'; | |
| 84 | + break; | |
| 85 | + default: | |
| 86 | + value = ''; | |
| 87 | + break; | |
| 88 | + } | |
| 89 | + return value; | |
| 90 | + }; | |
| 91 | + | |
| 92 | + $scope.volver = function (chofer, key) { | |
| 93 | + if (chofer.idTransportista === undefined) { | |
| 94 | + $scope.choferes.shift(); | |
| 95 | + $scope.crear = true; | |
| 96 | + chofer.editando = false; | |
| 97 | + return; | |
| 98 | + } else if (chofer.id !== 0 || !$scope.crear) { | |
| 99 | + $scope.choferes[key] = $scope.inicial; | |
| 100 | + $scope.choferes[key].editando = false; | |
| 101 | + } | |
| 102 | + $scope.crear = true; | |
| 103 | + }; | |
| 104 | + | |
| 105 | + $scope.guardar = function() { | |
| 106 | + $scope.choferes.forEach( function (chofer) { | |
| 107 | + if (chofer.id === 0) { | |
| 108 | + delete chofer.id; | |
| 109 | + } | |
| 110 | + delete chofer.transportista; | |
| 111 | + delete chofer.editando; | |
| 112 | + }); | |
| 113 | + focaAbmChoferService.guardarChoferes($scope.choferes); | |
| 31 | 114 | }; |
| 32 | 115 | |
| 33 | 116 | $scope.solicitarConfirmacion = function(chofer) { |
| 34 | 117 | focaModalService.confirm('ยฟEstรก seguro que desea borrar el chofer ' + |
| 35 | 118 | chofer.nombre + ' ?').then(function(confirmed) { |
| 36 | - if(confirmed) { | |
| 37 | - focaAbmChoferService.deleteChofer(chofer.id); | |
| 38 | - $scope.choferes.splice($scope.choferes.indexOf(chofer), 1); | |
| 119 | + if (confirmed) { | |
| 120 | + chofer.desactivado = true; | |
| 39 | 121 | } |
| 40 | 122 | }); |
| 41 | 123 | }; |
| ... | ... | @@ -61,6 +143,7 @@ angular.module('focaAbmChofer') |
| 61 | 143 | }; |
| 62 | 144 | focaModalService.modal(parametrosModal).then( |
| 63 | 145 | function(transportista) { |
| 146 | + $scope.crear = true; | |
| 64 | 147 | elegirTransportista(transportista); |
| 65 | 148 | focaAbmChoferService.transportistaSeleccionado = transportista; |
| 66 | 149 | }, function() {} |
| ... | ... | @@ -89,96 +172,43 @@ angular.module('focaAbmChofer') |
| 89 | 172 | focaAbmChoferService.transportistaSeleccionado = {}; |
| 90 | 173 | $location.path('/'); |
| 91 | 174 | } |
| 92 | - } | |
| 93 | - ]) | |
| 94 | - .controller('focaAbmChoferController', [ | |
| 95 | - '$scope', 'focaAbmChoferService', '$routeParams', | |
| 96 | - '$location', 'focaBotoneraLateralService', '$timeout', 'focaModalService', | |
| 97 | - function($scope, focaAbmChoferService, $routeParams, | |
| 98 | - $location, focaBotoneraLateralService, $timeout, focaModalService) { | |
| 99 | 175 | |
| 100 | - $scope.focused = 1; | |
| 101 | - $scope.nuevo = $routeParams.id === '0'; | |
| 102 | - $scope.chofer = {}; | |
| 103 | - $scope.transportistas = []; | |
| 104 | - $scope.now = new Date(); | |
| 105 | - $scope.next = function(key) { | |
| 106 | - if (key === 13) $scope.focused++; | |
| 107 | - }; | |
| 108 | - | |
| 109 | - focaAbmChoferService.getTiposDocumento().then(function(res) { | |
| 110 | - $scope.tiposDocumento = res.data; | |
| 111 | - }); | |
| 112 | - | |
| 113 | - //SETEO BOTONERA LATERAL | |
| 114 | - $timeout(function() { | |
| 115 | - focaBotoneraLateralService.showSalir(false); | |
| 116 | - focaBotoneraLateralService.showPausar(true); | |
| 117 | - focaBotoneraLateralService.showCancelar(true); | |
| 118 | - focaBotoneraLateralService.showGuardar(true, $scope.guardar); | |
| 119 | - }); | |
| 120 | - | |
| 121 | - if($scope.nuevo) { | |
| 122 | - focaAbmChoferService | |
| 123 | - .getTransportistaPorId($routeParams.idTransportista) | |
| 124 | - .then(function(res) { | |
| 125 | - var codigo = ('00000' + res.data.COD).slice(-5); | |
| 126 | - $scope.chofer.idTransportista = res.data.COD; | |
| 127 | - $scope.chofer.transportista = res.data; | |
| 128 | - $scope.$broadcast('addCabecera', { | |
| 129 | - label: 'Transportista:', | |
| 130 | - valor: codigo + ' - ' + res.data.NOM | |
| 131 | - }); | |
| 132 | - }); | |
| 133 | - } | |
| 134 | - | |
| 135 | - focaAbmChoferService.getChofer($routeParams.id).then(function(res) { | |
| 136 | - if(res.data) { | |
| 137 | - var codigo = ('00000' + res.data.transportista.COD).slice(-5); | |
| 138 | - $scope.chofer = res.data; | |
| 139 | - $scope.$broadcast('addCabecera', { | |
| 140 | - label: 'Transportista:', | |
| 141 | - valor: codigo + ' - ' + res.data.transportista.NOM | |
| 142 | - }); | |
| 143 | - } | |
| 144 | - }); | |
| 145 | - | |
| 146 | - focaAbmChoferService.getTransportistas().then(function(res) { | |
| 147 | - $scope.transportistas = res.data; | |
| 148 | - }); | |
| 149 | - | |
| 150 | - $scope.cancelar = function() { | |
| 151 | - $location.path('/chofer'); | |
| 152 | - }; | |
| 153 | - | |
| 154 | - $scope.guardar = function(key) { | |
| 155 | - key = (typeof key === 'undefined') ? 13 : key; | |
| 156 | - if(key === 13) { | |
| 157 | - validaDni().then(function() { | |
| 158 | - $scope.chofer.idTransportista = $routeParams.idTransportista; | |
| 159 | - delete $scope.chofer.transportista; | |
| 160 | - focaAbmChoferService.guardarChofer($scope.chofer).then(function() { | |
| 161 | - $location.path('/chofer'); | |
| 162 | - }); | |
| 163 | - }, function() { | |
| 164 | - focaModalService.alert('Dni existente'); | |
| 165 | - }); | |
| 176 | + function validaDni(chofer) { | |
| 177 | + if (!chofer.dni) { | |
| 178 | + focaModalService.alert('Ingrese DNI'); | |
| 179 | + return; | |
| 180 | + } else if (!chofer.telefono) { | |
| 181 | + focaModalService.alert('Ingrese telรฉfono'); | |
| 182 | + return; | |
| 166 | 183 | } |
| 167 | - }; | |
| 168 | 184 | |
| 169 | - function validaDni() { | |
| 170 | 185 | return new Promise(function(resolve, reject) { |
| 171 | 186 | focaAbmChoferService |
| 172 | - .getChoferPorDni($scope.chofer.dni) | |
| 187 | + .getChoferPorDni(chofer.dni) | |
| 173 | 188 | .then(function(res) { |
| 174 | - if(res.data.id && | |
| 175 | - $scope.chofer.id !== res.data.id) { | |
| 189 | + if (res.data.id && | |
| 190 | + chofer.id !== res.data.id) { | |
| 176 | 191 | reject(res.data); |
| 177 | - }else { | |
| 192 | + } else { | |
| 178 | 193 | resolve(); |
| 179 | 194 | } |
| 195 | + }) | |
| 196 | + .then(function() { | |
| 197 | + chofer.idTransportista = focaAbmChoferService.transportistaSeleccionado.COD; | |
| 198 | + delete chofer.transportista; | |
| 199 | + }, function() { | |
| 200 | + focaModalService.alert('Dni existente'); | |
| 201 | + $scope.editando = true; | |
| 180 | 202 | }); |
| 203 | + $scope.crear = true; | |
| 204 | + chofer.editando = false; | |
| 181 | 205 | }); |
| 182 | 206 | } |
| 207 | + | |
| 208 | + if ($localStorage.chofer) { | |
| 209 | + var chofer = JSON.parse($localStorage.chofer); | |
| 210 | + if (!chofer.id) { chofer.id = 0; } | |
| 211 | + $location.path('/chofer/' + chofer.id + '/' + chofer.idTransportista); | |
| 212 | + } | |
| 183 | 213 | } |
| 184 | 214 | ]); |
src/js/service.js
| ... | ... | @@ -16,6 +16,9 @@ angular.module('focaAbmChofer') |
| 16 | 16 | guardarChofer: function(chofer) { |
| 17 | 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 | 22 | getTransportistas: function() { |
| 20 | 23 | return $http.get(API_ENDPOINT.URL + '/transportista'); |
| 21 | 24 | }, |
src/views/foca-abm-choferes-item.html
| ... | ... | @@ -38,14 +38,17 @@ |
| 38 | 38 | <div class="col-sm-4"> |
| 39 | 39 | <input |
| 40 | 40 | class="form-control" |
| 41 | - type="text" | |
| 41 | + foca-tipo-input | |
| 42 | 42 | teclado-virtual |
| 43 | + solo-positivos | |
| 44 | + limite-numeros-max="15" | |
| 43 | 45 | ng-model="chofer.dni" |
| 44 | 46 | ng-required="true" |
| 45 | 47 | ng-keypress="next($event.keyCode)" |
| 46 | 48 | foca-focus="focused == 2" |
| 47 | 49 | ng-focus="focused = 2" |
| 48 | 50 | ng-disabled="!nuevo" |
| 51 | + string-toNumber | |
| 49 | 52 | /> |
| 50 | 53 | </div> |
| 51 | 54 | </div> |
| ... | ... | @@ -54,13 +57,16 @@ |
| 54 | 57 | <div class="col-sm-4"> |
| 55 | 58 | <input |
| 56 | 59 | class="form-control" |
| 57 | - type="text" | |
| 60 | + foca-tipo-input | |
| 58 | 61 | teclado-virtual |
| 62 | + solo-positivos | |
| 63 | + limite-numeros-max="15" | |
| 59 | 64 | ng-model="chofer.telefono" |
| 60 | 65 | ng-required="true" |
| 61 | 66 | ng-keypress="guardar($event.keyCode)" |
| 62 | 67 | foca-focus="focused == 3" |
| 63 | 68 | ng-focus="focused = 3" |
| 69 | + string-toNumber | |
| 64 | 70 | /> |
| 65 | 71 | </div> |
| 66 | 72 | </div> |
src/views/foca-abm-choferes-listado.html
| ... | ... | @@ -16,29 +16,145 @@ |
| 16 | 16 | <thead> |
| 17 | 17 | <tr> |
| 18 | 18 | <th>Nombre</th> |
| 19 | + <th>Tipo</th> | |
| 19 | 20 | <th>Documento</th> |
| 20 | 21 | <th>Telรฉfono</th> |
| 21 | 22 | <th class="text-center"> |
| 22 | 23 | <button |
| 23 | - ng-disabled="!idTransportista" | |
| 24 | 24 | title="Agregar" |
| 25 | 25 | class="btn btn-outline-debo boton-accion" |
| 26 | - ng-click="editar(0)"> | |
| 26 | + ng-click="crearChofer()" | |
| 27 | + ng-disabled="!crear" | |
| 28 | + > | |
| 27 | 29 | <i class="fa fa-plus"></i> |
| 28 | 30 | </button> |
| 29 | 31 | </th> |
| 30 | 32 | </tr> |
| 31 | 33 | </thead> |
| 32 | 34 | <tbody> |
| 33 | - <tr ng-repeat="chofer in choferes | filter:filters"> | |
| 34 | - <td ng-bind="chofer.nombre"></td> | |
| 35 | - <td ng-bind="chofer.dni"></td> | |
| 36 | - <td ng-bind="chofer.telefono"></td> | |
| 37 | - <td class="text-center"> | |
| 35 | + <tr ng-show="creando"> | |
| 36 | + <td align="center"> | |
| 37 | + <input | |
| 38 | + class="form-control" | |
| 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 | 154 | <button |
| 39 | 155 | class="btn btn-outline-dark boton-accion" |
| 40 | 156 | title="Editar" |
| 41 | - ng-click="editar(chofer.id)" | |
| 157 | + ng-click="editar(chofer)" | |
| 42 | 158 | > |
| 43 | 159 | <i class="fa fa-pencil"></i> |
| 44 | 160 | </button> |
| ... | ... | @@ -50,6 +166,20 @@ |
| 50 | 166 | <i class="fa fa-trash"></i> |
| 51 | 167 | </button> |
| 52 | 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 | 183 | </tr> |
| 54 | 184 | </body> |
| 55 | 185 | </table> |