diff --git a/src/js/controller.js b/src/js/controller.js index a909dde..679858e 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -16,7 +16,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo label: 'Fecha Reparto', image: 'abmChofer.png' }; - $scope.botonera = [transportista, fecha]; + $scope.botonera = [fecha, transportista]; var cabecera = ''; $scope.now = new Date(); $scope.idVendedor = 0; @@ -34,10 +34,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo focaBotoneraLateralService.showPausar(false); focaBotoneraLateralService.showGuardar(false); - // TODO: obtener vehiculos con remitos cargados para esa fecha que no han sido confirmados - // focaLogisticaPedidoRutaService.getVehiculosByIdUsuario().then(function(res) { - // $scope.vehiculos = res.data; - // }); + $scope.general = function() { $scope.idVendedor = 0; @@ -51,7 +48,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo $scope.cargar = function(idVehiculo, punto) { if(!$scope.fechaReparto) { - focaModalService.alert('elija primero una fecha de reparto'); + focaModalService.alert('Primero seleccione fecha de reparto'); return; } var idRemito; @@ -86,6 +83,10 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo }; $scope.hacerHojaRuta = function(vehiculo) { + if(!$scope.fechaReparto) { + focaModalService.alert('Primero seleccione fecha de reparto'); + return; + } var modalInstance = $uibModal.open( { ariaLabelledBy: 'Creación hoja ruta', @@ -184,6 +185,10 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo valor: fecha.toLocaleDateString() }); $scope.fechaReparto = fecha; + focaLogisticaPedidoRutaService.setFechaReparto(fecha); + focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) { + $scope.vehiculos = res.data; + }); }); };