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
Fireworks
Fireworks
Fireworks
Fireworks

MCL Fireworks Sign Up

Work Schedule

Otganization
Saturday June 28th
Sunday June 29th
Monday June 30th
Tuesday July 1st
Wednesday July 2nd
Thursday July 3rd
Friday July 4th

Contact Information

Folsom VFW Hall

1300 Forrest Street

Folsom, CA 95630

  • Facebook

Get in touch

© 2024 by Folsom MCL Det.#940. - Powered and secured by Wix

bottom of page