Add wallpaper background to all event views
This commit is contained in:
@@ -52,6 +52,7 @@ interface Event {
|
|||||||
location: string;
|
location: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
needed_items?: string[] | string;
|
needed_items?: string[] | string;
|
||||||
|
wallpaper?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EventAdmin: React.FC = () => {
|
const EventAdmin: React.FC = () => {
|
||||||
@@ -121,9 +122,8 @@ const EventAdmin: React.FC = () => {
|
|||||||
itemsBringing = rsvp.items_bringing;
|
itemsBringing = rsvp.items_bringing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemsBringing.length > 0) {
|
// Add items to claimed set
|
||||||
itemsBringing.forEach(item => claimed.add(item));
|
itemsBringing.forEach(item => claimed.add(item));
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error processing items for RSVP:', e);
|
console.error('Error processing items for RSVP:', e);
|
||||||
}
|
}
|
||||||
@@ -134,12 +134,11 @@ const EventAdmin: React.FC = () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Filter out claimed items from needed items
|
// Update state with processed data
|
||||||
const availableItems = items.filter(item => !claimed.has(item));
|
|
||||||
|
|
||||||
setNeededItems(availableItems);
|
|
||||||
setClaimedItems(Array.from(claimed));
|
|
||||||
setRsvps(processedRsvps);
|
setRsvps(processedRsvps);
|
||||||
|
setClaimedItems(Array.from(claimed));
|
||||||
|
// Filter needed items to only show unclaimed ones
|
||||||
|
setNeededItems(items.filter(item => !claimed.has(item)));
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setError('Failed to load event data');
|
setError('Failed to load event data');
|
||||||
@@ -300,302 +299,312 @@ const EventAdmin: React.FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container maxWidth="lg">
|
<Box
|
||||||
<Paper elevation={3} sx={{ p: 4, mt: 4 }}>
|
sx={{
|
||||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 4 }}>
|
minHeight: '100vh',
|
||||||
<Typography variant="h4" component="h2" color="primary">
|
backgroundImage: event?.wallpaper ? `url(${event.wallpaper})` : 'url(https://www.rydertech.us/backgrounds/space1.jpg)',
|
||||||
{event.title} - Admin
|
backgroundSize: 'cover',
|
||||||
</Typography>
|
backgroundPosition: 'center',
|
||||||
<Button
|
py: 4,
|
||||||
variant="outlined"
|
}}
|
||||||
onClick={() => navigate('/')}
|
>
|
||||||
>
|
<Container maxWidth="lg">
|
||||||
Back to Events
|
<Paper elevation={3} sx={{ p: 4, mt: 4 }}>
|
||||||
</Button>
|
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 4 }}>
|
||||||
</Box>
|
<Typography variant="h4" component="h2" color="primary">
|
||||||
|
{event.title} - Admin
|
||||||
{/* Add items status section */}
|
</Typography>
|
||||||
<Box sx={{ mb: 4 }}>
|
<Button
|
||||||
<Typography variant="h6" gutterBottom>
|
variant="outlined"
|
||||||
Items Status
|
onClick={() => navigate('/')}
|
||||||
</Typography>
|
>
|
||||||
<Box sx={{ display: 'flex', gap: 4 }}>
|
Back to Events
|
||||||
<Box>
|
</Button>
|
||||||
<Typography variant="subtitle1" gutterBottom>
|
|
||||||
Still Needed:
|
|
||||||
</Typography>
|
|
||||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
|
||||||
{neededItems.map((item: string, index: number) => (
|
|
||||||
<Chip
|
|
||||||
key={`${item}-${index}`}
|
|
||||||
label={item}
|
|
||||||
color="primary"
|
|
||||||
variant="outlined"
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
{neededItems.length === 0 && (
|
|
||||||
<Typography variant="body2" color="text.secondary">
|
|
||||||
All items have been claimed
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Typography variant="subtitle1" gutterBottom>
|
|
||||||
Claimed Items:
|
|
||||||
</Typography>
|
|
||||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
|
||||||
{claimedItems.map((item: string, index: number) => (
|
|
||||||
<Chip
|
|
||||||
key={`${item}-${index}`}
|
|
||||||
label={item}
|
|
||||||
color="success"
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
{claimedItems.length === 0 && (
|
|
||||||
<Typography variant="body2" color="text.secondary">
|
|
||||||
No items have been claimed yet
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
|
||||||
|
|
||||||
<Typography variant="h6" gutterBottom>
|
{/* Add items status section */}
|
||||||
RSVPs ({rsvps.length})
|
<Box sx={{ mb: 4 }}>
|
||||||
</Typography>
|
<Typography variant="h6" gutterBottom>
|
||||||
|
Items Status
|
||||||
<TableContainer>
|
</Typography>
|
||||||
<Table>
|
<Box sx={{ display: 'flex', gap: 4 }}>
|
||||||
<TableHead>
|
<Box>
|
||||||
<TableRow>
|
<Typography variant="subtitle1" gutterBottom>
|
||||||
<TableCell>Name</TableCell>
|
Still Needed:
|
||||||
<TableCell>Attending</TableCell>
|
</Typography>
|
||||||
<TableCell>Guests</TableCell>
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
||||||
<TableCell>Items Bringing</TableCell>
|
{neededItems.map((item: string, index: number) => (
|
||||||
<TableCell>Actions</TableCell>
|
<Chip
|
||||||
</TableRow>
|
key={`${item}-${index}`}
|
||||||
</TableHead>
|
label={item}
|
||||||
<TableBody>
|
|
||||||
{rsvps.map((rsvp: RSVP) => (
|
|
||||||
<TableRow key={rsvp.id}>
|
|
||||||
<TableCell>{rsvp.name}</TableCell>
|
|
||||||
<TableCell>{rsvp.attending.charAt(0).toUpperCase() + rsvp.attending.slice(1)}</TableCell>
|
|
||||||
<TableCell>
|
|
||||||
{rsvp.bringing_guests === 'yes' ?
|
|
||||||
`${rsvp.guest_count} (${rsvp.guest_names.replace(/\s+/g, ', ')})` :
|
|
||||||
'No'
|
|
||||||
}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell>
|
|
||||||
{(() => {
|
|
||||||
let items: string[] = [];
|
|
||||||
try {
|
|
||||||
if (typeof rsvp.items_bringing === 'string') {
|
|
||||||
try {
|
|
||||||
const parsed = JSON.parse(rsvp.items_bringing);
|
|
||||||
items = Array.isArray(parsed) ? parsed : [];
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error parsing items_bringing JSON in table:', e);
|
|
||||||
}
|
|
||||||
} else if (Array.isArray(rsvp.items_bringing)) {
|
|
||||||
items = rsvp.items_bringing;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error processing items in table:', e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
|
|
||||||
{items.length > 0 ? items.map((item: string, index: number) => (
|
|
||||||
<Chip
|
|
||||||
key={`${item}-${index}`}
|
|
||||||
label={item}
|
|
||||||
color="success"
|
|
||||||
size="small"
|
|
||||||
variant={claimedItems.includes(item) ? "filled" : "outlined"}
|
|
||||||
/>
|
|
||||||
)) : (
|
|
||||||
<Typography variant="body2" color="text.secondary">
|
|
||||||
No items
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
})()}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell>
|
|
||||||
<IconButton
|
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={() => handleEditRsvp(rsvp)}
|
variant="outlined"
|
||||||
sx={{ mr: 1 }}
|
|
||||||
>
|
|
||||||
<EditIcon />
|
|
||||||
</IconButton>
|
|
||||||
<IconButton
|
|
||||||
color="error"
|
|
||||||
onClick={() => handleDeleteRsvp(rsvp)}
|
|
||||||
>
|
|
||||||
<DeleteIcon />
|
|
||||||
</IconButton>
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
))}
|
|
||||||
</TableBody>
|
|
||||||
</Table>
|
|
||||||
</TableContainer>
|
|
||||||
|
|
||||||
<Box sx={{ display: 'flex', justifyContent: 'flex-end', mt: 4 }}>
|
|
||||||
<Button
|
|
||||||
variant="contained"
|
|
||||||
color="error"
|
|
||||||
startIcon={<DeleteIcon />}
|
|
||||||
onClick={() => setDeleteEventDialogOpen(true)}
|
|
||||||
>
|
|
||||||
Delete Event
|
|
||||||
</Button>
|
|
||||||
</Box>
|
|
||||||
</Paper>
|
|
||||||
|
|
||||||
<Dialog
|
|
||||||
open={deleteDialogOpen}
|
|
||||||
onClose={() => setDeleteDialogOpen(false)}
|
|
||||||
>
|
|
||||||
<DialogTitle>Delete RSVP</DialogTitle>
|
|
||||||
<DialogContent>
|
|
||||||
<Typography>
|
|
||||||
Are you sure you want to delete {rsvpToDelete?.name}'s RSVP?
|
|
||||||
</Typography>
|
|
||||||
</DialogContent>
|
|
||||||
<DialogActions>
|
|
||||||
<Button onClick={() => setDeleteDialogOpen(false)}>Cancel</Button>
|
|
||||||
<Button onClick={confirmDelete} color="error">Delete</Button>
|
|
||||||
</DialogActions>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
<Dialog
|
|
||||||
open={editDialogOpen}
|
|
||||||
onClose={() => setEditDialogOpen(false)}
|
|
||||||
maxWidth="sm"
|
|
||||||
fullWidth
|
|
||||||
>
|
|
||||||
<DialogTitle>Edit RSVP</DialogTitle>
|
|
||||||
<DialogContent>
|
|
||||||
<Box sx={{ mt: 2, display: 'flex', flexDirection: 'column', gap: 2 }}>
|
|
||||||
<TextField
|
|
||||||
label="Name"
|
|
||||||
name="name"
|
|
||||||
value={editForm.name}
|
|
||||||
onChange={handleTextInputChange}
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
<FormControl fullWidth>
|
|
||||||
<InputLabel>Attending</InputLabel>
|
|
||||||
<Select
|
|
||||||
name="attending"
|
|
||||||
value={editForm.attending}
|
|
||||||
onChange={handleSelectChange}
|
|
||||||
label="Attending"
|
|
||||||
>
|
|
||||||
<MenuItem value="yes">Yes</MenuItem>
|
|
||||||
<MenuItem value="no">No</MenuItem>
|
|
||||||
<MenuItem value="maybe">Maybe</MenuItem>
|
|
||||||
</Select>
|
|
||||||
</FormControl>
|
|
||||||
<FormControl fullWidth>
|
|
||||||
<InputLabel>Bringing Guests</InputLabel>
|
|
||||||
<Select
|
|
||||||
name="bringing_guests"
|
|
||||||
value={editForm.bringing_guests}
|
|
||||||
onChange={handleSelectChange}
|
|
||||||
label="Bringing Guests"
|
|
||||||
>
|
|
||||||
<MenuItem value="yes">Yes</MenuItem>
|
|
||||||
<MenuItem value="no">No</MenuItem>
|
|
||||||
</Select>
|
|
||||||
</FormControl>
|
|
||||||
{editForm.bringing_guests === 'yes' && (
|
|
||||||
<>
|
|
||||||
<TextField
|
|
||||||
label="Number of Guests"
|
|
||||||
name="guest_count"
|
|
||||||
type="number"
|
|
||||||
value={editForm.guest_count}
|
|
||||||
onChange={handleTextInputChange}
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
<TextField
|
|
||||||
label="Guest Names"
|
|
||||||
name="guest_names"
|
|
||||||
value={editForm.guest_names}
|
|
||||||
onChange={handleTextInputChange}
|
|
||||||
fullWidth
|
|
||||||
multiline
|
|
||||||
rows={2}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<FormControl fullWidth>
|
|
||||||
<InputLabel>What items are you bringing?</InputLabel>
|
|
||||||
<Select
|
|
||||||
multiple
|
|
||||||
name="items_bringing"
|
|
||||||
value={editForm.items_bringing}
|
|
||||||
onChange={handleItemsChange}
|
|
||||||
input={<OutlinedInput label="What items are you bringing?" />}
|
|
||||||
renderValue={(selected) => (
|
|
||||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
|
|
||||||
{Array.isArray(selected) ? selected.map((value: string) => (
|
|
||||||
<Chip
|
|
||||||
key={value}
|
|
||||||
label={value}
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
)) : null}
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{Array.from(new Set([...neededItems, ...editForm.items_bringing])).map((item: string) => (
|
|
||||||
<MenuItem key={item} value={item}>
|
|
||||||
<Checkbox checked={editForm.items_bringing.includes(item)} />
|
|
||||||
<ListItemText
|
|
||||||
primary={item}
|
|
||||||
secondary={neededItems.includes(item) ? 'Available' : 'Currently assigned'}
|
|
||||||
/>
|
/>
|
||||||
</MenuItem>
|
))}
|
||||||
))}
|
{neededItems.length === 0 && (
|
||||||
</Select>
|
<Typography variant="body2" color="text.secondary">
|
||||||
</FormControl>
|
All items have been claimed
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Typography variant="subtitle1" gutterBottom>
|
||||||
|
Claimed Items:
|
||||||
|
</Typography>
|
||||||
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
||||||
|
{claimedItems.map((item: string, index: number) => (
|
||||||
|
<Chip
|
||||||
|
key={`${item}-${index}`}
|
||||||
|
label={item}
|
||||||
|
color="success"
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
{claimedItems.length === 0 && (
|
||||||
|
<Typography variant="body2" color="text.secondary">
|
||||||
|
No items have been claimed yet
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</DialogContent>
|
|
||||||
<DialogActions>
|
|
||||||
<Button onClick={() => setEditDialogOpen(false)}>Cancel</Button>
|
|
||||||
<Button onClick={handleEditSubmit} color="primary">Save Changes</Button>
|
|
||||||
</DialogActions>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
<Dialog
|
<Typography variant="h6" gutterBottom>
|
||||||
open={deleteEventDialogOpen}
|
RSVPs ({rsvps.length})
|
||||||
onClose={() => setDeleteEventDialogOpen(false)}
|
|
||||||
>
|
|
||||||
<DialogTitle>Delete Event</DialogTitle>
|
|
||||||
<DialogContent>
|
|
||||||
<Typography>
|
|
||||||
Are you sure you want to delete "{event.title}"? This action cannot be undone.
|
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography color="error" sx={{ mt: 2 }}>
|
|
||||||
All RSVPs associated with this event will also be deleted.
|
<TableContainer>
|
||||||
</Typography>
|
<Table>
|
||||||
</DialogContent>
|
<TableHead>
|
||||||
<DialogActions>
|
<TableRow>
|
||||||
<Button onClick={() => setDeleteEventDialogOpen(false)}>Cancel</Button>
|
<TableCell>Name</TableCell>
|
||||||
<Button onClick={handleDeleteEvent} color="error" variant="contained">
|
<TableCell>Attending</TableCell>
|
||||||
Delete Event
|
<TableCell>Guests</TableCell>
|
||||||
</Button>
|
<TableCell>Items Bringing</TableCell>
|
||||||
</DialogActions>
|
<TableCell>Actions</TableCell>
|
||||||
</Dialog>
|
</TableRow>
|
||||||
</Container>
|
</TableHead>
|
||||||
|
<TableBody>
|
||||||
|
{rsvps.map((rsvp: RSVP) => (
|
||||||
|
<TableRow key={rsvp.id}>
|
||||||
|
<TableCell>{rsvp.name}</TableCell>
|
||||||
|
<TableCell>{rsvp.attending.charAt(0).toUpperCase() + rsvp.attending.slice(1)}</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
{rsvp.bringing_guests === 'yes' ?
|
||||||
|
`${rsvp.guest_count} (${rsvp.guest_names.replace(/\s+/g, ', ')})` :
|
||||||
|
'No'
|
||||||
|
}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
{(() => {
|
||||||
|
let items: string[] = [];
|
||||||
|
try {
|
||||||
|
if (typeof rsvp.items_bringing === 'string') {
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(rsvp.items_bringing);
|
||||||
|
items = Array.isArray(parsed) ? parsed : [];
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error parsing items_bringing JSON in table:', e);
|
||||||
|
}
|
||||||
|
} else if (Array.isArray(rsvp.items_bringing)) {
|
||||||
|
items = rsvp.items_bringing;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error processing items in table:', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
|
||||||
|
{items.length > 0 ? items.map((item: string, index: number) => (
|
||||||
|
<Chip
|
||||||
|
key={`${item}-${index}`}
|
||||||
|
label={item}
|
||||||
|
color="success"
|
||||||
|
size="small"
|
||||||
|
variant={claimedItems.includes(item) ? "filled" : "outlined"}
|
||||||
|
/>
|
||||||
|
)) : (
|
||||||
|
<Typography variant="body2" color="text.secondary">
|
||||||
|
No items
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
})()}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<IconButton
|
||||||
|
color="primary"
|
||||||
|
onClick={() => handleEditRsvp(rsvp)}
|
||||||
|
sx={{ mr: 1 }}
|
||||||
|
>
|
||||||
|
<EditIcon />
|
||||||
|
</IconButton>
|
||||||
|
<IconButton
|
||||||
|
color="error"
|
||||||
|
onClick={() => handleDeleteRsvp(rsvp)}
|
||||||
|
>
|
||||||
|
<DeleteIcon />
|
||||||
|
</IconButton>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
|
||||||
|
<Box sx={{ display: 'flex', justifyContent: 'flex-end', mt: 4 }}>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="error"
|
||||||
|
startIcon={<DeleteIcon />}
|
||||||
|
onClick={() => setDeleteEventDialogOpen(true)}
|
||||||
|
>
|
||||||
|
Delete Event
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
open={deleteDialogOpen}
|
||||||
|
onClose={() => setDeleteDialogOpen(false)}
|
||||||
|
>
|
||||||
|
<DialogTitle>Delete RSVP</DialogTitle>
|
||||||
|
<DialogContent>
|
||||||
|
<Typography>
|
||||||
|
Are you sure you want to delete {rsvpToDelete?.name}'s RSVP?
|
||||||
|
</Typography>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<Button onClick={() => setDeleteDialogOpen(false)}>Cancel</Button>
|
||||||
|
<Button onClick={confirmDelete} color="error">Delete</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
open={editDialogOpen}
|
||||||
|
onClose={() => setEditDialogOpen(false)}
|
||||||
|
maxWidth="sm"
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
<DialogTitle>Edit RSVP</DialogTitle>
|
||||||
|
<DialogContent>
|
||||||
|
<Box sx={{ mt: 2, display: 'flex', flexDirection: 'column', gap: 2 }}>
|
||||||
|
<TextField
|
||||||
|
label="Name"
|
||||||
|
name="name"
|
||||||
|
value={editForm.name}
|
||||||
|
onChange={handleTextInputChange}
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<FormControl fullWidth>
|
||||||
|
<InputLabel>Attending</InputLabel>
|
||||||
|
<Select
|
||||||
|
name="attending"
|
||||||
|
value={editForm.attending}
|
||||||
|
onChange={handleSelectChange}
|
||||||
|
label="Attending"
|
||||||
|
>
|
||||||
|
<MenuItem value="yes">Yes</MenuItem>
|
||||||
|
<MenuItem value="no">No</MenuItem>
|
||||||
|
<MenuItem value="maybe">Maybe</MenuItem>
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
<FormControl fullWidth>
|
||||||
|
<InputLabel>Bringing Guests</InputLabel>
|
||||||
|
<Select
|
||||||
|
name="bringing_guests"
|
||||||
|
value={editForm.bringing_guests}
|
||||||
|
onChange={handleSelectChange}
|
||||||
|
label="Bringing Guests"
|
||||||
|
>
|
||||||
|
<MenuItem value="yes">Yes</MenuItem>
|
||||||
|
<MenuItem value="no">No</MenuItem>
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
{editForm.bringing_guests === 'yes' && (
|
||||||
|
<>
|
||||||
|
<TextField
|
||||||
|
label="Number of Guests"
|
||||||
|
name="guest_count"
|
||||||
|
type="number"
|
||||||
|
value={editForm.guest_count}
|
||||||
|
onChange={handleTextInputChange}
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
label="Guest Names"
|
||||||
|
name="guest_names"
|
||||||
|
value={editForm.guest_names}
|
||||||
|
onChange={handleTextInputChange}
|
||||||
|
fullWidth
|
||||||
|
multiline
|
||||||
|
rows={2}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
<FormControl fullWidth>
|
||||||
|
<InputLabel>What items are you bringing?</InputLabel>
|
||||||
|
<Select
|
||||||
|
multiple
|
||||||
|
name="items_bringing"
|
||||||
|
value={editForm.items_bringing}
|
||||||
|
onChange={handleItemsChange}
|
||||||
|
input={<OutlinedInput label="What items are you bringing?" />}
|
||||||
|
renderValue={(selected) => (
|
||||||
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
|
||||||
|
{Array.isArray(selected) ? selected.map((value: string) => (
|
||||||
|
<Chip
|
||||||
|
key={value}
|
||||||
|
label={value}
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
)) : null}
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{Array.from(new Set([...neededItems, ...editForm.items_bringing])).map((item: string) => (
|
||||||
|
<MenuItem key={item} value={item}>
|
||||||
|
<Checkbox checked={editForm.items_bringing.includes(item)} />
|
||||||
|
<ListItemText
|
||||||
|
primary={item}
|
||||||
|
secondary={neededItems.includes(item) ? 'Available' : 'Currently assigned'}
|
||||||
|
/>
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
</Box>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<Button onClick={() => setEditDialogOpen(false)}>Cancel</Button>
|
||||||
|
<Button onClick={handleEditSubmit} color="primary">Save Changes</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
open={deleteEventDialogOpen}
|
||||||
|
onClose={() => setDeleteEventDialogOpen(false)}
|
||||||
|
>
|
||||||
|
<DialogTitle>Delete Event</DialogTitle>
|
||||||
|
<DialogContent>
|
||||||
|
<Typography>
|
||||||
|
Are you sure you want to delete "{event.title}"? This action cannot be undone.
|
||||||
|
</Typography>
|
||||||
|
<Typography color="error" sx={{ mt: 2 }}>
|
||||||
|
All RSVPs associated with this event will also be deleted.
|
||||||
|
</Typography>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<Button onClick={() => setDeleteEventDialogOpen(false)}>Cancel</Button>
|
||||||
|
<Button onClick={handleDeleteEvent} color="error" variant="contained">
|
||||||
|
Delete Event
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
|
</Container>
|
||||||
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ interface Event {
|
|||||||
location: string;
|
location: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
needed_items?: string[] | string;
|
needed_items?: string[] | string;
|
||||||
|
wallpaper?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EventView: React.FC = () => {
|
const EventView: React.FC = () => {
|
||||||
@@ -131,134 +132,144 @@ const EventView: React.FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container maxWidth="lg">
|
<Box
|
||||||
<Paper elevation={3} sx={{ p: 4, mt: 4 }}>
|
sx={{
|
||||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 4 }}>
|
minHeight: '100vh',
|
||||||
<Typography variant="h4" component="h2" color="primary">
|
backgroundImage: event?.wallpaper ? `url(${event.wallpaper})` : 'url(https://www.rydertech.us/backgrounds/space1.jpg)',
|
||||||
{event.title} - RSVPs
|
backgroundSize: 'cover',
|
||||||
</Typography>
|
backgroundPosition: 'center',
|
||||||
<Button
|
py: 4,
|
||||||
variant="outlined"
|
}}
|
||||||
onClick={() => navigate('/')}
|
>
|
||||||
>
|
<Container maxWidth="lg">
|
||||||
Back to Events
|
<Paper elevation={3} sx={{ p: 4, mt: 4 }}>
|
||||||
</Button>
|
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 4 }}>
|
||||||
</Box>
|
<Typography variant="h4" component="h2" color="primary">
|
||||||
|
{event.title} - RSVPs
|
||||||
|
</Typography>
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
onClick={() => navigate('/')}
|
||||||
|
>
|
||||||
|
Back to Events
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
|
||||||
<Box sx={{ mb: 4 }}>
|
<Box sx={{ mb: 4 }}>
|
||||||
<Typography variant="h6" gutterBottom>
|
<Typography variant="h6" gutterBottom>
|
||||||
Items Status
|
Items Status
|
||||||
</Typography>
|
</Typography>
|
||||||
<Box sx={{ display: 'flex', gap: 4 }}>
|
<Box sx={{ display: 'flex', gap: 4 }}>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography variant="subtitle1" gutterBottom>
|
<Typography variant="subtitle1" gutterBottom>
|
||||||
Still Needed:
|
Still Needed:
|
||||||
</Typography>
|
</Typography>
|
||||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
||||||
{neededItems.map((item: string, index: number) => (
|
{neededItems.map((item: string, index: number) => (
|
||||||
<Chip
|
<Chip
|
||||||
key={`${item}-${index}`}
|
key={`${item}-${index}`}
|
||||||
label={item}
|
label={item}
|
||||||
color="primary"
|
color="primary"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{neededItems.length === 0 && (
|
{neededItems.length === 0 && (
|
||||||
<Typography variant="body2" color="text.secondary">
|
<Typography variant="body2" color="text.secondary">
|
||||||
All items have been claimed
|
All items have been claimed
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
<Box>
|
||||||
<Box>
|
<Typography variant="subtitle1" gutterBottom>
|
||||||
<Typography variant="subtitle1" gutterBottom>
|
Claimed Items:
|
||||||
Claimed Items:
|
</Typography>
|
||||||
</Typography>
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
||||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
{claimedItems.map((item: string, index: number) => (
|
||||||
{claimedItems.map((item: string, index: number) => (
|
<Chip
|
||||||
<Chip
|
key={`${item}-${index}`}
|
||||||
key={`${item}-${index}`}
|
label={item}
|
||||||
label={item}
|
color="success"
|
||||||
color="success"
|
/>
|
||||||
/>
|
))}
|
||||||
))}
|
{claimedItems.length === 0 && (
|
||||||
{claimedItems.length === 0 && (
|
<Typography variant="body2" color="text.secondary">
|
||||||
<Typography variant="body2" color="text.secondary">
|
No items have been claimed yet
|
||||||
No items have been claimed yet
|
</Typography>
|
||||||
</Typography>
|
)}
|
||||||
)}
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
|
||||||
|
|
||||||
<Typography variant="h6" gutterBottom>
|
<Typography variant="h6" gutterBottom>
|
||||||
RSVPs ({rsvps.length})
|
RSVPs ({rsvps.length})
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<TableContainer>
|
<TableContainer>
|
||||||
<Table>
|
<Table>
|
||||||
<TableHead>
|
<TableHead>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell>Name</TableCell>
|
<TableCell>Name</TableCell>
|
||||||
<TableCell>Attending</TableCell>
|
<TableCell>Attending</TableCell>
|
||||||
<TableCell>Guests</TableCell>
|
<TableCell>Guests</TableCell>
|
||||||
<TableCell>Items Bringing</TableCell>
|
<TableCell>Items Bringing</TableCell>
|
||||||
</TableRow>
|
|
||||||
</TableHead>
|
|
||||||
<TableBody>
|
|
||||||
{rsvps.map((rsvp: RSVP) => (
|
|
||||||
<TableRow key={rsvp.id}>
|
|
||||||
<TableCell>{rsvp.name}</TableCell>
|
|
||||||
<TableCell>{rsvp.attending.charAt(0).toUpperCase() + rsvp.attending.slice(1)}</TableCell>
|
|
||||||
<TableCell>
|
|
||||||
{rsvp.bringing_guests === 'yes' ?
|
|
||||||
`${rsvp.guest_count} (${rsvp.guest_names.replace(/\s+/g, ', ')})` :
|
|
||||||
'No'
|
|
||||||
}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell>
|
|
||||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
|
|
||||||
{(() => {
|
|
||||||
let items: string[] = [];
|
|
||||||
try {
|
|
||||||
if (typeof rsvp.items_bringing === 'string') {
|
|
||||||
try {
|
|
||||||
const parsed = JSON.parse(rsvp.items_bringing);
|
|
||||||
items = Array.isArray(parsed) ? parsed : [];
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error parsing items_bringing JSON in table:', e);
|
|
||||||
}
|
|
||||||
} else if (Array.isArray(rsvp.items_bringing)) {
|
|
||||||
items = rsvp.items_bringing;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error processing items in table:', e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return items.length > 0 ? items.map((item: string, index: number) => (
|
|
||||||
<Chip
|
|
||||||
key={`${item}-${index}`}
|
|
||||||
label={item}
|
|
||||||
color="success"
|
|
||||||
size="small"
|
|
||||||
variant={claimedItems.includes(item) ? "filled" : "outlined"}
|
|
||||||
/>
|
|
||||||
)) : (
|
|
||||||
<Typography variant="body2" color="text.secondary">
|
|
||||||
No items
|
|
||||||
</Typography>
|
|
||||||
);
|
|
||||||
})()}
|
|
||||||
</Box>
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
</TableHead>
|
||||||
</TableBody>
|
<TableBody>
|
||||||
</Table>
|
{rsvps.map((rsvp: RSVP) => (
|
||||||
</TableContainer>
|
<TableRow key={rsvp.id}>
|
||||||
</Paper>
|
<TableCell>{rsvp.name}</TableCell>
|
||||||
</Container>
|
<TableCell>{rsvp.attending.charAt(0).toUpperCase() + rsvp.attending.slice(1)}</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
{rsvp.bringing_guests === 'yes' ?
|
||||||
|
`${rsvp.guest_count} (${rsvp.guest_names.replace(/\s+/g, ', ')})` :
|
||||||
|
'No'
|
||||||
|
}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
|
||||||
|
{(() => {
|
||||||
|
let items: string[] = [];
|
||||||
|
try {
|
||||||
|
if (typeof rsvp.items_bringing === 'string') {
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(rsvp.items_bringing);
|
||||||
|
items = Array.isArray(parsed) ? parsed : [];
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error parsing items_bringing JSON in table:', e);
|
||||||
|
}
|
||||||
|
} else if (Array.isArray(rsvp.items_bringing)) {
|
||||||
|
items = rsvp.items_bringing;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error processing items in table:', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return items.length > 0 ? items.map((item: string, index: number) => (
|
||||||
|
<Chip
|
||||||
|
key={`${item}-${index}`}
|
||||||
|
label={item}
|
||||||
|
color="success"
|
||||||
|
size="small"
|
||||||
|
variant={claimedItems.includes(item) ? "filled" : "outlined"}
|
||||||
|
/>
|
||||||
|
)) : (
|
||||||
|
<Typography variant="body2" color="text.secondary">
|
||||||
|
No items
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
|
})()}
|
||||||
|
</Box>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
</Paper>
|
||||||
|
</Container>
|
||||||
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ const RSVPForm: React.FC = () => {
|
|||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [success, setSuccess] = useState(false);
|
const [success, setSuccess] = useState(false);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const [event, setEvent] = useState<Event | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchEventDetails = async () => {
|
const fetchEventDetails = async () => {
|
||||||
@@ -86,6 +87,7 @@ const RSVPForm: React.FC = () => {
|
|||||||
|
|
||||||
setNeededItems(availableItems);
|
setNeededItems(availableItems);
|
||||||
setClaimedItems(Array.from(claimed));
|
setClaimedItems(Array.from(claimed));
|
||||||
|
setEvent(eventResponse.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching event details:', error);
|
console.error('Error fetching event details:', error);
|
||||||
setError('Failed to load event details');
|
setError('Failed to load event details');
|
||||||
@@ -211,127 +213,137 @@ const RSVPForm: React.FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container maxWidth="sm">
|
<Box
|
||||||
<Paper elevation={3} sx={{ p: 4, mt: 4 }}>
|
sx={{
|
||||||
<Typography variant="h4" component="h2" gutterBottom color="primary" align="center">
|
minHeight: '100vh',
|
||||||
RSVP Form
|
backgroundImage: event?.wallpaper ? `url(${event.wallpaper})` : 'url(https://www.rydertech.us/backgrounds/space1.jpg)',
|
||||||
</Typography>
|
backgroundSize: 'cover',
|
||||||
|
backgroundPosition: 'center',
|
||||||
{error && (
|
py: 4,
|
||||||
<Typography color="error" align="center" sx={{ mb: 2 }}>
|
}}
|
||||||
{error}
|
>
|
||||||
|
<Container maxWidth="sm">
|
||||||
|
<Paper elevation={3} sx={{ p: 4, mt: 4 }}>
|
||||||
|
<Typography variant="h4" component="h2" gutterBottom color="primary" align="center">
|
||||||
|
RSVP Form
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
|
||||||
|
{error && (
|
||||||
<Box component="form" onSubmit={handleSubmit} sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
<Typography color="error" align="center" sx={{ mb: 2 }}>
|
||||||
<TextField
|
{error}
|
||||||
label="Name"
|
</Typography>
|
||||||
name="name"
|
|
||||||
value={formData.name}
|
|
||||||
onChange={handleChange}
|
|
||||||
required
|
|
||||||
fullWidth
|
|
||||||
variant="outlined"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<FormControl fullWidth>
|
|
||||||
<InputLabel>Are you attending?</InputLabel>
|
|
||||||
<Select
|
|
||||||
name="attending"
|
|
||||||
value={formData.attending}
|
|
||||||
onChange={handleSelectChange}
|
|
||||||
label="Are you attending?"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<MenuItem value="yes">Yes</MenuItem>
|
|
||||||
<MenuItem value="no">No</MenuItem>
|
|
||||||
</Select>
|
|
||||||
</FormControl>
|
|
||||||
|
|
||||||
{formData.attending === 'yes' && (
|
|
||||||
<>
|
|
||||||
<FormControl fullWidth>
|
|
||||||
<InputLabel>Are you bringing any guests?</InputLabel>
|
|
||||||
<Select
|
|
||||||
name="bringing_guests"
|
|
||||||
value={formData.bringing_guests}
|
|
||||||
onChange={handleSelectChange}
|
|
||||||
label="Are you bringing any guests?"
|
|
||||||
>
|
|
||||||
<MenuItem value="yes">Yes</MenuItem>
|
|
||||||
<MenuItem value="no">No</MenuItem>
|
|
||||||
</Select>
|
|
||||||
</FormControl>
|
|
||||||
|
|
||||||
{formData.bringing_guests === 'yes' && (
|
|
||||||
<>
|
|
||||||
<TextField
|
|
||||||
label="Number of Guests"
|
|
||||||
name="guest_count"
|
|
||||||
type="number"
|
|
||||||
value={formData.guest_count}
|
|
||||||
onChange={handleChange}
|
|
||||||
fullWidth
|
|
||||||
variant="outlined"
|
|
||||||
inputProps={{ min: 1 }}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextField
|
|
||||||
label="Guest Names"
|
|
||||||
name="guest_names"
|
|
||||||
value={formData.guest_names}
|
|
||||||
onChange={handleChange}
|
|
||||||
multiline
|
|
||||||
rows={3}
|
|
||||||
fullWidth
|
|
||||||
variant="outlined"
|
|
||||||
placeholder="Please list the names of your guests"
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{neededItems.length > 0 && (
|
|
||||||
<FormControl fullWidth>
|
|
||||||
<InputLabel>What items are you bringing?</InputLabel>
|
|
||||||
<Select
|
|
||||||
multiple
|
|
||||||
name="items_bringing"
|
|
||||||
value={formData.items_bringing}
|
|
||||||
onChange={handleItemsChange}
|
|
||||||
input={<OutlinedInput label="What items are you bringing?" />}
|
|
||||||
renderValue={(selected) => (
|
|
||||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
|
|
||||||
{selected.map((value) => (
|
|
||||||
<Chip key={value} label={value} />
|
|
||||||
))}
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{neededItems.map((item) => (
|
|
||||||
<MenuItem key={item} value={item}>
|
|
||||||
<Checkbox checked={formData.items_bringing.includes(item)} />
|
|
||||||
<ListItemText primary={item} />
|
|
||||||
</MenuItem>
|
|
||||||
))}
|
|
||||||
</Select>
|
|
||||||
</FormControl>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Button
|
<Box component="form" onSubmit={handleSubmit} sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
||||||
type="submit"
|
<TextField
|
||||||
variant="contained"
|
label="Name"
|
||||||
color="primary"
|
name="name"
|
||||||
size="large"
|
value={formData.name}
|
||||||
disabled={isSubmitting}
|
onChange={handleChange}
|
||||||
sx={{ mt: 2 }}
|
required
|
||||||
>
|
fullWidth
|
||||||
{isSubmitting ? 'Submitting...' : 'Submit RSVP'}
|
variant="outlined"
|
||||||
</Button>
|
/>
|
||||||
</Box>
|
|
||||||
</Paper>
|
<FormControl fullWidth>
|
||||||
</Container>
|
<InputLabel>Are you attending?</InputLabel>
|
||||||
|
<Select
|
||||||
|
name="attending"
|
||||||
|
value={formData.attending}
|
||||||
|
onChange={handleSelectChange}
|
||||||
|
label="Are you attending?"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<MenuItem value="yes">Yes</MenuItem>
|
||||||
|
<MenuItem value="no">No</MenuItem>
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
|
||||||
|
{formData.attending === 'yes' && (
|
||||||
|
<>
|
||||||
|
<FormControl fullWidth>
|
||||||
|
<InputLabel>Are you bringing any guests?</InputLabel>
|
||||||
|
<Select
|
||||||
|
name="bringing_guests"
|
||||||
|
value={formData.bringing_guests}
|
||||||
|
onChange={handleSelectChange}
|
||||||
|
label="Are you bringing any guests?"
|
||||||
|
>
|
||||||
|
<MenuItem value="yes">Yes</MenuItem>
|
||||||
|
<MenuItem value="no">No</MenuItem>
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
|
||||||
|
{formData.bringing_guests === 'yes' && (
|
||||||
|
<>
|
||||||
|
<TextField
|
||||||
|
label="Number of Guests"
|
||||||
|
name="guest_count"
|
||||||
|
type="number"
|
||||||
|
value={formData.guest_count}
|
||||||
|
onChange={handleChange}
|
||||||
|
fullWidth
|
||||||
|
variant="outlined"
|
||||||
|
inputProps={{ min: 1 }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
label="Guest Names"
|
||||||
|
name="guest_names"
|
||||||
|
value={formData.guest_names}
|
||||||
|
onChange={handleChange}
|
||||||
|
multiline
|
||||||
|
rows={3}
|
||||||
|
fullWidth
|
||||||
|
variant="outlined"
|
||||||
|
placeholder="Please list the names of your guests"
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{neededItems.length > 0 && (
|
||||||
|
<FormControl fullWidth>
|
||||||
|
<InputLabel>What items are you bringing?</InputLabel>
|
||||||
|
<Select
|
||||||
|
multiple
|
||||||
|
name="items_bringing"
|
||||||
|
value={formData.items_bringing}
|
||||||
|
onChange={handleItemsChange}
|
||||||
|
input={<OutlinedInput label="What items are you bringing?" />}
|
||||||
|
renderValue={(selected) => (
|
||||||
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
|
||||||
|
{selected.map((value) => (
|
||||||
|
<Chip key={value} label={value} />
|
||||||
|
))}
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{neededItems.map((item) => (
|
||||||
|
<MenuItem key={item} value={item}>
|
||||||
|
<Checkbox checked={formData.items_bringing.includes(item)} />
|
||||||
|
<ListItemText primary={item} />
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
size="large"
|
||||||
|
disabled={isSubmitting}
|
||||||
|
sx={{ mt: 2 }}
|
||||||
|
>
|
||||||
|
{isSubmitting ? 'Submitting...' : 'Submit RSVP'}
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
</Container>
|
||||||
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user