fix: la pressione del pulsante di chiusura dei ticket nel gruppo 'chiudi a fine giornata' non provoca più l'attivazione dell'azione di consuntivazione a fine giornata
This commit is contained in:
@@ -204,6 +204,34 @@ const App = {
|
||||
refreshBtn.addEventListener('click', () => this.refreshLookups());
|
||||
}
|
||||
|
||||
// Bind button close end of day tickets
|
||||
const btnCloseEod = document.getElementById('btn-close-end-of-day');
|
||||
if (btnCloseEod) {
|
||||
btnCloseEod.addEventListener('click', async (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
const confirmed = await this.confirm(
|
||||
'Chiusura Ticket Fine Giornata',
|
||||
'Sei sicuro di voler chiudere tutti i ticket nel gruppo "CHIUDI A FINE GIORNATA"?\nI ticket rimarranno nel gruppo.'
|
||||
);
|
||||
if (!confirmed) return;
|
||||
|
||||
try {
|
||||
const res = await this.api('/api/groups/close-end-of-day', { method: 'POST' });
|
||||
if (res.count > 0) {
|
||||
Toast.success(res.message);
|
||||
} else {
|
||||
Toast.info(res.message);
|
||||
}
|
||||
this.updateSidebarBadges();
|
||||
this.route();
|
||||
} catch (err) {
|
||||
Toast.error('Errore durante la chiusura dei ticket: ' + err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Initial route
|
||||
window.addEventListener('resize', () => this.updateHeaderHeight());
|
||||
setTimeout(() => this.updateHeaderHeight(), 100);
|
||||
@@ -622,6 +650,9 @@ const App = {
|
||||
}
|
||||
|
||||
const triggerAction = async (e) => {
|
||||
if (e && e.target && e.target.closest('#btn-close-end-of-day')) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const confirmed = await this.confirm(
|
||||
|
||||
Reference in New Issue
Block a user