Skip to content

Commit

Permalink
booking calendar can use operational hour settings
Browse files Browse the repository at this point in the history
  • Loading branch information
lucia-gomez committed Nov 20, 2024
1 parent ac75209 commit b7d2f7d
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import {
EventDropArg,
} from "@fullcalendar/core";
import CalendarEventBlock, { NEW_TITLE_TAG } from "./CalendarEventBlock";
import { FormContextLevel, RoomSetting } from "../../../../types";
import React, { useContext, useEffect, useMemo, useRef } from "react";
import { Days, FormContextLevel, RoomSetting } from "../../../../types";
import { useContext, useEffect, useMemo, useRef } from "react";

import { BookingContext } from "../bookingProvider";
import { DatabaseContext } from "../../components/Provider";
import { Error } from "@mui/icons-material";
import { EventResizeDoneArg } from "fullcalendar";
import FullCalendar from "@fullcalendar/react";
Expand Down Expand Up @@ -84,6 +85,7 @@ export default function CalendarVerticalResource({
rooms,
dateView,
}: Props) {
const { operationHours } = useContext(DatabaseContext);
const {
bookingCalendarInfo,
existingCalendarEvents,
Expand Down Expand Up @@ -240,6 +242,13 @@ export default function CalendarVerticalResource({
);
}

const operationHoursToday = operationHours.find(
(setting) => Object.values(Days)[dateView.getDay()] === setting.day
);
const slotMinTime = `${operationHoursToday.open}:00:00`;
const slotMaxTime = `${operationHoursToday.close}:00:00`;
// don't use these values until we talk to Samantha/Jhanele

return (
<FullCalendarWrapper>
<FullCalendar
Expand Down

0 comments on commit b7d2f7d

Please sign in to comment.