feat: aggiunto shortcut per aggiungere il ticket in una nuova scheda. style: spostata consuntivazione accanto ad utente cliente.
This commit is contained in:
1 parent
107ba10689
commit
ce904756dd
6 files changed
+151
-9
No files matched your search
+53
-1
@@ -69,6 +69,7 @@ const App = {
|
||||
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 },
|
||||
open_terminal_console: { ctrl: true, alt: true, shift: false, key: 't', enabled: true },
|
||||
add_ticket_tab: { ctrl: true, alt: true, shift: false, key: 's', enabled: true },
|
||||
};
|
||||
return defaults[id] || { ctrl: true, alt: false, shift: false, key: 'Enter', enabled: true };
|
||||
},
|
||||
@@ -123,11 +124,18 @@ const App = {
|
||||
return text.replace(urlRegex, url => `<a href="${url}" target="_blank" rel="noopener noreferrer" style="color:var(--accent-primary); text-decoration:underline;">${url}</a>`);
|
||||
},
|
||||
|
||||
openTab(id, tn, title) {
|
||||
openTab(id, tn, title, notify = false) {
|
||||
const exists = this.tabs.find(t => String(t.id) === String(id));
|
||||
if (!exists) {
|
||||
this.tabs.push({ id, tn, title });
|
||||
this.saveTabs();
|
||||
if (notify && typeof Toast !== 'undefined') {
|
||||
Toast.success(`Ticket #${tn || id} aggiunto alle schede!`);
|
||||
}
|
||||
} else {
|
||||
if (notify && typeof Toast !== 'undefined') {
|
||||
Toast.info(`Ticket #${tn || id} è già nelle schede`);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -311,6 +319,50 @@ const App = {
|
||||
if (consoleObj) {
|
||||
consoleObj.toggle();
|
||||
}
|
||||
} else if (this.isShortcutTriggered(e, 'add_ticket_tab')) {
|
||||
e.preventDefault();
|
||||
// 1. Check if in ticket detail
|
||||
const detailTabBtn = document.querySelector('.ticket-header .open-tab-btn, .ticket-detail .open-tab-btn');
|
||||
if (detailTabBtn) {
|
||||
detailTabBtn.click();
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Check if multiple tickets selected in list
|
||||
const selectedRows = document.querySelectorAll('.ticket-table tbody tr.selected, .results-table tbody tr.selected');
|
||||
if (selectedRows.length > 0) {
|
||||
let count = 0;
|
||||
selectedRows.forEach(row => {
|
||||
const tabBtn = row.querySelector('.open-tab-btn');
|
||||
if (tabBtn) {
|
||||
const id = tabBtn.dataset.id;
|
||||
const tn = tabBtn.dataset.tn;
|
||||
const title = tabBtn.dataset.title || '';
|
||||
if (id) {
|
||||
this.openTab(parseInt(id, 10), tn, title);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (count > 0 && typeof Toast !== 'undefined') {
|
||||
Toast.success(`${count} ticket aggiunti alle schede!`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Check hovered or focused row in any ticket table/list
|
||||
const hoveredRow = document.querySelector('.ticket-table tbody tr:hover, .results-table tbody tr:hover, .ticket-table tbody tr:focus-within, .results-table tbody tr:focus-within');
|
||||
if (hoveredRow) {
|
||||
const tabBtn = hoveredRow.querySelector('.open-tab-btn');
|
||||
if (tabBtn) {
|
||||
tabBtn.click();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof Toast !== 'undefined') {
|
||||
Toast.info('Seleziona o apri un ticket per aggiungerlo in scheda');
|
||||
}
|
||||
}
|
||||
}, true);
|
||||
|
||||
|
||||
Reference in new issue
Block a user