fix: ora le ricerche lavorano nuovamente in cache. feat: aggiunto pulsante per eliminare rapidamente una ricerca testuale.

This commit is contained in:
Gabriele Cimaschi committed 2026-08-26 14:13:16 +02:00
1 parent 37c5f0c500
commit c5e17ca57a
2 files changed
+249 -78

No files matched your search

+37 -7
View File
@@ -346,7 +346,10 @@ const Filters = {
</div>
<div class="filter-group">
<span class="filter-label">Cerca in Cache</span>
<input type="text" class="filter-select form-input" data-filter="sub_search" id="filter-sub-search" value="${App.escapeHtml(this.state.sub_search || '')}" placeholder="Filtra testo..." style="width: 140px; padding: 4px 8px; font-family: inherit; font-size: 0.85rem;" autocomplete="off" />
<div style="position:relative; display:inline-flex; align-items:center;">
<input type="text" class="filter-select form-input" data-filter="sub_search" id="filter-sub-search" value="${App.escapeHtml(this.state.sub_search || '')}" placeholder="Filtra testo (Invio)..." title="Digita e premi Invio per filtrare i risultati in cache" style="width: 140px; padding: 4px 22px 4px 8px; font-family: inherit; font-size: 0.85rem;" autocomplete="off" />
<button type="button" id="filter-sub-search-clear" style="position:absolute; right:6px; top:50%; transform:translateY(-50%); background:none; border:none; color:var(--text-muted); cursor:pointer; display:${this.state.sub_search ? 'flex' : 'none'}; align-items:center; justify-content:center; padding:0; font-size:12px; line-height:1;" title="Cancella testo in cache">✕</button>
</div>
</div>
<div class="filters-actions" style="display:flex; gap:6px; align-items:center;">
<button class="btn btn-primary btn-xs" id="filter-refresh" title="Aggiorna lista ticket" style="display:inline-flex; align-items:center; gap:4px; height:26px; padding:0 10px; font-size:0.78rem;">
@@ -372,12 +375,39 @@ const Filters = {
});
if (sel.tagName === 'INPUT' && sel.type === 'text') {
sel.addEventListener('input', (e) => {
this.selectedPresetId = null;
this.state[e.target.dataset.filter] = e.target.value;
this.save();
if (onFilterChange) onFilterChange();
});
if (sel.dataset.filter === 'sub_search') {
const clearBtn = document.getElementById('filter-sub-search-clear');
sel.addEventListener('input', () => {
if (clearBtn) clearBtn.style.display = sel.value.trim() ? 'flex' : 'none';
});
sel.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
e.preventDefault();
this.selectedPresetId = null;
this.state[e.target.dataset.filter] = e.target.value;
this.save();
if (onFilterChange) onFilterChange();
}
});
if (clearBtn) {
clearBtn.addEventListener('click', (e) => {
e.stopPropagation();
sel.value = '';
clearBtn.style.display = 'none';
this.selectedPresetId = null;
this.state.sub_search = '';
this.save();
if (onFilterChange) onFilterChange();
});
}
} else {
sel.addEventListener('input', (e) => {
this.selectedPresetId = null;
this.state[e.target.dataset.filter] = e.target.value;
this.save();
if (onFilterChange) onFilterChange();
});
}
}
});