Show specific counts and amounts in confirmation bars

This commit is contained in:
Ian Gulliver
2025-12-30 12:14:44 -08:00
parent 06221a0d16
commit 772f804de6
2 changed files with 7 additions and 2 deletions

View File

@@ -367,7 +367,8 @@ func handleDonateSuccess(w http.ResponseWriter, r *http.Request) {
log.Println("[ERROR] failed to process payment:", err) log.Println("[ERROR] failed to process payment:", err)
} }
http.Redirect(w, r, fmt.Sprintf("/%s?donated=1", eventID), http.StatusSeeOther) amount := float64(sess.AmountTotal) / 100
http.Redirect(w, r, fmt.Sprintf("/%s?donated=%.2f", eventID, amount), http.StatusSeeOther)
} }
func handleStripeWebhook(w http.ResponseWriter, r *http.Request) { func handleStripeWebhook(w http.ResponseWriter, r *http.Request) {

View File

@@ -179,7 +179,9 @@
const eventId = 'afac26'; const eventId = 'afac26';
if (new URLSearchParams(location.search).get('donated') === '1') { const donatedAmount = new URLSearchParams(location.search).get('donated');
if (donatedAmount) {
document.getElementById('thank-you').textContent = `Thank you for your $${parseFloat(donatedAmount).toFixed(2)} donation!`;
document.getElementById('thank-you').style.display = 'block'; document.getElementById('thank-you').style.display = 'block';
history.replaceState({}, '', location.pathname); history.replaceState({}, '', location.pathname);
} }
@@ -269,6 +271,8 @@
location.href = data.url; location.href = data.url;
} else { } else {
updateUI(data); updateUI(data);
const word = data.numPeople === 1 ? 'person' : 'people';
document.getElementById('rsvp-confirmed').textContent = `Your RSVP has been updated to ${data.numPeople} ${word}.`;
document.getElementById('rsvp-confirmed').style.display = 'block'; document.getElementById('rsvp-confirmed').style.display = 'block';
} }
}); });