Commit 977e8418897ffa0e938beb42e618d79588ad6329

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

calendario bootstrap, cabeceras

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 = ''; 8 $scope.titulo = '';
9 var cabecera = ''; 9 var cabecera = '';
10 10
11 $scope.now = new Date(); 11 $scope.now = new Date();
12 $scope.dateOptions = {
13 maxDate: new Date()
14 };
12 15
13 if ($routeParams.parametro === 'nota-pedido') { 16 switch($routeParams.parametro){
14 $scope.actividad = 'Nota de pedido'; 17 case 'nota-pedido':
15 $scope.titulo = 'Seguimiento de nota de pedido'; 18 $scope.actividad = 'Nota de pedido';
16 cabecera = 'Vendedor:'; 19 $scope.titulo = 'Seguimiento de nota de pedido';
17 } 20 cabecera = 'Vendedor:';
18 21 break;
19 if ($routeParams.parametro === 'hoja-ruta') { 22 case 'hoja-ruta':
20 $scope.actividad = 'Entrega de producto'; 23 $scope.actividad = 'Entrega de producto';
21 $scope.titulo = 'Seguimiento de hoja de ruta'; 24 $scope.titulo = 'Seguimiento de hoja de ruta';
22 cabecera = 'Vehiculo:'; 25 cabecera = 'Vehiculo:';
23 } 26 break;
24 27 case 'cobranza':
25 if ($routeParams.parametro === 'cobranza') { 28 $scope.actividad = 'Cobranza';
26 $scope.actividad = 'Cobranza'; 29 $scope.titulo = 'Seguimiento de cobranza';
27 $scope.titulo = 'Seguimiento de cobranza'; 30 cabecera = 'Cobrador:';
28 cabecera = 'Cobrador:'; 31 break;
29 } 32 }
30 33
31 $scope.idUsuario = 0; 34 $scope.idUsuario = 0;
32 $scope.marcadores = []; 35 $scope.marcadores = [];
33 getSeguimiento(); 36 getSeguimiento();
34 37
35 $timeout(function() { 38 $timeout(function() {
36 $scope.$broadcast('addCabecera',{ 39 $scope.$broadcast('addCabecera',{
37 label: 'General', 40 label: 'General',
38 valor: '' 41 valor: ''
39 }); 42 });
40 }) 43 })
41 44
42 //SETEO BOTONERA LATERAL 45 //SETEO BOTONERA LATERAL
43 focaBotoneraLateralService.showSalir(true); 46 focaBotoneraLateralService.showSalir(true);
44 focaBotoneraLateralService.showPausar(false); 47 focaBotoneraLateralService.showPausar(false);
45 focaBotoneraLateralService.showGuardar(false); 48 focaBotoneraLateralService.showGuardar(false);
46 49
47 $scope.general = function() { 50 $scope.general = function() {
48 $scope.idUsuario = 0; 51 $scope.idUsuario = 0;
49 getSeguimiento(); 52 getSeguimiento();
50 $scope.$broadcast('removeCabecera', cabecera); 53 $scope.$broadcast('removeCabecera', cabecera);
54 $scope.$broadcast('removeCabecera', 'Individual');
51 $scope.$broadcast('addCabecera',{ 55 $scope.$broadcast('addCabecera',{
52 label: 'General', 56 label: 'General',
53 valor: '' 57 valor: ''
54 }); 58 });
55 }; 59 };
56 60
57 $scope.individual = function() { 61 $scope.individual = function() {
58 $scope.idUsuario = -1; 62 $scope.idUsuario = -1;
59 }; 63 };
60 64
61 $scope.salir = function() { 65 $scope.salir = function() {
62 $location.path('/'); 66 $location.path('/');
63 }; 67 };
64 68
65 $scope.search = function(key) { 69 $scope.search = function(key) {
66 if (key === 13) { 70 if (key === 13) {
67 $scope.idUsuario = $scope.idUsuarioInput; 71 $scope.idUsuario = $scope.idUsuarioInput;
68 getSeguimiento();
69 $scope.$broadcast('removeCabecera', 'General'); 72 $scope.$broadcast('removeCabecera', 'General');
70 $scope.$broadcast('addCabecera', { 73 $scope.$broadcast('addCabecera', {
71 label: cabecera, 74 label: 'Individual',
72 valor: $scope.idUsuarioInput 75 valor: ''
73 }); 76 });
77 getSeguimiento();
74 } 78 }
75 }; 79 };
76 80
77 $scope.fecha = function() { 81 $scope.fecha = function() {
78 getSeguimiento(); 82 getSeguimiento();
79 }; 83 };
80 84
81 function getSeguimiento() { 85 function getSeguimiento() {
82 var now = $scope.now; 86 var now = $scope.now;
83 var desde = new Date(new Date(now.setHours(0)).setMinutes(0)); 87 var desde = new Date(new Date(now.setHours(0)).setMinutes(0));
84 desde = desde.setDate(desde.getDate() - 1); 88 desde = desde.setDate(desde.getDate() - 1);
85 desde = new Date(desde); 89 desde = new Date(desde);
86 var datos = { 90 var datos = {
87 actividad: $scope.actividad, 91 actividad: $scope.actividad,
88 idUsuario: $scope.idUsuario, 92 idUsuario: $scope.idUsuario,
89 fechaDesde: desde, 93 fechaDesde: desde,
90 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)) 94 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59))
91 }; 95 };
92 96
93 $scope.datosBuscados = { 97 $scope.datosBuscados = {
94 actividad: $scope.actividad, 98 actividad: $scope.actividad,
95 individual: $scope.idUsuario !== 0 ? true : false 99 individual: $scope.idUsuario !== 0 ? true : false
96 }; 100 };
97 101
98 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) { 102 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) {
99 103 if($scope.idUsuario !== 0){
104 switch($routeParams.parametro){
105 case 'nota-pedido':
106 $scope.$broadcast('addCabecera', {
107 label: cabecera,
108 valor: (datos.data.length) ? $scope.idUsuario + ' - ' +
109 datos.data[0].notaPedido.vendedor.NomVen
110 : $scope.idUsuario
111 });
112 break;
113 case 'hoja-ruta':
114 $scope.$broadcast('addCabecera', {
115 label: cabecera,
116 valor: (datos.data.length) ? $scope.idUsuario + ' - ' +
117 datos.data[0].hojaRutaMovimiento.remito.hojaRuta.vehiculo.tractor
118 : $scope.idUsuario
119 });
120 break;
121 case 'cobranza':
122 break;
123 }
124 }
100 $scope.marcadores = datos.data; 125 $scope.marcadores = datos.data;
101 }); 126 });
102 } 127 }
103 } 128 }
104 ]); 129 ]);
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 <foca-cabecera-facturador 3 <foca-cabecera-facturador
4 titulo="titulo" 4 titulo="titulo"
5 fecha="now" 5 fecha="now"
6 class="mb-0 col-lg-12" 6 class="mb-0 col-lg-12"
7 ></foca-cabecera-facturador> 7 ></foca-cabecera-facturador>
8 </div> 8 </div>
9 <div class="row"> 9 <div class="row">
10 <div class="col-10"> 10 <div class="col-10">
11 <osm 11 <osm
12 latitud="-32.89214159952345" 12 latitud="-32.89214159952345"
13 longitud="-68.84572999101856" 13 longitud="-68.84572999101856"
14 zoom="14" 14 zoom="14"
15 marcadores="marcadores" 15 marcadores="marcadores"
16 parametros= "datosBuscados" 16 parametros= "datosBuscados"
17 /> 17 />
18 </div> 18 </div>
19 <div class="col-2 pl-0"> 19 <div class="col-2 pl-0">
20 <input 20 <input
21 type="date" 21 type="text"
22 ng-model="now" 22 ng-model="now"
23 class="btn col-12 my-1" 23 class="btn col-12 my-1"
24 foca-focus="true"
25 ng-blur="fecha()" 24 ng-blur="fecha()"
26 hasta-hoy 25 uib-datepicker-popup="dd/MM/yyyy"
26 show-button-bar="false"
27 is-open="datepickerOpen"
28 on-open-focus="false"
29 ng-focus="datepickerOpen = true"
30 datepicker-options="dateOptions"
27 /> 31 />
28 <button 32 <button
29 type="button" 33 type="button"
30 ng-class="{'active': idUsuario == 0}" 34 ng-class="{'active': idUsuario == 0}"
31 class="btn col-12 my-1" 35 class="btn col-12 my-1"
32 ng-click="general()" 36 ng-click="general()"
33 >General</button> 37 >General</button>
34 <button 38 <button
35 type="button" 39 type="button"
36 ng-class="{'active': idUsuario != 0}" 40 ng-class="{'active': idUsuario != 0}"
37 class="btn col-12 my-1" 41 class="btn col-12 my-1"
38 ng-click="individual()" 42 ng-click="individual()"
39 >Individual</button> 43 >Individual</button>
40 <div class="form-group" ng-show="idUsuario == -1"> 44 <div class="form-group" ng-show="idUsuario == -1">
41 <input 45 <input
42 type="text" 46 type="text"
43 placeholder="Vendedor" 47 placeholder="Vendedor"
44 class="form-control" 48 class="form-control"
45 ng-model="idUsuarioInput" 49 ng-model="idUsuarioInput"
46 ng-keypress="search($event.keyCode)" 50 ng-keypress="search($event.keyCode)"
47 foca-focus="idUsuario == -1" 51 foca-focus="idUsuario == -1"
48 ng-show="actividad == 'Nota de pedido'" 52 ng-show="actividad == 'Nota de pedido'"
49 > 53 >
50 <input 54 <input
51 type="text" 55 type="text"
52 placeholder="Vehiculo" 56 placeholder="Vehiculo"
53 class="form-control" 57 class="form-control"
54 ng-model="idUsuarioInput" 58 ng-model="idUsuarioInput"
55 ng-keypress="search($event.keyCode)" 59 ng-keypress="search($event.keyCode)"
56 foca-focus="idUsuario == -1" 60 foca-focus="idUsuario == -1"
57 ng-show="actividad == 'Entrega de producto'" 61 ng-show="actividad == 'Entrega de producto'"
58 > 62 >
59 <input 63 <input
60 type="text" 64 type="text"
61 placeholder="Cobrador" 65 placeholder="Cobrador"
62 class="form-control" 66 class="form-control"
63 ng-model="idUsuarioInput" 67 ng-model="idUsuarioInput"
64 ng-keypress="search($event.keyCode)" 68 ng-keypress="search($event.keyCode)"
65 foca-focus="idUsuario == -1" 69 foca-focus="idUsuario == -1"
66 ng-show="actividad == 'Cobranza'" 70 ng-show="actividad == 'Cobranza'"
67 > 71 >
68 </div> 72 </div>
69 </div> 73 </div>
70 </div> 74 </div>
71 </div> 75 </div>