| 166 |
166 |
|
if (!isCurrentMonth) classes.push('other-month');
|
| 167 |
167 |
|
if (isToday) classes.push('today');
|
| 168 |
168 |
|
|
| 169 |
|
- |
html += `<div class="${classes.join(' ')}" data-date="${escAttr(dateKey)}" data-act="eventsCalendar.toggleDayDetail" data-a1="${escAttr(dateKey)}">`;
|
|
169 |
+ |
html += `<div class="${classes.join(' ')}">`;
|
| 170 |
170 |
|
html += `<div class="cal-month-cell-header"><span class="cal-day-number">${cursor.getDate()}</span></div>`;
|
| 171 |
171 |
|
|
| 172 |
172 |
|
// Events first, then what is due: the day's fixed points, then the
|
| 196 |
196 |
|
|
| 197 |
197 |
|
html += '</div></div>';
|
| 198 |
198 |
|
container.innerHTML = html;
|
| 199 |
|
- |
|
| 200 |
|
- |
// Hide day detail when month changes
|
| 201 |
|
- |
const detail = document.getElementById('month-day-detail');
|
| 202 |
|
- |
if (detail) detail.classList.add('hidden');
|
| 203 |
|
- |
}
|
| 204 |
|
- |
|
| 205 |
|
- |
function toggleDayDetail(dateKey) {
|
| 206 |
|
- |
const detail = document.getElementById('month-day-detail');
|
| 207 |
|
- |
if (!detail) return;
|
| 208 |
|
- |
|
| 209 |
|
- |
if (detail.dataset.date === dateKey && !detail.classList.contains('hidden')) {
|
| 210 |
|
- |
detail.classList.add('hidden');
|
| 211 |
|
- |
return;
|
| 212 |
|
- |
}
|
| 213 |
|
- |
|
| 214 |
|
- |
const eventsByDate = groupByDate(monthEvents);
|
| 215 |
|
- |
const dayEvents = eventsByDate.get(dateKey) || [];
|
| 216 |
|
- |
const dayTasks = groupTasksByDueDate(monthTasks).get(dateKey) || [];
|
| 217 |
|
- |
const dateObj = new Date(dateKey + 'T12:00:00');
|
| 218 |
|
- |
const dayLabel = dateObj.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric' });
|
| 219 |
|
- |
|
| 220 |
|
- |
let html = `<h3>${esc(dayLabel)}</h3>`;
|
| 221 |
|
- |
if (dayEvents.length === 0 && dayTasks.length === 0) {
|
| 222 |
|
- |
html += '<p class="no-events-day">Nothing on this day.</p>';
|
| 223 |
|
- |
} else {
|
| 224 |
|
- |
dayEvents.forEach(e => {
|
| 225 |
|
- |
const blockClass = e.blockType ? `block-${e.blockType}` : '';
|
| 226 |
|
- |
html += `<div class="cal-day-detail-event ${blockClass}" data-act="events.open" data-a1="${escAttr(e.id)}">
|
| 227 |
|
- |
<span class="cal-detail-time">${esc(e.timeFormatted)}</span>
|
| 228 |
|
- |
<span class="cal-detail-title">${esc(e.title)}</span>
|
| 229 |
|
- |
${e.location ? `<span class="cal-detail-location">${esc(e.location)}</span>` : ''}
|
| 230 |
|
- |
</div>`;
|
| 231 |
|
- |
});
|
| 232 |
|
- |
dayTasks.forEach(t => {
|
| 233 |
|
- |
const overdue = t.isOverdue ? ' overdue' : '';
|
| 234 |
|
- |
const done = t.status === 'Completed' ? ' done' : '';
|
| 235 |
|
- |
html += `<div class="cal-day-detail-task${overdue}${done}" data-act="taskOverview.open" data-a1="${escAttr(t.id)}">
|
| 236 |
|
- |
<span class="cal-detail-time">Due</span>
|
| 237 |
|
- |
<span class="cal-detail-title">${esc(t.title)}</span>
|
| 238 |
|
- |
${t.projectName ? `<span class="cal-detail-location">${esc(t.projectName)}</span>` : ''}
|
| 239 |
|
- |
</div>`;
|
| 240 |
|
- |
});
|
| 241 |
|
- |
}
|
| 242 |
|
- |
|
| 243 |
|
- |
detail.dataset.date = dateKey;
|
| 244 |
|
- |
detail.innerHTML = html;
|
| 245 |
|
- |
detail.classList.remove('hidden');
|
| 246 |
199 |
|
}
|
| 247 |
200 |
|
|
| 248 |
201 |
|
function prevMonth() { currentMonthDate.setMonth(currentMonthDate.getMonth() - 1); loadMonth(); }
|
| 478 |
431 |
|
prevWeek,
|
| 479 |
432 |
|
nextWeek,
|
| 480 |
433 |
|
goToThisWeek,
|
| 481 |
|
- |
toggleDayDetail,
|
| 482 |
434 |
|
};
|
| 483 |
435 |
|
|
| 484 |
436 |
|
})();
|