diff --git a/src/js/controller-productividad.js b/src/js/controller-productividad.js index 6645f0c..076f59d 100644 --- a/src/js/controller-productividad.js +++ b/src/js/controller-productividad.js @@ -81,14 +81,50 @@ angular.module('focaModalInforme') } ] }; + $scope.seleccionarTipo = function() { + var data = [ + { + id: 0, + label: 'Todos' + }, + { + id: 1, + label: 'Vendedores' + }, + { + id: 2, + label: 'Cobradores' + }, + { + id: 3, + label: 'Transportistas' + } + ]; + focaModalService.modal({ + titulo: 'Seleccionar entidad', + data: data, + columnas: [ + { + propiedad: 'label', + nombre: 'Entidad' + } + ], + }).then(function(res) { + $scope.params.entidad = res; + }); + }; $scope.generarInforme = function() { - //$scope.generando = true; + if (!$scope.params.entidad) { + focaModalService.alert('Seleccione una entidad'); + return; + } + $scope.generando = true; focaModalInformeProductividadService .getInformeData($scope.params) .then(function(res) { var result = []; - console.log(res); - if (true) { + + if ($scope.params.entidad.id === 1 || !$scope.params.entidad.id) { result.push({ cliente: 'Vendedores' }); @@ -107,7 +143,7 @@ angular.module('focaModalInforme') }); }); } - if (true) { + if ($scope.params.entidad.id === 2 || !$scope.params.entidad.id) { result.push({ cliente: 'Cobradores' }); @@ -126,7 +162,7 @@ angular.module('focaModalInforme') }); }); } - if (true) { + if ($scope.params.entidad.id === 3 || !$scope.params.entidad.id) { result.push({ cliente: 'Transportistas' }); @@ -165,11 +201,10 @@ angular.module('focaModalInforme') $scope.cancel = function() { $uibModalInstance.dismiss('Cancelar'); }; - $scope.clearSector = function() { - $scope.params.sector = undefined; + $scope.clearEntidad = function() { + $scope.params.entidad = undefined; }; - } ] ); diff --git a/src/views/informe-productividad.html b/src/views/informe-productividad.html index 3750cde..1cd0bc1 100644 --- a/src/views/informe-productividad.html +++ b/src/views/informe-productividad.html @@ -57,27 +57,22 @@ Entidad