diff --git a/public/js/calendar.js b/public/js/calendar.js
index f91fbab..0cfe1bd 100644
--- a/public/js/calendar.js
+++ b/public/js/calendar.js
@@ -61,6 +61,20 @@ function concertLinksHtml(concert) {
`;
}
+function rehearsalInfoHtml(r) {
+ const linkArgs = { uid: `rehearsal-${r.id}`, title: 'Répétition Octane', startISO: r.startsAt, endISO: r.endsAt, location: r.location };
+ return `
+
+
Répétition proposée
+
${r.location ? escapeHtml(r.location) + ' · ' : ''}${formatTime(r.startsAt)} – ${formatTime(r.endsAt)} · Proposée par ${escapeHtml(r.proposedByName)}
+ ${rehearsalAcceptedByHtml(r)}
+
+ ${calendarLinksMenuHtml(linkArgs, 'repetition.ics')}
+
+
+ `;
+}
+
async function loadLastChecked() {
const { last_checked } = await api.get('/api/calendar/last-checked');
const el = document.getElementById('last-checked');
@@ -199,14 +213,16 @@ function renderCalendar() {
}
cell.appendChild(dotsEl);
- cell.addEventListener('click', () => openModal(date, slot, visible, concert));
+ cell.addEventListener('click', () => openModal(date, slot, visible, concert, rehearsal));
const countEl = document.createElement('div');
countEl.className = 'cell-count';
countEl.textContent = avail.length + '/' + visible.length;
cell.appendChild(countEl);
} else if (concert) {
- cell.addEventListener('click', () => openModal(date, null, [], concert));
+ cell.addEventListener('click', () => openModal(date, null, [], concert, rehearsal));
+ } else if (rehearsal) {
+ cell.addEventListener('click', () => openModal(date, null, [], null, rehearsal));
} else {
cell.classList.add('empty');
const lbl = document.createElement('div');
@@ -286,7 +302,7 @@ function pollWorkflowStatus(btn, maxMs = 180000, intervalMs = 4000) {
}, intervalMs);
}
-function openModal(date, slot, visible, concert) {
+function openModal(date, slot, visible, concert, rehearsal) {
const avail = visible.filter((p) => p.is_available);
const busy = visible.filter((p) => !p.is_available);
@@ -314,6 +330,9 @@ function openModal(date, slot, visible, concert) {
const concertSection = document.getElementById('modal-concert-section');
concertSection.innerHTML = concert ? concertLinksHtml(concert) : '';
+ const rehearsalSection = document.getElementById('modal-rehearsal-section');
+ rehearsalSection.innerHTML = rehearsal ? rehearsalInfoHtml(rehearsal) : '';
+
const renderPeople = (list, containerId) => {
const el = document.getElementById(containerId);
el.innerHTML = '';
diff --git a/src/routes/rehearsals.js b/src/routes/rehearsals.js
index 1b2c7e6..d8b9835 100644
--- a/src/routes/rehearsals.js
+++ b/src/routes/rehearsals.js
@@ -47,6 +47,7 @@ router.post(
location: location ? location.trim() : null,
proposedBy: req.user.id,
});
+ await rehearsalsRepo.upsertVote(rehearsal.id, req.user.id, 'accept');
discord.notifyAll(
discord.rehearsalProposedMessage({ userName: req.user.name, startsAt: rehearsal.starts_at, location: rehearsal.location })
);