Commit 0cbd42e70089d5be02b527d372d6e5339d168bd6

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

informe productividad - ok selector entidad

src/js/controller-productividad.js
... ... @@ -81,14 +81,50 @@ angular.module('focaModalInforme')
81 81 }
82 82 ]
83 83 };
  84 + $scope.seleccionarTipo = function() {
  85 + var data = [
  86 + {
  87 + id: 0,
  88 + label: 'Todos'
  89 + },
  90 + {
  91 + id: 1,
  92 + label: 'Vendedores'
  93 + },
  94 + {
  95 + id: 2,
  96 + label: 'Cobradores'
  97 + },
  98 + {
  99 + id: 3,
  100 + label: 'Transportistas'
  101 + }
  102 + ];
  103 + focaModalService.modal({
  104 + titulo: 'Seleccionar entidad',
  105 + data: data,
  106 + columnas: [
  107 + {
  108 + propiedad: 'label',
  109 + nombre: 'Entidad'
  110 + }
  111 + ],
  112 + }).then(function(res) {
  113 + $scope.params.entidad = res;
  114 + });
  115 + };
84 116 $scope.generarInforme = function() {
85   - //$scope.generando = true;
  117 + if (!$scope.params.entidad) {
  118 + focaModalService.alert('Seleccione una entidad');
  119 + return;
  120 + }
  121 + $scope.generando = true;
86 122 focaModalInformeProductividadService
87 123 .getInformeData($scope.params)
88 124 .then(function(res) {
89 125 var result = [];
90   - console.log(res);
91   - if (true) {
  126 +
  127 + if ($scope.params.entidad.id === 1 || !$scope.params.entidad.id) {
92 128 result.push({
93 129 cliente: 'Vendedores'
94 130 });
... ... @@ -107,7 +143,7 @@ angular.module('focaModalInforme')
107 143 });
108 144 });
109 145 }
110   - if (true) {
  146 + if ($scope.params.entidad.id === 2 || !$scope.params.entidad.id) {
111 147 result.push({
112 148 cliente: 'Cobradores'
113 149 });
... ... @@ -126,7 +162,7 @@ angular.module('focaModalInforme')
126 162 });
127 163 });
128 164 }
129   - if (true) {
  165 + if ($scope.params.entidad.id === 3 || !$scope.params.entidad.id) {
130 166 result.push({
131 167 cliente: 'Transportistas'
132 168 });
... ... @@ -165,11 +201,10 @@ angular.module('focaModalInforme')
165 201 $scope.cancel = function() {
166 202 $uibModalInstance.dismiss('Cancelar');
167 203 };
168   - $scope.clearSector = function() {
169   - $scope.params.sector = undefined;
  204 + $scope.clearEntidad = function() {
  205 + $scope.params.entidad = undefined;
170 206 };
171 207  
172   -
173 208 }
174 209 ]
175 210 );
src/views/informe-productividad.html
... ... @@ -57,27 +57,22 @@
57 57 </div>
58 58 <small class="col-md-2 col-4 text-left my-1">Entidad</small>
59 59 <div class="col-md-4 col-8 input-group mb-2">
60   - <select class="form-control">
61   - <option value="0">Todos</option>
62   - <option value="1">Vendedores</option>
63   - <option value="2">Cobradores</option>
64   - <option value="3">Transportistas</option>
65   - </select>
66   - <button type="button" class="clear-input text-danger" ng-click="clearSector()">
  60 + <input type="text" class="form-control" ng-model="params.entidad.label" readonly>
  61 + <button type="button" class="clear-input text-danger" ng-click="clearEntidad()">
67 62 <i class="fa fa-times"></i>
68 63 </button>
69   - <!-- <div class="input-group-append">
  64 + <div class="input-group-append">
70 65 <div class="input-group-append" ng-hide="ingreso">
71 66 <button
72 67 ladda="searchLoading"
73 68 data-spinner-color="#FF0000"
74 69 class="btn btn-outline-secondary"
75 70 type="button"
76   - ng-click="seleccionarSector(13)">
  71 + ng-click="seleccionarTipo()">
77 72 <i class="fa fa-search" aria-hidden="true"></i>
78 73 </button>
79 74 </div>
80   - </div> -->
  75 + </div>
81 76 </div>
82 77 </div>
83 78 <div