import wixData from 'wix-data'; import wixWindow from 'wix-window'; $w.onReady(function () { $w('#errorMessage').hide(); // Hide error on page load }); // Triggered when the Submit button is clicked export async function submitButton_click(event) { $w('#errorMessage').hide(); // Get user input const name = $w('#nameInput').value; const phone = $w('#phoneInput').value; const email = $w('#emailInput').value; const organization = $w('#orgInput').value; const selectedDay = $w('#dayChoice').value[0]; const selectedShift = $w('#shiftChoice').value[0]; if (!name || !phone || !email || !organization || !selectedDay || !selectedShift) { $w('#errorMessage').text = "Please complete all fields."; $w('#errorMessage').show(); return; } // Map readable date options to Date objects const dateMap = { "Saturday, June 28": new Date(2025, 5, 28), "Sunday, June 29": new Date(2025, 5, 29), "Monday, June 30": new Date(2025, 5, 30), "Tuesday, July 1": new Date(2025, 6, 1), "Wednesday, July 2": new Date(2025, 6, 2), "Thursday, July 3": new Date(2025, 6, 3), "Friday, July 4": new Date(2025, 6, 4) }; const selectedDate = dateMap[selectedDay]; if (!selectedDate) { $w('#errorMessage').text = "Invalid date selected."; $w('#errorMessage').show(); return; } // Determine max signups allowed const weekday = selectedDate.getDay(); // 0 = Sunday, 1 = Monday, ..., 6 = Saturday const isMonToThu = weekday >= 1 && weekday <= 4; // Monday to Thursday const maxSignups = isMonToThu ? 3 : 5; try { const existingSignups = await wixData.query("SignUps") .eq("date", selectedDate) .eq("shift", selectedShift) .find(); if (existingSignups.totalCount >= maxSignups) { $w('#errorMessage').text = "This shift is full. Please choose another."; $w('#errorMessage').show(); return; } // Add new signup await wixData.insert("SignUps", { name, phone, email, organization, date: selectedDate, shift: selectedShift }); // Show confirmation (e.g., lightbox) wixWindow.openLightbox("ThankYouLightbox"); } catch (error) { console.error("Submission error:", error); $w('#errorMessage').text = "There was an issue saving your signup. Please try again."; $w('#errorMessage').show(); } }
top of page
Home
About
Membership
Events
Projects
Toys for Tots
MCL Scholarship Program
Contact Us
Links Forms Files
Useful Links
Useful Forms
File Library
News
More
Use tab to navigate through the menu items.
Log In Member
MCL Fireworks Sign Up
Work Schedule
Name
*
Phone
*
Email
*
Otganization
*
Saturday June 28th
Saturday's time slots are filled up
Sunday June 29th
Sunday's Slots are all filled up
Monday June 30th
Monday's slots are all filled up
Tuesday July 1st
Tuesday's slots are all filled up
Wednesday July 2nd
Wednesday's Slots are all filled up
Thursday July 3rd
Thursday's time slots are filled up
Friday July 4th
1300 - 1700
1700 - 2100
Submit
bottom of page