Commit 9918850eb4974152addcc70947c0b2d2b44a4d04

Authored by Nicolás Guarnieri
Exists in master and in 1 other branch develop

Merge branch 'master' into 'master'

Master

See merge request !22
src/js/controller.js
1   -angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoController', [
  1 +angular.module('focaAdminSeguimiento').controller('focaAdminSeguimientoController', [
2 2 '$scope', '$timeout', 'focaAdminSeguimientoService',
3 3 'focaBotoneraLateralService','$location', '$routeParams',
4 4 function($scope, $timeout, focaAdminSeguimientoService,
5 5 focaBotoneraLateralService, $location, $routeParams) {
6   -
7 6 $scope.actividad = '';
8 7 $scope.titulo = '';
9 8 var cabecera = '';
... ... @@ -14,7 +13,7 @@ angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoControll
14 13 maxDate: new Date()
15 14 };
16 15  
17   - switch($routeParams.parametro){
  16 + switch ($routeParams.parametro) {
18 17 case 'nota-pedido':
19 18 $scope.actividad = 'Nota de pedido';
20 19 $scope.titulo = 'Seguimiento de nota de pedido';
... ... @@ -39,13 +38,6 @@ angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoControll
39 38 $scope.marcadores = [];
40 39 getSeguimiento();
41 40  
42   - $timeout(function() {
43   - $scope.$broadcast('addCabecera',{
44   - label: 'General',
45   - valor: ''
46   - });
47   - });
48   -
49 41 //SETEO BOTONERA LATERAL
50 42 focaBotoneraLateralService.showSalir(true);
51 43 focaBotoneraLateralService.showPausar(false);
... ... @@ -54,12 +46,6 @@ angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoControll
54 46 $scope.general = function() {
55 47 $scope.idUsuario = 0;
56 48 getSeguimiento();
57   - $scope.$broadcast('removeCabecera', cabecera);
58   - $scope.$broadcast('removeCabecera', 'Individual');
59   - $scope.$broadcast('addCabecera',{
60   - label: 'General -',
61   - valor: $scope.marcadores.length + ' ' + plural
62   - });
63 49 };
64 50  
65 51 $scope.individual = function() {
... ... @@ -73,11 +59,7 @@ angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoControll
73 59 $scope.search = function(key) {
74 60 if (key === 13) {
75 61 $scope.idUsuario = $scope.idUsuarioInput;
76   - $scope.$broadcast('removeCabecera', 'General');
77   - $scope.$broadcast('addCabecera', {
78   - label: 'Individual',
79   - valor: $scope.marcadores.length + ' ' + $scope.actividad
80   - });
  62 +
81 63 getSeguimiento();
82 64 if ($scope.actividad === 'Entrega de producto' && $scope.idUsuario !== 0) {
83 65 focaAdminSeguimientoService.obtenerRemitosVehiculo($scope.idUsuario)
... ... @@ -97,6 +79,7 @@ angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoControll
97 79 };
98 80  
99 81 function getSeguimiento() {
  82 + $scope.$broadcast('cleanCabecera');
100 83 var now = $scope.now;
101 84 var desde = new Date(new Date(now.setHours(0)).setMinutes(0));
102 85 desde = desde.setDate(desde.getDate() - 1);
... ... @@ -116,29 +99,60 @@ angular.module('focaAdminSeguimiento') .controller('focaAdminSeguimientoControll
116 99 };
117 100  
118 101 focaAdminSeguimientoService.obtenerActividad(datos).then(function(datos) {
119   - if($scope.idUsuario !== 0){
120   - switch($routeParams.parametro){
  102 + $scope.marcadores = datos.data;
  103 +
  104 + if ($scope.idUsuario !== 0) {
  105 + $scope.$broadcast('removeCabecera', 'General -');
  106 + $scope.$broadcast('addCabecera', {
  107 + label: 'Individual',
  108 + valor: ''
  109 + });
  110 +
  111 + var valor = '';
  112 + switch ($routeParams.parametro) {
121 113 case 'nota-pedido':
122   - $scope.$broadcast('addCabecera', {
123   - label: cabecera,
124   - valor: (datos.data.length) ? $scope.idUsuario + ' - ' +
125   - datos.data[0].notaPedido.vendedor.NomVen
126   - : $scope.idUsuario
127   - });
  114 + if (datos.data.length) {
  115 + valor = datos.data[0].notaPedido.vendedor.NUM + ' - ' +
  116 + datos.data[0].notaPedido.vendedor.NOM.trim();
  117 + } else {
  118 + valor = $scope.idUsuario;
  119 + }
128 120 break;
129 121 case 'hoja-ruta':
130   - $scope.$broadcast('addCabecera', {
131   - label: cabecera,
132   - valor: (datos.data.length) ? $scope.idUsuario + ' - ' +
133   - datos.data[0].hojaRutaMovimiento.remito.hojaRuta.vehiculo.tractor
134   - : $scope.idUsuario
135   - });
  122 + if (datos.data.length) {
  123 + valor = $scope.idUsuario + ' - ' + datos.data[0]
  124 + .hojaRutaMovimiento.remito.hojaRuta.vehiculo.tractor.trim();
  125 + } else {
  126 + valor = $scope.idUsuario;
  127 + }
  128 +
136 129 break;
137 130 case 'cobranza':
  131 + if (datos.data.length) {
  132 + valor = datos.data[0].notaPedido.vendedor.NUM + ' - ' +
  133 + datos.data[0].notaPedido.vendedor.NOM.trim();
  134 + } else {
  135 + valor = $scope.idUsuario;
  136 + }
138 137 break;
139 138 }
  139 +
  140 + $scope.$broadcast('addCabecera', {
  141 + label: cabecera,
  142 + valor: valor
  143 + });
  144 +
  145 + } else {
  146 + $scope.$broadcast('addCabecera',{
  147 + label: 'General',
  148 + valor: ''
  149 + });
140 150 }
141   - $scope.marcadores = datos.data;
  151 +
  152 + $scope.$broadcast('addCabecera', {
  153 + label: 'Cantidad: ',
  154 + valor: datos.data.length + ' Marcadores'
  155 + });
142 156 });
143 157 }
144 158 }
src/js/osm-directive.js
... ... @@ -77,13 +77,14 @@ angular.module('focaAdminSeguimiento').directive('osm', function() {
77 77 }
78 78  
79 79 var notaPedido = marcador.notaPedido;
80   - var textVendedor = notaPedido.idVendedor + ' - ';
81 80  
82 81 if (notaPedido.vendedor) {
83   - textVendedor += notaPedido.vendedor.NomVen;
  82 + observacion.push([
  83 + 'Vendedor',
  84 + notaPedido.vendedor.NUM + ' - ' + notaPedido.vendedor.NOM
  85 + ]);
84 86 }
85 87  
86   - observacion.push(['Vendedor', textVendedor]);
87 88  
88 89 if (!$scope.parametros.individual) {
89 90 observacion.push(['Ultima Nota de Pedido', '']);
... ... @@ -126,7 +127,7 @@ angular.module('focaAdminSeguimiento').directive('osm', function() {
126 127  
127 128 function getCobranza(marcador) {
128 129 observacion = '';
129   - observacion += 'Cobrador: ' + marcador.recibo.cobrador.CodVen + ' - ' +
  130 + observacion += 'Cobrador: ' + marcador.recibo.cobrador.NUM + ' - ' +
130 131 marcador.recibo.CFE + '<br/>';
131 132  
132 133 if (!$scope.parametros.individual) {