diff --git a/src/js/controllerDetalleVehiculo.js b/src/js/controllerDetalleVehiculo.js
index 846c481..5b32ddf 100644
--- a/src/js/controllerDetalleVehiculo.js
+++ b/src/js/controllerDetalleVehiculo.js
@@ -1,9 +1,41 @@
angular.module('focaLogisticaPedidoRuta')
- .controller('focaDetalleVehiculo', ['$scope', '$uibModalInstance', 'vehiculo', 'marcador',
+ .controller('focaDetalleVehiculo',
+ ['$scope',
+ '$uibModalInstance',
+ 'vehiculo',
+ 'marcador',
function($scope, $uibModalInstance, vehiculo, marcador) {
$scope.articulos = marcador.notaPedido.articulosNotaPedido;
+ $scope.articuloSeleccionado = {};
$scope.vehiculo = vehiculo;
$scope.aceptar = function() {
$uibModalInstance.close();
};
+
+ $scope.cargarACisterna = function(cisterna) {
+ if(!$scope.articuloSeleccionado.id) {
+ //TODO: usar modal de foca
+ alert('Debe seleccionar un articulo');
+ return;
+ }
+ if(cisterna.cisternaCarga.cantidad) {
+ cisterna.cisternaCarga.cantidad += parseFloat(cisterna.aCargar);
+ }else {
+ cisterna.cisternaCarga.cantidad = parseFloat(cisterna.aCargar);
+ cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.id;
+ }
+ cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad;
+ cisterna.aCargar = '';
+ };
+ $scope.calcularPorcentaje = function(cisterna) {
+ if(!cisterna.cisternaCarga.cantidad) {
+ cisterna.cisternaCarga.cantidad = 0;
+ }
+ var porcentaje = (cisterna.cisternaCarga.cantidad * 100 /
+ cisterna.capacidad) + '%';
+ document.getElementById(cisterna.id).style.width = porcentaje;
+ };
+ $scope.cambioArticulo = function(articulo) {
+ $scope.articuloSeleccionado = articulo;
+ };
}]);
diff --git a/src/js/osm-directive.js b/src/js/osm-directive.js
index 3e330ab..e189c93 100644
--- a/src/js/osm-directive.js
+++ b/src/js/osm-directive.js
@@ -7,7 +7,7 @@ angular.module('focaLogisticaPedidoRuta').directive('foca', function() {
scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map);
},
- controller: ['$scope', function($scope) {
+ controller: ['$scope', '$filter', function($scope, $filter) {
$scope.markers = [];
$scope.$watch('marcadores', function() {
for(var i in $scope.markers) {
@@ -15,8 +15,41 @@ angular.module('focaLogisticaPedidoRuta').directive('foca', function() {
}
$scope.markers = [];
- angular.forEach($scope.marcadores, function(marcador) {
- var observacion = '';
+ observacion += 'Fecha: ' +
+ $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
+ marcador.fecha.slice(11,19) + '
';
+ observacion += 'NÂș: ' + $filter('comprobante')([
+ marcador.notaPedido.sucursal,
+ marcador.notaPedido.numeroNotaPedido
+ ]) + '
';
+ observacion += 'Cliente: ' +
+ marcador.notaPedido.cliente.NOM + '
';
+
+ if ($scope.parametros.individual) {
+ observacion +=
+ 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$');
+ observacion = 'Orden: ' + marcador.orden + '
' + observacion;
+
+ if (marcador.distancia) {
+ observacion += '
Distancia a casa central: ' +
+ marcador.distancia + 'km';
+ }
+ } else {
+ observacion += 'Cantidad de nota de pedido: ' +
+ marcador.cantidad + '
';
+ observacion += 'Total Vendido: ' +
+ $filter('currency')(marcador.total, '$');
+ }
+ observacion += '
';
+ observacion += '';
$scope.markers.push(
diff --git a/src/views/foca-detalle-vehiculo.html b/src/views/foca-detalle-vehiculo.html
index d3776a3..9bc872b 100644
--- a/src/views/foca-detalle-vehiculo.html
+++ b/src/views/foca-detalle-vehiculo.html
@@ -1,29 +1,58 @@