Refactor manejo de URL para eliminar parámetros de búsqueda en la navegación y mejorar la visibilidad de personas en formularios

This commit is contained in:
Naiel
2026-02-23 12:38:28 +00:00
parent 9ab0472e2a
commit 75947d3468
8 changed files with 133 additions and 22 deletions

View File

@@ -621,7 +621,8 @@ function addCategory_Personas(
change_cb = () => {},
label = 'Persona',
open_default = false,
default_empty_text = '- Lista Vacia -'
default_empty_text = '- Lista Vacia -',
show_hidden = false,
) {
var details_0 = document.createElement('details'); // children: img_0, summary_0
//details_0.open = true;
@@ -670,6 +671,7 @@ function addCategory_Personas(
.map((entry) => {
var key = entry['_key'];
var value = entry;
if (value.Oculto == true && !show_hidden) { return; }
if (lastreg != value.Region.toUpperCase()) {
lastreg = value.Region.toUpperCase();
var h3_0 = document.createElement('h2');
@@ -1218,6 +1220,7 @@ function TS_IndexElement(
id="${searchKeyInput}"
placeholder="🔍 Buscar..."
style="width: calc(100% - 18px); padding: 8px; border: 1px solid #ccc; border-radius: 4px; background-color: rebeccapurple; color: white;"
value=""
/>
</th>
</tr>
@@ -1237,7 +1240,11 @@ function TS_IndexElement(
// Add search functionality
const searchKeyEl = document.getElementById(searchKeyInput);
searchKeyEl.addEventListener('input', () => debounce(debounce_search, render, 200, [rows]));
// If there is a preset search value in URL, apply it
var hashQuery = new URLSearchParams(window.location.hash.split('?')[1]);
if (hashQuery.has('search')) {
searchKeyEl.value = hashQuery.get('search');
}
function searchInData(data, searchValue, config) {
if (!searchValue) return true;
@@ -1846,7 +1853,7 @@ var BootIntervalID = setInterval(() => {
SUB_LOGGED_IN = true;
localStorage.setItem('TELESEC_BYPASS_ID', SUB_LOGGED_IN_ID);
SetPages();
open_page(location.hash.replace('#', ''));
open_page(location.hash.replace('#', '').split("?")[0]);
}
if (!data) {
const persona = { Nombre: 'Admin (bypass)', Roles: 'ADMIN,' };
@@ -1883,7 +1890,7 @@ var BootIntervalID = setInterval(() => {
}
} else {
SetPages();
open_page(location.hash.replace('#', ''));
open_page(location.hash.replace('#', '').split("?")[0]);
}
clearInterval(BootIntervalID);
}