Commit ec55b5e39568ffc43bc06d41a1bac70a63c17999

Authored by Jose Pinto
1 parent e9e49925da
Exists in master and in 1 other branch develop

agrego foca-cabecera

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
27 //SETEO BOTONERA LATERAL 35 //SETEO BOTONERA LATERAL
28 focaBotoneraLateralService.showSalir(true); 36 focaBotoneraLateralService.showSalir(true);
29 focaBotoneraLateralService.showPausar(false); 37 focaBotoneraLateralService.showPausar(false);
30 focaBotoneraLateralService.showGuardar(false); 38 focaBotoneraLateralService.showGuardar(false);
31 39
32 $scope.general = function() { 40 $scope.general = function() {
33 $scope.idUsuario = 0; 41 $scope.idUsuario = 0;
34 getSeguimiento(); 42 getSeguimiento();
43 $scope.$broadcast('removeCabecera', cabecera);
35 }; 44 };
36 45
37 $scope.individual = function() { 46 $scope.individual = function() {
38 $scope.idUsuario = -1; 47 $scope.idUsuario = -1;
39 }; 48 };
40 49
41 $scope.salir = function() { 50 $scope.salir = function() {
42 $location.path('/'); 51 $location.path('/');
43 }; 52 };
44 53
45 $scope.search = function(key) { 54 $scope.search = function(key) {
46 if (key === 13) { 55 if (key === 13) {
47 $scope.idUsuario = $scope.idUsuarioInput; 56 $scope.idUsuario = $scope.idUsuarioInput;
48 getSeguimiento(); 57 getSeguimiento();
58 $scope.$broadcast('addCabecera', {
59 label: cabecera,
60 valor: $scope.idUsuarioInput
61 });
49 } 62 }
50 }; 63 };
51 64
52 $scope.fecha = function() { 65 $scope.fecha = function() {
53 getSeguimiento(); 66 getSeguimiento();
54 }; 67 };
55 68
56 function getSeguimiento() { 69 function getSeguimiento() {
57 var now = $scope.now; 70 var now = $scope.now;
58 var desde = new Date(new Date(now.setHours(0)).setMinutes(0)); 71 var desde = new Date(new Date(now.setHours(0)).setMinutes(0));
59 desde = desde.setDate(desde.getDate() - 1); 72 desde = desde.setDate(desde.getDate() - 1);
60 desde = new Date(desde); 73 desde = new Date(desde);
61 var datos = { 74 var datos = {
62 actividad: $scope.actividad, 75 actividad: $scope.actividad,
63 idUsuario: $scope.idUsuario, 76 idUsuario: $scope.idUsuario,
64 fechaDesde: desde, 77 fechaDesde: desde,
65 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)) 78 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59))
66 }; 79 };
67 80
68 $scope.datosBuscados = { 81 $scope.datosBuscados = {
69 actividad: $scope.actividad, 82 actividad: $scope.actividad,
70 individual: $scope.idUsuario !== 0 ? true : false 83 individual: $scope.idUsuario !== 0 ? true : false
71 }; 84 };
72 85
73 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) { 86 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) {
74 87
75 $scope.marcadores = datos.data; 88 $scope.marcadores = datos.data;
76 }); 89 });
77 } 90 }
78 } 91 }
79 ]); 92 ]);
80 93
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