fix: ora il timer del tempo consuntivato si aggiorna ogni 60 secondi.

This commit is contained in:
Gabriele Cimaschi committed 2026-08-26 13:58:36 +02:00
1 parent a36e501596
commit 37c5f0c500
3 files changed
+50 -1

No files matched your search

+18 -1
View File
@@ -241,10 +241,16 @@ const App = {
} else {
this.route();
}
// Set periodic refresh for daily time accounting counter (every 60 seconds)
if (!this.dailyTimerInterval) {
this.dailyTimerInterval = setInterval(() => this.updateDailyTimer(), 60000);
}
},
/** Route based on current hash */
route() {
this.updateDailyTimer();
const fullHash = window.location.hash || '#/dashboard';
const hash = fullHash.split('?')[0];
const titleEl = document.getElementById('page-title');
@@ -364,7 +370,18 @@ const App = {
throw new Error(errData.error || errData.message || `HTTP ${response.status}`);
}
return response.json();
const data = await response.json();
// Automatically update daily timer on any system mutation (POST, PUT, PATCH, DELETE)
const method = (options.method || 'GET').toUpperCase();
if (method !== 'GET' && !url.includes('/api/users/time-today')) {
setTimeout(() => {
this.updateDailyTimer();
this.updateSidebarBadges();
}, 100);
}
return data;
},
/** Ensure lookup data is loaded (cached) */
+1
View File
@@ -237,6 +237,7 @@ const TicketListView = {
<option value="50" ${per_page === 50 ? 'selected' : ''}>50</option>
<option value="100" ${per_page === 100 ? 'selected' : ''}>100</option>
<option value="200" ${per_page === 200 ? 'selected' : ''}>200</option>
<option value="500" ${per_page === 500 ? 'selected' : ''}>500</option>
</select>
</div>
`;