diff --git a/src/js/controller.js b/src/js/controller.js index a3c65b1..735d6bd 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -37,41 +37,34 @@ angular.module('focaEstadoCisternas') } } ); - modalInstance.result.then( - function(transportista) { - elegirTransportista(transportista); - }, function() { - - } - ); + return modalInstance.result; }; $scope.seleccionarVehiculo = function() { - if(!$scope.idTransportista) { - focaModalService.alert('Primero seleccione un transportista'); - return; - } - var query = '/vehiculo/transportista/' + $scope.idTransportista; - var columnas = { - nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], - propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] - }; - var titulo = 'Búsqueda de vehículos'; + $scope.seleccionarTransportista().then( + function(transportista) { + elegirTransportista(transportista); - focaModalService.modal(columnas, query, titulo).then( - function(vehiculo) { - $scope.$broadcast('addCabecera', { - label: 'Vehículo:', - valor: vehiculo.codigo - }); - $scope.cisternas = vehiculo.cisternas; - getEstadosCisternas($scope.cisternas); - }, function() { - // funcion ejecutada cuando se cancela el modal - }); + var query = '/vehiculo/transportista/' + $scope.idTransportista; + var columnas = { + nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], + propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] + }; + var titulo = 'Búsqueda de vehículos'; + + focaModalService.modal(columnas, query, titulo).then( + function(vehiculo) { + $scope.$broadcast('addCabecera', { + label: 'Vehículo:', + valor: vehiculo.codigo + }); + $scope.cisternas = vehiculo.cisternas; + getEstadosCisternas($scope.cisternas); + }, function() {}); + }, function() {}); }; - $scope.seleccionarFecha = function() { + $scope.seleccionarFechaEntrega = function() { focaModalService.modalFecha('Fecha').then(function(fecha) { $scope.$broadcast('addCabecera', { label: 'Fecha:', diff --git a/src/js/service.js b/src/js/service.js index db22c67..9c8f46d 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -29,15 +29,11 @@ angular.module('focaEstadoCisternas') getBotonera: function() { return [ { - label: 'Transportista', - image: 'transportista.png' - }, - { label: 'Vehiculo', image: 'vehiculos.png' }, { - label: 'Fecha', + label: 'Fecha entrega', image: 'fechaDeReparto.png' }, { diff --git a/src/views/foca-estado-cisterna.html b/src/views/foca-estado-cisterna.html index da29c53..c99ce4f 100644 --- a/src/views/foca-estado-cisterna.html +++ b/src/views/foca-estado-cisterna.html @@ -9,7 +9,7 @@
- +