Fix event capacity: no negative availability, sold-out enforcement, admin override

- Backend: use calculateAvailableSeats so availableSeats is never negative
- Backend: reject public booking when confirmed >= capacity; admin create/manual bypass capacity
- Frontend: spotsLeft = max(0, capacity - bookedCount), isSoldOut when bookedCount >= capacity
- Frontend: sold-out redirect on booking page, cap quantity by spotsLeft, never show negative

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Michilis
2026-02-12 03:01:58 +00:00
parent 8315029091
commit fe75912f23
8 changed files with 61 additions and 68 deletions

View File

@@ -619,7 +619,7 @@ export default function AdminEventDetailPage() {
<div>
<p className="font-medium">Capacity</p>
<p className="text-gray-600">{confirmedCount + checkedInCount} / {event.capacity} spots filled</p>
<p className="text-sm text-gray-500">{event.capacity - confirmedCount - checkedInCount} spots remaining</p>
<p className="text-sm text-gray-500">{Math.max(0, event.capacity - confirmedCount - checkedInCount)} spots remaining</p>
</div>
</div>
</div>