Commit c69b29e38e504893abe518ecc067015b67a6d5fb

Authored by Eric Fernandez
1 parent ab97fc8d10
Exists in master and in 1 other branch develop

soporta consultas json

src/js/controllerModal.js
... ... @@ -23,7 +23,12 @@ angular.module('focaModal')
23 23 $scope.busquedaPress = function(key) {
24 24 if(key === 13) {
25 25 $scope.searchLoading = true;
26   - focaModalService.getEntidad($scope.filters, parametrosModal.query).then(
  26 + focaModalService.getEntidad(
  27 + $scope.filters,
  28 + parametrosModal.query,
  29 + parametrosModal.tipo,
  30 + parametrosModal.json
  31 + ).then(
27 32 function(res) {
28 33 $scope.searchLoading = false;
29 34 $scope.primerBusqueda = true;
1 1 angular.module('focaModal')
2   - .service('focaModalService', [
  2 + .factory('focaModalService', [
3 3 '$uibModal', 'API_ENDPOINT', '$http',
4 4 function($uibModal, API_ENDPOINT, $http) {
5 5 return {
... ... @@ -49,8 +49,12 @@ angular.module('focaModal')
49 49 }
50 50 );
51 51 },
52   - getEntidad: function(filters, query) {
53   - return $http.get(API_ENDPOINT.URL + query, {nombre: filters});
  52 + getEntidad: function(filters, query, tipo, json) {
  53 + if (tipo === 'POST') {
  54 + return $http.post(API_ENDPOINT.URL + query, json);
  55 + } else {
  56 + return $http.get(API_ENDPOINT.URL + query, {nombre: filters});
  57 + }
54 58 },
55 59 modalFecha: function(titulo) {
56 60 return $uibModal.open({
src/views/foca-modal.html
... ... @@ -6,7 +6,6 @@
6 6 </div>
7 7 <div class="input-group pr-0 my-2" ng-class="(parametrosModal.size == 'md') ? 'col-lg-12' : 'col-lg-6'">
8 8 <input
9   - ng-disabled="searchLoading"
10 9 type="text"
11 10 class="form-control form-control-sm"
12 11 id="search"