tutto di troppo: fix visualizzazione email. style: riviste icone invio ed elimina, postato aggiungi ticket al grppo e informazioni laterali da a cc.

This commit is contained in:
Gabriele Cimaschi committed 2026-09-09 11:04:14 +02:00
1 parent 9ae0cec0ca
commit cf500aabb3
7 files changed
+743 -85

No files matched your search

+58 -15
View File
@@ -46,7 +46,25 @@ const TimeAccountingView = {
date: this.selectedDate,
});
const data = await App.api(`/api/tickets/time-accounting/summary?${params}`);
let data = await App.api(`/api/tickets/time-accounting/summary?${params}`);
// If non-working days are hidden, ensure selectedDate is a valid working day
if (!this.showNonWorkingDays) {
const workDays = (data && data.work_days) || [1, 2, 3, 4, 5];
const parts = this.selectedDate.split('-').map(Number);
const d = new Date(parts[0], parts[1] - 1, parts[2]);
let shifted = false;
while (workDays.length > 0 && !workDays.includes(d.getDay())) {
d.setDate(d.getDate() - 1);
shifted = true;
}
if (shifted) {
this.selectedDate = this.formatLocalISO(d);
params.set('date', this.selectedDate);
data = await App.api(`/api/tickets/time-accounting/summary?${params}`);
}
}
this.summaryData = data;
// Auto-select first article if current selection is invalid
@@ -192,22 +210,43 @@ const TimeAccountingView = {
const targetMins = (data && data.target_minutes) || 480;
const workDays = (data && data.work_days) || [1, 2, 3, 4, 5];
// Generate 7 days before and 7 days after selected date (15 days total)
// Generate 2 full weeks of days (15 calendar days if showing all, or 10-11 working days if hiding non-working days)
const dateList = [];
if (this.showNonWorkingDays) {
for (let offset = -7; offset <= 7; offset++) {
const d = new Date(selected);
d.setDate(d.getDate() + offset);
dateList.push(d);
}
} else {
const before = [];
let dPrev = new Date(selected);
while (before.length < 5) {
dPrev.setDate(dPrev.getDate() - 1);
if (workDays.includes(dPrev.getDay())) {
before.unshift(new Date(dPrev));
}
}
const current = new Date(selected);
const after = [];
let dNext = new Date(selected);
while (after.length < 5) {
dNext.setDate(dNext.getDate() + 1);
if (workDays.includes(dNext.getDay())) {
after.push(new Date(dNext));
}
}
dateList.push(...before, current, ...after);
}
const days = [];
for (let offset = -7; offset <= 7; offset++) {
const d = new Date(selected);
d.setDate(d.getDate() + offset);
for (const d of dateList) {
const isoStr = this.formatLocalISO(d);
const dayOfWeek = d.getDay(); // 0 = Sun, 1 = Mon ... 6 = Sat
const isWorkDay = workDays.includes(dayOfWeek);
const isSelected = isoStr === this.selectedDate;
const isToday = isoStr === todayStr;
// Filter out non-working days if toggle is off, unless it's currently selected
if (!isWorkDay && !this.showNonWorkingDays && !isSelected) {
continue;
}
const dayNum = d.getDate();
const weekdayName = weekdays[dayOfWeek];
const monthName = months[d.getMonth()];
@@ -413,9 +452,7 @@ const TimeAccountingView = {
document.getElementById('ta-btn-toggle-nonwork')?.addEventListener('click', () => {
this.showNonWorkingDays = !this.showNonWorkingDays;
localStorage.setItem('otrs_ta_show_non_working_days', this.showNonWorkingDays);
const container = document.getElementById('view-container');
container.innerHTML = this.buildHtml(this.summaryData);
this.bindEvents();
this.loadData();
});
// Day pill clicks
@@ -428,18 +465,24 @@ const TimeAccountingView = {
// Previous day button
document.getElementById('ta-day-prev')?.addEventListener('click', () => {
const workDays = (this.summaryData && this.summaryData.work_days) || [1, 2, 3, 4, 5];
const parts = this.selectedDate.split('-').map(Number);
const d = new Date(parts[0], parts[1] - 1, parts[2]);
d.setDate(d.getDate() - 1);
do {
d.setDate(d.getDate() - 1);
} while (!this.showNonWorkingDays && workDays.length > 0 && !workDays.includes(d.getDay()));
this.selectedDate = this.formatLocalISO(d);
this.loadData();
});
// Next day button
document.getElementById('ta-day-next')?.addEventListener('click', () => {
const workDays = (this.summaryData && this.summaryData.work_days) || [1, 2, 3, 4, 5];
const parts = this.selectedDate.split('-').map(Number);
const d = new Date(parts[0], parts[1] - 1, parts[2]);
d.setDate(d.getDate() + 1);
do {
d.setDate(d.getDate() + 1);
} while (!this.showNonWorkingDays && workDays.length > 0 && !workDays.includes(d.getDay()));
this.selectedDate = this.formatLocalISO(d);
this.loadData();
});