Commit 60884b7aeb1c0f86bba79563dfeb719cf8264bc5

Authored by Nicolás Guarnieri
1 parent a12f96ab05
Exists in master and in 1 other branch develop

idvehiculo

Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
src/js/osm-directive.js
1 angular.module('focaAdminSeguimiento').directive('osm', function() { 1 angular.module('focaAdminSeguimiento').directive('osm', function() {
2 return { 2 return {
3 restrict: 'E', 3 restrict: 'E',
4 link: function(scope, el, attrs) { 4 link: function(scope, el, attrs) {
5 var contenedor = document.createElement('div'); 5 var contenedor = document.createElement('div');
6 el.append(contenedor); 6 el.append(contenedor);
7 scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom); 7 scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom);
8 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); 8 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map);
9 }, 9 },
10 controller: ['$scope', '$filter', function($scope, $filter) { 10 controller: ['$scope', '$filter', function($scope, $filter) {
11 $scope.markers = []; 11 $scope.markers = [];
12 $scope.$watch('marcadores', function() { 12 $scope.$watch('marcadores', function() {
13 for(var i in $scope.markers) { 13 for(var i in $scope.markers) {
14 $scope.map.removeLayer($scope.markers[i]); 14 $scope.map.removeLayer($scope.markers[i]);
15 } 15 }
16 16
17 $scope.markers = []; 17 $scope.markers = [];
18 angular.forEach($scope.marcadores, function(marcador) { 18 angular.forEach($scope.marcadores, function(marcador) {
19 var observacion = ''; 19 var observacion = '';
20 observacion += 'Actividad: ' + marcador.actividad + '<br/>'; 20 observacion += 'Actividad: ' + marcador.actividad + '<br/>';
21 21
22 observacion += 'Fecha: ' + 22 observacion += 'Fecha: ' +
23 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 23 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
24 marcador.fecha.slice(11,19) + '<br/>'; 24 marcador.fecha.slice(11,19) + '<br/>';
25 25
26 if ($scope.parametros.actividad === 'Nota de pedido') { 26 if ($scope.parametros.actividad === 'Nota de pedido') {
27 console.info(marcador.notaPedido[0].vendedor); 27 console.info(marcador.notaPedido[0].vendedor);
28 observacion += 28 observacion +=
29 'Vendedor: ' + marcador.notaPedido[0].idVendedor + ' - ' + 29 'Vendedor: ' + marcador.notaPedido[0].idVendedor + ' - ' +
30 ( 30 (
31 marcador.notaPedido[0].vendedor[0] ? 31 marcador.notaPedido[0].vendedor[0] ?
32 marcador.notaPedido[0].vendedor[0].NomVen : 32 marcador.notaPedido[0].vendedor[0].NomVen :
33 '' 33 ''
34 ) + '<br/>'; 34 ) + '<br/>';
35 35
36 if ($scope.parametros.individual) { 36 if ($scope.parametros.individual) {
37 observacion += 'Nº: ' + $filter('comprobante')([ 37 observacion += 'Nº: ' + $filter('comprobante')([
38 marcador.notaPedido[0].sucursal, 38 marcador.notaPedido[0].sucursal,
39 marcador.notaPedido[0].numeroNotaPedido 39 marcador.notaPedido[0].numeroNotaPedido
40 ]) + '<br/>'; 40 ]) + '<br/>';
41 observacion += 41 observacion +=
42 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$'); 42 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$');
43 } else { 43 } else {
44 observacion += 'Cantidad de nota de pedido: ' + 44 observacion += 'Cantidad de nota de pedido: ' +
45 marcador.cantidad + '<br/>'; 45 marcador.cantidad + '<br/>';
46 observacion += 'Total Vendido: ' + 46 observacion += 'Total Vendido: ' +
47 $filter('currency')(marcador.total, '$'); 47 $filter('currency')(marcador.total, '$');
48 } 48 }
49 } else { 49 } else {
50 observacion += 'Vehiculo: ' + marcador.idUsuario + '<br/>'; 50 observacion += 'Vehiculo: ' + marcador.hojaRuta[0].idVehiculo + '<br/>';
51 if ($scope.parametros.individual) { 51 if ($scope.parametros.individual) {
52 observacion += 'Hoja de ruta: ' + $filter('comprobante')([ 52 observacion += 'Hoja de ruta: ' + $filter('comprobante')([
53 marcador.remito[0].hojaRuta[0].sucursal, 53 marcador.remito[0].hojaRuta[0].sucursal,
54 marcador.remito[0].hojaRuta[0].numeroHojaRuta 54 marcador.remito[0].hojaRuta[0].numeroHojaRuta
55 ]) + '<br/>'; 55 ]) + '<br/>';
56 observacion += 'Remito: ' + $filter('comprobante')([ 56 observacion += 'Remito: ' + $filter('comprobante')([
57 marcador.remito[0].sucursal, 57 marcador.remito[0].sucursal,
58 marcador.remito[0].numeroRemito 58 marcador.remito[0].numeroRemito
59 ]) + '<br/>'; 59 ]) + '<br/>';
60 observacion += 'Producto: ' + 60 observacion += 'Producto: ' +
61 marcador.remito[0].articuloRemito[0].descripcion + '<br/>'; 61 marcador.remito[0].articuloRemito[0].descripcion + '<br/>';
62 observacion += 'Cantidad entregada: ' + 62 observacion += 'Cantidad entregada: ' +
63 marcador.remito[0].carga + '<br/>'; 63 marcador.remito[0].carga + '<br/>';
64 } 64 }
65 } 65 }
66 66
67 $scope.markers.push( 67 $scope.markers.push(
68 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map) 68 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map)
69 .bindPopup(observacion) 69 .bindPopup(observacion)
70 ); 70 );
71 71
72 $scope.markers[0].openPopup(); 72 $scope.markers[0].openPopup();
73 }); 73 });
74 }); 74 });
75 }], 75 }],
76 scope: { 76 scope: {
77 latitud: '=', 77 latitud: '=',
78 longitud: '=', 78 longitud: '=',
79 zoom: '=', 79 zoom: '=',
80 marcadores: '=', 80 marcadores: '=',
81 parametros: '=' 81 parametros: '='
82 } 82 }
83 }; 83 };
84 }); 84 });
85 85