Commit 8af8e6fd0fa34fd8f50b0e8ebbc0de2846dbad74

Authored by Eric Fernandez
Exists in master and in 1 other branch develop

Merge branch 'master' into 'master'

agrego foca-botonera-lateral

See merge request !13
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
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 = '';
5 8
6 $scope.now = new Date(); 9 $scope.now = new Date();
7 10
8 if ($routeParams.parametro === 'nota-pedido') { 11 if ($routeParams.parametro === 'nota-pedido') {
9 $scope.actividad = 'Nota de pedido'; 12 $scope.actividad = 'Nota de pedido';
10 } 13 }
11 14
12 if ($routeParams.parametro === 'hoja-ruta') { 15 if ($routeParams.parametro === 'hoja-ruta') {
13 $scope.actividad = 'Entrega de producto'; 16 $scope.actividad = 'Entrega de producto';
14 } 17 }
15 18
16 if ($routeParams.parametro === 'cobranza') { 19 if ($routeParams.parametro === 'cobranza') {
17 $scope.actividad = 'Cobranza'; 20 $scope.actividad = 'Cobranza';
18 } 21 }
19 22
20 $scope.idUsuario = 0; 23 $scope.idUsuario = 0;
21 $scope.marcadores = []; 24 $scope.marcadores = [];
22 getSeguimiento(); 25 getSeguimiento();
23 26
27 //SETEO BOTONERA LATERAL
28 focaBotoneraLateralService.showSalir(true);
29 focaBotoneraLateralService.showPausar(false);
30 focaBotoneraLateralService.showGuardar(false);
31
24 $scope.general = function() { 32 $scope.general = function() {
25 $scope.idUsuario = 0; 33 $scope.idUsuario = 0;
26 getSeguimiento(); 34 getSeguimiento();
27 }; 35 };
28 36
29 $scope.individual = function() { 37 $scope.individual = function() {
30 $scope.idUsuario = -1; 38 $scope.idUsuario = -1;
31 }; 39 };
32 40
33 $scope.salir = function() { 41 $scope.salir = function() {
34 $location.path('/'); 42 $location.path('/');
35 }; 43 };
36 44
37 $scope.search = function(key) { 45 $scope.search = function(key) {
38 if (key === 13) { 46 if (key === 13) {
39 $scope.idUsuario = $scope.idUsuarioInput; 47 $scope.idUsuario = $scope.idUsuarioInput;
40 getSeguimiento(); 48 getSeguimiento();
41 } 49 }
42 }; 50 };
43 51
44 $scope.fecha = function() { 52 $scope.fecha = function() {
45 getSeguimiento(); 53 getSeguimiento();
46 }; 54 };
47 55
48 function getSeguimiento() { 56 function getSeguimiento() {
49 var now = $scope.now; 57 var now = $scope.now;
50 var desde = new Date(new Date(now.setHours(0)).setMinutes(0)); 58 var desde = new Date(new Date(now.setHours(0)).setMinutes(0));
51 desde = desde.setDate(desde.getDate() - 1); 59 desde = desde.setDate(desde.getDate() - 1);
52 desde = new Date(desde); 60 desde = new Date(desde);
53 var datos = { 61 var datos = {
54 actividad: $scope.actividad, 62 actividad: $scope.actividad,
55 idUsuario: $scope.idUsuario, 63 idUsuario: $scope.idUsuario,
56 fechaDesde: desde, 64 fechaDesde: desde,
57 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)) 65 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59))
58 }; 66 };
59 67
60 $scope.datosBuscados = { 68 $scope.datosBuscados = {
61 actividad: $scope.actividad, 69 actividad: $scope.actividad,
62 individual: $scope.idUsuario !== 0 ? true : false 70 individual: $scope.idUsuario !== 0 ? true : false
63 }; 71 };
64 72
65 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) { 73 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) {
66 74
67 $scope.marcadores = datos.data; 75 $scope.marcadores = datos.data;
68 }); 76 });
69 } 77 }
70 } 78 }
71 ]); 79 ]);
72 80
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 <div class="offset-1 col-9">
4 <osm 4 <osm
5 latitud="-32.89214159952345" 5 latitud="-32.89214159952345"
6 longitud="-68.84572999101856" 6 longitud="-68.84572999101856"
7 zoom="14" 7 zoom="14"
8 marcadores="marcadores" 8 marcadores="marcadores"
9 parametros= "datosBuscados" 9 parametros= "datosBuscados"
10 /> 10 />
11 </div> 11 </div>
12 <div class="col-2 pl-0"> 12 <div class="col-2 pl-0">
13 <input 13 <input
14 type="date" 14 type="date"
15 ng-model="now" 15 ng-model="now"
16 class="btn col-12 my-1" 16 class="btn col-12 my-1"
17 foca-focus="true" 17 foca-focus="true"
18 ng-blur="fecha()" 18 ng-blur="fecha()"
19 hasta-hoy 19 hasta-hoy
20 /> 20 />
21 <button 21 <button
22 type="button" 22 type="button"
23 ng-class="{'active': idUsuario == 0}" 23 ng-class="{'active': idUsuario == 0}"
24 class="btn col-12 my-1" 24 class="btn col-12 my-1"
25 ng-click="general()" 25 ng-click="general()"
26 >General</button> 26 >General</button>
27 <button 27 <button
28 type="button" 28 type="button"
29 ng-class="{'active': idUsuario != 0}" 29 ng-class="{'active': idUsuario != 0}"
30 class="btn col-12 my-1" 30 class="btn col-12 my-1"
31 ng-click="individual()" 31 ng-click="individual()"
32 >Individual</button> 32 >Individual</button>
33 <div class="form-group" ng-show="idUsuario == -1"> 33 <div class="form-group" ng-show="idUsuario == -1">
34 <input 34 <input
35 type="text" 35 type="text"
36 placeholder="Vendedor" 36 placeholder="Vendedor"
37 class="form-control" 37 class="form-control"
38 ng-model="idUsuarioInput" 38 ng-model="idUsuarioInput"
39 ng-keypress="search($event.keyCode)" 39 ng-keypress="search($event.keyCode)"
40 foca-focus="idUsuario == -1" 40 foca-focus="idUsuario == -1"
41 ng-show="actividad == 'Nota de pedido'" 41 ng-show="actividad == 'Nota de pedido'"
42 > 42 >
43 <input 43 <input
44 type="text" 44 type="text"
45 placeholder="Vehiculo" 45 placeholder="Vehiculo"
46 class="form-control" 46 class="form-control"
47 ng-model="idUsuarioInput" 47 ng-model="idUsuarioInput"
48 ng-keypress="search($event.keyCode)" 48 ng-keypress="search($event.keyCode)"
49 foca-focus="idUsuario == -1" 49 foca-focus="idUsuario == -1"
50 ng-show="actividad == 'Entrega de producto'" 50 ng-show="actividad == 'Entrega de producto'"
51 > 51 >
52 <input 52 <input
53 type="text" 53 type="text"
54 placeholder="Cobrador" 54 placeholder="Cobrador"
55 class="form-control" 55 class="form-control"
56 ng-model="idUsuarioInput" 56 ng-model="idUsuarioInput"
57 ng-keypress="search($event.keyCode)" 57 ng-keypress="search($event.keyCode)"
58 foca-focus="idUsuario == -1" 58 foca-focus="idUsuario == -1"
59 ng-show="actividad == 'Cobranza'" 59 ng-show="actividad == 'Cobranza'"
60 > 60 >
61 </div> 61 </div>
62 <button
63 type="button"
64 class="btn col-12 my-1 boton-salir"
65 ng-click="salir()"
66 >
67 Salir
68 </button>
69 </div> 62 </div>
70 </div> 63 </div>
71 </div> 64 </div>
72 65