function formatDate(dateStr) { const d = new Date(dateStr); return d.toLocaleDateString('fr-FR', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }); } function showError(message) { document.getElementById('error').innerHTML = `
${escapeHtml(message)}
`; } (async function init() { await initNav('history'); const params = new URLSearchParams(window.location.search); const id = params.get('id'); const container = document.getElementById('content'); if (!id) { container.innerHTML = '

Concert introuvable.

'; return; } try { const setlist = await api.get(`/api/setlists/${id}`); const main = setlist.songs.filter((s) => !s.is_encore); const encore = setlist.songs.filter((s) => s.is_encore); container.innerHTML = `

${escapeHtml(setlist.name || 'Concert')}

${escapeHtml(setlist.venue || '')} · ${formatDate(setlist.concert_date)}

Setlist

${main.length ? `
    ${main.map((s) => `
  1. ${escapeHtml(s.title)} — ${escapeHtml(s.artist)}${s.note ? `${escapeHtml(s.note)}` : ''}
  2. `).join('')}
` : '

Aucun morceau enregistré.

'}

Rappel

${encore.length ? `
    ${encore.map((s) => `
  1. ${escapeHtml(s.title)} — ${escapeHtml(s.artist)}${s.note ? `${escapeHtml(s.note)}` : ''}
  2. `).join('')}
` : '

Aucun rappel enregistré.

'}
`; } catch (err) { showError(err.message); } })();