Adding info to RSVP form and back to events list button
This commit is contained in:
@@ -445,6 +445,25 @@ const RSVPForm: React.FC = () => {
|
|||||||
<Typography variant="h4" component="h2" gutterBottom color="primary" align="center">
|
<Typography variant="h4" component="h2" gutterBottom color="primary" align="center">
|
||||||
RSVP Form
|
RSVP Form
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
|
{event && (
|
||||||
|
<Box sx={{ mb: 3, textAlign: 'center' }}>
|
||||||
|
<Typography variant="h5" component="h3" gutterBottom>
|
||||||
|
{event.title}
|
||||||
|
</Typography>
|
||||||
|
{event.description && (
|
||||||
|
<Typography variant="body2" color="text.secondary">
|
||||||
|
<strong>Info:</strong> {event.description}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
<Typography variant="body2" color="text.secondary">
|
||||||
|
<strong>Date:</strong> {new Date(event.date).toLocaleString()}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="body2" color="text.secondary">
|
||||||
|
<strong>Location:</strong> {event.location}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<Typography color="error" align="center" sx={{ mb: 2 }}>
|
<Typography color="error" align="center" sx={{ mb: 2 }}>
|
||||||
@@ -652,22 +671,31 @@ const RSVPForm: React.FC = () => {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Box sx={{ display: 'flex', justifyContent: 'space-between', mt: 2, gap: 2 }}>
|
||||||
type="submit"
|
<Button
|
||||||
variant="contained"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
size="large"
|
onClick={() => navigate('/')}
|
||||||
disabled={isSubmitting ||
|
sx={{ flexGrow: 1 }}
|
||||||
!formData.name.trim() ||
|
>
|
||||||
!formData.email_address.trim() ||
|
Back to Events List
|
||||||
!formData.attending ||
|
</Button>
|
||||||
(formData.attending === 'yes' && !formData.bringing_guests) ||
|
<Button
|
||||||
(formData.bringing_guests === 'yes' && (formData.guest_count < 1 || formData.guest_names.some(name => !name.trim())))
|
type="submit"
|
||||||
}
|
variant="contained"
|
||||||
sx={{ mt: 2 }}
|
color="primary"
|
||||||
>
|
disabled={isSubmitting ||
|
||||||
{isSubmitting ? 'Submitting...' : 'Submit RSVP'}
|
!formData.name.trim() ||
|
||||||
</Button>
|
!formData.email_address.trim() ||
|
||||||
|
!formData.attending ||
|
||||||
|
(formData.attending === 'yes' && !formData.bringing_guests) ||
|
||||||
|
(formData.bringing_guests === 'yes' && (formData.guest_count < 1 || formData.guest_names.some(name => !name.trim())))
|
||||||
|
}
|
||||||
|
sx={{ flexGrow: 1 }}
|
||||||
|
>
|
||||||
|
{isSubmitting ? 'Submitting...' : 'Submit RSVP'}
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Paper>
|
</Paper>
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
Reference in New Issue
Block a user