source: Klonkt/src/views/pages/admin-shows.ejs@ 77b6fca

main
Last change on this file since 77b6fca was 8d32dcf, checked in by roboburr <roboburr@…>, 3 months ago

Show agenda + notify-me (premium feature #8) — last of the 8

  • DB: shows (site_id, date, time, city, venue, country, ticket_url, notes).
  • routes/shows.js (public, premium-gated): GET /shows (upcoming shows + notify form), POST /shows/notify (subscribers source 'notify', double opt-in if SMTP; confirm/unsub via the generic /nieuwsbrief links).
  • routes/admin-shows.js (site admin + premium): GET /admin/shows (list + add form + subscriber count), POST / (add; optional notify email to 'notify' subscribers if SMTP is available), POST /:id/delete.
  • SubscriberService.confirmedFor(siteId, source?) — optional source filter ('notify').
  • views: pages/shows.ejs + pages/admin-shows.ejs. Dashboard 📅 Agenda link.

Notify email requires SMTP (like #1/#2 sending); without SMTP the show is saved
and sign-ups still work. node --check passed.

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 4.0 KB
Line 
1<%
2 var ss = (typeof shows !== 'undefined') ? shows : [];
3 var msg = (typeof msg !== 'undefined') ? msg : '';
4 var smtp = (typeof smtp !== 'undefined') ? smtp : false;
5 var nc = (typeof notifyCount !== 'undefined') ? notifyCount : 0;
6%>
7<section class="ash">
8 <p><a href="/admin" class="btn">&larr; Beheer</a></p>
9 <h1>Agenda</h1>
10
11 <% if (msg) { %><div class="ash-msg ash-<%= (typeof msgKind!=='undefined')?msgKind:'' %>"><%= msg %></div><% } %>
12
13 <p class="ash-note"><strong><%= nc %></strong> abonnee(s) voor show-aankondigingen.
14 <% if (!smtp) { %><br>⚠ SMTP niet ingesteld — shows worden opgeslagen, maar notify-mails kunnen pas verstuurd worden zodra je SMTP invult.<% } %></p>
15
16 <form method="POST" action="<%= siteUrlBase %>/admin/shows" class="ash-form">
17 <div class="ash-grid">
18 <label>Datum<input type="date" name="date" required></label>
19 <label>Tijd (optioneel)<input type="time" name="time"></label>
20 <label>Plaats<input type="text" name="city" required placeholder="Amsterdam"></label>
21 <label>Land (optioneel)<input type="text" name="country" placeholder="NL"></label>
22 <label class="ash-wide">Locatie/zaal (optioneel)<input type="text" name="venue" placeholder="Paradiso"></label>
23 <label class="ash-wide">Ticket-URL (optioneel)<input type="url" name="ticket_url" placeholder="https://..."></label>
24 <label class="ash-wide">Notitie (optioneel)<input type="text" name="notes" placeholder="Support: ..."></label>
25 </div>
26 <label class="ash-check"><input type="checkbox" name="notify" value="1" <%= smtp ? '' : 'disabled' %>> Abonnees per e-mail op de hoogte brengen<%= smtp ? '' : ' (SMTP vereist)' %></label>
27 <button type="submit" class="ash-add">+ Show toevoegen</button>
28 </form>
29
30 <% if (ss.length) { %>
31 <ul class="ash-list">
32 <% ss.forEach(function(s){ %>
33 <li class="ash-item">
34 <span class="ash-when"><%= s.date %><% if (s.time) { %> <%= s.time %><% } %></span>
35 <span class="ash-where"><%= s.city %><% if (s.venue) { %> — <%= s.venue %><% } %></span>
36 <form method="POST" action="<%= siteUrlBase %>/admin/shows/<%= s.id %>/delete" onsubmit="return confirm('Show verwijderen?')" style="margin:0">
37 <button type="submit" class="ash-del">🗑</button>
38 </form>
39 </li>
40 <% }); %>
41 </ul>
42 <% } else { %>
43 <p class="ash-empty">Nog geen shows.</p>
44 <% } %>
45</section>
46
47<style>
48 .ash { max-width: 680px; margin: 0 auto; padding: 24px 18px 64px; }
49 .ash h1 { margin: .4rem 0 14px; }
50 .ash-msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
51 .ash-ok { background: rgba(60,160,90,.15); } .ash-bad { background: rgba(200,60,60,.15); }
52 .ash-note { font-size: 13px; opacity: .8; margin: 0 0 18px; }
53 .ash-form { border: 1px solid rgba(128,128,128,.2); border-radius: 14px; padding: 16px; margin-bottom: 24px; }
54 .ash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
55 .ash-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; }
56 .ash-grid .ash-wide { grid-column: 1 / -1; }
57 .ash-grid input { padding: 9px 11px; border-radius: 8px; border: 1px solid rgba(128,128,128,.4); background: transparent; color: inherit; font: inherit; font-weight: 400; }
58 .ash-check { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 13.5px; }
59 .ash-add { padding: 10px 18px; border-radius: 10px; border: none; background: var(--accent,#6b8f71); color: #fff; font-weight: 600; cursor: pointer; }
60 .ash-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
61 .ash-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid rgba(128,128,128,.18); border-radius: 10px; }
62 .ash-when { font-variant-numeric: tabular-nums; font-weight: 600; flex: 0 0 auto; }
63 .ash-where { flex: 1 1 auto; opacity: .85; }
64 .ash-del { background: none; border: none; cursor: pointer; font-size: 16px; opacity: .6; }
65 .ash-empty { opacity: .7; }
66</style>
Note: See TracBrowser for help on using the repository browser.