Commit 208f4a879595653d7fce7c30e27726bedd813ace
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master See merge request !13
Showing
2 changed files
Show diff stats
src/js/controllerModal.js
| ... | ... | @@ -23,31 +23,50 @@ angular.module('focaModal') |
| 23 | 23 | $scope.busquedaPress = function(key) { |
| 24 | 24 | if(key === 13) { |
| 25 | 25 | $scope.searchLoading = true; |
| 26 | - focaModalService.getEntidad( | |
| 27 | - $scope.filters, | |
| 28 | - parametrosModal.query, | |
| 29 | - parametrosModal.tipo, | |
| 30 | - parametrosModal.json | |
| 31 | - ).then( | |
| 32 | - function(res) { | |
| 33 | - $scope.searchLoading = false; | |
| 34 | - $scope.primerBusqueda = true; | |
| 35 | - $scope.entidades = res.data; | |
| 36 | - filtros($scope.entidades); | |
| 37 | - $scope.search(true); | |
| 38 | - } | |
| 39 | - ); | |
| 26 | + if (parametrosModal.query) { | |
| 27 | + focaModalService.getEntidad( | |
| 28 | + $scope.filters, | |
| 29 | + parametrosModal.query, | |
| 30 | + parametrosModal.tipo, | |
| 31 | + parametrosModal.json | |
| 32 | + ).then( | |
| 33 | + function(res) { | |
| 34 | + $scope.searchLoading = false; | |
| 35 | + $scope.primerBusqueda = true; | |
| 36 | + $scope.entidades = res.data; | |
| 37 | + filtros($scope.entidades); | |
| 38 | + $scope.search(true); | |
| 39 | + } | |
| 40 | + ); | |
| 41 | + } else { | |
| 42 | + $scope.searchLoading = false; | |
| 43 | + $scope.primerBusqueda = true; | |
| 44 | + $scope.entidades = parametrosModal.data; | |
| 45 | + filtros($scope.entidades); | |
| 46 | + $scope.search(true); | |
| 47 | + } | |
| 40 | 48 | } |
| 41 | 49 | }; |
| 42 | - $scope.busquedaPress(13); | |
| 43 | 50 | function filtros(entidades) { |
| 44 | 51 | for (var i = 0; i < $scope.parametrosModal.columnas.length; i++) { |
| 45 | 52 | var filtro = $scope.parametrosModal.columnas[i].filtro; |
| 46 | 53 | if (filtro) { |
| 47 | - for (var j = 0; j < entidades.length; j++) { | |
| 48 | - entidades[j][$scope.parametrosModal.columnas[i].propiedad] = | |
| 49 | - $filter(filtro.nombre)(entidades[j][$scope | |
| 50 | - .parametrosModal.columnas[i].propiedad], filtro.parametro); | |
| 54 | + if (filtro.nombre === 'comprobante') { | |
| 55 | + for (var j = 0; j < entidades.length; j++) { | |
| 56 | + var array = []; | |
| 57 | + $scope.parametrosModal.columnas[i].propiedad | |
| 58 | + .forEach(function(prop) { | |
| 59 | + array.push(entidades[j][prop]); | |
| 60 | + }); | |
| 61 | + entidades[j][$scope.parametrosModal.columnas[i].propiedad] = | |
| 62 | + $filter('comprobante')(array); | |
| 63 | + } | |
| 64 | + } else { | |
| 65 | + for (var j = 0; j < entidades.length; j++) { | |
| 66 | + entidades[j][$scope.parametrosModal.columnas[i].propiedad] = | |
| 67 | + $filter(filtro.nombre)(entidades[j][$scope | |
| 68 | + .parametrosModal.columnas[i].propiedad], filtro.parametro); | |
| 69 | + } | |
| 51 | 70 | } |
| 52 | 71 | } |
| 53 | 72 | } |
| ... | ... | @@ -177,5 +196,6 @@ angular.module('focaModal') |
| 177 | 196 | $scope.selectedEntidad = 0; |
| 178 | 197 | } |
| 179 | 198 | } |
| 199 | + $scope.busquedaPress(13); | |
| 180 | 200 | }] |
| 181 | 201 | ); |
src/views/foca-modal.html
| ... | ... | @@ -53,15 +53,15 @@ |
| 53 | 53 | </tr> |
| 54 | 54 | <tr class="selected" |
| 55 | 55 | ng-repeat="(key, entidad) in currentPageEntidades" |
| 56 | - ng-click="select(entidad)" | |
| 56 | + ng-click="!parametrosModal.soloMostrar ? select(entidad) : null" | |
| 57 | 57 | > |
| 58 | 58 | <td |
| 59 | 59 | ng-repeat="columna in parametrosModal.columnas" |
| 60 | 60 | ng-bind="entidad[columna.propiedad]"></td> |
| 61 | - <td class="d-md-none text-primary"> | |
| 61 | + <td class="d-md-none text-primary" ng-if="!parametrosModal.soloMostrar"> | |
| 62 | 62 | <i class="fa fa-circle-thin" aria-hidden="true"></i> |
| 63 | 63 | </td> |
| 64 | - <td class="d-none d-md-table-cell"> | |
| 64 | + <td class="d-none d-md-table-cell" ng-if="!parametrosModal.soloMostrar"> | |
| 65 | 65 | <button |
| 66 | 66 | type="button" |
| 67 | 67 | class="btn btn-xs p-1 float-right" |