feat: aggiunta ricerca testuale in cache nella pagina ricerca spudorata.
This commit is contained in:
1 parent
8d24759a15
commit
a36e501596
4 files changed
+261
-254
No files matched your search
@@ -14,6 +14,7 @@ const Filters = {
|
||||
customer_user_id: '',
|
||||
date_from: '',
|
||||
date_to: '',
|
||||
sub_search: '',
|
||||
},
|
||||
my: {
|
||||
queue_id: '',
|
||||
@@ -23,6 +24,7 @@ const Filters = {
|
||||
customer_user_id: '',
|
||||
date_from: '',
|
||||
date_to: '',
|
||||
sub_search: '',
|
||||
},
|
||||
spudorata: {
|
||||
queue_id: '',
|
||||
@@ -32,6 +34,7 @@ const Filters = {
|
||||
customer_user_id: '',
|
||||
date_from: '',
|
||||
date_to: '',
|
||||
sub_search: '',
|
||||
}
|
||||
},
|
||||
|
||||
@@ -93,7 +96,7 @@ const Filters = {
|
||||
|
||||
/** Reset all filters */
|
||||
reset() {
|
||||
this.state = { queue_id: '', state_id: '', priority_id: '', user_id: '', customer_user_id: '', date_from: '', date_to: '' };
|
||||
this.state = { queue_id: '', state_id: '', priority_id: '', user_id: '', customer_user_id: '', date_from: '', date_to: '', sub_search: '' };
|
||||
if (this.currentMode === 'my') {
|
||||
const activeAgentId = localStorage.getItem('activeAgentId') || '1';
|
||||
this.state.user_id = activeAgentId;
|
||||
@@ -341,6 +344,10 @@ const Filters = {
|
||||
<span class="filter-label">A Data/Ora</span>
|
||||
<input type="datetime-local" class="filter-select" data-filter="date_to" id="filter-date-to" value="${this.state.date_to || ''}" style="width: 170px; padding: 4px 8px; font-family: inherit; font-size: 0.85rem;" />
|
||||
</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>
|
||||
<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;">
|
||||
🔄 Aggiorna
|
||||
@@ -363,6 +370,15 @@ const Filters = {
|
||||
this.save();
|
||||
if (onFilterChange) onFilterChange();
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Helper to bind standard multiselect popover events
|
||||
|
||||
@@ -324,6 +324,30 @@ const RicercaSpudorataView = {
|
||||
let list = [...this.cachedTickets];
|
||||
const s = Filters.state;
|
||||
|
||||
if (s.sub_search) {
|
||||
const q = String(s.sub_search).toLowerCase().trim();
|
||||
if (q) {
|
||||
list = list.filter(t => {
|
||||
const fields = [
|
||||
t.tn,
|
||||
t.title,
|
||||
t.queue_name,
|
||||
t.state_name,
|
||||
t.priority_name,
|
||||
t.owner_first,
|
||||
t.owner_last,
|
||||
`${t.owner_first || ''} ${t.owner_last || ''}`,
|
||||
t.customer_first,
|
||||
t.customer_last,
|
||||
`${t.customer_first || ''} ${t.customer_last || ''}`,
|
||||
t.customer_id,
|
||||
t.customer_user_id
|
||||
];
|
||||
return fields.some(f => f && String(f).toLowerCase().includes(q));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (s.state_id) {
|
||||
const selectedStates = String(s.state_id).split(',').filter(Boolean);
|
||||
list = list.filter(t => selectedStates.includes(String(t.ticket_state_id)));
|
||||
|
||||
Reference in new issue
Block a user