diff --git a/src/js/controller.js b/src/js/controller.js index 9030317..a178def 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -12,10 +12,11 @@ angular.module('focaAbmVehiculo') }]; //SETEO BOTONERA LATERAL - focaBotoneraLateralService.showSalir(true); + focaBotoneraLateralService.showSalir(false); focaBotoneraLateralService.showPausar(false); focaBotoneraLateralService.showCancelar(false); focaBotoneraLateralService.showGuardar(false); + focaBotoneraLateralService.addCustomButton('Salir', salir); if(focaAbmVehiculoService.transportistaSeleccionado.COD) { elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); @@ -79,6 +80,10 @@ angular.module('focaAbmVehiculo') $scope.vehiculos = datos.data; }); } + function salir() { + focaAbmVehiculoService.transportistaSeleccionado = {}; + $location.path('/'); + } } ]) .controller('focaAbmVehiculoController', [ @@ -154,30 +159,33 @@ angular.module('focaAbmVehiculo') $location.path('/vehiculo/' + $routeParams.idVehiculo + '/cisterna/0/'); } }; - $scope.guardar = function() { - //Valida si existe numero de unidad - if(!validaTotalCargas() && !$scope.nuevo) { - focaModalService.alert('La suma de las capacidades de las cisternas' + - ' debe ser igual a la capacidad total del vehículo'); - return; + $scope.guardar = function(key) { + key = (typeof key === 'undefined') ? 13 : key; + if(key === 13){ + //Valida si existe numero de unidad + if(!validaTotalCargas() && !$scope.nuevo) { + focaModalService.alert('La suma de las capacidades de las cisternas' + + ' debe ser igual a la capacidad total del vehículo'); + return; + } + validaCodigoUnidad().then(function() { + delete $scope.vehiculo.transportista; + delete $scope.vehiculo.cisternas; + focaAbmVehiculoService.guardarVehiculo($scope.vehiculo) + .then(function(res) { + if($scope.nuevo) { + $location.path('/vehiculo/' + res.data.id + + '/' + res.data.idTransportista); + }else { + guardarCisternas().then(function() { + $window.location.assign('/#!/vehiculo'); + }); + } + }); + }, function(){ + focaModalService.alert('Código de unidad existente'); + }); } - validaCodigoUnidad().then(function() { - delete $scope.vehiculo.transportista; - delete $scope.vehiculo.cisternas; - focaAbmVehiculoService.guardarVehiculo($scope.vehiculo) - .then(function(res) { - if($scope.nuevo) { - $location.path('/vehiculo/' + res.data.id + - '/' + res.data.idTransportista); - }else { - guardarCisternas().then(function() { - $window.location.assign('/#!/vehiculo'); - }); - } - }); - }, function(){ - focaModalService.alert('Código de unidad existente'); - }); }; $scope.solicitarConfirmacionCisterna = function(cisterna) { diff --git a/src/views/foca-abm-vehiculos-item.html b/src/views/foca-abm-vehiculos-item.html index 47ca4ba..4fd97d0 100644 --- a/src/views/foca-abm-vehiculos-item.html +++ b/src/views/foca-abm-vehiculos-item.html @@ -11,26 +11,15 @@
- -
- -
-
-
- -
+ +
@@ -44,8 +33,8 @@ teclado-virtual ng-model="vehiculo.tractor" ng-required="true" - foca-focus="focused == 1" - ng-focus="focused = 1" + foca-focus="focused == 2" + ng-focus="focused = 2" ng-keypress="next($event.keyCode)" />
@@ -59,8 +48,8 @@ teclado-virtual ng-model="vehiculo.semi" ng-required="true" - foca-focus="focused == 4" - ng-focus="focused = 4" + foca-focus="focused == 3" + ng-focus="focused = 3" ng-keypress="next($event.keyCode)" />
@@ -74,9 +63,9 @@ teclado-virtual ng-model="vehiculo.capacidad" ng-required="true" - foca-focus="focused == 2" - ng-focus="focused = 2" - ng-keypress="next($event.keyCode)" + foca-focus="focused == 4" + ng-focus="focused = 4" + ng-keypress="guardar($event.keyCode)" />