import wixData from 'wix-data'; import { saveBooking } from 'backend/bookingService'; const heroImages = [ "wix:image://v1/hero1.jpg", "wix:image://v1/hero2.jpg", "wix:image://v1/hero3.jpg" ]; let heroIndex = 0; const testimonials = [ { message: "Great mobile service and fast response!", author: "Emily R." }, { message: "Professional and friendly staff.", author: "John M." }, { message: "Highly recommend Slater Mechanical.", author: "Sophie K." } ]; let testimonialIndex = 0; let testimonialInterval; $w.onReady(() => { startHeroSlider(); showTestimonial(0); startTestimonialScroll(); setupBookingForm(); }); function startHeroSlider() { const heroImage = $w("#heroImage"); setInterval(() => { heroIndex = (heroIndex + 1) % heroImages.length; heroImage.hide("fade", { duration: 500 }) .then(() => { heroImage.src = heroImages[heroIndex]; return heroImage.show("fade", { duration: 500 }); }); }, 6000); } function showTestimonial(index) { $w("#testimonialText").text = testimonials[index].message; $w("#testimonialAuthor").text = `- ${testimonials[index].author}`; } function startTestimonialScroll() { testimonialInterval = setInterval(() => { testimonialIndex = (testimonialIndex + 1) % testimonials.length; showTestimonial(testimonialIndex); }, 7000); $w("#testimonialBox").onMouseIn(() => clearInterval(testimonialInterval)); $w("#testimonialBox").onMouseOut(() => startTestimonialScroll()); } function setupBookingForm() { $w("#submitBooking").onClick(() => { $w("#errorMsg").hide(); $w("#successMsg").hide(); if (!isValidForm()) { $w("#errorMsg").show(); return; } const booking = { name: $w("#nameInput").value, phone: $w("#phoneInput").value, email: $w("#emailInput").value, serviceType: $w("#serviceDropdown").value, appointmentDate: $w("#datePicker").value }; saveBooking(booking) .then(() => { $w("#successMsg").show(); $w("#bookingForm").hide(); }) .catch(() => { $w("#errorMsg").text = "Something went wrong. Please try again."; $w("#errorMsg").show(); }); }); } function isValidForm() { return $w("#nameInput").valid && $w("#phoneInput").valid && $w("#emailInput").valid && $w("#serviceDropdown").value !== "" && $w("#datePicker").value !== null; }import wixData from 'wix-data'; import { saveBooking } from 'backend/bookingService'; const heroImages = [ "wix:image://v1/hero1.jpg", "wix:image://v1/hero2.jpg", "wix:image://v1/hero3.jpg" ]; let heroIndex = 0; const testimonials = [ { message: "Great mobile service and fast response!", author: "Emily R." }, { message: "Professional and friendly staff.", author: "John M." }, { message: "Highly recommend Slater Mechanical.", author: "Sophie K." } ]; let testimonialIndex = 0; let testimonialInterval; $w.onReady(() => { startHeroSlider(); showTestimonial(0); startTestimonialScroll(); setupBookingForm(); }); function startHeroSlider() { const heroImage = $w("#heroImage"); setInterval(() => { heroIndex = (heroIndex + 1) % heroImages.length; heroImage.hide("fade", { duration: 500 }) .then(() => { heroImage.src = heroImages[heroIndex]; return heroImage.show("fade", { duration: 500 }); }); }, 6000); } function showTestimonial(index) { $w("#testimonialText").text = testimonials[index].message; $w("#testimonialAuthor").text = `- ${testimonials[index].author}`; } function startTestimonialScroll() { testimonialInterval = setInterval(() => { testimonialIndex = (testimonialIndex + 1) % testimonials.length; showTestimonial(testimonialIndex); }, 7000); $w("#testimonialBox").onMouseIn(() => clearInterval(testimonialInterval)); $w("#testimonialBox").onMouseOut(() => startTestimonialScroll()); } function setupBookingForm() { $w("#submitBooking").onClick(() => { $w("#errorMsg").hide(); $w("#successMsg").hide(); if (!isValidForm()) { $w("#errorMsg").show(); return; } const booking = { name: $w("#nameInput").value, phone: $w("#phoneInput").value, email: $w("#emailInput").value, serviceType: $w("#serviceDropdown").value, appointmentDate: $w("#datePicker").value }; saveBooking(booking) .then(() => { $w("#successMsg").show(); $w("#bookingForm").hide(); }) .catch(() => { $w("#errorMsg").text = "Something went wrong. Please try again."; $w("#errorMsg").show(); }); }); } function isValidForm() { return $w("#nameInput").valid && $w("#phoneInput").valid && $w("#emailInput").valid && $w("#serviceDropdown").value !== "" && $w("#datePicker").value !== null; } import wixData from 'wix-data'; import { saveBooking } from 'backend/bookingService'; const heroImages = [ "wix:image://v1/hero1.jpg", "wix:image://v1/hero2.jpg", "wix:image://v1/hero3.jpg" ]; let heroIndex = 0; const testimonials = [ { message: "Great mobile service and fast response!", author: "Emily R." }, { message: "Professional and friendly staff.", author: "John M." }, { message: "Highly recommend Slater Mechanical.", author: "Sophie K." } ]; let testimonialIndex = 0; let testimonialInterval; $w.onReady(() => { startHeroSlider(); showTestimonial(0); startTestimonialScroll(); setupBookingForm(); }); function startHeroSlider() { const heroImage = $w("#heroImage"); setInterval(() => { heroIndex = (heroIndex + 1) % heroImages.length; heroImage.hide("fade", { duration: 500 }) .then(() => { heroImage.src = heroImages[heroIndex]; return heroImage.show("fade", { duration: 500 }); }); }, 6000); } function showTestimonial(index) { $w("#testimonialText").text = testimonials[index].message; $w("#testimonialAuthor").text = `- ${testimonials[index].author}`; } function startTestimonialScroll() { testimonialInterval = setInterval(() => { testimonialIndex = (testimonialIndex + 1) % testimonials.length; showTestimonial(testimonialIndex); }, 7000); $w("#testimonialBox").onMouseIn(() => clearInterval(testimonialInterval)); $w("#testimonialBox").onMouseOut(() => startTestimonialScroll()); } function setupBookingForm() { $w("#submitBooking").onClick(() => { $w("#errorMsg").hide(); $w("#successMsg").hide(); if (!isValidForm()) { $w("#errorMsg").show(); return; } const booking = { name: $w("#nameInput").value, phone: $w("#phoneInput").value, email: $w("#emailInput").value, serviceType: $w("#serviceDropdown").value, appointmentDate: $w("#datePicker").value }; saveBooking(booking) .then(() => { $w("#successMsg").show(); $w("#bookingForm").hide(); }) .catch(() => { $w("#errorMsg").text = "Something went wrong. Please try again."; $w("#errorMsg").show(); }); }); } function isValidForm() { return $w("#nameInput").valid && $w("#phoneInput").valid && $w("#emailInput").valid && $w("#serviceDropdown").value !== "" && $w("#datePicker").value !== null; }
top of page

Gallery

bottom of page
import wixData from 'wix-data'; export function saveBooking(booking) { return wixData.insert("Bookings", booking); }