Commit f34f10a6d11647c1e50b9810a98a7bf450bb6662

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

Merge branch 'master' into 'master'

agrego foca-cabecera

See merge request !14
src/js/controller.js
1 angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [ 1 angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [
2 '$scope', '$timeout', 'focaAdminSeguimientoService', 2 '$scope', '$timeout', 'focaAdminSeguimientoService',
3 'focaBotoneraLateralService','$location', '$routeParams', 3 'focaBotoneraLateralService','$location', '$routeParams',
4 function($scope, $timeout, focaAdminSeguimientoService, 4 function($scope, $timeout, focaAdminSeguimientoService,
5 focaBotoneraLateralService, $location, $routeParams) { 5 focaBotoneraLateralService, $location, $routeParams) {
6 6
7 $scope.actividad = ''; 7 $scope.actividad = '';
8 $scope.titulo = '';
9 var cabecera = '';
8 10
9 $scope.now = new Date(); 11 $scope.now = new Date();
10 12
11 if ($routeParams.parametro === 'nota-pedido') { 13 if ($routeParams.parametro === 'nota-pedido') {
12 $scope.actividad = 'Nota de pedido'; 14 $scope.actividad = 'Nota de pedido';
15 $scope.titulo = 'Seguimiento de nota de pedido';
16 cabecera = 'Vendedor:';
13 } 17 }
14 18
15 if ($routeParams.parametro === 'hoja-ruta') { 19 if ($routeParams.parametro === 'hoja-ruta') {
16 $scope.actividad = 'Entrega de producto'; 20 $scope.actividad = 'Entrega de producto';
21 $scope.titulo = 'Seguimiento de hoja de ruta';
22 cabecera = 'Vehiculo:';
17 } 23 }
18 24
19 if ($routeParams.parametro === 'cobranza') { 25 if ($routeParams.parametro === 'cobranza') {
20 $scope.actividad = 'Cobranza'; 26 $scope.actividad = 'Cobranza';
27 $scope.titulo = 'Seguimiento de cobranza';
28 cabecera = 'Cobrador:';
21 } 29 }
22 30
23 $scope.idUsuario = 0; 31 $scope.idUsuario = 0;
24 $scope.marcadores = []; 32 $scope.marcadores = [];
25 getSeguimiento(); 33 getSeguimiento();
26 34
35 $timeout(function() {
36 $scope.$broadcast('addCabecera',{
37 label: 'General',
38 valor: ''
39 });
40 })
41
27 //SETEO BOTONERA LATERAL 42 //SETEO BOTONERA LATERAL
28 focaBotoneraLateralService.showSalir(true); 43 focaBotoneraLateralService.showSalir(true);
29 focaBotoneraLateralService.showPausar(false); 44 focaBotoneraLateralService.showPausar(false);
30 focaBotoneraLateralService.showGuardar(false); 45 focaBotoneraLateralService.showGuardar(false);
31 46
32 $scope.general = function() { 47 $scope.general = function() {
33 $scope.idUsuario = 0; 48 $scope.idUsuario = 0;
34 getSeguimiento(); 49 getSeguimiento();
50 $scope.$broadcast('removeCabecera', cabecera);
51 $scope.$broadcast('addCabecera',{
52 label: 'General',
53 valor: ''
54 });
35 }; 55 };
36 56
37 $scope.individual = function() { 57 $scope.individual = function() {
38 $scope.idUsuario = -1; 58 $scope.idUsuario = -1;
39 }; 59 };
40 60
41 $scope.salir = function() { 61 $scope.salir = function() {
42 $location.path('/'); 62 $location.path('/');
43 }; 63 };
44 64
45 $scope.search = function(key) { 65 $scope.search = function(key) {
46 if (key === 13) { 66 if (key === 13) {
47 $scope.idUsuario = $scope.idUsuarioInput; 67 $scope.idUsuario = $scope.idUsuarioInput;
48 getSeguimiento(); 68 getSeguimiento();
69 $scope.$broadcast('removeCabecera', 'General');
70 $scope.$broadcast('addCabecera', {
71 label: cabecera,
72 valor: $scope.idUsuarioInput
73 });
49 } 74 }
50 }; 75 };
51 76
52 $scope.fecha = function() { 77 $scope.fecha = function() {
53 getSeguimiento(); 78 getSeguimiento();
54 }; 79 };
55 80
56 function getSeguimiento() { 81 function getSeguimiento() {
57 var now = $scope.now; 82 var now = $scope.now;
58 var desde = new Date(new Date(now.setHours(0)).setMinutes(0)); 83 var desde = new Date(new Date(now.setHours(0)).setMinutes(0));
59 desde = desde.setDate(desde.getDate() - 1); 84 desde = desde.setDate(desde.getDate() - 1);
60 desde = new Date(desde); 85 desde = new Date(desde);
61 var datos = { 86 var datos = {
62 actividad: $scope.actividad, 87 actividad: $scope.actividad,
63 idUsuario: $scope.idUsuario, 88 idUsuario: $scope.idUsuario,
64 fechaDesde: desde, 89 fechaDesde: desde,
65 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)) 90 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59))
66 }; 91 };
67 92
68 $scope.datosBuscados = { 93 $scope.datosBuscados = {
69 actividad: $scope.actividad, 94 actividad: $scope.actividad,
70 individual: $scope.idUsuario !== 0 ? true : false 95 individual: $scope.idUsuario !== 0 ? true : false
71 }; 96 };
72 97
73 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) { 98 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) {
74 99
75 $scope.marcadores = datos.data; 100 $scope.marcadores = datos.data;
76 }); 101 });
77 } 102 }
78 } 103 }
79 ]); 104 ]);
80 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 </div> 69 </div>
63 </div> 70 </div>
64 </div> 71 </div>
65 72