Commit a12f96ab05b1daa82c9bc3ab236f9797fbeaf286

Authored by Nicolás Guarnieri
1 parent d966d341f9
Exists in master

mostrar vendedor

Showing 1 changed file with 3 additions and 2 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 observacion += 28 observacion +=
28 'Vendedor: ' + marcador.notaPedido[0].idVendedor + ' - ' + 29 'Vendedor: ' + marcador.notaPedido[0].idVendedor + ' - ' +
29 ( 30 (
30 marcador.notaPedido[0].vendedor ? 31 marcador.notaPedido[0].vendedor[0] ?
31 marcador.notaPedido[0].vendedor.NomVen : 32 marcador.notaPedido[0].vendedor[0].NomVen :
32 '' 33 ''
33 ) + '<br/>'; 34 ) + '<br/>';
34 35
35 if ($scope.parametros.individual) { 36 if ($scope.parametros.individual) {
36 observacion += 'Nº: ' + $filter('comprobante')([ 37 observacion += 'Nº: ' + $filter('comprobante')([
37 marcador.notaPedido[0].sucursal, 38 marcador.notaPedido[0].sucursal,
38 marcador.notaPedido[0].numeroNotaPedido 39 marcador.notaPedido[0].numeroNotaPedido
39 ]) + '<br/>'; 40 ]) + '<br/>';
40 observacion += 41 observacion +=
41 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$'); 42 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$');
42 } else { 43 } else {
43 observacion += 'Cantidad de nota de pedido: ' + 44 observacion += 'Cantidad de nota de pedido: ' +
44 marcador.cantidad + '<br/>'; 45 marcador.cantidad + '<br/>';
45 observacion += 'Total Vendido: ' + 46 observacion += 'Total Vendido: ' +
46 $filter('currency')(marcador.total, '$'); 47 $filter('currency')(marcador.total, '$');
47 } 48 }
48 } else { 49 } else {
49 observacion += 'Vehiculo: ' + marcador.idUsuario + '<br/>'; 50 observacion += 'Vehiculo: ' + marcador.idUsuario + '<br/>';
50 if ($scope.parametros.individual) { 51 if ($scope.parametros.individual) {
51 observacion += 'Hoja de ruta: ' + $filter('comprobante')([ 52 observacion += 'Hoja de ruta: ' + $filter('comprobante')([
52 marcador.remito[0].hojaRuta[0].sucursal, 53 marcador.remito[0].hojaRuta[0].sucursal,
53 marcador.remito[0].hojaRuta[0].numeroHojaRuta 54 marcador.remito[0].hojaRuta[0].numeroHojaRuta
54 ]) + '<br/>'; 55 ]) + '<br/>';
55 observacion += 'Remito: ' + $filter('comprobante')([ 56 observacion += 'Remito: ' + $filter('comprobante')([
56 marcador.remito[0].sucursal, 57 marcador.remito[0].sucursal,
57 marcador.remito[0].numeroRemito 58 marcador.remito[0].numeroRemito
58 ]) + '<br/>'; 59 ]) + '<br/>';
59 observacion += 'Producto: ' + 60 observacion += 'Producto: ' +
60 marcador.remito[0].articuloRemito[0].descripcion + '<br/>'; 61 marcador.remito[0].articuloRemito[0].descripcion + '<br/>';
61 observacion += 'Cantidad entregada: ' + 62 observacion += 'Cantidad entregada: ' +
62 marcador.remito[0].carga + '<br/>'; 63 marcador.remito[0].carga + '<br/>';
63 } 64 }
64 } 65 }
65 66
66 $scope.markers.push( 67 $scope.markers.push(
67 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map) 68 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map)
68 .bindPopup(observacion) 69 .bindPopup(observacion)
69 ); 70 );
70 71
71 $scope.markers[0].openPopup(); 72 $scope.markers[0].openPopup();
72 }); 73 });
73 }); 74 });
74 }], 75 }],
75 scope: { 76 scope: {
76 latitud: '=', 77 latitud: '=',
77 longitud: '=', 78 longitud: '=',
78 zoom: '=', 79 zoom: '=',
79 marcadores: '=', 80 marcadores: '=',
80 parametros: '=' 81 parametros: '='
81 } 82 }
82 }; 83 };
83 }); 84 });
84 85