diff --git a/src/app_modules.js b/src/app_modules.js index 179c6c5..acaf01e 100644 --- a/src/app_modules.js +++ b/src/app_modules.js @@ -1213,6 +1213,7 @@ function TS_IndexElement( var searchKeyInput = safeuuid(); var debounce_search = safeuuid(); var debounce_load = safeuuid(); + var filter_tr = safeuuid(); // Create the container with search bar and table container.innerHTML = html` @@ -1230,6 +1231,7 @@ function TS_IndexElement( /> + @@ -1251,7 +1253,24 @@ function TS_IndexElement( if (hashQuery.has('search')) { searchKeyEl.value = hashQuery.get('search'); } + var filters = {}; + if (hashQuery.has('filter')) { + hashQuery.getAll('filter').forEach((filter) => { + var [key, value] = filter.split(":"); + filters[key] = value; + }); + document.getElementById(filter_tr).innerHTML = 'Filtrando por: ' + Object.entries(filters) + .map(([key, value]) => `${key}`) + .join(', ') + ' - Limpiar filtros'; + } function searchInData(data, searchValue, config) { + if (filters) { + for (var fkey in filters) { + if (data[fkey] != filters[fkey]) { + return false; + } + } + } if (!searchValue) return true; // Search in ID diff --git a/src/page/pagos.js b/src/page/pagos.js index d6bb70c..a425119 100644 --- a/src/page/pagos.js +++ b/src/page/pagos.js @@ -1030,7 +1030,7 @@ PAGES.pagos = {
-

Total Ganancias

+

Total Gastos

0.00€
diff --git a/src/page/personas.js b/src/page/personas.js index 4a6c675..6ec7f23 100644 --- a/src/page/personas.js +++ b/src/page/personas.js @@ -66,7 +66,7 @@ PAGES.personas = { Notas del Monedero


- +
@@ -209,7 +209,7 @@ PAGES.personas = { }); }; document.getElementById(btn_ver_monedero).onclick = () => { - setUrlHash('pagos?search=' + encodeURIComponent(document.getElementById(field_nombre).value)); // Navigate to pagos and show transactions for this person + setUrlHash('pagos?filter=Persona:' + encodeURIComponent(mid)); // Navigate to pagos and show transactions for this person }; document.getElementById(btn_borrar).onclick = () => { if (confirm('¿Quieres borrar esta persona?') == true) {