Commit 05ea01e417e112883b2c82979b1df5f752d7cc02

Authored by Luigi
1 parent 7b348d3bbe
Exists in master and in 1 other branch develop

Setear fecha predeterminada en cabecera

Showing 2 changed files with 33 additions and 26 deletions   Show diff stats
src/js/controller.js
1 angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaController', [ 1 angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaController', [
2 '$scope', 'focaLogisticaPedidoRutaService', '$location', '$uibModal', '$filter', 2 '$scope', 'focaLogisticaPedidoRutaService', '$location', '$uibModal', '$filter',
3 'focaModalService', 'focaBotoneraLateralService', '$interval', 3 'focaModalService', 'focaBotoneraLateralService', '$interval',
4 function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter, 4 function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter,
5 focaModalService, focaBotoneraLateralService, $interval 5 focaModalService, focaBotoneraLateralService, $interval
6 ) { 6 ) {
7 $scope.actividad = 'Logistica'; 7 $scope.actividad = 'Logistica';
8 //Datos Pantalla 8 //Datos Pantalla
9 $scope.titulo = 'Logistica de Pedidos'; 9 $scope.titulo = 'Logistica de Pedidos';
10
10 var transportista = { 11 var transportista = {
11 label: 'Vehículo', 12 label: 'Vehículo',
12 image: 'abmChofer.png' 13 image: 'abmChofer.png'
13 }; 14 };
14 var fecha = { 15 var fecha = {
15 label: 'Fecha Reparto', 16 label: 'Fecha Reparto',
16 image: 'fechaDeReparto.png' 17 image: 'fechaDeReparto.png'
17 }; 18 };
18 $scope.botonera = [fecha, transportista]; 19 $scope.botonera = [fecha, transportista];
19 var cabecera = ''; 20 var cabecera = '';
20 $scope.now = new Date(); 21 $scope.now = new Date();
21 $scope.idVendedor = 0; 22 $scope.idVendedor = 0;
22 $scope.marcadores = []; 23 $scope.marcadores = [];
23 $scope.vehiculos = []; 24 $scope.vehiculos = [];
24 getSeguimiento(); 25 getSeguimiento();
25 $scope.arrastrando = false; 26 $scope.arrastrando = false;
26 $scope.general = function() { 27 $scope.general = function() {
27 $scope.idVendedor = 0; 28 $scope.idVendedor = 0;
28 getSeguimiento(); 29 getSeguimiento();
29 }; 30 };
30 31
32 setearFecha(new Date());
33
31 //SETEO BOTONERA LATERAL 34 //SETEO BOTONERA LATERAL
32 focaBotoneraLateralService.showSalir(true); 35 focaBotoneraLateralService.showSalir(true);
33 focaBotoneraLateralService.showPausar(false); 36 focaBotoneraLateralService.showPausar(false);
34 focaBotoneraLateralService.showGuardar(false); 37 focaBotoneraLateralService.showGuardar(false);
35 38
36 $scope.general = function() { 39 $scope.general = function() {
37 $scope.idVendedor = 0; 40 $scope.idVendedor = 0;
38 getSeguimiento(); 41 getSeguimiento();
39 $scope.$broadcast('removeCabecera', cabecera); 42 $scope.$broadcast('removeCabecera', cabecera);
40 $scope.$broadcast('addCabecera', { 43 $scope.$broadcast('addCabecera', {
41 label: 'General', 44 label: 'General',
42 valor: '' 45 valor: ''
43 }); 46 });
44 }; 47 };
45 48
46 $scope.cargar = function(idVehiculo, punto) { 49 $scope.cargar = function(idVehiculo, punto) {
47 if(!eligioFecha()) return; 50 if (!eligioFecha()) return;
48 var idRemito; 51 var idRemito;
49 if(punto === -1) { 52 if (punto === -1) {
50 idRemito = -1; 53 idRemito = -1;
51 }else { 54 } else {
52 idRemito = JSON.parse(punto).notaPedido.remito.id; 55 idRemito = JSON.parse(punto).notaPedido.remito.id;
53 } 56 }
54 $uibModal.open( 57 $uibModal.open(
55 { 58 {
56 ariaLabelledBy: 'Busqueda de Vehiculo', 59 ariaLabelledBy: 'Busqueda de Vehiculo',
57 templateUrl: 'foca-detalle-vehiculo.html', 60 templateUrl: 'foca-detalle-vehiculo.html',
58 controller: 'focaDetalleVehiculo', 61 controller: 'focaDetalleVehiculo',
59 size: 'lg', 62 size: 'lg',
60 resolve: { 63 resolve: {
61 idVehiculo: function() {return idVehiculo;}, 64 idVehiculo: function() {return idVehiculo;},
62 idRemito: function() {return idRemito;}, 65 idRemito: function() {return idRemito;},
63 fechaReparto: function() {return $scope.fechaReparto;} 66 fechaReparto: function() {return $scope.fechaReparto;}
64 } 67 }
65 } 68 }
66 ); 69 );
67 }; 70 };
68 71
69 $scope.quitarVehiculo = function(vehiculo) { 72 $scope.quitarVehiculo = function(vehiculo) {
70 if(!eligioFecha() || vehiculoEnUso(vehiculo)) return; 73 if (!eligioFecha() || vehiculoEnUso(vehiculo)) return;
71 74
72 focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + 75 focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' +
73 vehiculo.codigo + ' de ' + vehiculo.transportista.NOM + '?').then(function() { 76 vehiculo.codigo + ' de ' + vehiculo.transportista.NOM + '?').then(function() {
74 eliminarVehiculo(vehiculo); 77 eliminarVehiculo(vehiculo);
75 }); 78 });
76 }; 79 };
77 80
78 $scope.hacerHojaRuta = function(vehiculo, cerrar) { 81 $scope.hacerHojaRuta = function(vehiculo, cerrar) {
79 if(!eligioFecha() || vehiculoEnUso(vehiculo)) return; 82 if (!eligioFecha() || vehiculoEnUso(vehiculo)) return;
80 var modalInstance = $uibModal.open( 83 var modalInstance = $uibModal.open(
81 { 84 {
82 ariaLabelledBy: 'Creación hoja ruta', 85 ariaLabelledBy: 'Creación hoja ruta',
83 templateUrl: 'foca-modal-cerrar-vehiculo.html', 86 templateUrl: 'foca-modal-cerrar-vehiculo.html',
84 controller: 'focaModalCerrarVehiculo', 87 controller: 'focaModalCerrarVehiculo',
85 size: 'lg', 88 size: 'lg',
86 resolve: { 89 resolve: {
87 idVehiculo: function() {return vehiculo.id;}, 90 idVehiculo: function() {return vehiculo.id;},
88 fechaReparto: function() {return $scope.fechaReparto;}, 91 fechaReparto: function() {return $scope.fechaReparto;},
89 cerrar: function() {return cerrar;} 92 cerrar: function() {return cerrar;}
90 } 93 }
91 } 94 }
92 ); 95 );
93 modalInstance.result.then(function() { 96 modalInstance.result.then(function() {
94 97
95 }, function() { 98 }, function() {
96 //usar cuando se cancela el modal 99 //usar cuando se cancela el modal
97 }); 100 });
98 }; 101 };
99 102
100 $scope.arrastra = function() { 103 $scope.arrastra = function() {
101 $scope.arrastrando = true; 104 $scope.arrastrando = true;
102 $scope.$digest(); 105 $scope.$digest();
103 }; 106 };
104 107
105 $scope.noArrastra = function() { 108 $scope.noArrastra = function() {
106 $scope.arrastrando = false; 109 $scope.arrastrando = false;
107 $scope.$digest(); 110 $scope.$digest();
108 }; 111 };
109 112
110 $scope.individual = function() { 113 $scope.individual = function() {
111 $scope.idVendedor = -1; 114 $scope.idVendedor = -1;
112 }; 115 };
113 116
114 $scope.mostrarDetalle = function() { 117 $scope.mostrarDetalle = function() {
115 $scope.detalle = true; 118 $scope.detalle = true;
116 }; 119 };
117 120
118 $scope.salir = function() { 121 $scope.salir = function() {
119 $location.path('/'); 122 $location.path('/');
120 }; 123 };
121 124
122 $scope.search = function() { 125 $scope.search = function() {
123 getSeguimiento(); 126 getSeguimiento();
124 }; 127 };
125 128
126 $scope.fecha = function() { 129 $scope.fecha = function() {
127 getSeguimiento(); 130 getSeguimiento();
128 }; 131 };
129 132
130 $scope.seleccionarVehículo = function() { 133 $scope.seleccionarVehículo = function() {
131 var parametrosModal = { 134 var parametrosModal = {
132 titulo: 'Búsqueda de Transportista', 135 titulo: 'Búsqueda de Transportista',
133 query: '/transportista', 136 query: '/transportista',
134 columnas: [ 137 columnas: [
135 { 138 {
136 nombre: 'Código', 139 nombre: 'Código',
137 propiedad: 'COD' 140 propiedad: 'COD'
138 }, 141 },
139 { 142 {
140 nombre: 'Nombre', 143 nombre: 'Nombre',
141 propiedad: 'NOM' 144 propiedad: 'NOM'
142 }, 145 },
143 { 146 {
144 nombre: 'CUIT', 147 nombre: 'CUIT',
145 propiedad: 'CUIT' 148 propiedad: 'CUIT'
146 } 149 }
147 ] 150 ]
148 }; 151 };
149 focaModalService.modal(parametrosModal).then(function(transportista) { 152 focaModalService.modal(parametrosModal).then(function(transportista) {
150 $scope.selectVehiculo(transportista.COD, transportista.NOM); 153 $scope.selectVehiculo(transportista.COD, transportista.NOM);
151 }); 154 });
152 }; 155 };
153 156
154 $scope.selectVehiculo = function(idTransportista, nombreTransportista) { 157 $scope.selectVehiculo = function(idTransportista, nombreTransportista) {
155 var parametrosModal = { 158 var parametrosModal = {
156 columnas: [ 159 columnas: [
157 { 160 {
158 propiedad: 'codigo', 161 propiedad: 'codigo',
159 nombre: 'Código' 162 nombre: 'Código'
160 }, 163 },
161 { 164 {
162 propiedad: 'tractor', 165 propiedad: 'tractor',
163 nombre: 'tractor' 166 nombre: 'tractor'
164 }, 167 },
165 { 168 {
166 propiedad: 'semi', 169 propiedad: 'semi',
167 nombre: 'Semi' 170 nombre: 'Semi'
168 }, 171 },
169 { 172 {
170 propiedad: 'capacidadTotalCisternas', 173 propiedad: 'capacidadTotalCisternas',
171 nombre: 'Capacidad' 174 nombre: 'Capacidad'
172 } 175 }
173 ], 176 ],
174 query: '/vehiculo/transportista/' + idTransportista, 177 query: '/vehiculo/transportista/' + idTransportista,
175 titulo: 'Búsqueda de vehiculos', 178 titulo: 'Búsqueda de vehiculos',
176 subTitulo: idTransportista + '-' + nombreTransportista 179 subTitulo: idTransportista + '-' + nombreTransportista
177 }; 180 };
178 focaModalService.modal(parametrosModal).then( 181 focaModalService.modal(parametrosModal).then(
179 function(vehiculo) { 182 function(vehiculo) {
180 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); 183 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id});
181 if(existe.length) { 184 if (existe.length) {
182 focaModalService.alert('El vehiculo ya ha sido cargado'); 185 focaModalService.alert('El vehiculo ya ha sido cargado');
183 return; 186 return;
184 } 187 }
185 if(!vehiculo.cisternas.length) { 188 if (!vehiculo.cisternas.length) {
186 focaModalService.alert('El vehiculo no tiene cisternas'); 189 focaModalService.alert('El vehiculo no tiene cisternas');
187 return; 190 return;
188 } 191 }
189 $scope.vehiculos.push(vehiculo); 192 $scope.vehiculos.push(vehiculo);
190 }, function() { 193 }, function() {
191 // funcion ejecutada cuando se cancela el modal 194 // funcion ejecutada cuando se cancela el modal
192 }); 195 });
193 }; 196 };
194 197
195 $scope.seleccionarFechaReparto = function() { 198 $scope.seleccionarFechaReparto = function() {
196 focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { 199 focaModalService.modalFecha('Fecha de reparto').then(function(fecha) {
197 $scope.$broadcast('addCabecera',{ 200 setearFecha(fecha);
201 });
202 };
203
204 function setearFecha(fecha) {
205 $scope.fechaReparto = fecha;
206 focaLogisticaPedidoRutaService.setFechaReparto(fecha);
207 focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res){
208 $scope.vehiculos = res.data;
209 $scope.$broadcast('addCabecera', {
198 label: 'Fecha:', 210 label: 'Fecha:',
199 valor: fecha.toLocaleDateString() 211 valor: fecha.toLocaleDateString()
200 }); 212 });
201 $scope.fechaReparto = fecha;
202 focaLogisticaPedidoRutaService.setFechaReparto(fecha);
203 focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) {
204 $scope.vehiculos = res.data;
205 });
206 }); 213 });
207 }; 214 }
208 215
209 function getSeguimiento() { 216 function getSeguimiento() {
210 var desde = new Date('1900/01/01'); 217 var desde = new Date('1900/01/01');
211 var hasta = new Date('2099/01/01'); 218 var hasta = new Date('2099/01/01');
212 if($scope.fechaDesde) { 219 if ($scope.fechaDesde) {
213 var fechaDesde = $scope.fechaDesde; 220 var fechaDesde = $scope.fechaDesde;
214 desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); 221 desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0));
215 desde = new Date(desde); 222 desde = new Date(desde);
216 } 223 }
217 if($scope.fechaHasta) { 224 if ($scope.fechaHasta) {
218 var fechaHasta = $scope.fechaHasta; 225 var fechaHasta = $scope.fechaHasta;
219 hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); 226 hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0));
220 hasta = hasta.setDate(hasta.getDate() + 1); 227 hasta = hasta.setDate(hasta.getDate() + 1);
221 hasta = new Date(hasta); 228 hasta = new Date(hasta);
222 } 229 }
223 var datos = { 230 var datos = {
224 actividad: $scope.actividad, 231 actividad: $scope.actividad,
225 idUsuario: $scope.idVendedor, 232 idUsuario: $scope.idVendedor,
226 fechaDesde: desde, 233 fechaDesde: desde,
227 fechaHasta: hasta, 234 fechaHasta: hasta,
228 asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? 235 asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ?
229 false : undefined) 236 false : undefined)
230 }; 237 };
231 238
232 $scope.datosBuscados = { 239 $scope.datosBuscados = {
233 actividad: $scope.actividad, 240 actividad: $scope.actividad,
234 individual: $scope.idVendedor ? true : false 241 individual: $scope.idVendedor ? true : false
235 }; 242 };
236 243
237 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { 244 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) {
238 if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { 245 if (JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) {
239 $scope.marcadores = datos.data; 246 $scope.marcadores = datos.data;
240 } 247 }
241 }); 248 });
242 } 249 }
243 250
244 function eliminarVehiculo(vehiculo) { 251 function eliminarVehiculo(vehiculo) {
245 focaLogisticaPedidoRutaService.getRemitosByIdVehiculo(vehiculo.id).then(function(res) { 252 focaLogisticaPedidoRutaService.getRemitosByIdVehiculo(vehiculo.id).then(function(res) {
246 if(!res.data.length) { 253 if (!res.data.length) {
247 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); 254 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1);
248 }else { 255 } else {
249 focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + 256 focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' +
250 'tiene remitos asociados').then(function() { 257 'tiene remitos asociados').then(function() {
251 $scope.hacerHojaRuta(vehiculo, true); 258 $scope.hacerHojaRuta(vehiculo, true);
252 }); 259 });
253 } 260 }
254 }); 261 });
255 } 262 }
256 263
257 function eligioFecha() { 264 function eligioFecha() {
258 if(!$scope.fechaReparto) { 265 if (!$scope.fechaReparto) {
259 focaModalService.alert('Primero seleccione fecha de reparto'); 266 focaModalService.alert('Primero seleccione fecha de reparto');
260 return false; 267 return false;
261 } 268 }
262 return true; 269 return true;
263 } 270 }
264 271
265 function vehiculoEnUso(vehiculo) { 272 function vehiculoEnUso(vehiculo) {
266 var idUsuario = focaLogisticaPedidoRutaService.idUsuario; 273 var idUsuario = focaLogisticaPedidoRutaService.idUsuario;
267 for(var i = 0; i < vehiculo.cisternas.length; i++) { 274 for(var i = 0; i < vehiculo.cisternas.length; i++) {
268 for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { 275 for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) {
269 var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; 276 var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j];
270 if(cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto 277 if (cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto
271 .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso && 278 .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso &&
272 cisternaCarga.idUsuarioProceso !== idUsuario) 279 cisternaCarga.idUsuarioProceso !== idUsuario)
273 { 280 {
274 focaModalService.alert('El vehículo está siendo usado por otro usuario'); 281 focaModalService.alert('El vehículo está siendo usado por otro usuario');
275 return true; 282 return true;
276 } 283 }
277 } 284 }
278 } 285 }
279 return false; 286 return false;
280 } 287 }
281 $interval(function() { 288 $interval(function() {
src/js/osm-directive.js
1 angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', function() { 1 angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', 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 contenedor.className = 'border border-light rounded'; 6 contenedor.className = 'border border-light rounded';
7 el.append(contenedor); 7 el.append(contenedor);
8 scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom); 8 scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom);
9 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); 9 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map);
10 }, 10 },
11 controller: ['$scope', '$filter', '$compile', 'focaModalService', 11 controller: ['$scope', '$filter', '$compile', 'focaModalService',
12 function($scope, $filter, $compile, focaModalService) { 12 function($scope, $filter, $compile, focaModalService) {
13 $scope.markers = []; 13 $scope.markers = [];
14 $scope.verProductos = function(id) { 14 $scope.verProductos = function(id) {
15 var parametrosModal = { 15 var parametrosModal = {
16 titulo: 'Productos', 16 titulo: 'Productos',
17 query: '/articulos/remito/' + id, 17 query: '/articulos/remito/' + id,
18 soloMostrar: true, 18 soloMostrar: true,
19 size: 'md', 19 size: 'md',
20 columnas: [ 20 columnas: [
21 { 21 {
22 nombre: 'Producto', 22 nombre: 'Producto',
23 propiedad: 'descripcion' 23 propiedad: 'descripcion'
24 }, 24 },
25 { 25 {
26 nombre: 'Cantidad', 26 nombre: 'Cantidad',
27 propiedad: 'cantidad' 27 propiedad: 'cantidad'
28 } 28 }
29 ] 29 ]
30 }; 30 };
31 focaModalService.modal(parametrosModal).then(); 31 focaModalService.modal(parametrosModal).then();
32 }; 32 };
33 $scope.$watch('marcadores', function() { 33 $scope.$watch('marcadores', function() {
34 for(var i in $scope.markers) { 34 for(var i in $scope.markers) {
35 $scope.map.removeLayer($scope.markers[i]); 35 $scope.map.removeLayer($scope.markers[i]);
36 } 36 }
37 $scope.markers = []; 37 $scope.markers = [];
38 38
39 angular.forEach($scope.marcadores, function(marcador) { 39 angular.forEach($scope.marcadores, function(marcador) {
40 var observacion = 40 var observacion =
41 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' + 41 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' +
42 ( 42 (
43 marcador.notaPedido.vendedor ? 43 marcador.notaPedido.vendedor ?
44 marcador.notaPedido.vendedor.NomVen : 44 marcador.notaPedido.vendedor.NomVen :
45 '' 45 ''
46 ) + '<br/>'; 46 ) + '<br/>';
47 observacion += 'Fecha: ' + 47 observacion += 'Fecha: ' +
48 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 48 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
49 marcador.fecha.slice(11,19) + '<br/>'; 49 marcador.fecha.slice(11,19) + '<br/>';
50 observacion += 'Remito Nº: ' + $filter('comprobante')([ 50 observacion += 'Remito Nº: ' + $filter('comprobante')([
51 marcador.notaPedido.remito.sucursal, 51 marcador.notaPedido.remito.sucursal,
52 marcador.notaPedido.remito.numeroRemito 52 marcador.notaPedido.remito.numeroRemito
53 ]) + '<br/>'; 53 ]) + '<br/>';
54 observacion += 'Cliente: ' + 54 observacion += 'Cliente: ' +
55 marcador.notaPedido.cliente.NOM; 55 marcador.notaPedido.cliente.NOM;
56 56
57 // if($scope.parametros.individual) { 57 // if($scope.parametros.individual) {
58 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion; 58 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion;
59 59
60 if(marcador.distancia) { 60 if (marcador.distancia) {
61 observacion += '<br/>Distancia a casa central: ' + 61 observacion += '<br/>Distancia a casa central: ' +
62 marcador.distancia + 'km'; 62 marcador.distancia + 'km';
63 } 63 }
64 var icon; 64 var icon;
65 if(marcador.notaPedido.remito.idUsuarioProceso) { 65 if (marcador.notaPedido.remito.idUsuarioProceso) {
66 observacion += '<br/>'; 66 observacion += '<br/>';
67 observacion += '<strong>'; 67 observacion += '<strong>';
68 observacion += 'Fecha de entrega: ' + marcador.notaPedido.remito 68 observacion += 'Fecha de entrega: ' + marcador.notaPedido.remito
69 .cisternaMovimientos[0].cisternaCarga.fechaReparto.substring(0, 10); 69 .cisternaMovimientos[0].cisternaCarga.fechaReparto.substring(0, 10);
70 observacion += '<br/>'; 70 observacion += '<br/>';
71 observacion += 'Vehículo: ' + marcador.notaPedido.remito 71 observacion += 'Vehículo: ' + marcador.notaPedido.remito
72 .cisternaMovimientos[0].cisternaCarga.cisterna.vehiculo.codigo; 72 .cisternaMovimientos[0].cisternaCarga.cisterna.vehiculo.codigo;
73 observacion += '<br/>'; 73 observacion += '<br/>';
74 observacion += 'Transportista: ' + marcador.notaPedido.remito 74 observacion += 'Transportista: ' + marcador.notaPedido.remito
75 .cisternaMovimientos[0].cisternaCarga.cisterna.vehiculo.transportista 75 .cisternaMovimientos[0].cisternaCarga.cisterna.vehiculo.transportista
76 .NOM; 76 .NOM;
77 observacion += '</strong>'; 77 observacion += '</strong>';
78 //Asignado ROJO 78 //Asignado ROJO
79 icon = new L.Icon({ 79 icon = new L.Icon({
80 iconUrl: 'img/marker-icon-2x-red.png', 80 iconUrl: 'img/marker-icon-2x-red.png',
81 shadowUrl: 'img/marker-shadow.png', 81 shadowUrl: 'img/marker-shadow.png',
82 iconSize: [25, 41], 82 iconSize: [25, 41],
83 iconAnchor: [12, 41], 83 iconAnchor: [12, 41],
84 popupAnchor: [1, -34], 84 popupAnchor: [1, -34],
85 shadowSize: [41, 41] 85 shadowSize: [41, 41]
86 }); 86 });
87 }else { 87 } else {
88 observacion += '<br/>'; 88 observacion += '<br/>';
89 observacion += '<i class="fa fa-map-marker fa-3x" aria-hidden="true"'+ 89 observacion += '<i class="fa fa-map-marker fa-3x" aria-hidden="true"'+
90 'class="form-control" ondragend="dropEnd()" ondragstart=\'drag(event, '+ 90 'class="form-control" ondragend="dropEnd()" ondragstart=\'drag(event, '+
91 JSON.stringify(marcador)+')\' draggable="true"></i>(Arrastrar icono)'; 91 JSON.stringify(marcador)+')\' draggable="true"></i>(Arrastrar icono)';
92 observacion += '<button title="Ver productos" class="btn btn-secondary' + 92 observacion += '<button title="Ver productos" class="btn btn-secondary' +
93 ' float-right mt-2"'+ 93 ' float-right mt-2"'+
94 'ng-click="verProductos('+marcador.notaPedido.remito.id+')">' + 94 'ng-click="verProductos('+marcador.notaPedido.remito.id+')">' +
95 '<i class="fa fa-info" aria-hidden="true"></i>' + 95 '<i class="fa fa-info" aria-hidden="true"></i>' +
96 '</button>'; 96 '</button>';
97 97
98 //Sin asignar VERDE 98 //Sin asignar VERDE
99 icon = new L.Icon({ 99 icon = new L.Icon({
100 iconUrl: 'img/marker-icon-2x-green.png', 100 iconUrl: 'img/marker-icon-2x-green.png',
101 shadowUrl: 'img/marker-shadow.png', 101 shadowUrl: 'img/marker-shadow.png',
102 iconSize: [25, 41], 102 iconSize: [25, 41],
103 iconAnchor: [12, 41], 103 iconAnchor: [12, 41],
104 popupAnchor: [1, -34], 104 popupAnchor: [1, -34],
105 shadowSize: [41, 41] 105 shadowSize: [41, 41]
106 }); 106 });
107 } 107 }
108 108
109 //COMPILO HTML PARA QUE FUNCIONE BOTON EN POPUP 109 //COMPILO HTML PARA QUE FUNCIONE BOTON EN POPUP
110 observacion = '<div>' + observacion + '</div>'; 110 observacion = '<div>' + observacion + '</div>';
111 var compiledHtml = $compile(angular.element(observacion))($scope); 111 var compiledHtml = $compile(angular.element(observacion))($scope);
112 112
113 $scope.markers.push( 113 $scope.markers.push(
114 L.marker( 114 L.marker(
115 [marcador.latitud, marcador.longitud], {icon: icon}) 115 [marcador.latitud, marcador.longitud], {icon: icon})
116 .addTo($scope.map) 116 .addTo($scope.map)
117 .bindPopup(compiledHtml[0]) 117 .bindPopup(compiledHtml[0])
118 .bindTooltip('Haga click para seleccionar') 118 .bindTooltip('Haga click para seleccionar')
119 ); 119 );
120 //abre marcador del primer punto 120 //abre marcador del primer punto
121 //$scope.markers[0].openPopup(); 121 //$scope.markers[0].openPopup();
122 }); 122 });
123 }); 123 });
124 }], 124 }],
125 scope: { 125 scope: {
126 latitud: '=', 126 latitud: '=',
127 longitud: '=', 127 longitud: '=',
128 zoom: '=', 128 zoom: '=',
129 marcadores: '=', 129 marcadores: '=',
130 parametros: '=' 130 parametros: '='
131 } 131 }
132 }; 132 };
133 }); 133 });
134 134