Implement separate toggles for email notifications and event conclusion email

This commit is contained in:
Ryderjj89
2025-05-26 12:39:23 -04:00
parent f686d3ae2b
commit ec8a4398e3

View File

@@ -50,6 +50,7 @@ interface FormData {
email_notifications_enabled: boolean;
email_recipients: string;
thank_you_message: string; // Added thank you message field
event_conclusion_email_enabled: boolean; // Added state for event conclusion email toggle
}
const EventForm: React.FC = () => {
@@ -65,6 +66,7 @@ const EventForm: React.FC = () => {
email_notifications_enabled: false,
email_recipients: '',
thank_you_message: '', // Added thank you message state
event_conclusion_email_enabled: false, // Initialize new state
});
const [wallpaper, setWallpaper] = useState<File | null>(null);
const [currentItem, setCurrentItem] = useState('');
@@ -128,6 +130,9 @@ const EventForm: React.FC = () => {
// Append thank you message
submitData.append('thank_you_message', formData.thank_you_message);
// Append event conclusion email enabled state
submitData.append('event_conclusion_email_enabled', String(formData.event_conclusion_email_enabled));
// Append wallpaper if selected
if (wallpaper) {
@@ -403,12 +408,39 @@ const EventForm: React.FC = () => {
variant="outlined"
placeholder="email1@example.com, email2@example.com"
helperText="Enter email addresses separated by commas"
sx={{ mt: 2 }} // Added margin top for spacing
/>
)}
<FormControlLabel
control={
<Checkbox
checked={formData.event_conclusion_email_enabled}
onChange={(e) => {
setFormData((prev) => ({
...prev,
event_conclusion_email_enabled: e.target.checked,
}));
}}
sx={{
color: 'rgba(255, 255, 255, 0.7)',
'&.Mui-checked': {
color: '#90caf9',
},
}}
/>
}
label="Enable Event Conclusion Email"
sx={{
color: 'rgba(255, 255, 255, 0.9)',
mt: 2, // Added margin top for spacing
}}
/>
{formData.event_conclusion_email_enabled && (
<DarkTextField
fullWidth
label="Thank You Message (for email notifications)"
label="Event conclusion message"
name="thank_you_message"
value={formData.thank_you_message}
onChange={handleChange}
@@ -416,7 +448,9 @@ const EventForm: React.FC = () => {
multiline
rows={4}
helperText="This message will be sent to attendees who opted for email notifications the day after the event."
sx={{ mt: 2 }} // Added margin top for spacing
/>
)}
</Box>
</Box>