2025-12-29 13:04:15 -08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
<script>document.documentElement.className = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'wa-dark' : 'wa-light';</script>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
<title>Applause for a Cause - HCA Tickets</title>
|
|
|
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@3/dist-cdn/styles/themes/default.css">
|
|
|
|
|
<script type="module" src="https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@3/dist-cdn/webawesome.loader.js"></script>
|
|
|
|
|
<style>
|
|
|
|
|
body {
|
|
|
|
|
font-family: var(--wa-font-sans);
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
margin: 0;
|
|
|
|
|
padding: 1rem;
|
|
|
|
|
}
|
2025-12-29 14:27:59 -08:00
|
|
|
#signin { display: none; flex: 1; align-items: center; justify-content: center; }
|
2025-12-29 13:04:15 -08:00
|
|
|
#main { display: none; width: 100%; max-width: 600px; }
|
|
|
|
|
.header {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 1rem;
|
|
|
|
|
margin-bottom: 2rem;
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
.header img {
|
|
|
|
|
width: 40px;
|
|
|
|
|
height: 40px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
}
|
|
|
|
|
.header .spacer { flex: 1; }
|
2025-12-29 13:17:02 -08:00
|
|
|
.event-header {
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin-bottom: 1.5rem;
|
|
|
|
|
}
|
|
|
|
|
.event-header img {
|
|
|
|
|
height: 120px;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
}
|
|
|
|
|
.event-header p {
|
|
|
|
|
margin: 0.25rem 0;
|
|
|
|
|
opacity: 0.7;
|
|
|
|
|
}
|
|
|
|
|
.rsvp-section {
|
|
|
|
|
margin-top: 1.5rem;
|
|
|
|
|
padding-top: 1.5rem;
|
|
|
|
|
border-top: 1px solid var(--wa-color-neutral-80);
|
|
|
|
|
}
|
|
|
|
|
.rsvp-controls {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 1rem;
|
|
|
|
|
margin-top: 1rem;
|
|
|
|
|
}
|
2025-12-29 14:20:03 -08:00
|
|
|
.donation-options {
|
|
|
|
|
margin-top: 1rem;
|
|
|
|
|
padding-top: 1rem;
|
|
|
|
|
border-top: 1px solid var(--wa-color-neutral-80);
|
|
|
|
|
}
|
|
|
|
|
.donation-options label {
|
|
|
|
|
display: block;
|
|
|
|
|
margin: 0.5rem 0;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
.custom-amount {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
margin-left: 1.5rem;
|
|
|
|
|
}
|
|
|
|
|
.thank-you {
|
|
|
|
|
background: var(--wa-color-success-95);
|
|
|
|
|
color: var(--wa-color-success-30);
|
|
|
|
|
padding: 1rem;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
}
|
|
|
|
|
.wa-dark .thank-you {
|
|
|
|
|
background: var(--wa-color-success-20);
|
|
|
|
|
color: var(--wa-color-success-90);
|
|
|
|
|
}
|
|
|
|
|
.donation-info {
|
|
|
|
|
margin-top: 0.5rem;
|
|
|
|
|
opacity: 0.7;
|
|
|
|
|
}
|
2025-12-29 13:04:15 -08:00
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body style="opacity: 0">
|
|
|
|
|
<div id="signin"></div>
|
|
|
|
|
<div id="main">
|
|
|
|
|
<div class="header">
|
|
|
|
|
<img data-bind="picture" alt="Profile">
|
|
|
|
|
<span data-bind="name"></span>
|
|
|
|
|
<span class="spacer"></span>
|
|
|
|
|
<wa-button variant="neutral" size="small" id="logout-btn">Switch User</wa-button>
|
|
|
|
|
</div>
|
2025-12-29 14:20:03 -08:00
|
|
|
<div id="thank-you" class="thank-you" style="display: none;">
|
|
|
|
|
Thank you for your generous donation!
|
|
|
|
|
</div>
|
2025-12-29 13:17:02 -08:00
|
|
|
<wa-card>
|
|
|
|
|
<div class="event-header">
|
|
|
|
|
<img src="/afac26-logo.png" alt="Applause for a Cause">
|
|
|
|
|
<p>Feb 7, 2026 · 6:30 PM</p>
|
|
|
|
|
<p>Helios Gym</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="rsvp-section">
|
|
|
|
|
<div id="rsvp-prompt">
|
|
|
|
|
<strong>RSVP now!</strong>
|
|
|
|
|
<div class="rsvp-controls">
|
|
|
|
|
<span>Number of people:</span>
|
|
|
|
|
<wa-input type="number" id="num-people" min="1" value="1" style="width: 80px;"></wa-input>
|
|
|
|
|
</div>
|
2025-12-29 14:20:03 -08:00
|
|
|
<div class="donation-options">
|
|
|
|
|
<strong>Would you like to make a donation?</strong>
|
|
|
|
|
<label><input type="radio" name="donation" value="25" checked> $25 suggested donation per family</label>
|
|
|
|
|
<label><input type="radio" name="donation" value="custom"> Other amount</label>
|
|
|
|
|
<div class="custom-amount" id="custom-amount-row" style="display: none;">
|
|
|
|
|
$<wa-input type="number" id="custom-amount" min="1" value="25" style="width: 100px;"></wa-input>
|
|
|
|
|
</div>
|
|
|
|
|
<label><input type="radio" name="donation" value="0"> Maybe later</label>
|
|
|
|
|
</div>
|
|
|
|
|
<wa-button variant="brand" id="rsvp-btn" style="margin-top: 1rem;">RSVP</wa-button>
|
2025-12-29 13:17:02 -08:00
|
|
|
</div>
|
|
|
|
|
<div id="rsvp-status" style="display: none;">
|
|
|
|
|
<strong id="rsvp-message"></strong>
|
2025-12-29 14:20:03 -08:00
|
|
|
<div id="donation-status" class="donation-info"></div>
|
2025-12-29 13:17:02 -08:00
|
|
|
<div class="rsvp-controls">
|
|
|
|
|
<span>Change to:</span>
|
|
|
|
|
<wa-input type="number" id="num-people-update" min="0" value="1" style="width: 80px;"></wa-input>
|
|
|
|
|
<wa-button variant="neutral" id="update-btn">Update</wa-button>
|
|
|
|
|
</div>
|
2025-12-29 14:20:03 -08:00
|
|
|
<div class="donation-options">
|
|
|
|
|
<strong>Make an additional donation?</strong>
|
|
|
|
|
<div style="display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem;">
|
|
|
|
|
$<wa-input type="number" id="additional-amount" min="1" value="25" style="width: 100px;"></wa-input>
|
|
|
|
|
<wa-button variant="neutral" id="donate-btn">Donate</wa-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-12-29 13:17:02 -08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-12-29 13:04:15 -08:00
|
|
|
</wa-card>
|
2025-12-29 14:27:59 -08:00
|
|
|
<wa-button variant="text" size="small" href="/" style="margin-top: 2rem; margin-left: 3px;">« Events</wa-button>
|
2025-12-29 13:04:15 -08:00
|
|
|
</div>
|
|
|
|
|
<script type="module">
|
2025-12-29 13:17:02 -08:00
|
|
|
import { auth, logout, api } from '/app.js';
|
2025-12-29 13:04:15 -08:00
|
|
|
|
|
|
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
|
|
|
|
|
document.documentElement.className = e.matches ? 'wa-dark' : 'wa-light';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await auth();
|
|
|
|
|
document.getElementById('main').style.display = 'block';
|
|
|
|
|
document.getElementById('logout-btn').addEventListener('click', logout);
|
|
|
|
|
|
2025-12-29 13:17:02 -08:00
|
|
|
const eventId = 'afac26';
|
|
|
|
|
|
2025-12-29 14:20:03 -08:00
|
|
|
if (new URLSearchParams(location.search).get('donated') === '1') {
|
|
|
|
|
document.getElementById('thank-you').style.display = 'block';
|
|
|
|
|
history.replaceState({}, '', location.pathname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
document.querySelectorAll('input[name="donation"]').forEach(radio => {
|
|
|
|
|
radio.addEventListener('change', () => {
|
|
|
|
|
document.getElementById('custom-amount-row').style.display =
|
|
|
|
|
radio.value === 'custom' && radio.checked ? 'flex' : 'none';
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2025-12-29 13:17:02 -08:00
|
|
|
async function loadRSVP() {
|
|
|
|
|
const data = await api('GET', `/api/rsvp/${eventId}`);
|
|
|
|
|
updateUI(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateUI(data) {
|
|
|
|
|
if (data.numPeople > 0) {
|
|
|
|
|
document.getElementById('rsvp-prompt').style.display = 'none';
|
|
|
|
|
document.getElementById('rsvp-status').style.display = 'block';
|
|
|
|
|
const word = data.numPeople === 1 ? 'person' : 'people';
|
|
|
|
|
document.getElementById('rsvp-message').textContent = `You're RSVPed for ${data.numPeople} ${word}.`;
|
|
|
|
|
document.getElementById('num-people-update').value = data.numPeople;
|
2025-12-29 14:20:03 -08:00
|
|
|
if (data.donation > 0) {
|
|
|
|
|
document.getElementById('donation-status').textContent = `You've donated $${data.donation.toFixed(2)}. Thank you!`;
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementById('donation-status').textContent = '';
|
|
|
|
|
}
|
2025-12-29 13:17:02 -08:00
|
|
|
} else {
|
|
|
|
|
document.getElementById('rsvp-prompt').style.display = 'block';
|
|
|
|
|
document.getElementById('rsvp-status').style.display = 'none';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-29 14:20:03 -08:00
|
|
|
function getSelectedDonation() {
|
|
|
|
|
const selected = document.querySelector('input[name="donation"]:checked');
|
|
|
|
|
if (!selected || selected.value === '0') return 0;
|
|
|
|
|
if (selected.value === 'custom') {
|
|
|
|
|
return parseInt(document.getElementById('custom-amount').value) || 0;
|
|
|
|
|
}
|
|
|
|
|
return parseInt(selected.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function startDonation(amount) {
|
|
|
|
|
const data = await api('POST', `/api/donate/${eventId}`, { amount: amount * 100 });
|
|
|
|
|
location.href = data.url;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-29 13:17:02 -08:00
|
|
|
document.getElementById('rsvp-btn').addEventListener('click', async () => {
|
|
|
|
|
const numPeople = parseInt(document.getElementById('num-people').value) || 1;
|
|
|
|
|
const data = await api('POST', `/api/rsvp/${eventId}`, { numPeople });
|
|
|
|
|
updateUI(data);
|
2025-12-29 14:20:03 -08:00
|
|
|
|
|
|
|
|
const donationAmount = getSelectedDonation();
|
|
|
|
|
if (donationAmount > 0) {
|
|
|
|
|
await startDonation(donationAmount);
|
|
|
|
|
}
|
2025-12-29 13:17:02 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
document.getElementById('update-btn').addEventListener('click', async () => {
|
|
|
|
|
const numPeople = parseInt(document.getElementById('num-people-update').value) || 0;
|
|
|
|
|
const data = await api('POST', `/api/rsvp/${eventId}`, { numPeople });
|
|
|
|
|
updateUI(data);
|
|
|
|
|
});
|
|
|
|
|
|
2025-12-29 14:20:03 -08:00
|
|
|
document.getElementById('donate-btn').addEventListener('click', async () => {
|
|
|
|
|
const amount = parseInt(document.getElementById('additional-amount').value) || 0;
|
|
|
|
|
if (amount > 0) {
|
|
|
|
|
await startDonation(amount);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2025-12-29 13:17:02 -08:00
|
|
|
await loadRSVP();
|
|
|
|
|
|
2025-12-29 13:04:15 -08:00
|
|
|
await customElements.whenDefined('wa-card');
|
|
|
|
|
document.body.style.opacity = 1;
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|