Commit e901e7f3d1572c3a2cd64fe78d3ae0b6f8f6c65e

Authored by Nicolás Guarnieri
1 parent 8e7a80ab0e
Exists in master

refactor seguimiento para vendedores

Showing 2 changed files with 55 additions and 40 deletions   Show diff stats
src/js/controller.js
1 angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [ 1 angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoController', [
2 '$scope', '$timeout', 'focaAdminSeguimientoService', 2 '$scope', '$timeout', 'focaAdminSeguimientoService',
3 'focaBotoneraLateralService','$location', '$routeParams', 3 'focaBotoneraLateralService','$location', '$routeParams',
4 function($scope, $timeout, focaAdminSeguimientoService, 4 function($scope, $timeout, focaAdminSeguimientoService,
5 focaBotoneraLateralService, $location, $routeParams) { 5 focaBotoneraLateralService, $location, $routeParams) {
6
7 $scope.actividad = ''; 6 $scope.actividad = '';
8 $scope.titulo = ''; 7 $scope.titulo = '';
9 var cabecera = ''; 8 var cabecera = '';
10 var plural = ''; 9 var plural = '';
11 10
12 $scope.now = new Date(); 11 $scope.now = new Date();
13 $scope.dateOptions = { 12 $scope.dateOptions = {
14 maxDate: new Date() 13 maxDate: new Date()
15 }; 14 };
16 15
17 switch($routeParams.parametro){ 16 switch ($routeParams.parametro) {
18 case 'nota-pedido': 17 case 'nota-pedido':
19 $scope.actividad = 'Nota de pedido'; 18 $scope.actividad = 'Nota de pedido';
20 $scope.titulo = 'Seguimiento de nota de pedido'; 19 $scope.titulo = 'Seguimiento de nota de pedido';
21 cabecera = 'Vendedor:'; 20 cabecera = 'Vendedor:';
22 plural = 'Vendedores'; 21 plural = 'Vendedores';
23 break; 22 break;
24 case 'hoja-ruta': 23 case 'hoja-ruta':
25 $scope.actividad = 'Entrega de producto'; 24 $scope.actividad = 'Entrega de producto';
26 $scope.titulo = 'Seguimiento de hoja de ruta'; 25 $scope.titulo = 'Seguimiento de hoja de ruta';
27 cabecera = 'Vehiculo:'; 26 cabecera = 'Vehiculo:';
28 plural = 'Vehiculos'; 27 plural = 'Vehiculos';
29 break; 28 break;
30 case 'cobranza': 29 case 'cobranza':
31 $scope.actividad = 'Cobranza'; 30 $scope.actividad = 'Cobranza';
32 $scope.titulo = 'Seguimiento de cobranza'; 31 $scope.titulo = 'Seguimiento de cobranza';
33 cabecera = 'Cobrador:'; 32 cabecera = 'Cobrador:';
34 plural = 'Cobradores'; 33 plural = 'Cobradores';
35 break; 34 break;
36 } 35 }
37 36
38 $scope.idUsuario = 0; 37 $scope.idUsuario = 0;
39 $scope.marcadores = []; 38 $scope.marcadores = [];
40 getSeguimiento(); 39 getSeguimiento();
41 40
42 $timeout(function() {
43 $scope.$broadcast('addCabecera',{
44 label: 'General',
45 valor: ''
46 });
47 });
48
49 //SETEO BOTONERA LATERAL 41 //SETEO BOTONERA LATERAL
50 focaBotoneraLateralService.showSalir(true); 42 focaBotoneraLateralService.showSalir(true);
51 focaBotoneraLateralService.showPausar(false); 43 focaBotoneraLateralService.showPausar(false);
52 focaBotoneraLateralService.showGuardar(false); 44 focaBotoneraLateralService.showGuardar(false);
53 45
54 $scope.general = function() { 46 $scope.general = function() {
55 $scope.idUsuario = 0; 47 $scope.idUsuario = 0;
56 getSeguimiento(); 48 getSeguimiento();
57 $scope.$broadcast('removeCabecera', cabecera);
58 $scope.$broadcast('removeCabecera', 'Individual');
59 $scope.$broadcast('addCabecera',{
60 label: 'General -',
61 valor: $scope.marcadores.length + ' ' + plural
62 });
63 }; 49 };
64 50
65 $scope.individual = function() { 51 $scope.individual = function() {
66 $scope.idUsuario = -1; 52 $scope.idUsuario = -1;
67 }; 53 };
68 54
69 $scope.salir = function() { 55 $scope.salir = function() {
70 $location.path('/'); 56 $location.path('/');
71 }; 57 };
72 58
73 $scope.search = function(key) { 59 $scope.search = function(key) {
74 if (key === 13) { 60 if (key === 13) {
75 $scope.idUsuario = $scope.idUsuarioInput; 61 $scope.idUsuario = $scope.idUsuarioInput;
76 $scope.$broadcast('removeCabecera', 'General'); 62
77 $scope.$broadcast('addCabecera', {
78 label: 'Individual',
79 valor: $scope.marcadores.length + ' ' + $scope.actividad
80 });
81 getSeguimiento(); 63 getSeguimiento();
82 if ($scope.actividad === 'Entrega de producto' && $scope.idUsuario !== 0) { 64 if ($scope.actividad === 'Entrega de producto' && $scope.idUsuario !== 0) {
83 focaAdminSeguimientoService.obtenerRemitosVehiculo($scope.idUsuario) 65 focaAdminSeguimientoService.obtenerRemitosVehiculo($scope.idUsuario)
84 .then(function(res) { 66 .then(function(res) {
85 var remitos = []; 67 var remitos = [];
86 for (var i = 0; i < res.data.length; i++) { 68 for (var i = 0; i < res.data.length; i++) {
87 remitos = remitos.concat(res.data[i].remitos); 69 remitos = remitos.concat(res.data[i].remitos);
88 } 70 }
89 $scope.remitosVehiculo = remitos; 71 $scope.remitosVehiculo = remitos;
90 }); 72 });
91 } 73 }
92 } 74 }
93 }; 75 };
94 76
95 $scope.fecha = function() { 77 $scope.fecha = function() {
96 getSeguimiento(); 78 getSeguimiento();
97 }; 79 };
98 80
99 function getSeguimiento() { 81 function getSeguimiento() {
82 $scope.$broadcast('cleanCabecera');
100 var now = $scope.now; 83 var now = $scope.now;
101 var desde = new Date(new Date(now.setHours(0)).setMinutes(0)); 84 var desde = new Date(new Date(now.setHours(0)).setMinutes(0));
102 desde = desde.setDate(desde.getDate() - 1); 85 desde = desde.setDate(desde.getDate() - 1);
103 desde = new Date(desde); 86 desde = new Date(desde);
104 var datos = { 87 var datos = {
105 actividad: $scope.actividad, 88 actividad: $scope.actividad,
106 idUsuario: $scope.idUsuario, 89 idUsuario: $scope.idUsuario,
107 fechaDesde: desde, 90 fechaDesde: desde,
108 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)), 91 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)),
109 entregado: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? 92 entregado: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ?
110 false : undefined) 93 false : undefined)
111 }; 94 };
112 95
113 $scope.datosBuscados = { 96 $scope.datosBuscados = {
114 actividad: $scope.actividad, 97 actividad: $scope.actividad,
115 individual: $scope.idUsuario !== 0 ? true : false 98 individual: $scope.idUsuario !== 0 ? true : false
116 }; 99 };
117 100
118 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) { 101 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) {
119 if($scope.idUsuario !== 0){ 102 $scope.marcadores = datos.data;
120 switch($routeParams.parametro){ 103
104 if ($scope.idUsuario !== 0) {
105 $scope.$broadcast('removeCabecera', 'General -');
106 $scope.$broadcast('addCabecera', {
107 label: 'Individual',
108 valor: ''
109 });
110
111 var valor = '';
112 switch ($routeParams.parametro) {
121 case 'nota-pedido': 113 case 'nota-pedido':
122 $scope.$broadcast('addCabecera', { 114 if (datos.data.length) {
123 label: cabecera, 115 valor = datos.data[0].notaPedido.vendedor.NUM + ' - ' +
124 valor: (datos.data.length) ? $scope.idUsuario + ' - ' + 116 datos.data[0].notaPedido.vendedor.NOM.trim();
125 datos.data[0].notaPedido.vendedor.NomVen 117 } else {
126 : $scope.idUsuario 118 valor = $scope.idUsuario;
127 }); 119 }
128 break; 120 break;
129 case 'hoja-ruta': 121 case 'hoja-ruta':
130 $scope.$broadcast('addCabecera', { 122 if (datos.data.length) {
131 label: cabecera, 123 valor = $scope.idUsuario + ' - ' + datos.data[0]
132 valor: (datos.data.length) ? $scope.idUsuario + ' - ' + 124 .hojaRutaMovimiento.remito.hojaRuta.vehiculo.tractor.trim();
133 datos.data[0].hojaRutaMovimiento.remito.hojaRuta.vehiculo.tractor 125 } else {
134 : $scope.idUsuario 126 valor = $scope.idUsuario;
135 }); 127 }
128
136 break; 129 break;
137 case 'cobranza': 130 case 'cobranza':
131 if (datos.data.length) {
132 valor = datos.data[0].notaPedido.vendedor.NUM + ' - ' +
133 datos.data[0].notaPedido.vendedor.NOM.trim();
134 } else {
135 valor = $scope.idUsuario;
136 }
138 break; 137 break;
139 } 138 }
139
140 $scope.$broadcast('addCabecera', {
141 label: cabecera,
142 valor: valor
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 var observacion = ''; 18 var observacion = '';
19 19
20 angular.forEach($scope.marcadores, function(marcador) { 20 angular.forEach($scope.marcadores, function(marcador) {
21 var icon = new L.Icon({ 21 var icon = new L.Icon({
22 iconUrl: 'img/marker-icon-2x-blue.png', 22 iconUrl: 'img/marker-icon-2x-blue.png',
23 shadowUrl: 'img/marker-shadow.png', 23 shadowUrl: 'img/marker-shadow.png',
24 iconSize: [25, 41], 24 iconSize: [25, 41],
25 iconAnchor: [12, 41], 25 iconAnchor: [12, 41],
26 popupAnchor: [1, -34], 26 popupAnchor: [1, -34],
27 shadowSize: [41, 41] 27 shadowSize: [41, 41]
28 }); 28 });
29 if ($scope.parametros.actividad === 'Nota de pedido') { 29 if ($scope.parametros.actividad === 'Nota de pedido') {
30 observacion = generarObservacion(getNotaPedido(marcador)); 30 observacion = generarObservacion(getNotaPedido(marcador));
31 } 31 }
32 32
33 if ($scope.parametros.actividad === 'Cobranza') { 33 if ($scope.parametros.actividad === 'Cobranza') {
34 observacion = getCobranza(marcador); 34 observacion = getCobranza(marcador);
35 } 35 }
36 36
37 if ($scope.parametros.actividad === 'Entrega de producto') { 37 if ($scope.parametros.actividad === 'Entrega de producto') {
38 observacion = getEntrega(marcador); 38 observacion = getEntrega(marcador);
39 if (marcador.hojaRutaMovimiento.remito.rechazado) { 39 if (marcador.hojaRutaMovimiento.remito.rechazado) {
40 icon = new L.Icon({ 40 icon = new L.Icon({
41 iconUrl: 'img/marker-icon-2x-yellow.png', 41 iconUrl: 'img/marker-icon-2x-yellow.png',
42 shadowUrl: 'img/marker-shadow.png', 42 shadowUrl: 'img/marker-shadow.png',
43 iconSize: [25, 41], 43 iconSize: [25, 41],
44 iconAnchor: [12, 41], 44 iconAnchor: [12, 41],
45 popupAnchor: [1, -34], 45 popupAnchor: [1, -34],
46 shadowSize: [41, 41] 46 shadowSize: [41, 41]
47 }); 47 });
48 } else { 48 } else {
49 icon = new L.Icon({ 49 icon = new L.Icon({
50 iconUrl: 'img/marker-icon-2x-green.png', 50 iconUrl: 'img/marker-icon-2x-green.png',
51 shadowUrl: 'img/marker-shadow.png', 51 shadowUrl: 'img/marker-shadow.png',
52 iconSize: [25, 41], 52 iconSize: [25, 41],
53 iconAnchor: [12, 41], 53 iconAnchor: [12, 41],
54 popupAnchor: [1, -34], 54 popupAnchor: [1, -34],
55 shadowSize: [41, 41] 55 shadowSize: [41, 41]
56 }); 56 });
57 } 57 }
58 } 58 }
59 59
60 if (observacion) { 60 if (observacion) {
61 $scope.markers.push( 61 $scope.markers.push(
62 L.marker( 62 L.marker(
63 [marcador.latitud, marcador.longitud], 63 [marcador.latitud, marcador.longitud],
64 {icon: icon}).addTo($scope.map) 64 {icon: icon}).addTo($scope.map)
65 .bindPopup(observacion) 65 .bindPopup(observacion)
66 ); 66 );
67 67
68 $scope.markers[0].openPopup(); 68 $scope.markers[0].openPopup();
69 } 69 }
70 }); 70 });
71 71
72 function getNotaPedido(marcador) { 72 function getNotaPedido(marcador) {
73 var observacion = []; 73 var observacion = [];
74 74
75 if (!marcador.notaPedido.id) { 75 if (!marcador.notaPedido.id) {
76 return false; 76 return false;
77 } 77 }
78 78
79 var notaPedido = marcador.notaPedido; 79 var notaPedido = marcador.notaPedido;
80 var textVendedor = notaPedido.idVendedor + ' - ';
81 80
82 if (notaPedido.vendedor) { 81 if (notaPedido.vendedor) {
83 textVendedor += notaPedido.vendedor.NomVen; 82 observacion.push([
83 'Vendedor',
84 notaPedido.vendedor.NUM + ' - ' + notaPedido.vendedor.NOM
85 ]);
84 } 86 }
85 87
86 observacion.push(['Vendedor', textVendedor]);
87 88
88 if (!$scope.parametros.individual) { 89 if (!$scope.parametros.individual) {
89 observacion.push(['Ultima Nota de Pedido', '']); 90 observacion.push(['Ultima Nota de Pedido', '']);
90 } 91 }
91 92
92 var textFecha = $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + 93 var textFecha = $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') +
93 ' ' + marcador.fecha.slice(11,19); 94 ' ' + marcador.fecha.slice(11,19);
94 observacion.push(['Fecha', textFecha]); 95 observacion.push(['Fecha', textFecha]);
95 96
96 observacion.push(['Nº', 97 observacion.push(['Nº',
97 $filter('comprobante')([notaPedido.sucursal, notaPedido.numeroNotaPedido ]) 98 $filter('comprobante')([notaPedido.sucursal, notaPedido.numeroNotaPedido ])
98 ]); 99 ]);
99 100
100 if (notaPedido.cliente) { 101 if (notaPedido.cliente) {
101 observacion.push(['Cliente', notaPedido.cliente.NOM]); 102 observacion.push(['Cliente', notaPedido.cliente.NOM]);
102 } 103 }
103 104
104 if ($scope.parametros.individual) { 105 if ($scope.parametros.individual) {
105 observacion.push(['Total', $filter('currency')(notaPedido.total, '$')]); 106 observacion.push(['Total', $filter('currency')(notaPedido.total, '$')]);
106 observacion.unshift(['Orden', marcador.orden]); 107 observacion.unshift(['Orden', marcador.orden]);
107 108
108 if (marcador.distancia) { 109 if (marcador.distancia) {
109 observacion.push(['Distancia a casa central', 110 observacion.push(['Distancia a casa central',
110 marcador.distancia + 'km' 111 marcador.distancia + 'km'
111 ]); 112 ]);
112 } 113 }
113 } else { 114 } else {
114 observacion.push(['Cantidad de nota de pedido', 115 observacion.push(['Cantidad de nota de pedido',
115 marcador.cantidad 116 marcador.cantidad
116 ]); 117 ]);
117 118
118 observacion.push(['Total Vendido', 119 observacion.push(['Total Vendido',
119 $filter('currency')(marcador.total, '$') 120 $filter('currency')(marcador.total, '$')
120 ]); 121 ]);
121 } 122 }
122 123
123 console.info(marcador, observacion); 124 console.info(marcador, observacion);
124 return observacion; 125 return observacion;
125 } 126 }
126 127
127 function getCobranza(marcador) { 128 function getCobranza(marcador) {
128 observacion = ''; 129 observacion = '';
129 observacion += 'Cobrador: ' + marcador.recibo.cobrador.CodVen + ' - ' + 130 observacion += 'Cobrador: ' + marcador.recibo.cobrador.NUM + ' - ' +
130 marcador.recibo.CFE + '<br/>'; 131 marcador.recibo.CFE + '<br/>';
131 132
132 if (!$scope.parametros.individual) { 133 if (!$scope.parametros.individual) {
133 observacion += '<b>Ultima Cobranza</b><br/>'; 134 observacion += '<b>Ultima Cobranza</b><br/>';
134 } 135 }
135 136
136 observacion += 'Fecha: ' + 137 observacion += 'Fecha: ' +
137 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 138 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
138 marcador.fecha.slice(11,19) + '<br/>'; 139 marcador.fecha.slice(11,19) + '<br/>';
139 observacion += 'Nº: ' + $filter('comprobante')([ 140 observacion += 'Nº: ' + $filter('comprobante')([
140 marcador.recibo.PVE, marcador.recibo.NCO]) + '<br/>'; 141 marcador.recibo.PVE, marcador.recibo.NCO]) + '<br/>';
141 observacion += 'Cliente: ' + marcador.recibo.cliente.NOM + '<br/>'; 142 observacion += 'Cliente: ' + marcador.recibo.cliente.NOM + '<br/>';
142 var totalCobrado = 0; 143 var totalCobrado = 0;
143 for (var i = 0; i < marcador.recibo.cuerpos.length; i++) { 144 for (var i = 0; i < marcador.recibo.cuerpos.length; i++) {
144 if (marcador.recibo.cuerpos[i].LOP === 'P') { 145 if (marcador.recibo.cuerpos[i].LOP === 'P') {
145 totalCobrado += marcador.recibo.cuerpos[i].IMP; 146 totalCobrado += marcador.recibo.cuerpos[i].IMP;
146 } 147 }
147 } 148 }
148 149
149 if ($scope.parametros.individual) { 150 if ($scope.parametros.individual) {
150 if (marcador.distancia) { 151 if (marcador.distancia) {
151 observacion += 'Distancia a casa central: ' + 152 observacion += 'Distancia a casa central: ' +
152 marcador.distancia + 'km' + '<br/>'; 153 marcador.distancia + 'km' + '<br/>';
153 observacion += 'Total Cobrado: ' + 154 observacion += 'Total Cobrado: ' +
154 $filter('currency')(totalCobrado, '$'); 155 $filter('currency')(totalCobrado, '$');
155 } 156 }
156 } else { 157 } else {
157 observacion += 'Cantidad de cobranzas: ' + 158 observacion += 'Cantidad de cobranzas: ' +
158 marcador.cantidad + '<br/>'; 159 marcador.cantidad + '<br/>';
159 observacion += 'Total Cobrado: ' + 160 observacion += 'Total Cobrado: ' +
160 $filter('currency')(totalCobrado, '$'); 161 $filter('currency')(totalCobrado, '$');
161 } 162 }
162 return observacion; 163 return observacion;
163 } 164 }
164 165
165 function getEntrega(marcador) { 166 function getEntrega(marcador) {
166 var observacion = ''; 167 var observacion = '';
167 var remito = marcador.hojaRutaMovimiento.remito; 168 var remito = marcador.hojaRutaMovimiento.remito;
168 observacion += 'Vehiculo: ' + 169 observacion += 'Vehiculo: ' +
169 remito.hojaRuta.idVehiculo + ' - ' + 170 remito.hojaRuta.idVehiculo + ' - ' +
170 remito.hojaRuta.vehiculo.tractor + '<br/>'; 171 remito.hojaRuta.vehiculo.tractor + '<br/>';
171 observacion += 'Transportista: ' + 172 observacion += 'Transportista: ' +
172 remito.hojaRuta.transportista.NOM + '<br/>'; 173 remito.hojaRuta.transportista.NOM + '<br/>';
173 observacion += 'Chofer: ' + 174 observacion += 'Chofer: ' +
174 remito.hojaRuta.chofer.nombre + '<br/>'; 175 remito.hojaRuta.chofer.nombre + '<br/>';
175 observacion += 'Hoja de ruta: ' + $filter('comprobante')([ 176 observacion += 'Hoja de ruta: ' + $filter('comprobante')([
176 remito.hojaRuta.sucursal, 177 remito.hojaRuta.sucursal,
177 remito.hojaRuta.numeroHojaRuta 178 remito.hojaRuta.numeroHojaRuta
178 ]) + '<br/>'; 179 ]) + '<br/>';
179 180
180 if (!$scope.parametros.individual) { 181 if (!$scope.parametros.individual) {
181 observacion += '<b>Ultimo Remito</b><br/>'; 182 observacion += '<b>Ultimo Remito</b><br/>';
182 } 183 }
183 184
184 observacion += 'Fecha: ' + 185 observacion += 'Fecha: ' +
185 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 186 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
186 marcador.fecha.slice(11,19) + '<br/>'; 187 marcador.fecha.slice(11,19) + '<br/>';
187 188
188 observacion += 'Nº: ' + $filter('comprobante')([ 189 observacion += 'Nº: ' + $filter('comprobante')([
189 remito.sucursal, 190 remito.sucursal,
190 remito.numeroRemito 191 remito.numeroRemito
191 ]) + '<br/>'; 192 ]) + '<br/>';
192 observacion += 'Cliente: ' + 193 observacion += 'Cliente: ' +
193 remito.cliente.NOM + '<br/>'; 194 remito.cliente.NOM + '<br/>';
194 195
195 if ($scope.parametros.individual) { 196 if ($scope.parametros.individual) {
196 // observacion += 'Producto: ' + 197 // observacion += 'Producto: ' +
197 // remito.articulosRemito[0].descripcion + '<br/>'; 198 // remito.articulosRemito[0].descripcion + '<br/>';
198 // observacion += 'Cantidad entregada: ' + 199 // observacion += 'Cantidad entregada: ' +
199 // remito.carga + '<br/>'; 200 // remito.carga + '<br/>';
200 201
201 if (marcador.distancia) { 202 if (marcador.distancia) {
202 observacion += 'Distancia a casa central: ' + marcador.distancia + 203 observacion += 'Distancia a casa central: ' + marcador.distancia +
203 'km <br/>'; 204 'km <br/>';
204 } 205 }
205 206
206 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion; 207 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion;
207 } else { 208 } else {
208 observacion += 'Cantidad de entregas: ' + marcador.cantidad; 209 observacion += 'Cantidad de entregas: ' + marcador.cantidad;
209 } 210 }
210 observacion += '<br/>'; 211 observacion += '<br/>';
211 if (remito.rechazado) { 212 if (remito.rechazado) {
212 observacion += '<strong>Motivo del rechazo: ' + remito.motivoRechazo; 213 observacion += '<strong>Motivo del rechazo: ' + remito.motivoRechazo;
213 } 214 }
214 215
215 return observacion; 216 return observacion;
216 } 217 }
217 218
218 function generarObservacion(array) { 219 function generarObservacion(array) {
219 var resultado = ''; 220 var resultado = '';
220 221
221 for (var i = 0; i < array.length; i++) { 222 for (var i = 0; i < array.length; i++) {
222 resultado += '<b>' + array[i][0] + ': </b>'; 223 resultado += '<b>' + array[i][0] + ': </b>';
223 resultado += array[i][1]; 224 resultado += array[i][1];
224 225
225 if (i < (array.length - 1)) { 226 if (i < (array.length - 1)) {
226 resultado += '<br/>'; 227 resultado += '<br/>';
227 } 228 }
228 } 229 }
229 230
230 return resultado; 231 return resultado;
231 } 232 }
232 }); 233 });
233 }], 234 }],
234 scope: { 235 scope: {
235 latitud: '=', 236 latitud: '=',
236 longitud: '=', 237 longitud: '=',
237 zoom: '=', 238 zoom: '=',
238 marcadores: '=', 239 marcadores: '=',
239 parametros: '=' 240 parametros: '='
240 } 241 }
241 }; 242 };