From b824425a6b85424a515177cfb2a7c255cb99f848 Mon Sep 17 00:00:00 2001 From: Luigi Date: Fri, 15 Mar 2019 16:46:54 -0300 Subject: [PATCH] Cambios en seleccionar fechas pasadas --- src/js/controller.js | 46 +++++++++++++++++++++------------------ src/js/controllerDatosHojaRuta.js | 6 ++--- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index 017ba78..0a7f703 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -77,27 +77,27 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', }, true); $scope.crearHojaRuta = function() { - if(!$scope.hojaRuta.remitosTabla.length) { + if (!$scope.hojaRuta.remitosTabla.length) { focaModalService.alert('Ingrese Remitos'); return; } - if(!$scope.hojaRuta.chofer.id) { + if (!$scope.hojaRuta.chofer.id) { focaModalService.alert('Ingrese Chofer'); return; } - if(!$scope.hojaRuta.vehiculo.id) { + if (!$scope.hojaRuta.vehiculo.id) { focaModalService.alert('Ingrese Vehiculo'); return; } - if(!$scope.hojaRuta.transportista.COD) { + if (!$scope.hojaRuta.transportista.COD) { focaModalService.alert('Ingrese Transportista'); return; } - if(!$scope.hojaRuta.tarifario.costo) { + if (!$scope.hojaRuta.tarifario.costo) { focaModalService.alert('Ingrese Tarifario'); return; } - if(!$scope.hojaRuta.datosExtra) { + if (!$scope.hojaRuta.datosExtra) { focaModalService.alert('Ingrese Datos extra'); return; } @@ -135,7 +135,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', }; $scope.seleccionarTransportista = function() { - if(eligioPreConfirmado()) return; + if (eligioPreConfirmado()) return; var parametrosModal = { titulo: 'Búsqueda de transportista', query: '/transportista', @@ -209,7 +209,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', }; $scope.seleccionarVehiculo = function() { - if(!eligioFecha() || eligioPreConfirmado()) return; + if (!eligioFecha() || eligioPreConfirmado()) return; modalVehiculos(); }; @@ -242,7 +242,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', }; $scope.seleccionarRemitos = function() { - if(eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; + if (eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; var modalInstance = $uibModal.open( { ariaLabelledBy: 'Busqueda de Remito', @@ -299,12 +299,12 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', }; $scope.seleccionarVehiculosPrecargados = function() { - if(!eligioFecha()) return; + if (!eligioFecha()) return; modalVehiculos(true); }; $scope.cargarCisterna = function(idRemito) { - if(!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return; + if (!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return; var modalInstance = $uibModal.open( { ariaLabelledBy: 'Busqueda de Vehiculo', @@ -373,9 +373,13 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', }; function elegirFecha() { - focaModalService.modalFecha('Fecha de entrega').then(function(fecha) { + var fechaEntrega = { + titulo: 'Fecha de entrega', + minDate: new Date() + }; + focaModalService.modalFecha(fechaEntrega).then(function(fecha) { $scope.$broadcast('addCabecera', { - label: 'Fecha de entrega:', + label: 'Fecha de entrega: ', valor: fecha.toLocaleDateString() }); $scope.hojaRuta.fechaReparto = fecha; @@ -383,7 +387,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', } function eligioPreConfirmado() { - if($scope.eligioPreConfirmado) { + if ($scope.eligioPreConfirmado) { focaModalService.alert('No puede elegir si eligió un vehiculo pre cargado'); return true; } @@ -391,7 +395,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', } function eligioFecha() { - if(!$scope.hojaRuta.fechaReparto) { + if (!$scope.hojaRuta.fechaReparto) { focaModalService.alert('Primero seleccione fecha de reparto'); return false; } @@ -399,7 +403,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', } function eligioVehiculo() { - if(!$scope.hojaRuta.vehiculo.id) { + if (!$scope.hojaRuta.vehiculo.id) { focaModalService.alert('Primero seleccione vehiculo'); return false; } @@ -408,11 +412,11 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', function modalVehiculos(preCargados) { var parametrosModal = {}; - if(preCargados) { + if (preCargados) { parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' + new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10); parametrosModal.titulo = 'Búsqueda de vehiculos pre confirmados'; - }else { + } else { parametrosModal.query = '/vehiculo'; parametrosModal.titulo = 'Búsqueda de vehículos'; } @@ -431,10 +435,10 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', } ]; focaModalService.modal(parametrosModal).then(function(vehiculo) { - if(!preCargados && vehiculoEnUso(vehiculo)) return; + if (!preCargados && vehiculoEnUso(vehiculo)) return; $scope.hojaRuta.vehiculo = vehiculo; $scope.hojaRuta.transportista = vehiculo.transportista; - if(preCargados) { + if (preCargados) { $scope.eligioPreConfirmado = true; $scope.hojaRuta.vehiculo = vehiculo; $scope.$broadcast('addCabecera', { @@ -447,7 +451,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', .then(function(res) { $scope.hojaRuta.remitosTabla = res.data; }); - }else { + } else { focaCrearHojaRutaService .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto, true) .then(function(res) { diff --git a/src/js/controllerDatosHojaRuta.js b/src/js/controllerDatosHojaRuta.js index dca8b71..3cfda31 100644 --- a/src/js/controllerDatosHojaRuta.js +++ b/src/js/controllerDatosHojaRuta.js @@ -11,8 +11,8 @@ angular.module('focaCrearHojaRuta') $scope.focused = 0; $scope.aceptar = function(key) { - if(key === 13) { - if(!$scope.formDatosHojaRuta.$valid) { + if (key === 13) { + if (!$scope.formDatosHojaRuta.$valid) { focaModalService.alert('Formulario inválido'); return; } @@ -21,7 +21,7 @@ angular.module('focaCrearHojaRuta') }; $scope.next = function(key) { - if(key === 13) $scope.focused++; + if (key === 13) $scope.focused++; }; $scope.cancel = function() { -- 1.9.1