fix: corretta pulizia delle code quando si passa con il tab. feat: aggiunto shortcut per tornare alla pagina ticket.

This commit is contained in:
Gabriele Cimaschi committed 2026-09-14 11:57:02 +02:00
1 parent c33a7a4666
commit 1bc3d8bf8a
4 files changed
+29 -5

No files matched your search

+6
View File
@@ -66,6 +66,7 @@ const App = {
quick_edit_save: { ctrl: true, alt: false, shift: false, key: 'Enter', enabled: true }, quick_edit_save: { ctrl: true, alt: false, shift: false, key: 'Enter', enabled: true },
pdf_save_edited: { ctrl: true, alt: false, shift: false, key: 'Enter', enabled: true }, pdf_save_edited: { ctrl: true, alt: false, shift: false, key: 'Enter', enabled: true },
ricerca_spudorata_open: { ctrl: true, alt: false, shift: true, key: 'f', enabled: true }, ricerca_spudorata_open: { ctrl: true, alt: false, shift: true, key: 'f', enabled: true },
ticket_list_open: { ctrl: true, alt: false, shift: true, key: 'Backspace', enabled: true },
}; };
return defaults[id] || { ctrl: true, alt: false, shift: false, key: 'Enter', enabled: true }; return defaults[id] || { ctrl: true, alt: false, shift: false, key: 'Enter', enabled: true };
}, },
@@ -295,6 +296,11 @@ const App = {
searchInput.select(); searchInput.select();
} }
} }
} else if (this.isShortcutTriggered(e, 'ticket_list_open')) {
if (window.location.hash !== '#/tickets' && window.location.hash !== '') {
e.preventDefault();
window.location.hash = '#/tickets';
}
} }
}); });
+7
View File
@@ -72,6 +72,13 @@ const ShortcutsView = {
context: 'Globale', context: 'Globale',
defaultCombo: { ctrl: true, alt: false, shift: true, key: 'f', enabled: true } defaultCombo: { ctrl: true, alt: false, shift: true, key: 'f', enabled: true }
}, },
{
id: 'ticket_list_open',
name: 'Torna a Elenco Ticket',
description: 'Naviga direttamente alla pagina principale dell\'elenco ticket',
context: 'Globale',
defaultCombo: { ctrl: true, alt: false, shift: true, key: 'Backspace', enabled: true }
},
{ {
id: 'create_ticket_submit', id: 'create_ticket_submit',
name: 'Invia Nuovo Ticket', name: 'Invia Nuovo Ticket',
+13 -3
View File
@@ -3577,7 +3577,12 @@ const TicketDetailView = {
queueSearchInput.addEventListener('input', () => { queueSearchInput.addEventListener('input', () => {
clearTimeout(queueDebounce); clearTimeout(queueDebounce);
const q = queueSearchInput.value.trim(); const q = queueSearchInput.value.trim();
if (queueIdInput) queueIdInput.value = ''; const origQueueName = (this.originalValues['queue_name'] || '').trim();
if (q !== origQueueName) {
if (queueIdInput) queueIdInput.value = '';
} else {
if (queueIdInput) queueIdInput.value = String(this.originalValues['queue_id'] || '');
}
checkChanges(); checkChanges();
queueDebounce = setTimeout(async () => { queueDebounce = setTimeout(async () => {
@@ -3699,8 +3704,13 @@ const TicketDetailView = {
saveBtn.addEventListener('click', async () => { saveBtn.addEventListener('click', async () => {
const queueSearch = queueSearchInput ? queueSearchInput.value.trim() : ''; const queueSearch = queueSearchInput ? queueSearchInput.value.trim() : '';
if (queueSearchInput && !queueIdInput.value) { if (queueSearchInput && !queueIdInput.value) {
Toast.warning('Seleziona una coda valida dall\'elenco.'); const origName = (this.originalValues['queue_name'] || '').trim();
return; if (queueSearch === origName && this.originalValues['queue_id']) {
queueIdInput.value = String(this.originalValues['queue_id']);
} else {
Toast.warning('Seleziona una coda valida dall\'elenco.');
return;
}
} }
const customerSearch = customerSearchInput ? customerSearchInput.value.trim() : ''; const customerSearch = customerSearchInput ? customerSearchInput.value.trim() : '';
+3 -2
View File
@@ -916,8 +916,8 @@ router.patch('/:id', async (req, res) => {
if (updates.type_id !== undefined) ticketFields.TypeID = updates.type_id; if (updates.type_id !== undefined) ticketFields.TypeID = updates.type_id;
if (updates.title !== undefined) ticketFields.Title = updates.title; if (updates.title !== undefined) ticketFields.Title = updates.title;
if (updates.ticket_lock_id !== undefined) ticketFields.LockID = updates.ticket_lock_id; if (updates.ticket_lock_id !== undefined) ticketFields.LockID = updates.ticket_lock_id;
if (updates.customer_id !== undefined) ticketFields.CustomerID = updates.customer_id; if (updates.customer_id !== undefined && updates.customer_id !== null && updates.customer_id !== '') ticketFields.CustomerID = updates.customer_id;
if (updates.customer_user_id !== undefined) ticketFields.CustomerUser = updates.customer_user_id; if (updates.customer_user_id !== undefined && updates.customer_user_id !== null && updates.customer_user_id !== '') ticketFields.CustomerUser = updates.customer_user_id;
// If ticketFields is empty but we have a note or timeUnit to log, supply a dummy field (StateID) so Ticket is not empty // If ticketFields is empty but we have a note or timeUnit to log, supply a dummy field (StateID) so Ticket is not empty
if (Object.keys(ticketFields).length === 0 && (hasNote || (!isNaN(timeUnit) && timeUnit > 0))) { if (Object.keys(ticketFields).length === 0 && (hasNote || (!isNaN(timeUnit) && timeUnit > 0))) {
@@ -986,6 +986,7 @@ router.patch('/:id', async (req, res) => {
const client = await pool.connect(); const client = await pool.connect();
try { try {
await client.query('BEGIN'); await client.query('BEGIN');
const localNow = getLocalTimestamp();
// If state is changing, check if the target state is a closed state type to auto-unlock // If state is changing, check if the target state is a closed state type to auto-unlock
if (updates.ticket_state_id && updates.ticket_state_id !== current.ticket_state_id) { if (updates.ticket_state_id && updates.ticket_state_id !== current.ticket_state_id) {