Commit 75a9948b74d542a202d678ba5f8633b1a4e45ae8

Authored by Eric Fernandez
Exists in master and in 1 other branch develop

Merge branch 'master' into 'master'

Master

See merge request !18
src/js/controller.js
... ... @@ -12,10 +12,11 @@ angular.module('focaAbmVehiculo')
12 12 }];
13 13  
14 14 //SETEO BOTONERA LATERAL
15   - focaBotoneraLateralService.showSalir(true);
  15 + focaBotoneraLateralService.showSalir(false);
16 16 focaBotoneraLateralService.showPausar(false);
17 17 focaBotoneraLateralService.showCancelar(false);
18 18 focaBotoneraLateralService.showGuardar(false);
  19 + focaBotoneraLateralService.addCustomButton('Salir', salir);
19 20  
20 21 if(focaAbmVehiculoService.transportistaSeleccionado.COD) {
21 22 elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado);
... ... @@ -79,6 +80,10 @@ angular.module('focaAbmVehiculo')
79 80 $scope.vehiculos = datos.data;
80 81 });
81 82 }
  83 + function salir() {
  84 + focaAbmVehiculoService.transportistaSeleccionado = {};
  85 + $location.path('/');
  86 + }
82 87 }
83 88 ])
84 89 .controller('focaAbmVehiculoController', [
... ... @@ -154,30 +159,33 @@ angular.module('focaAbmVehiculo')
154 159 $location.path('/vehiculo/' + $routeParams.idVehiculo + '/cisterna/0/');
155 160 }
156 161 };
157   - $scope.guardar = function() {
158   - //Valida si existe numero de unidad
159   - if(!validaTotalCargas() && !$scope.nuevo) {
160   - focaModalService.alert('La suma de las capacidades de las cisternas' +
161   - ' debe ser igual a la capacidad total del vehículo');
162   - return;
  162 + $scope.guardar = function(key) {
  163 + key = (typeof key === 'undefined') ? 13 : key;
  164 + if(key === 13){
  165 + //Valida si existe numero de unidad
  166 + if(!validaTotalCargas() && !$scope.nuevo) {
  167 + focaModalService.alert('La suma de las capacidades de las cisternas' +
  168 + ' debe ser igual a la capacidad total del vehículo');
  169 + return;
  170 + }
  171 + validaCodigoUnidad().then(function() {
  172 + delete $scope.vehiculo.transportista;
  173 + delete $scope.vehiculo.cisternas;
  174 + focaAbmVehiculoService.guardarVehiculo($scope.vehiculo)
  175 + .then(function(res) {
  176 + if($scope.nuevo) {
  177 + $location.path('/vehiculo/' + res.data.id +
  178 + '/' + res.data.idTransportista);
  179 + }else {
  180 + guardarCisternas().then(function() {
  181 + $window.location.assign('/#!/vehiculo');
  182 + });
  183 + }
  184 + });
  185 + }, function(){
  186 + focaModalService.alert('Código de unidad existente');
  187 + });
163 188 }
164   - validaCodigoUnidad().then(function() {
165   - delete $scope.vehiculo.transportista;
166   - delete $scope.vehiculo.cisternas;
167   - focaAbmVehiculoService.guardarVehiculo($scope.vehiculo)
168   - .then(function(res) {
169   - if($scope.nuevo) {
170   - $location.path('/vehiculo/' + res.data.id +
171   - '/' + res.data.idTransportista);
172   - }else {
173   - guardarCisternas().then(function() {
174   - $window.location.assign('/#!/vehiculo');
175   - });
176   - }
177   - });
178   - }, function(){
179   - focaModalService.alert('Código de unidad existente');
180   - });
181 189  
182 190 };
183 191 $scope.solicitarConfirmacionCisterna = function(cisterna) {
src/views/foca-abm-vehiculos-item.html
... ... @@ -11,26 +11,15 @@
11 11 <input type="hidden" name="id" ng-model="sector.id" />
12 12 <div class="row mt-3">
13 13 <div class="form-group d-flex mb-2 col-md-6">
14   - <label class="col-form-label col-md-3">Transportista</label>
15   - <div class="input-group col-md-9 pl-0">
16   - <input
17   - class="form-control"
18   - type="text"
19   - ng-value="transportistaStamp"
20   - readonly
21   - />
22   - </div>
23   - </div>
24   - <div class="form-group d-flex mb-2 col-md-6">
25   - <label class="col-form-label col-md-3">Unidad</label>
26   - <div class="input-group col-md-9 pl-0">
  14 + <label class="col-form-label col-md-4">Unidad</label>
  15 + <div class="input-group col-md-8 pl-0">
27 16 <input
28 17 class="form-control"
29 18 type="text"
30 19 teclado-virtual
31 20 ng-model="vehiculo.codigo"
32   - foca-focus="focused == 3"
33   - ng-focus="focused = 3"
  21 + foca-focus="focused == 1"
  22 + ng-focus="focused = 1"
34 23 ng-keypress="next($event.keyCode)"
35 24 />
36 25 </div>
... ... @@ -44,8 +33,8 @@
44 33 teclado-virtual
45 34 ng-model="vehiculo.tractor"
46 35 ng-required="true"
47   - foca-focus="focused == 1"
48   - ng-focus="focused = 1"
  36 + foca-focus="focused == 2"
  37 + ng-focus="focused = 2"
49 38 ng-keypress="next($event.keyCode)"
50 39 />
51 40 </div>
... ... @@ -59,8 +48,8 @@
59 48 teclado-virtual
60 49 ng-model="vehiculo.semi"
61 50 ng-required="true"
62   - foca-focus="focused == 4"
63   - ng-focus="focused = 4"
  51 + foca-focus="focused == 3"
  52 + ng-focus="focused = 3"
64 53 ng-keypress="next($event.keyCode)"
65 54 />
66 55 </div>
... ... @@ -74,9 +63,9 @@
74 63 teclado-virtual
75 64 ng-model="vehiculo.capacidad"
76 65 ng-required="true"
77   - foca-focus="focused == 2"
78   - ng-focus="focused = 2"
79   - ng-keypress="next($event.keyCode)"
  66 + foca-focus="focused == 4"
  67 + ng-focus="focused = 4"
  68 + ng-keypress="guardar($event.keyCode)"
80 69 />
81 70 </div>
82 71 </div>