top of page
bottom of page
import wixBookings from 'wix-bookings'; import wixData from 'wix-data'; // Define the Service ID and Staff IDs const SERVICE_ID = '18ee7e14-9cfd-49e6-893a-7ca836189db6'; const STAFF_IDS = [ '9cdb283a-05af-4d79-b402-d8a32c0299ea', 'c0bb665a-c801-41fd-8762-ac9bf45f59ac', '089ab480-1f9c-4eed-b2f2-9519cceb80f0' ]; // Function to block time for staff export async function blockTimeForStaff(booking) { const { startTime } = booking; const endTime = new Date(startTime.getTime() + 2 * 60 * 60 * 1000); // 2 hours later // Loop through each staff ID and create a blocked time slot for (const staffId of STAFF_IDS) { try { await wixBookings.createTimeSlot({ staffId: staffId, startTime: startTime, endTime: endTime, status: 'blocked', // Ensure the status is 'blocked' title: 'Blocked due to Detox Day Pass booking' }); } catch (error) { console.error(`Failed to block time for staff ID ${staffId}:`, error); } } }