Commit a40b57fb7eeaf435531219212674ca55134ba8a3

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

ver listado de marcadores

src/js/controller.js
1 angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoController', [ 1 angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoController', [
2 '$scope', '$timeout', 'focaAdminSeguimientoService', 2 '$scope', '$timeout', 'focaAdminSeguimientoService', '$uibModal',
3 'focaBotoneraLateralService','$location', '$routeParams', 3 'focaBotoneraLateralService','$location', '$routeParams',
4 function($scope, $timeout, focaAdminSeguimientoService, 4 function($scope, $timeout, focaAdminSeguimientoService, $uibModal,
5 focaBotoneraLateralService, $location, $routeParams) { 5 focaBotoneraLateralService, $location, $routeParams) {
6 $scope.actividad = ''; 6 $scope.actividad = '';
7 $scope.titulo = ''; 7 $scope.titulo = '';
8 var cabecera = ''; 8 var cabecera = '';
9 var plural = ''; 9 var plural = '';
10 10
11 $scope.now = new Date(); 11 $scope.now = new Date();
12 $scope.dateOptions = { 12 $scope.dateOptions = {
13 maxDate: new Date() 13 maxDate: new Date()
14 }; 14 };
15 15
16 switch ($routeParams.parametro) { 16 switch ($routeParams.parametro) {
17 case 'nota-pedido': 17 case 'nota-pedido':
18 $scope.actividad = 'Nota de pedido'; 18 $scope.actividad = 'Nota de pedido';
19 $scope.titulo = 'Seguimiento de nota de pedido'; 19 $scope.titulo = 'Seguimiento de nota de pedido';
20 cabecera = 'Vendedor:'; 20 cabecera = 'Vendedor:';
21 plural = 'Vendedores'; 21 plural = 'Vendedores';
22 break; 22 break;
23 case 'hoja-ruta': 23 case 'hoja-ruta':
24 $scope.actividad = 'Entrega de producto'; 24 $scope.actividad = 'Entrega de producto';
25 $scope.titulo = 'Seguimiento de hoja de ruta'; 25 $scope.titulo = 'Seguimiento de hoja de ruta';
26 cabecera = 'Vehiculo:'; 26 cabecera = 'Vehiculo:';
27 plural = 'Vehiculos'; 27 plural = 'Vehiculos';
28 break; 28 break;
29 case 'cobranza': 29 case 'cobranza':
30 $scope.actividad = 'Cobranza'; 30 $scope.actividad = 'Cobranza';
31 $scope.titulo = 'Seguimiento de cobranza'; 31 $scope.titulo = 'Seguimiento de cobranza';
32 cabecera = 'Cobrador:'; 32 cabecera = 'Cobrador:';
33 plural = 'Cobradores'; 33 plural = 'Cobradores';
34 break; 34 break;
35 } 35 }
36 36
37 $scope.idUsuario = 0; 37 $scope.idUsuario = 0;
38 $scope.marcadores = []; 38 $scope.marcadores = [];
39 getSeguimiento(); 39 getSeguimiento();
40 40
41 //SETEO BOTONERA LATERAL 41 //SETEO BOTONERA LATERAL
42 focaBotoneraLateralService.showSalir(true); 42 focaBotoneraLateralService.showSalir(true);
43 focaBotoneraLateralService.showPausar(false); 43 focaBotoneraLateralService.showPausar(false);
44 focaBotoneraLateralService.showGuardar(false); 44 focaBotoneraLateralService.showGuardar(false);
45 45
46 $scope.general = function() { 46 $scope.general = function() {
47 $scope.idUsuario = 0; 47 $scope.idUsuario = 0;
48 getSeguimiento(); 48 getSeguimiento();
49 }; 49 };
50 50
51 $scope.individual = function() { 51 $scope.individual = function() {
52 $scope.idUsuario = -1; 52 $scope.idUsuario = -1;
53 }; 53 };
54 54
55 $scope.salir = function() { 55 $scope.salir = function() {
56 $location.path('/'); 56 $location.path('/');
57 }; 57 };
58 58
59 $scope.search = function(key) { 59 $scope.search = function(key) {
60 if (key === 13) { 60 if (key === 13) {
61 $scope.idUsuario = $scope.idUsuarioInput; 61 $scope.idUsuario = $scope.idUsuarioInput;
62 62
63 getSeguimiento(); 63 getSeguimiento();
64 if ($scope.actividad === 'Entrega de producto' && $scope.idUsuario !== 0) { 64 if ($scope.actividad === 'Entrega de producto' && $scope.idUsuario !== 0) {
65 focaAdminSeguimientoService.obtenerRemitosVehiculo($scope.idUsuario) 65 focaAdminSeguimientoService.obtenerRemitosVehiculo($scope.idUsuario)
66 .then(function(res) { 66 .then(function(res) {
67 var remitos = []; 67 var remitos = [];
68 for (var i = 0; i < res.data.length; i++) { 68 for (var i = 0; i < res.data.length; i++) {
69 remitos = remitos.concat(res.data[i].remitos); 69 remitos = remitos.concat(res.data[i].remitos);
70 } 70 }
71 $scope.remitosVehiculo = remitos; 71 $scope.remitosVehiculo = remitos;
72 }); 72 });
73 } 73 }
74 } 74 }
75 }; 75 };
76 76
77 $scope.fecha = function() { 77 $scope.fecha = function() {
78 getSeguimiento(); 78 getSeguimiento();
79 }; 79 };
80 80
81 $scope.showMarcadores = function() {
82 var texto = '';
83
84 if ($scope.actividad === 'Nota de pedido') {
85 texto = 'Marcadores de notas de pedido';
86 }
87
88 if ($scope.actividad === 'Entrega de producto') {
89 texto = 'Marcadores de entregas';
90 }
91
92 if ($scope.actividad === 'Cobranza') {
93 texto = 'Marcadores de cobranzas';
94 }
95
96
97 var modalInstance = $uibModal.open(
98 {
99 ariaLabelledBy: texto,
100 templateUrl: 'foca-modal-marcadores.html',
101 controller: 'focaModalMarcadoresController',
102 size: 'lg',
103 resolve: {
104 parametros: function() {
105 var parametros = {
106 marcadores: $scope.marcadores,
107 actividad: $scope.actividad
108 };
109
110 return parametros;
111 }
112 }
113 }
114 );
115
116 modalInstance.result.then(
117 function(localizacion) {
118 $scope.$broadcast('moveMap', {
119 latitud: localizacion.latitud,
120 longitud: localizacion.longitud,
121 indice: localizacion.indice
122 });
123 }, function() {
124 // funcion ejecutada cuando se cancela el modal
125 }
126 );
127 };
128
81 function getSeguimiento() { 129 function getSeguimiento() {
82 var now = $scope.now; 130 var now = $scope.now;
83 var hasta = angular.copy(now); 131 var hasta = angular.copy(now);
84 hasta.setDate(hasta.getDate() + 1); 132 hasta.setDate(hasta.getDate() + 1);
85 133
86 var datos = { 134 var datos = {
87 actividad: $scope.actividad, 135 actividad: $scope.actividad,
88 idUsuario: $scope.idUsuario, 136 idUsuario: $scope.idUsuario,
89 fechaDesde: now, 137 fechaDesde: now,
90 fechaHasta: hasta, 138 fechaHasta: hasta,
91 entregado: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? 139 entregado: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ?
92 false : undefined) 140 false : undefined)
93 }; 141 };
94 142
95 $scope.datosBuscados = { 143 $scope.datosBuscados = {
96 actividad: $scope.actividad, 144 actividad: $scope.actividad,
97 individual: $scope.idUsuario !== 0 ? true : false 145 individual: $scope.idUsuario !== 0 ? true : false
98 }; 146 };
99 147
100 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) { 148 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) {
101 $scope.marcadores = datos.data; 149 $scope.marcadores = datos.data;
102 $scope.$broadcast('cleanCabecera'); 150 $scope.$broadcast('cleanCabecera');
103 151
104 if ($scope.idUsuario !== 0) { 152 if ($scope.idUsuario !== 0) {
105 $scope.$broadcast('addCabecera', { 153 $scope.$broadcast('addCabecera', {
106 label: 'Individual', 154 label: 'Individual',
107 valor: '' 155 valor: ''
108 }); 156 });
109 157
110 var valor = ''; 158 var valor = '';
111 switch ($routeParams.parametro) { 159 switch ($routeParams.parametro) {
112 case 'nota-pedido': 160 case 'nota-pedido':
113 if (datos.data.length) { 161 if (datos.data.length) {
114 valor = datos.data[0].notaPedido.vendedor.NUM + ' - ' + 162 valor = datos.data[0].notaPedido.vendedor.NUM + ' - ' +
115 datos.data[0].notaPedido.vendedor.NOM.trim(); 163 datos.data[0].notaPedido.vendedor.NOM.trim();
116 } else { 164 } else {
117 valor = $scope.idUsuario; 165 valor = $scope.idUsuario;
118 } 166 }
119 break; 167 break;
120 case 'hoja-ruta': 168 case 'hoja-ruta':
121 if (datos.data.length) { 169 if (datos.data.length) {
122 valor = $scope.idUsuario + ' - ' + datos.data[0] 170 valor = $scope.idUsuario + ' - ' + datos.data[0]
123 .hojaRutaMovimiento.remito.hojaRuta.vehiculo.tractor.trim(); 171 .hojaRutaMovimiento.remito.hojaRuta.vehiculo.tractor.trim();
124 } else { 172 } else {
125 valor = $scope.idUsuario; 173 valor = $scope.idUsuario;
126 } 174 }
127 175
128 break; 176 break;
129 case 'cobranza': 177 case 'cobranza':
130 if (datos.data.length) { 178 if (datos.data.length) {
131 valor = datos.data[0].notaPedido.vendedor.NUM + ' - ' + 179 valor = datos.data[0].recibo.cobrador.NUM + ' - ' +
132 datos.data[0].notaPedido.vendedor.NOM.trim(); 180 datos.data[0].recibo.cobrador.NOM.trim();
133 } else { 181 } else {
134 valor = $scope.idUsuario; 182 valor = $scope.idUsuario;
135 } 183 }
136 break; 184 break;
137 } 185 }
138 186
139 $scope.$broadcast('addCabecera', { 187 $scope.$broadcast('addCabecera', {
140 label: cabecera, 188 label: cabecera,
141 valor: valor 189 valor: valor
142 }); 190 });
143 191
144 } else { 192 } else {
145 $scope.$broadcast('addCabecera',{ 193 $scope.$broadcast('addCabecera',{
146 label: 'General', 194 label: 'General',
147 valor: '' 195 valor: ''
148 }); 196 });
149 } 197 }
150 198
151 $scope.$broadcast('addCabecera', { 199 $scope.$broadcast('addCabecera', {
152 label: 'Cantidad: ', 200 label: 'Cantidad: ',
153 valor: datos.data.length + ' Marcadores' 201 valor: datos.data.length + ' Marcadores'
154 }); 202 });
155 }); 203 });
156 } 204 }
157 } 205 }
158 ]); 206 ]);
159 207
src/js/modalController.js
File was created 1 angular.module('focaAdminSeguimiento').controller('focaModalMarcadoresController', [
2 '$uibModalInstance', '$scope', '$filter', 'parametros',
3 function($uibModalInstance, $scope, $filter, parametros) {
4 init();
5
6 $scope.selectPage = selectPage;
7
8 $scope.select = function(marcador, indice) {
9 $uibModalInstance.close({
10 latitud: marcador.latitud,
11 longitud: marcador.longitud,
12 indice: indice
13 });
14 };
15
16 $scope.cancel = function() {
17 $uibModalInstance.dismiss('cancel');
18 };
19
20 function init() {
21 $scope.numPerPage = 10;
22 $scope.currentPage = 1;
23 $scope.currentPageMarcadores = [];
24 $scope.actividad = parametros.actividad;
25 $scope.marcadores = arrayDatos(angular.copy(parametros.marcadores));
26
27 $scope.lastPage = Math.ceil(
28 $scope.marcadores.length / $scope.numPerPage
29 );
30
31 selectPage(1);
32 }
33
34 function selectPage(page) {
35 var start = (page - 1) * $scope.numPerPage;
36 var end = start + $scope.numPerPage;
37 $scope.paginas = [];
38 $scope.paginas = calcularPages(page);
39 $scope.currentPageMarcadores = $scope.marcadores.slice(start, end);
40 $scope.currentPage = page;
41 }
42
43 function calcularPages(paginaActual) {
44 var paginas = [];
45 paginas.push(paginaActual);
46
47 if (paginaActual - 1 > 1) {
48
49 paginas.unshift(paginaActual - 1);
50 if (paginaActual - 2 > 1) {
51 paginas.unshift(paginaActual - 2);
52 }
53 }
54
55 if (paginaActual + 1 < $scope.lastPage) {
56 paginas.push(paginaActual + 1);
57 if (paginaActual + 2 < $scope.lastPage) {
58 paginas.push(paginaActual + 2);
59 }
60 }
61
62 if (paginaActual !== 1) {
63 paginas.unshift(1);
64 }
65
66 if (paginaActual !== $scope.lastPage) {
67 paginas.push($scope.lastPage);
68 }
69
70 return paginas;
71 }
72
73 function arrayDatos(marcadores) {
74 marcadores.reverse();
75
76 for (var i = marcadores.length - 1; i >= 0; i--) {
77 var marcador = marcadores[i];
78
79 if ($scope.actividad === 'Nota de pedido') {
80 marcador.numero = $filter('comprobante')([
81 marcador.notaPedido.sucursal,
82 marcador.notaPedido.numeroNotaPedido
83 ]);
84
85 marcador.cliente = $filter('rellenarDigitos')(
86 marcador.notaPedido.cliente.COD, 3) + ' - ' +
87 marcador.notaPedido.cliente.NOM;
88 }
89
90 if ($scope.actividad === 'Entrega de producto') {
91
92 }
93
94 if ($scope.actividad === 'Cobranza') {
95 marcador.numero = $filter('comprobante')([
96 marcador.recibo.PVE,
97 marcador.recibo.NCO
98 ]);
99
100 marcador.cliente = $filter('rellenarDigitos')(
101 marcador.recibo.CLI, 3) + ' - ' +
102 marcador.recibo.CFE;
103 }
104 }
105
106 return marcadores;
107 }
108
109 }
110 ]);
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 80
81 if (notaPedido.vendedor) { 81 if (notaPedido.vendedor) {
82 observacion.push([ 82 observacion.push([
83 'Vendedor', 83 'Vendedor',
84 notaPedido.vendedor.NUM + ' - ' + notaPedido.vendedor.NOM 84 notaPedido.vendedor.NUM + ' - ' + notaPedido.vendedor.NOM
85 ]); 85 ]);
86 } 86 }
87 87
88 88
89 if (!$scope.parametros.individual) { 89 if (!$scope.parametros.individual) {
90 observacion.push(['Ultima Nota de Pedido', '']); 90 observacion.push(['Ultima Nota de Pedido', '']);
91 } 91 }
92 92
93 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') +
94 ' ' + marcador.fecha.slice(11,19); 94 ' ' + marcador.fecha.slice(11,19);
95 observacion.push(['Fecha', textFecha]); 95 observacion.push(['Fecha', textFecha]);
96 96
97 observacion.push(['Nº', 97 observacion.push(['Nº',
98 $filter('comprobante')([notaPedido.sucursal, notaPedido.numeroNotaPedido ]) 98 $filter('comprobante')([notaPedido.sucursal, notaPedido.numeroNotaPedido ])
99 ]); 99 ]);
100 100
101 if (notaPedido.cliente) { 101 if (notaPedido.cliente) {
102 observacion.push(['Cliente', notaPedido.cliente.NOM]); 102 observacion.push(['Cliente', notaPedido.cliente.NOM]);
103 } 103 }
104 104
105 if ($scope.parametros.individual) { 105 if ($scope.parametros.individual) {
106 observacion.push(['Total', $filter('currency')(notaPedido.total, '$')]); 106 observacion.push(['Total', $filter('currency')(notaPedido.total, '$')]);
107 observacion.unshift(['Orden', marcador.orden]); 107 observacion.unshift(['Orden', marcador.orden]);
108 108
109 if (marcador.distancia) { 109 if (marcador.distancia) {
110 observacion.push(['Distancia a casa central', 110 observacion.push(['Distancia a casa central',
111 marcador.distancia + 'km' 111 marcador.distancia + 'km'
112 ]); 112 ]);
113 } 113 }
114 } else { 114 } else {
115 observacion.push(['Cantidad de nota de pedido', 115 observacion.push(['Cantidad de nota de pedido',
116 marcador.cantidad 116 marcador.cantidad
117 ]); 117 ]);
118 118
119 observacion.push(['Total Vendido', 119 observacion.push(['Total Vendido',
120 $filter('currency')(marcador.total, '$') 120 $filter('currency')(marcador.total, '$')
121 ]); 121 ]);
122 } 122 }
123 123
124 console.info(marcador, observacion);
125 return observacion; 124 return observacion;
126 } 125 }
127 126
128 function getCobranza(marcador) { 127 function getCobranza(marcador) {
129 observacion = ''; 128 observacion = '';
130 observacion += 'Cobrador: ' + marcador.recibo.cobrador.NUM + ' - ' + 129 observacion += 'Cobrador: ' + marcador.recibo.cobrador.NUM + ' - ' +
131 marcador.recibo.CFE + '<br/>'; 130 marcador.recibo.CFE + '<br/>';
132 131
133 if (!$scope.parametros.individual) { 132 if (!$scope.parametros.individual) {
134 observacion += '<b>Ultima Cobranza</b><br/>'; 133 observacion += '<b>Ultima Cobranza</b><br/>';
135 } 134 }
136 135
137 observacion += 'Fecha: ' + 136 observacion += 'Fecha: ' +
138 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 137 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
139 marcador.fecha.slice(11,19) + '<br/>'; 138 marcador.fecha.slice(11,19) + '<br/>';
140 observacion += 'Nº: ' + $filter('comprobante')([ 139 observacion += 'Nº: ' + $filter('comprobante')([
141 marcador.recibo.PVE, marcador.recibo.NCO]) + '<br/>'; 140 marcador.recibo.PVE, marcador.recibo.NCO]) + '<br/>';
142 observacion += 'Cliente: ' + marcador.recibo.cliente.NOM + '<br/>'; 141 observacion += 'Cliente: ' + marcador.recibo.cliente.NOM + '<br/>';
143 var totalCobrado = 0; 142 var totalCobrado = 0;
144 for (var i = 0; i < marcador.recibo.cuerpos.length; i++) { 143 for (var i = 0; i < marcador.recibo.cuerpos.length; i++) {
145 if (marcador.recibo.cuerpos[i].LOP === 'P') { 144 if (marcador.recibo.cuerpos[i].LOP === 'P') {
146 totalCobrado += marcador.recibo.cuerpos[i].IMP; 145 totalCobrado += marcador.recibo.cuerpos[i].IMP;
147 } 146 }
148 } 147 }
149 148
150 if ($scope.parametros.individual) { 149 if ($scope.parametros.individual) {
151 if (marcador.distancia) { 150 if (marcador.distancia) {
152 observacion += 'Distancia a casa central: ' + 151 observacion += 'Distancia a casa central: ' +
153 marcador.distancia + 'km' + '<br/>'; 152 marcador.distancia + 'km' + '<br/>';
154 observacion += 'Total Cobrado: ' + 153 observacion += 'Total Cobrado: ' +
155 $filter('currency')(totalCobrado, '$'); 154 $filter('currency')(totalCobrado, '$');
156 } 155 }
157 } else { 156 } else {
158 observacion += 'Cantidad de cobranzas: ' + 157 observacion += 'Cantidad de cobranzas: ' +
159 marcador.cantidad + '<br/>'; 158 marcador.cantidad + '<br/>';
160 observacion += 'Total Cobrado: ' + 159 observacion += 'Total Cobrado: ' +
161 $filter('currency')(totalCobrado, '$'); 160 $filter('currency')(totalCobrado, '$');
162 } 161 }
163 return observacion; 162 return observacion;
164 } 163 }
165 164
166 function getEntrega(marcador) { 165 function getEntrega(marcador) {
167 var observacion = ''; 166 var observacion = '';
168 var remito = marcador.hojaRutaMovimiento.remito; 167 var remito = marcador.hojaRutaMovimiento.remito;
169 observacion += 'Vehiculo: ' + 168 observacion += 'Vehiculo: ' +
170 remito.hojaRuta.idVehiculo + ' - ' + 169 remito.hojaRuta.idVehiculo + ' - ' +
171 remito.hojaRuta.vehiculo.tractor + '<br/>'; 170 remito.hojaRuta.vehiculo.tractor + '<br/>';
172 observacion += 'Transportista: ' + 171 observacion += 'Transportista: ' +
173 remito.hojaRuta.transportista.NOM + '<br/>'; 172 remito.hojaRuta.transportista.NOM + '<br/>';
174 observacion += 'Chofer: ' + 173 observacion += 'Chofer: ' +
175 remito.hojaRuta.chofer.nombre + '<br/>'; 174 remito.hojaRuta.chofer.nombre + '<br/>';
176 observacion += 'Hoja de ruta: ' + $filter('comprobante')([ 175 observacion += 'Hoja de ruta: ' + $filter('comprobante')([
177 remito.hojaRuta.sucursal, 176 remito.hojaRuta.sucursal,
178 remito.hojaRuta.numeroHojaRuta 177 remito.hojaRuta.numeroHojaRuta
179 ]) + '<br/>'; 178 ]) + '<br/>';
180 179
181 if (!$scope.parametros.individual) { 180 if (!$scope.parametros.individual) {
182 observacion += '<b>Ultimo Remito</b><br/>'; 181 observacion += '<b>Ultimo Remito</b><br/>';
183 } 182 }
184 183
185 observacion += 'Fecha: ' + 184 observacion += 'Fecha: ' +
186 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 185 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
187 marcador.fecha.slice(11,19) + '<br/>'; 186 marcador.fecha.slice(11,19) + '<br/>';
188 187
189 observacion += 'Nº: ' + $filter('comprobante')([ 188 observacion += 'Nº: ' + $filter('comprobante')([
190 remito.sucursal, 189 remito.sucursal,
191 remito.numeroRemito 190 remito.numeroRemito
192 ]) + '<br/>'; 191 ]) + '<br/>';
193 observacion += 'Cliente: ' + 192 observacion += 'Cliente: ' +
194 remito.cliente.NOM + '<br/>'; 193 remito.cliente.NOM + '<br/>';
195 194
196 if ($scope.parametros.individual) { 195 if ($scope.parametros.individual) {
197 // observacion += 'Producto: ' + 196 // observacion += 'Producto: ' +
198 // remito.articulosRemito[0].descripcion + '<br/>'; 197 // remito.articulosRemito[0].descripcion + '<br/>';
199 // observacion += 'Cantidad entregada: ' + 198 // observacion += 'Cantidad entregada: ' +
200 // remito.carga + '<br/>'; 199 // remito.carga + '<br/>';
201 200
202 if (marcador.distancia) { 201 if (marcador.distancia) {
203 observacion += 'Distancia a casa central: ' + marcador.distancia + 202 observacion += 'Distancia a casa central: ' + marcador.distancia +
204 'km <br/>'; 203 'km <br/>';
205 } 204 }
206 205
207 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion; 206 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion;
208 } else { 207 } else {
209 observacion += 'Cantidad de entregas: ' + marcador.cantidad; 208 observacion += 'Cantidad de entregas: ' + marcador.cantidad;
210 } 209 }
211 observacion += '<br/>'; 210 observacion += '<br/>';
212 if (remito.rechazado) { 211 if (remito.rechazado) {
213 observacion += '<strong>Motivo del rechazo: ' + remito.motivoRechazo; 212 observacion += '<strong>Motivo del rechazo: ' + remito.motivoRechazo;
214 } 213 }
215 214
216 return observacion; 215 return observacion;
217 } 216 }
218 217
219 function generarObservacion(array) { 218 function generarObservacion(array) {
220 var resultado = ''; 219 var resultado = '';
221 220
222 for (var i = 0; i < array.length; i++) { 221 for (var i = 0; i < array.length; i++) {
223 resultado += '<b>' + array[i][0] + ': </b>'; 222 resultado += '<b>' + array[i][0] + ': </b>';
224 resultado += array[i][1]; 223 resultado += array[i][1];
225 224
226 if (i < (array.length - 1)) { 225 if (i < (array.length - 1)) {
227 resultado += '<br/>'; 226 resultado += '<br/>';
228 } 227 }
229 } 228 }
230 229
231 return resultado; 230 return resultado;
232 } 231 }
233 }); 232 });
233
234
235 $scope.$on('moveMap', function(evt, data) {
236 var center = new L.LatLng(data.latitud, data.longitud);
237 $scope.map.flyTo(center, 11, {duration: 0.5});
238 $scope.markers[data.indice].openPopup();
239 });
234 }], 240 }],
235 scope: { 241 scope: {
236 latitud: '=', 242 latitud: '=',
237 longitud: '=', 243 longitud: '=',
238 zoom: '=', 244 zoom: '=',
239 marcadores: '=', 245 marcadores: '=',
240 parametros: '=' 246 parametros: '='
241 } 247 }
242 }; 248 };
243 }); 249 });
src/views/foca-admin-seguimiento.html
1 <div class="foca-admin-seguimiento"> 1 <div class="foca-admin-seguimiento">
2 <div class="row"> 2 <div class="row">
3 <foca-cabecera-facturador 3 <foca-cabecera-facturador
4 titulo="titulo" 4 titulo="titulo"
5 fecha="now" 5 fecha="now"
6 class="mb-0 col-lg-12" 6 class="mb-0 col-lg-12"
7 ></foca-cabecera-facturador> 7 ></foca-cabecera-facturador>
8 </div> 8 </div>
9 <div class="row"> 9 <div class="row">
10 <div class="col-10"> 10 <div class="col-10">
11 <osm 11 <osm
12 latitud="-34.7152975" 12 latitud="-34.7152975"
13 longitud="-65.9053867" 13 longitud="-65.9053867"
14 zoom="6" 14 zoom="6"
15 marcadores="marcadores" 15 marcadores="marcadores"
16 parametros= "datosBuscados" 16 parametros= "datosBuscados"
17 /> 17 />
18 </div> 18 </div>
19 <div class="col-2 pl-0"> 19 <div class="col-2 pl-0">
20 <input 20 <input
21 type="text" 21 type="text"
22 ng-model="now" 22 ng-model="now"
23 class="btn col-12 my-1" 23 class="btn col-12 my-1"
24 ng-blur="fecha()" 24 ng-blur="fecha()"
25 uib-datepicker-popup="dd/MM/yyyy" 25 uib-datepicker-popup="dd/MM/yyyy"
26 show-button-bar="false" 26 show-button-bar="false"
27 is-open="datepickerOpen" 27 is-open="datepickerOpen"
28 on-open-focus="false" 28 on-open-focus="false"
29 ng-focus="datepickerOpen = true" 29 ng-focus="datepickerOpen = true"
30 datepicker-options="dateOptions" 30 datepicker-options="dateOptions"
31 /> 31 />
32 <button 32 <button
33 type="button" 33 type="button"
34 ng-class="{'active': idUsuario == 0}" 34 ng-class="{'active': idUsuario == 0}"
35 class="btn col-12 my-1" 35 class="btn col-12 my-1"
36 ng-click="general()" 36 ng-click="general()"
37 >General</button> 37 >General</button>
38 <button 38 <button
39 type="button" 39 type="button"
40 ng-class="{'active': idUsuario != 0}" 40 ng-class="{'active': idUsuario != 0}"
41 class="btn col-12 my-1" 41 class="btn col-12 my-1"
42 ng-click="individual()" 42 ng-click="individual()"
43 >Individual</button> 43 >Individual</button>
44 <div class="form-group" ng-show="idUsuario != 0"> 44 <div class="form-group my-1" ng-show="idUsuario != 0">
45 <input 45 <input
46 type="text" 46 type="text"
47 placeholder="Vendedor" 47 placeholder="Vendedor"
48 class="form-control" 48 class="form-control"
49 ng-model="idUsuarioInput" 49 ng-model="idUsuarioInput"
50 ng-keypress="search($event.keyCode)" 50 ng-keypress="search($event.keyCode)"
51 foca-focus="idUsuario == -1" 51 foca-focus="idUsuario == -1"
52 ng-show="actividad == 'Nota de pedido'" 52 ng-show="actividad == 'Nota de pedido'"
53 > 53 >
54 <input 54 <input
55 type="text" 55 type="text"
56 placeholder="Vehiculo" 56 placeholder="Vehiculo"
57 class="form-control" 57 class="form-control"
58 ng-model="idUsuarioInput" 58 ng-model="idUsuarioInput"
59 ng-keypress="search($event.keyCode)" 59 ng-keypress="search($event.keyCode)"
60 foca-focus="idUsuario == -1" 60 foca-focus="idUsuario == -1"
61 ng-show="actividad == 'Entrega de producto'" 61 ng-show="actividad == 'Entrega de producto'"
62 > 62 >
63 <input 63 <input
64 type="text" 64 type="text"
65 placeholder="Cobrador" 65 placeholder="Cobrador"
66 class="form-control" 66 class="form-control"
67 ng-model="idUsuarioInput" 67 ng-model="idUsuarioInput"
68 ng-keypress="search($event.keyCode)" 68 ng-keypress="search($event.keyCode)"
69 foca-focus="idUsuario == -1" 69 foca-focus="idUsuario == -1"
70 ng-show="actividad == 'Cobranza'" 70 ng-show="actividad == 'Cobranza'"
71 > 71 >
72 </div> 72 </div>
73 <button
74 type="button"
75 class="btn col-12 my-1"
76 ng-show="marcadores.length > 0 && idUsuario > 0"
77 ng-click="showMarcadores()"
78 >Listar marcadores</button>
73 <div ng-show="actividad === 'Entrega de producto' && idUsuario != 0"> 79 <div ng-show="actividad === 'Entrega de producto' && idUsuario != 0">
74 <div class="custom-control custom-radio"> 80 <div class="custom-control custom-radio">
75 <input 81 <input
76 type="radio" 82 type="radio"
77 class="custom-control-input" 83 class="custom-control-input"
78 id="idTodos" 84 id="idTodos"
79 name="filtro" 85 name="filtro"
80 ng-model="filtroEstado" 86 ng-model="filtroEstado"
81 ng-change="search(13)" 87 ng-change="search(13)"
82 checked> 88 checked>
83 <label class="custom-control-label pb-3" for="idTodos"></label> 89 <label class="custom-control-label pb-3" for="idTodos"></label>
84 <img src="img/marker-icon-grey.png"> 90 <img src="img/marker-icon-grey.png">
85 <strong>Todos</strong> 91 <strong>Todos</strong>
86 </div> 92 </div>
87 <div class="custom-control custom-radio"> 93 <div class="custom-control custom-radio">
88 <input 94 <input
89 type="radio" 95 type="radio"
90 class="custom-control-input" 96 class="custom-control-input"
91 id="entregado" 97 id="entregado"
92 name="filtro" 98 name="filtro"
93 ng-model="filtroEstado" 99 ng-model="filtroEstado"
94 ng-change="search(13)" 100 ng-change="search(13)"
95 ng-value="true"> 101 ng-value="true">
96 <label class="custom-control-label pb-3" for="entregado"></label> 102 <label class="custom-control-label pb-3" for="entregado"></label>
97 <img src="img/marker-icon-green.png"> 103 <img src="img/marker-icon-green.png">
98 <strong>Entregado</strong> 104 <strong>Entregado</strong>
99 </div> 105 </div>
100 <div class="custom-control custom-radio"> 106 <div class="custom-control custom-radio">
101 <input 107 <input
102 type="radio" 108 type="radio"
103 class="custom-control-input" 109 class="custom-control-input"
104 id="noEntregado" 110 id="noEntregado"
105 name="filtro" 111 name="filtro"
106 ng-model="filtroEstado" 112 ng-model="filtroEstado"
107 ng-change="search(13)" 113 ng-change="search(13)"
108 ng-value="false"> 114 ng-value="false">
109 <label class="custom-control-label pb-3" for="noEntregado"></label> 115 <label class="custom-control-label pb-3" for="noEntregado"></label>
110 <img src="img/marker-icon-yellow.png"> 116 <img src="img/marker-icon-yellow.png">
111 <strong>No entregado</strong> 117 <strong>No entregado</strong>
112 </div> 118 </div>
113 </div> 119 </div>
114 </div> 120 </div>
115 </div> 121 </div>
116 <div ng-show="actividad === 'Entrega de producto' && idUsuario != 0"> 122 <div ng-show="actividad === 'Entrega de producto' && idUsuario != 0">
117 <strong>Remitos pendientes de entrega</strong> 123 <strong>Remitos pendientes de entrega</strong>
118 <table class="table"> 124 <table class="table">
119 <thead> 125 <thead>
120 <tr> 126 <tr>
121 <th>Remito Nº</th> 127 <th>Remito Nº</th>
122 <th>Cliente</th> 128 <th>Cliente</th>
123 <th>Dirección</th> 129 <th>Dirección</th>
124 </tr> 130 </tr>
125 </thead> 131 </thead>
126 <tbody> 132 <tbody>
127 <tr ng-repeat="remito in remitosVehiculo"> 133 <tr ng-repeat="remito in remitosVehiculo">
128 <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td> 134 <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td>
129 <td ng-bind="remito.nombreCliente"></td> 135 <td ng-bind="remito.nombreCliente"></td>
130 <td ng-bind="remito.domicilioStamp"></td> 136 <td ng-bind="remito.domicilioStamp"></td>
131 </tr> 137 </tr>
132 </tbody> 138 </tbody>
133 </table> 139 </table>
134 </div> 140 </div>
135 </div> 141 </div>
136 142
src/views/foca-modal-marcadores.html
File was created 1 <div class="modal-header py-1">
2 <div class="row w-100">
3 <div class="col-lg-4 col-7">
4 <h5 class="modal-title my-1">Lista de Marcadores</h5>
5 </div>
6 </div>
7 </div>
8 <div class="modal-body" id="modal-body">
9 <table class="table table-striped table-sm">
10 <thead>
11 <tr>
12 <th>Orden</th>
13 <th>Número</th>
14 <th>Cliente</th>
15 <th>Km desde la base</th>
16 <th></th>
17 </tr>
18 </thead>
19 <tbody>
20 <tr
21 ng-repeat="(key, marcador) in currentPageMarcadores"
22 >
23 <td ng-bind="marcador.orden"></td>
24 <td ng-bind="marcador.numero"></td>
25 <td ng-bind="marcador.cliente"></td>
26 <td ng-bind="marcador.distancia"></td>
27 <td>
28 <button
29 type="button"
30 class="btn btn-xs p-1 float-right btn-primary"
31 ng-click="select(marcador, (currentPageMarcadores.length - key - 1))"
32 >
33 <i class="fa fa-map-marker px-1" aria-hidden="true"></i>
34 </button>
35 </td>
36 </tr>
37 </tbody>
38 </table>
39 </div>
40 <div class="modal-footer py-1">
41 <nav ng-show="currentPageClientes.length > 0 && primerBusqueda && !ingreso" class="mr-auto">
42 <ul class="pagination pagination-sm mb-0">
43 <li class="page-item" ng-class="{'disabled': currentPage == 1}">
44 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage - 1)">
45 <span aria-hidden="true">&laquo;</span>
46 <span class="sr-only">Anterior</span>
47 </a>
48 </li>
49 <li
50 class="page-item"
51 ng-repeat="pagina in paginas"
52 ng-class="{'active': pagina == currentPage}"
53 >
54 <a
55 class="page-link"
56 href="javascript:void()"
57 ng-click="selectPage(pagina)"
58 ng-bind="pagina"
59 ></a>
60 </li>
61 <li class="page-item" ng-class="{'disabled': currentPage == lastPage}">
62 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage + 1)">
63 <span aria-hidden="true">&raquo;</span>
64 <span class="sr-only">Siguiente</span>
65 </a>
66 </li>
67 </ul>
68 </nav>
69 <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button>
70 </div>
71