Commit 648b1f87b74304dd5290d7cd86a6c5fd2fb699a6

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

order y observaciones en marcadores

1 { 1 {
2 "name": "foca-admin-seguimiento", 2 "name": "foca-admin-seguimiento",
3 "version": "0.0.1", 3 "version": "0.0.2",
4 "description": "Seguimiento de actividad", 4 "description": "Seguimiento de actividad",
5 "main": "index.js", 5 "main": "index.js",
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1", 7 "test": "echo \"Error: no test specified\" && exit 1",
8 "compile": "gulp uglify", 8 "compile": "gulp uglify",
9 "gulp-pre-commit": "gulp pre-commit", 9 "gulp-pre-commit": "gulp pre-commit",
10 "postinstall": "npm run compile && gulp clean-post-install", 10 "postinstall": "npm run compile && gulp clean-post-install",
11 "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint leaflet pump" 11 "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint leaflet pump"
12 }, 12 },
13 "pre-commit": [ 13 "pre-commit": [
14 "gulp-pre-commit" 14 "gulp-pre-commit"
15 ], 15 ],
16 "repository": { 16 "repository": {
17 "type": "git", 17 "type": "git",
18 "url": "https://debo.suite.repo/modulos-npm/foca-admin-seguimiento.git" 18 "url": "https://debo.suite.repo/modulos-npm/foca-admin-seguimiento.git"
19 }, 19 },
20 "author": "Foca Software", 20 "author": "Foca Software",
21 "license": "ISC", 21 "license": "ISC",
22 "devDependencies": { 22 "devDependencies": {
23 "angular": "1.7.5", 23 "angular": "^1.7.5",
24 "angular-route": "1.7.5", 24 "angular-route": "^1.7.5",
25 "bootstrap": "4.1.3", 25 "bootstrap": "^4.1.3",
26 "font-awesome": "^4.7.0", 26 "font-awesome": "^4.7.0",
27 "gulp": "^3.9.1", 27 "gulp": "^3.9.1",
28 "gulp-angular-templatecache": "2.2.3", 28 "gulp-angular-templatecache": "^2.2.3",
29 "gulp-clean": "^0.4.0", 29 "gulp-clean": "^0.4.0",
30 "gulp-concat": "^2.6.1", 30 "gulp-concat": "^2.6.1",
31 "gulp-connect": "^5.6.1", 31 "gulp-connect": "^5.6.1",
32 "gulp-htmlmin": "5.0.1", 32 "gulp-htmlmin": "^5.0.1",
33 "gulp-jshint": "2.1.0", 33 "gulp-jshint": "^2.1.0",
34 "gulp-rename": "1.4.0", 34 "gulp-rename": "^1.4.0",
35 "gulp-replace": "1.0.0", 35 "gulp-replace": "^1.0.0",
36 "gulp-sequence": "^1.0.0", 36 "gulp-sequence": "^1.0.0",
37 "gulp-uglify": "3.0.1", 37 "gulp-uglify": "^3.0.1",
38 "gulp-uglify-es": "^1.0.4", 38 "gulp-uglify-es": "^1.0.4",
39 "jasmine-core": "^3.3.0", 39 "jasmine-core": "^3.3.0",
40 "jquery": "3.3.1", 40 "jquery": "^3.3.1",
41 "jshint": "2.9.6", 41 "jshint": "^2.9.6",
42 "leaflet": "^1.3.4", 42 "leaflet": "^1.3.4",
43 "pre-commit": "^1.2.2", 43 "pre-commit": "^1.2.2",
44 "pump": "3.0.0", 44 "pump": "^3.0.0",
45 "ui-bootstrap4": "3.0.5" 45 "ui-bootstrap4": "^3.0.5"
46 } 46 }
47 } 47 }
48 48
src/js/controller.js
1 angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [ 1 angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [
2 '$scope', 'focaAdminSeguimientoService', '$location', '$routeParams', 2 '$scope', 'focaAdminSeguimientoService', '$location', '$routeParams',
3 function($scope, focaAdminSeguimientoService, $location, $routeParams) { 3 function($scope, focaAdminSeguimientoService, $location, $routeParams) {
4 $scope.actividad = ''; 4 $scope.actividad = '';
5 5
6 $scope.now = new Date(); 6 $scope.now = new Date();
7 7
8 if ($routeParams.parametro === 'nota-pedido') { 8 if ($routeParams.parametro === 'nota-pedido') {
9 $scope.actividad = 'Nota de pedido'; 9 $scope.actividad = 'Nota de pedido';
10 } 10 }
11 11
12 if ($routeParams.parametro === 'hoja-ruta') { 12 if ($routeParams.parametro === 'hoja-ruta') {
13 $scope.actividad = 'Entrega de producto'; 13 $scope.actividad = 'Entrega de producto';
14 } 14 }
15 15
16 $scope.idUsuario = 0; 16 $scope.idUsuario = 0;
17 $scope.marcadores = []; 17 $scope.marcadores = [];
18 getSeguimiento(); 18 getSeguimiento();
19 19
20 $scope.general = function() { 20 $scope.general = function() {
21 $scope.idUsuario = 0; 21 $scope.idUsuario = 0;
22 getSeguimiento(); 22 getSeguimiento();
23 }; 23 };
24 24
25 $scope.individual = function() { 25 $scope.individual = function() {
26 $scope.idUsuario = -1; 26 $scope.idUsuario = -1;
27 }; 27 };
28 28
29 $scope.salir = function() { 29 $scope.salir = function() {
30 $location.path('/'); 30 $location.path('/');
31 }; 31 };
32 32
33 $scope.search = function(key) { 33 $scope.search = function(key) {
34 if (key === 13) { 34 if (key === 13) {
35 $scope.idUsuario = $scope.idUsuarioInput; 35 $scope.idUsuario = $scope.idUsuarioInput;
36 getSeguimiento(); 36 getSeguimiento();
37 } 37 }
38 }; 38 };
39 39
40 $scope.fecha = function() { 40 $scope.fecha = function() {
41 getSeguimiento(); 41 getSeguimiento();
42 }; 42 };
43 43
44 function getSeguimiento () { 44 function getSeguimiento() {
45 var now = $scope.now; 45 var now = $scope.now;
46 var desde = new Date(new Date(now.setHours(0)).setMinutes(0)); 46 var desde = new Date(new Date(now.setHours(0)).setMinutes(0));
47 desde = desde.setDate(desde.getDate() - 1); 47 desde = desde.setDate(desde.getDate() - 1);
48 desde = new Date(desde); 48 desde = new Date(desde);
49 var datos = { 49 var datos = {
50 actividad: $scope.actividad, 50 actividad: $scope.actividad,
51 idUsuario: $scope.idUsuario, 51 idUsuario: $scope.idUsuario,
52 fechaDesde: desde, 52 fechaDesde: desde,
53 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)) 53 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59))
54 }; 54 };
55 55
56 $scope.datosBuscados = { 56 $scope.datosBuscados = {
57 actividad: $scope.actividad, 57 actividad: $scope.actividad,
58 individual: $scope.idUsuario !== 0 ? true : false 58 individual: $scope.idUsuario !== 0 ? true : false
59 }; 59 };
60 60
61 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) { 61 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) {
62 62
63 $scope.marcadores = datos.data; 63 $scope.marcadores = datos.data;
64 }); 64 });
65 } 65 }
66 } 66 }
67 ]); 67 ]);
68 68
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 20
21 if ($scope.parametros.actividad === 'Nota de pedido') { 21 if ($scope.parametros.actividad === 'Nota de pedido') {
22 observacion += 22 observacion +=
23 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' + 23 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' +
24 ( 24 (
25 marcador.notaPedido.vendedor ? 25 marcador.notaPedido.vendedor ?
26 marcador.notaPedido.vendedor.NomVen : 26 marcador.notaPedido.vendedor.NomVen :
27 '' 27 ''
28 ) + '<br/>'; 28 ) + '<br/>';
29 observacion += 'Fecha: ' + 29 observacion += 'Fecha: ' +
30 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 30 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
31 marcador.fecha.slice(11,19) + '<br/>'; 31 marcador.fecha.slice(11,19) + '<br/>';
32 observacion += 'Nº: ' + $filter('comprobante')([ 32 observacion += 'Nº: ' + $filter('comprobante')([
33 marcador.notaPedido.sucursal, 33 marcador.notaPedido.sucursal,
34 marcador.notaPedido.numeroNotaPedido 34 marcador.notaPedido.numeroNotaPedido
35 ]) + '<br/>'; 35 ]) + '<br/>';
36 observacion += 'Cliente: ' + 36 observacion += 'Cliente: ' +
37 marcador.notaPedido.cliente.NOM + '<br/>'; 37 marcador.notaPedido.cliente.NOM + '<br/>';
38 if ($scope.parametros.individual) { 38 if ($scope.parametros.individual) {
39 observacion += 39 observacion +=
40 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$'); 40 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$');
41 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion;
41 } else { 42 } else {
42 observacion += 'Cantidad de nota de pedido: ' + 43 observacion += 'Cantidad de nota de pedido: ' +
43 marcador.cantidad + '<br/>'; 44 marcador.cantidad + '<br/>';
44 observacion += 'Total Vendido: ' + 45 observacion += 'Total Vendido: ' +
45 $filter('currency')(marcador.total, '$'); 46 $filter('currency')(marcador.total, '$');
46 } 47 }
47 } else { 48 } else {
48 observacion += 'Vehiculo: ' + 49 observacion += 'Vehiculo: ' +
49 marcador.remito.hojaRuta.idVehiculo + '<br/>'; 50 marcador.remito.hojaRuta.idVehiculo + ' - ' +
51 marcador.remito.hojaRuta.vehiculo.tractor + '<br/>';
52 observacion += 'Transportista: ' +
53 marcador.remito.hojaRuta.transportista.NOM + '<br/>';
54 observacion += 'Chofer: ' +
55 marcador.remito.hojaRuta.chofer.nombre + '<br/>';
56 console.info(marcador);
50 observacion += 'Fecha: ' + 57 observacion += 'Fecha: ' +
51 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + 58 $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' +
52 marcador.fecha.slice(11,19) + '<br/>'; 59 marcador.fecha.slice(11,19) + '<br/>';
53 observacion += 'Hoja de ruta: ' + $filter('comprobante')([ 60 observacion += 'Hoja de ruta: ' + $filter('comprobante')([
54 marcador.remito.hojaRuta.sucursal, 61 marcador.remito.hojaRuta.sucursal,
55 marcador.remito.hojaRuta.numeroHojaRuta 62 marcador.remito.hojaRuta.numeroHojaRuta
56 ]) + '<br/>'; 63 ]) + '<br/>';
57 observacion += 'Remito: ' + $filter('comprobante')([ 64 observacion += 'Remito: ' + $filter('comprobante')([
58 marcador.remito.sucursal, 65 marcador.remito.sucursal,
59 marcador.remito.numeroRemito 66 marcador.remito.numeroRemito
60 ]) + '<br/>'; 67 ]) + '<br/>';
61 observacion += 'Cliente: ' + 68 observacion += 'Cliente: ' +
62 marcador.remito.cliente.NOM + '<br/>'; 69 marcador.remito.cliente.NOM + '<br/>';
63 if ($scope.parametros.individual) { 70 if ($scope.parametros.individual) {
64 observacion += 'Producto: ' + 71 observacion += 'Producto: ' +
65 marcador.remito.articuloRemito.descripcion + '<br/>'; 72 marcador.remito.articulosRemito[0].descripcion + '<br/>';
66 observacion += 'Cantidad entregada: ' + 73 observacion += 'Cantidad entregada: ' +
67 marcador.remito.carga + '<br/>'; 74 marcador.remito.carga + '<br/>';
75 observacion += 'Observaciones: ' + marcador.observaciones;
76 observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion;
68 } else { 77 } else {
69 observacion += 'Cantidad de entregas: ' + 78 observacion += 'Cantidad de entregas: ' + marcador.cantidad;
70 marcador.cantidad + '<br/>';
71 } 79 }
72 } 80 }
73 81
74 $scope.markers.push( 82 $scope.markers.push(
75 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map) 83 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map)
76 .bindPopup(observacion) 84 .bindPopup(observacion)
77 ); 85 );
78 86
79 $scope.markers[0].openPopup(); 87 $scope.markers[0].openPopup();
80 }); 88 });
81 }); 89 });
82 }], 90 }],
83 scope: { 91 scope: {
84 latitud: '=', 92 latitud: '=',
85 longitud: '=', 93 longitud: '=',
86 zoom: '=', 94 zoom: '=',
87 marcadores: '=', 95 marcadores: '=',
88 parametros: '=' 96 parametros: '='
89 } 97 }
90 }; 98 };
91 }); 99 });