diff --git a/src/js/app.js b/src/js/app.js index bb5cc52..e227d68 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -1 +1 @@ -angular.module('focaAbmVehiculo', ['ngRoute', 'focaModal', 'ui.bootstrap']); +angular.module('focaAbmVehiculo', ['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']); diff --git a/src/js/controller.js b/src/js/controller.js index 72044d5..65fbb62 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -1,14 +1,23 @@ angular.module('focaAbmVehiculo') .controller('focaAbmVehiculosController', [ - '$scope', 'focaAbmVehiculoService', '$location', 'focaModalService', '$uibModal', - function($scope, focaAbmVehiculoService, $location, focaModalService, $uibModal) { - $scope.buscar = function(idTransportista) { - focaAbmVehiculoService - .getVehiculosPorTransportista(idTransportista) - .then(function(datos) { - $scope.vehiculos = datos.data; - }); - }; + '$scope', 'focaAbmVehiculoService', '$location', 'focaModalService', + '$uibModal', 'focaBotoneraLateralService', '$timeout', + function($scope, focaAbmVehiculoService, $location, focaModalService, + $uibModal, focaBotoneraLateralService, $timeout) { + + $scope.now = new Date(); + $scope.botonera = ['Transportista']; + + //SETEO BOTONERA LATERAL + focaBotoneraLateralService.showSalir(true); + focaBotoneraLateralService.showPausar(false); + focaBotoneraLateralService.showCancelar(false); + focaBotoneraLateralService.showGuardar(false); + + if(focaAbmVehiculoService.transportistaSeleccionado.COD) { + elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); + } + $scope.editar = function(id) { $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); }; @@ -38,39 +47,90 @@ angular.module('focaAbmVehiculo') } ); modalInstance.result.then( - function(transprotista) { - $scope.idTransportista = transprotista.COD; - $scope.filtros = transprotista.NOM.trim(); - $scope.buscar(transprotista.COD); + function(transportista) { + elegirTransportista(transportista); + focaAbmVehiculoService.transportistaSeleccionado = transportista; }, function() { } ); }; + + function elegirTransportista(transportista) { + $scope.idTransportista = transportista.COD; + $scope.filtros = transportista.NOM.trim(); + $timeout(function() { + $scope.$broadcast('addCabecera', { + label: 'Transportista:', + valor: transportista.COD + ' - ' + transportista.NOM + }); + }); + buscar(transportista.COD); + } + + function buscar(idTransportista) { + focaAbmVehiculoService + .getVehiculosPorTransportista(idTransportista) + .then(function(datos) { + $scope.vehiculos = datos.data; + }); + } + } ]) .controller('focaAbmVehiculoController', [ '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', - 'focaModalService', + 'focaModalService', '$timeout', 'focaBotoneraLateralService', function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, - focaModalService) { + focaModalService, $timeout, focaBotoneraLateralService) { $scope.nuevo = $routeParams.idVehiculo == 0 ? true : false; + $scope.now = new Date(); + $scope.focused = 1; + + + + $timeout(function() { + focaBotoneraLateralService.showSalir(false); + focaBotoneraLateralService.showPausar(false); + focaBotoneraLateralService.showCancelar(true); + focaBotoneraLateralService.showGuardar(true, $scope.guardar); + }); + console.log($routeParams); + + if($scope.nuevo) { focaAbmVehiculoService .getTransportistaPorId($routeParams.idTransportista) .then(function(res) { $scope.vehiculo.idTransportista = res.data.COD; $scope.vehiculo.transportista = res.data; + $scope.$broadcast('addCabecera', { + label: 'Transportista:', + valor: res.data.COD + ' - ' + res.data.NOM + }); }); } $scope.vehiculo = {}; focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { - if(res.data) $scope.vehiculo = res.data; + if(res.data) { + $scope.vehiculo = res.data; + $scope.$broadcast('addCabecera', { + label: 'Transportista:', + valor: res.data.transportista.COD + ' - ' + res.data.transportista.NOM + }); + $scope.$broadcast('addCabecera', { + label: 'Vehículo:', + valor: res.data.codigo + }); + } }); focaAbmVehiculoService.getCisternadoPorVehiculo($routeParams.idVehiculo) .then(function(res) { $scope.cisternas = res.data; }); + $scope.next = function(key) { + if (key === 13) $scope.focused++; + }; $scope.cancelar = function() { $location.path('/vehiculo'); }; @@ -117,9 +177,9 @@ angular.module('focaAbmVehiculo') } ); modalInstance.result.then( - function(transprotista) { - $scope.vehiculo.idTransportista = transprotista.COD; - $scope.vehiculo.transportista = transprotista; + function(transportista) { + $scope.vehiculo.idTransportista = transportista.COD; + $scope.vehiculo.transportista = transportista; }, function() { } diff --git a/src/js/controllerCisterna.js b/src/js/controllerCisterna.js index a9203b8..7541ef6 100644 --- a/src/js/controllerCisterna.js +++ b/src/js/controllerCisterna.js @@ -1,16 +1,30 @@ angular.module('focaAbmVehiculo') .controller('focaAbmVehiculoCisternaController', [ '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', - 'focaModalService', + 'focaModalService', 'focaBotoneraLateralService', '$timeout', function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, - focaModalService) { + focaModalService, focaBotoneraLateralService, $timeout) { $scope.editar = false; + $scope.now = new Date(); $scope.cisterna = { cisternaCarga: { articulo: {} } }; + $scope.focused = 1; + $scope.next = function(key) { + if (key === 13) $scope.focused++; + }; + + //SETEO BOTONERA LATERAL + $timeout(function() { + focaBotoneraLateralService.showSalir(false); + focaBotoneraLateralService.showPausar(false); + focaBotoneraLateralService.showCancelar(true); + focaBotoneraLateralService.showGuardar(true, $scope.guardar); + }); + focaAbmVehiculoService.getCisterna($routeParams.id).then(function(res) { if(res.data) { $scope.cisterna = res.data; @@ -19,9 +33,18 @@ angular.module('focaAbmVehiculo') $scope.editar = false; } }); + focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { + $scope.$broadcast('addCabecera', { + label: 'Transportista:', + valor: res.data.transportista.COD + ' - ' + res.data.transportista.NOM + }); + $scope.$broadcast('addCabecera', { + label: 'Vehículo:', + valor: res.data.codigo + }); + }); $scope.cancelar = function() { $location.path('/vehiculo/' + $routeParams.idVehiculo); - console.log($routeParams.id); }; $scope.guardar = function() { if(!$scope.cisterna.unidadMedida) { @@ -79,6 +102,6 @@ angular.module('focaAbmVehiculo') $scope.cisterna.idUnidadMedida = unidaMedida.ID; $scope.cisterna.unidadMedida = unidaMedida; }); - } + }; } ]); diff --git a/src/js/service.js b/src/js/service.js index 1358be3..b4be7de 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -33,6 +33,7 @@ angular.module('focaAbmVehiculo') }, getTransportistaPorId: function(id) { return $http.get(API_ENDPOINT.URL + '/transportista/' + id); - } + }, + transportistaSeleccionado: {} }; }]); diff --git a/src/views/foca-abm-cisterna-item.html b/src/views/foca-abm-cisterna-item.html index 66b6e50..6e845ce 100644 --- a/src/views/foca-abm-cisterna-item.html +++ b/src/views/foca-abm-cisterna-item.html @@ -1,14 +1,24 @@ -

Cisterna

+
+ +
+
- +
@@ -22,6 +32,9 @@ foca-tipo-input ng-model="cisterna.capacidad" ng-required="true" + ng-keypress="next($event.keyCode)" + foca-focus="focused == 2" + ng-focus="focused = 2" /> @@ -39,7 +52,7 @@ class="btn btn-outline-secondary form-control" type="button" ng-click="seleccionarUnidadMedida()" - ng-disabled="editar" + foca-focus="focused == 3" > @@ -79,14 +92,4 @@ --> -
-
- - -
-
diff --git a/src/views/foca-abm-vehiculos-item.html b/src/views/foca-abm-vehiculos-item.html index ea30341..c4e5645 100644 --- a/src/views/foca-abm-vehiculos-item.html +++ b/src/views/foca-abm-vehiculos-item.html @@ -1,108 +1,116 @@ -

Vehiculo

-
- -
- -
- - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- - +
+ +
+
+
+ + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
Cisternas
+ + + + + + + + + + + + + + + + + + + +
CódigoCapacidadUnidad de MedidaCarga + +
+ + +
- -
-

Cisternas

- - - - - - - - - - - - - - - - - - - -
UnidadUnidad de MedidaCapacidadCarga - -
- - -
diff --git a/src/views/foca-abm-vehiculos-listado.html b/src/views/foca-abm-vehiculos-listado.html index 934ef4e..e689bd8 100644 --- a/src/views/foca-abm-vehiculos-listado.html +++ b/src/views/foca-abm-vehiculos-listado.html @@ -1,70 +1,68 @@ -
-

Vehiculos

-
- -
- +
+ +
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
UnidadDominio TractorDominio SemiCapacidad + +
+ + +
- - - - - - - - - - - - - - - - - - - - -
UnidadDominio TractorDominio SemiCapacidad - -
- - -
- - Salir -