Feature: Add RSVP cut-off date functionality
This commit is contained in:
@@ -56,6 +56,15 @@ const RSVPForm: React.FC = () => {
|
||||
axios.get(`/api/events/${slug}/rsvps`)
|
||||
]);
|
||||
|
||||
// Check if event is closed for RSVPs
|
||||
if (eventResponse.data.rsvp_cutoff_date) {
|
||||
const cutoffDate = new Date(eventResponse.data.rsvp_cutoff_date);
|
||||
if (new Date() > cutoffDate) {
|
||||
navigate(`/view/events/${slug}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Process needed items
|
||||
let items: string[] = [];
|
||||
if (eventResponse.data.needed_items) {
|
||||
@@ -291,6 +300,12 @@ const RSVPForm: React.FC = () => {
|
||||
</Typography>
|
||||
)}
|
||||
|
||||
{event?.rsvp_cutoff_date && (
|
||||
<Typography variant="body2" color="text.secondary" align="center" sx={{ mb: 2 }}>
|
||||
<strong>Note:</strong> RSVPs will close on {new Date(event.rsvp_cutoff_date).toLocaleString()}
|
||||
</Typography>
|
||||
)}
|
||||
|
||||
<Box component="form" onSubmit={handleSubmit} sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
||||
<TextField
|
||||
label="Name"
|
||||
|
||||
Reference in New Issue
Block a user