Commit 4703ee08d4b94a3c0a69aafbd7e8bda7a5aeadd3
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'upstream/master'
Showing
4 changed files
Show diff stats
gulpfile.js
1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
2 | const clean = require('gulp-clean'); | 2 | const clean = require('gulp-clean'); |
3 | const concat = require('gulp-concat'); | 3 | const concat = require('gulp-concat'); |
4 | const htmlmin = require('gulp-htmlmin'); | 4 | const htmlmin = require('gulp-htmlmin'); |
5 | const rename = require('gulp-rename'); | 5 | const rename = require('gulp-rename'); |
6 | const uglify = require('gulp-uglify'); | 6 | const uglify = require('gulp-uglify'); |
7 | const gulp = require('gulp'); | 7 | const gulp = require('gulp'); |
8 | const pump = require('pump'); | 8 | const pump = require('pump'); |
9 | const jshint = require('gulp-jshint'); | 9 | const jshint = require('gulp-jshint'); |
10 | const replace = require('gulp-replace'); | 10 | const replace = require('gulp-replace'); |
11 | const connect = require('gulp-connect'); | 11 | const connect = require('gulp-connect'); |
12 | 12 | ||
13 | var paths = { | 13 | var paths = { |
14 | srcJS: 'src/js/*.js', | 14 | srcJS: 'src/js/*.js', |
15 | srcViews: 'src/views/*.html', | 15 | srcViews: 'src/views/*.html', |
16 | tmp: 'tmp', | 16 | tmp: 'tmp', |
17 | dist: 'dist/' | 17 | dist: 'dist/' |
18 | }; | 18 | }; |
19 | 19 | ||
20 | gulp.task('templates', ['clean'], function() { | 20 | gulp.task('templates', ['clean'], function() { |
21 | return pump( | 21 | return pump( |
22 | [ | 22 | [ |
23 | gulp.src(paths.srcViews), | 23 | gulp.src(paths.srcViews), |
24 | htmlmin(), | 24 | htmlmin(), |
25 | templateCache('views.js', { | 25 | templateCache('views.js', { |
26 | module: 'focaAdminSeguimiento', | 26 | module: 'focaAdminSeguimiento', |
27 | root: '' | 27 | root: '' |
28 | }), | 28 | }), |
29 | gulp.dest(paths.tmp) | 29 | gulp.dest(paths.tmp) |
30 | ] | 30 | ] |
31 | ); | 31 | ); |
32 | }); | 32 | }); |
33 | 33 | ||
34 | gulp.task('uglify', ['templates'], function() { | 34 | gulp.task('uglify', ['templates'], function() { |
35 | return pump( | 35 | return pump( |
36 | [ | 36 | [ |
37 | gulp.src([ | 37 | gulp.src([ |
38 | paths.srcJS, | 38 | paths.srcJS, |
39 | 'tmp/views.js' | 39 | 'tmp/views.js' |
40 | ]), | 40 | ]), |
41 | concat('foca-admin-seguimiento.js'), | 41 | concat('foca-admin-seguimiento.js'), |
42 | replace('src/views/', ''), | 42 | replace('src/views/', ''), |
43 | gulp.dest(paths.tmp), | 43 | gulp.dest(paths.tmp), |
44 | rename('foca-admin-seguimiento.min.js'), | 44 | rename('foca-admin-seguimiento.min.js'), |
45 | uglify(), | 45 | uglify(), |
46 | replace('"ngRoute","ui.bootstrap"', ''), | 46 | replace('"ngRoute","ui.bootstrap","focaBotoneraLateral"', ''), |
47 | gulp.dest(paths.dist) | 47 | gulp.dest(paths.dist) |
48 | ] | 48 | ] |
49 | ); | 49 | ); |
50 | }); | 50 | }); |
51 | 51 | ||
52 | gulp.task('clean', function(){ | 52 | gulp.task('clean', function(){ |
53 | return gulp.src(['tmp', 'dist'], {read: false}) | 53 | return gulp.src(['tmp', 'dist'], {read: false}) |
54 | .pipe(clean()); | 54 | .pipe(clean()); |
55 | }); | 55 | }); |
56 | 56 | ||
57 | gulp.task('pre-commit', function() { | 57 | gulp.task('pre-commit', function() { |
58 | return pump( | 58 | return pump( |
59 | [ | 59 | [ |
60 | gulp.src(paths.srcJS), | 60 | gulp.src(paths.srcJS), |
61 | jshint('.jshintrc'), | 61 | jshint('.jshintrc'), |
62 | jshint.reporter('default'), | 62 | jshint.reporter('default'), |
63 | jshint.reporter('fail') | 63 | jshint.reporter('fail') |
64 | ] | 64 | ] |
65 | ); | 65 | ); |
66 | 66 | ||
67 | gulp.start('uglify'); | 67 | gulp.start('uglify'); |
68 | }); | 68 | }); |
69 | 69 | ||
70 | gulp.task('webserver', function() { | 70 | gulp.task('webserver', function() { |
71 | pump [ | 71 | pump [ |
72 | connect.server({port: 3300, host: '0.0.0.0'}) | 72 | connect.server({port: 3300, host: '0.0.0.0'}) |
73 | ] | 73 | ] |
74 | }); | 74 | }); |
75 | 75 | ||
76 | gulp.task('clean-post-install', function() { | 76 | gulp.task('clean-post-install', function() { |
77 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 77 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
78 | 'index.html'], {read: false}) | 78 | 'index.html'], {read: false}) |
79 | .pipe(clean()); | 79 | .pipe(clean()); |
80 | }); | 80 | }); |
81 | 81 | ||
82 | gulp.task('default', ['webserver']); | 82 | gulp.task('default', ['webserver']); |
83 | 83 | ||
84 | gulp.task('watch', function() { | 84 | gulp.task('watch', function() { |
85 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 85 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); |
86 | }); | 86 | }); |
87 | 87 |
src/js/app.js
1 | angular.module('focaAdminSeguimiento', [ | 1 | angular.module('focaAdminSeguimiento', [ |
2 | 'ngRoute', | 2 | 'ngRoute', |
3 | 'ui.bootstrap' | 3 | 'ui.bootstrap', |
4 | 'focaBotoneraLateral' | ||
4 | ]); | 5 | ]); |
5 | 6 |
src/js/controller.js
1 | angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [ | 1 | angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [ |
2 | '$scope', 'focaAdminSeguimientoService', '$location', '$routeParams', | 2 | '$scope', '$timeout', 'focaAdminSeguimientoService', |
3 | function($scope, focaAdminSeguimientoService, $location, $routeParams) { | 3 | 'focaBotoneraLateralService','$location', '$routeParams', |
4 | function($scope, $timeout, focaAdminSeguimientoService, | ||
5 | focaBotoneraLateralService, $location, $routeParams) { | ||
6 | |||
4 | $scope.actividad = ''; | 7 | $scope.actividad = ''; |
8 | $scope.titulo = ''; | ||
9 | var cabecera = ''; | ||
5 | 10 | ||
6 | $scope.now = new Date(); | 11 | $scope.now = new Date(); |
7 | 12 | ||
8 | if ($routeParams.parametro === 'nota-pedido') { | 13 | if ($routeParams.parametro === 'nota-pedido') { |
9 | $scope.actividad = 'Nota de pedido'; | 14 | $scope.actividad = 'Nota de pedido'; |
15 | $scope.titulo = 'Seguimiento de nota de pedido'; | ||
16 | cabecera = 'Vendedor:'; | ||
10 | } | 17 | } |
11 | 18 | ||
12 | if ($routeParams.parametro === 'hoja-ruta') { | 19 | if ($routeParams.parametro === 'hoja-ruta') { |
13 | $scope.actividad = 'Entrega de producto'; | 20 | $scope.actividad = 'Entrega de producto'; |
21 | $scope.titulo = 'Seguimiento de hoja de ruta'; | ||
22 | cabecera = 'Vehiculo:'; | ||
14 | } | 23 | } |
15 | 24 | ||
16 | if ($routeParams.parametro === 'cobranza') { | 25 | if ($routeParams.parametro === 'cobranza') { |
17 | $scope.actividad = 'Cobranza'; | 26 | $scope.actividad = 'Cobranza'; |
27 | $scope.titulo = 'Seguimiento de cobranza'; | ||
28 | cabecera = 'Cobrador:'; | ||
18 | } | 29 | } |
19 | 30 | ||
20 | $scope.idUsuario = 0; | 31 | $scope.idUsuario = 0; |
21 | $scope.marcadores = []; | 32 | $scope.marcadores = []; |
22 | getSeguimiento(); | 33 | getSeguimiento(); |
23 | 34 | ||
35 | $timeout(function() { | ||
36 | $scope.$broadcast('addCabecera',{ | ||
37 | label: 'General', | ||
38 | valor: '' | ||
39 | }); | ||
40 | }) | ||
41 | |||
42 | //SETEO BOTONERA LATERAL | ||
43 | focaBotoneraLateralService.showSalir(true); | ||
44 | focaBotoneraLateralService.showPausar(false); | ||
45 | focaBotoneraLateralService.showGuardar(false); | ||
46 | |||
24 | $scope.general = function() { | 47 | $scope.general = function() { |
25 | $scope.idUsuario = 0; | 48 | $scope.idUsuario = 0; |
26 | getSeguimiento(); | 49 | getSeguimiento(); |
50 | $scope.$broadcast('removeCabecera', cabecera); | ||
51 | $scope.$broadcast('addCabecera',{ | ||
52 | label: 'General', | ||
53 | valor: '' | ||
54 | }); | ||
27 | }; | 55 | }; |
28 | 56 | ||
29 | $scope.individual = function() { | 57 | $scope.individual = function() { |
30 | $scope.idUsuario = -1; | 58 | $scope.idUsuario = -1; |
31 | }; | 59 | }; |
32 | 60 | ||
33 | $scope.salir = function() { | 61 | $scope.salir = function() { |
34 | $location.path('/'); | 62 | $location.path('/'); |
35 | }; | 63 | }; |
36 | 64 | ||
37 | $scope.search = function(key) { | 65 | $scope.search = function(key) { |
38 | if (key === 13) { | 66 | if (key === 13) { |
39 | $scope.idUsuario = $scope.idUsuarioInput; | 67 | $scope.idUsuario = $scope.idUsuarioInput; |
40 | getSeguimiento(); | 68 | getSeguimiento(); |
69 | $scope.$broadcast('removeCabecera', 'General'); | ||
70 | $scope.$broadcast('addCabecera', { | ||
71 | label: cabecera, | ||
72 | valor: $scope.idUsuarioInput | ||
73 | }); | ||
41 | } | 74 | } |
42 | }; | 75 | }; |
43 | 76 | ||
44 | $scope.fecha = function() { | 77 | $scope.fecha = function() { |
45 | getSeguimiento(); | 78 | getSeguimiento(); |
46 | }; | 79 | }; |
47 | 80 | ||
48 | function getSeguimiento() { | 81 | function getSeguimiento() { |
49 | var now = $scope.now; | 82 | var now = $scope.now; |
50 | var desde = new Date(new Date(now.setHours(0)).setMinutes(0)); | 83 | var desde = new Date(new Date(now.setHours(0)).setMinutes(0)); |
51 | desde = desde.setDate(desde.getDate() - 1); | 84 | desde = desde.setDate(desde.getDate() - 1); |
52 | desde = new Date(desde); | 85 | desde = new Date(desde); |
53 | var datos = { | 86 | var datos = { |
54 | actividad: $scope.actividad, | 87 | actividad: $scope.actividad, |
55 | idUsuario: $scope.idUsuario, | 88 | idUsuario: $scope.idUsuario, |
56 | fechaDesde: desde, | 89 | fechaDesde: desde, |
57 | fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)) | 90 | fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)) |
58 | }; | 91 | }; |
59 | 92 | ||
60 | $scope.datosBuscados = { | 93 | $scope.datosBuscados = { |
61 | actividad: $scope.actividad, | 94 | actividad: $scope.actividad, |
62 | individual: $scope.idUsuario !== 0 ? true : false | 95 | individual: $scope.idUsuario !== 0 ? true : false |
63 | }; | 96 | }; |
64 | 97 | ||
65 | focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) { | 98 | focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) { |
66 | 99 | ||
67 | $scope.marcadores = datos.data; | 100 | $scope.marcadores = datos.data; |
68 | }); | 101 | }); |
69 | } | 102 | } |
70 | } | 103 | } |
71 | ]); | 104 | ]); |
72 | 105 |
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 | <div class="offset-1 col-9"> | 3 | <foca-cabecera-facturador |
4 | titulo="titulo" | ||
5 | fecha="now" | ||
6 | class="mb-0 col-lg-12" | ||
7 | ></foca-cabecera-facturador> | ||
8 | </div> | ||
9 | <div class="row"> | ||
10 | <div class="col-10"> | ||
4 | <osm | 11 | <osm |
5 | latitud="-32.89214159952345" | 12 | latitud="-32.89214159952345" |
6 | longitud="-68.84572999101856" | 13 | longitud="-68.84572999101856" |
7 | zoom="14" | 14 | zoom="14" |
8 | marcadores="marcadores" | 15 | marcadores="marcadores" |
9 | parametros= "datosBuscados" | 16 | parametros= "datosBuscados" |
10 | /> | 17 | /> |
11 | </div> | 18 | </div> |
12 | <div class="col-2 pl-0"> | 19 | <div class="col-2 pl-0"> |
13 | <input | 20 | <input |
14 | type="date" | 21 | type="date" |
15 | ng-model="now" | 22 | ng-model="now" |
16 | class="btn col-12 my-1" | 23 | class="btn col-12 my-1" |
17 | foca-focus="true" | 24 | foca-focus="true" |
18 | ng-blur="fecha()" | 25 | ng-blur="fecha()" |
19 | hasta-hoy | 26 | hasta-hoy |
20 | /> | 27 | /> |
21 | <button | 28 | <button |
22 | type="button" | 29 | type="button" |
23 | ng-class="{'active': idUsuario == 0}" | 30 | ng-class="{'active': idUsuario == 0}" |
24 | class="btn col-12 my-1" | 31 | class="btn col-12 my-1" |
25 | ng-click="general()" | 32 | ng-click="general()" |
26 | >General</button> | 33 | >General</button> |
27 | <button | 34 | <button |
28 | type="button" | 35 | type="button" |
29 | ng-class="{'active': idUsuario != 0}" | 36 | ng-class="{'active': idUsuario != 0}" |
30 | class="btn col-12 my-1" | 37 | class="btn col-12 my-1" |
31 | ng-click="individual()" | 38 | ng-click="individual()" |
32 | >Individual</button> | 39 | >Individual</button> |
33 | <div class="form-group" ng-show="idUsuario == -1"> | 40 | <div class="form-group" ng-show="idUsuario == -1"> |
34 | <input | 41 | <input |
35 | type="text" | 42 | type="text" |
36 | placeholder="Vendedor" | 43 | placeholder="Vendedor" |
37 | class="form-control" | 44 | class="form-control" |
38 | ng-model="idUsuarioInput" | 45 | ng-model="idUsuarioInput" |
39 | ng-keypress="search($event.keyCode)" | 46 | ng-keypress="search($event.keyCode)" |
40 | foca-focus="idUsuario == -1" | 47 | foca-focus="idUsuario == -1" |
41 | ng-show="actividad == 'Nota de pedido'" | 48 | ng-show="actividad == 'Nota de pedido'" |
42 | > | 49 | > |
43 | <input | 50 | <input |
44 | type="text" | 51 | type="text" |
45 | placeholder="Vehiculo" | 52 | placeholder="Vehiculo" |
46 | class="form-control" | 53 | class="form-control" |
47 | ng-model="idUsuarioInput" | 54 | ng-model="idUsuarioInput" |
48 | ng-keypress="search($event.keyCode)" | 55 | ng-keypress="search($event.keyCode)" |
49 | foca-focus="idUsuario == -1" | 56 | foca-focus="idUsuario == -1" |
50 | ng-show="actividad == 'Entrega de producto'" | 57 | ng-show="actividad == 'Entrega de producto'" |
51 | > | 58 | > |
52 | <input | 59 | <input |
53 | type="text" | 60 | type="text" |
54 | placeholder="Cobrador" | 61 | placeholder="Cobrador" |
55 | class="form-control" | 62 | class="form-control" |
56 | ng-model="idUsuarioInput" | 63 | ng-model="idUsuarioInput" |
57 | ng-keypress="search($event.keyCode)" | 64 | ng-keypress="search($event.keyCode)" |
58 | foca-focus="idUsuario == -1" | 65 | foca-focus="idUsuario == -1" |
59 | ng-show="actividad == 'Cobranza'" | 66 | ng-show="actividad == 'Cobranza'" |
60 | > | 67 | > |
61 | </div> | 68 | </div> |
62 | <button | ||
63 | type="button" | ||
64 | class="btn col-12 my-1 boton-salir" | ||
65 | ng-click="salir()" |