diff --git a/src/js/controller.js b/src/js/controller.js
index 14ba00b..abf60fc 100644
--- a/src/js/controller.js
+++ b/src/js/controller.js
@@ -7,6 +7,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
$scope.actividad = 'Logistica';
//Datos Pantalla
$scope.titulo = 'Logistica de Pedidos';
+
var transportista = {
label: 'Vehículo',
image: 'abmChofer.png'
@@ -28,6 +29,8 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
getSeguimiento();
};
+ setearFecha(new Date());
+
//SETEO BOTONERA LATERAL
focaBotoneraLateralService.showSalir(true);
focaBotoneraLateralService.showPausar(false);
@@ -44,11 +47,11 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
};
$scope.cargar = function(idVehiculo, punto) {
- if(!eligioFecha()) return;
+ if (!eligioFecha()) return;
var idRemito;
- if(punto === -1) {
+ if (punto === -1) {
idRemito = -1;
- }else {
+ } else {
idRemito = JSON.parse(punto).notaPedido.remito.id;
}
$uibModal.open(
@@ -67,7 +70,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
};
$scope.quitarVehiculo = function(vehiculo) {
- if(!eligioFecha() || vehiculoEnUso(vehiculo)) return;
+ if (!eligioFecha() || vehiculoEnUso(vehiculo)) return;
focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' +
vehiculo.codigo + ' de ' + vehiculo.transportista.NOM + '?').then(function() {
@@ -76,7 +79,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
};
$scope.hacerHojaRuta = function(vehiculo, cerrar) {
- if(!eligioFecha() || vehiculoEnUso(vehiculo)) return;
+ if (!eligioFecha() || vehiculoEnUso(vehiculo)) return;
var modalInstance = $uibModal.open(
{
ariaLabelledBy: 'Creación hoja ruta',
@@ -178,11 +181,11 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
focaModalService.modal(parametrosModal).then(
function(vehiculo) {
var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id});
- if(existe.length) {
+ if (existe.length) {
focaModalService.alert('El vehiculo ya ha sido cargado');
return;
}
- if(!vehiculo.cisternas.length) {
+ if (!vehiculo.cisternas.length) {
focaModalService.alert('El vehiculo no tiene cisternas');
return;
}
@@ -194,27 +197,31 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
$scope.seleccionarFechaReparto = function() {
focaModalService.modalFecha('Fecha de reparto').then(function(fecha) {
- $scope.$broadcast('addCabecera',{
+ setearFecha(fecha);
+ });
+ };
+
+ function setearFecha(fecha) {
+ $scope.fechaReparto = fecha;
+ focaLogisticaPedidoRutaService.setFechaReparto(fecha);
+ focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res){
+ $scope.vehiculos = res.data;
+ $scope.$broadcast('addCabecera', {
label: 'Fecha:',
valor: fecha.toLocaleDateString()
});
- $scope.fechaReparto = fecha;
- focaLogisticaPedidoRutaService.setFechaReparto(fecha);
- focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) {
- $scope.vehiculos = res.data;
- });
});
- };
+ }
function getSeguimiento() {
var desde = new Date('1900/01/01');
var hasta = new Date('2099/01/01');
- if($scope.fechaDesde) {
+ if ($scope.fechaDesde) {
var fechaDesde = $scope.fechaDesde;
desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0));
desde = new Date(desde);
}
- if($scope.fechaHasta) {
+ if ($scope.fechaHasta) {
var fechaHasta = $scope.fechaHasta;
hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0));
hasta = hasta.setDate(hasta.getDate() + 1);
@@ -235,7 +242,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
};
focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) {
- if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) {
+ if (JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) {
$scope.marcadores = datos.data;
}
});
@@ -243,9 +250,9 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
function eliminarVehiculo(vehiculo) {
focaLogisticaPedidoRutaService.getRemitosByIdVehiculo(vehiculo.id).then(function(res) {
- if(!res.data.length) {
+ if (!res.data.length) {
$scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1);
- }else {
+ } else {
focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' +
'tiene remitos asociados').then(function() {
$scope.hacerHojaRuta(vehiculo, true);
@@ -255,7 +262,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
}
function eligioFecha() {
- if(!$scope.fechaReparto) {
+ if (!$scope.fechaReparto) {
focaModalService.alert('Primero seleccione fecha de reparto');
return false;
}
@@ -267,7 +274,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo
for(var i = 0; i < vehiculo.cisternas.length; i++) {
for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) {
var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j];
- if(cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto
+ if (cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto
.toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso &&
cisternaCarga.idUsuarioProceso !== idUsuario)
{
diff --git a/src/js/osm-directive.js b/src/js/osm-directive.js
index 7eb07cc..9399b17 100644
--- a/src/js/osm-directive.js
+++ b/src/js/osm-directive.js
@@ -40,8 +40,8 @@ angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', function()
var observacion =
'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' +
(
- marcador.notaPedido.vendedor ?
- marcador.notaPedido.vendedor.NomVen :
+ marcador.notaPedido.vendedor ?
+ marcador.notaPedido.vendedor.NomVen :
''
) + '
';
observacion += 'Fecha: ' +
@@ -57,12 +57,12 @@ angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', function()
// if($scope.parametros.individual) {
observacion = 'Orden: ' + marcador.orden + '
' + observacion;
- if(marcador.distancia) {
+ if (marcador.distancia) {
observacion += '
Distancia a casa central: ' +
marcador.distancia + 'km';
}
var icon;
- if(marcador.notaPedido.remito.idUsuarioProceso) {
+ if (marcador.notaPedido.remito.idUsuarioProceso) {
observacion += '
';
observacion += '';
observacion += 'Fecha de entrega: ' + marcador.notaPedido.remito
@@ -84,7 +84,7 @@ angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', function()
popupAnchor: [1, -34],
shadowSize: [41, 41]
});
- }else {
+ } else {
observacion += '
';
observacion += '