Commit b824425a6b85424a515177cfb2a7c255cb99f848

Authored by Luigi
1 parent fc27ef770c
Exists in master

Cambios en seleccionar fechas pasadas

src/js/controller.js
... ... @@ -77,27 +77,27 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
77 77 }, true);
78 78  
79 79 $scope.crearHojaRuta = function() {
80   - if(!$scope.hojaRuta.remitosTabla.length) {
  80 + if (!$scope.hojaRuta.remitosTabla.length) {
81 81 focaModalService.alert('Ingrese Remitos');
82 82 return;
83 83 }
84   - if(!$scope.hojaRuta.chofer.id) {
  84 + if (!$scope.hojaRuta.chofer.id) {
85 85 focaModalService.alert('Ingrese Chofer');
86 86 return;
87 87 }
88   - if(!$scope.hojaRuta.vehiculo.id) {
  88 + if (!$scope.hojaRuta.vehiculo.id) {
89 89 focaModalService.alert('Ingrese Vehiculo');
90 90 return;
91 91 }
92   - if(!$scope.hojaRuta.transportista.COD) {
  92 + if (!$scope.hojaRuta.transportista.COD) {
93 93 focaModalService.alert('Ingrese Transportista');
94 94 return;
95 95 }
96   - if(!$scope.hojaRuta.tarifario.costo) {
  96 + if (!$scope.hojaRuta.tarifario.costo) {
97 97 focaModalService.alert('Ingrese Tarifario');
98 98 return;
99 99 }
100   - if(!$scope.hojaRuta.datosExtra) {
  100 + if (!$scope.hojaRuta.datosExtra) {
101 101 focaModalService.alert('Ingrese Datos extra');
102 102 return;
103 103 }
... ... @@ -135,7 +135,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
135 135 };
136 136  
137 137 $scope.seleccionarTransportista = function() {
138   - if(eligioPreConfirmado()) return;
  138 + if (eligioPreConfirmado()) return;
139 139 var parametrosModal = {
140 140 titulo: 'Búsqueda de transportista',
141 141 query: '/transportista',
... ... @@ -209,7 +209,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
209 209 };
210 210  
211 211 $scope.seleccionarVehiculo = function() {
212   - if(!eligioFecha() || eligioPreConfirmado()) return;
  212 + if (!eligioFecha() || eligioPreConfirmado()) return;
213 213 modalVehiculos();
214 214 };
215 215  
... ... @@ -242,7 +242,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
242 242 };
243 243  
244 244 $scope.seleccionarRemitos = function() {
245   - if(eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return;
  245 + if (eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return;
246 246 var modalInstance = $uibModal.open(
247 247 {
248 248 ariaLabelledBy: 'Busqueda de Remito',
... ... @@ -299,12 +299,12 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
299 299 };
300 300  
301 301 $scope.seleccionarVehiculosPrecargados = function() {
302   - if(!eligioFecha()) return;
  302 + if (!eligioFecha()) return;
303 303 modalVehiculos(true);
304 304 };
305 305  
306 306 $scope.cargarCisterna = function(idRemito) {
307   - if(!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return;
  307 + if (!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return;
308 308 var modalInstance = $uibModal.open(
309 309 {
310 310 ariaLabelledBy: 'Busqueda de Vehiculo',
... ... @@ -373,9 +373,13 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
373 373 };
374 374  
375 375 function elegirFecha() {
376   - focaModalService.modalFecha('Fecha de entrega').then(function(fecha) {
  376 + var fechaEntrega = {
  377 + titulo: 'Fecha de entrega',
  378 + minDate: new Date()
  379 + };
  380 + focaModalService.modalFecha(fechaEntrega).then(function(fecha) {
377 381 $scope.$broadcast('addCabecera', {
378   - label: 'Fecha de entrega:',
  382 + label: 'Fecha de entrega: ',
379 383 valor: fecha.toLocaleDateString()
380 384 });
381 385 $scope.hojaRuta.fechaReparto = fecha;
... ... @@ -383,7 +387,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
383 387 }
384 388  
385 389 function eligioPreConfirmado() {
386   - if($scope.eligioPreConfirmado) {
  390 + if ($scope.eligioPreConfirmado) {
387 391 focaModalService.alert('No puede elegir si eligió un vehiculo pre cargado');
388 392 return true;
389 393 }
... ... @@ -391,7 +395,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
391 395 }
392 396  
393 397 function eligioFecha() {
394   - if(!$scope.hojaRuta.fechaReparto) {
  398 + if (!$scope.hojaRuta.fechaReparto) {
395 399 focaModalService.alert('Primero seleccione fecha de reparto');
396 400 return false;
397 401 }
... ... @@ -399,7 +403,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
399 403 }
400 404  
401 405 function eligioVehiculo() {
402   - if(!$scope.hojaRuta.vehiculo.id) {
  406 + if (!$scope.hojaRuta.vehiculo.id) {
403 407 focaModalService.alert('Primero seleccione vehiculo');
404 408 return false;
405 409 }
... ... @@ -408,11 +412,11 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
408 412  
409 413 function modalVehiculos(preCargados) {
410 414 var parametrosModal = {};
411   - if(preCargados) {
  415 + if (preCargados) {
412 416 parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' +
413 417 new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10);
414 418 parametrosModal.titulo = 'Búsqueda de vehiculos pre confirmados';
415   - }else {
  419 + } else {
416 420 parametrosModal.query = '/vehiculo';
417 421 parametrosModal.titulo = 'Búsqueda de vehículos';
418 422 }
... ... @@ -431,10 +435,10 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
431 435 }
432 436 ];
433 437 focaModalService.modal(parametrosModal).then(function(vehiculo) {
434   - if(!preCargados && vehiculoEnUso(vehiculo)) return;
  438 + if (!preCargados && vehiculoEnUso(vehiculo)) return;
435 439 $scope.hojaRuta.vehiculo = vehiculo;
436 440 $scope.hojaRuta.transportista = vehiculo.transportista;
437   - if(preCargados) {
  441 + if (preCargados) {
438 442 $scope.eligioPreConfirmado = true;
439 443 $scope.hojaRuta.vehiculo = vehiculo;
440 444 $scope.$broadcast('addCabecera', {
... ... @@ -447,7 +451,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
447 451 .then(function(res) {
448 452 $scope.hojaRuta.remitosTabla = res.data;
449 453 });
450   - }else {
  454 + } else {
451 455 focaCrearHojaRutaService
452 456 .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto, true)
453 457 .then(function(res) {
src/js/controllerDatosHojaRuta.js
... ... @@ -11,8 +11,8 @@ angular.module('focaCrearHojaRuta')
11 11 $scope.focused = 0;
12 12  
13 13 $scope.aceptar = function(key) {
14   - if(key === 13) {
15   - if(!$scope.formDatosHojaRuta.$valid) {
  14 + if (key === 13) {
  15 + if (!$scope.formDatosHojaRuta.$valid) {
16 16 focaModalService.alert('Formulario inválido');
17 17 return;
18 18 }
... ... @@ -21,7 +21,7 @@ angular.module('focaCrearHojaRuta')
21 21 };
22 22  
23 23 $scope.next = function(key) {
24   - if(key === 13) $scope.focused++;
  24 + if (key === 13) $scope.focused++;
25 25 };
26 26  
27 27 $scope.cancel = function() {