+
{props.user.name}
@@ -171,7 +179,7 @@ export default function Book(props: any): JSX.Element {
{locationInfo(selectedLocation).address}
)}
-
+
{preferredTimeZone &&
dayjs(date)
@@ -192,7 +200,7 @@ export default function Book(props: any): JSX.Element {
name="name"
id="name"
required
- className="shadow-sm dark:bg-gray-700 dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
+ className="shadow-sm dark:bg-black dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
placeholder="John Doe"
defaultValue={props.booking ? props.booking.attendees[0].name : ""}
/>
@@ -210,7 +218,7 @@ export default function Book(props: any): JSX.Element {
name="email"
id="email"
required
- className="shadow-sm dark:bg-gray-700 dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
+ className="shadow-sm dark:bg-black dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
placeholder="you@example.com"
defaultValue={props.booking ? props.booking.attendees[0].email : ""}
/>
@@ -218,7 +226,9 @@ export default function Book(props: any): JSX.Element {
{locations.length > 1 && (
- Location
+
+ Location
+
{locations.map((location) => (
))}
@@ -248,7 +260,7 @@ export default function Book(props: any): JSX.Element {
placeholder="Enter phone number"
id="phone"
required
- className="shadow-sm dark:bg-gray-700 dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
+ className="shadow-sm dark:bg-black dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
onChange={() => {
/* DO NOT REMOVE: Callback required by PhoneInput, comment added to satisfy eslint:no-empty-function */
}}
@@ -274,7 +286,7 @@ export default function Book(props: any): JSX.Element {
id={"custom_" + input.id}
required={input.required}
rows={3}
- className="shadow-sm dark:bg-gray-700 dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
+ className="shadow-sm dark:bg-black dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
placeholder=""
/>
)}
@@ -284,7 +296,7 @@ export default function Book(props: any): JSX.Element {
name={"custom_" + input.id}
id={"custom_" + input.id}
required={input.required}
- className="shadow-sm dark:bg-gray-700 dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
+ className="shadow-sm dark:bg-black dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
placeholder=""
/>
)}
@@ -294,7 +306,7 @@ export default function Book(props: any): JSX.Element {
name={"custom_" + input.id}
id={"custom_" + input.id}
required={input.required}
- className="shadow-sm dark:bg-gray-700 dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
+ className="shadow-sm dark:bg-black dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300 rounded-md"
placeholder=""
/>
)}
@@ -304,7 +316,7 @@ export default function Book(props: any): JSX.Element {
type="checkbox"
name={"custom_" + input.id}
id={"custom_" + input.id}
- className="focus:ring-black h-4 w-4 text-blue-600 border-gray-300 rounded mr-2"
+ className="focus:ring-black h-4 w-4 text-black border-gray-300 rounded mr-2"
placeholder=""
/>
-
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/api/book/[user].ts b/pages/api/book/[user].ts
index a7f10b15..b032c925 100644
--- a/pages/api/book/[user].ts
+++ b/pages/api/book/[user].ts
@@ -13,12 +13,14 @@ import { User } from "@prisma/client";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
+import isBetween from "dayjs/plugin/isBetween";
import dayjsBusinessDays from "dayjs-business-days";
import { Exception } from "handlebars";
import EventOrganizerRequestMail from "@lib/emails/EventOrganizerRequestMail";
dayjs.extend(dayjsBusinessDays);
dayjs.extend(utc);
+dayjs.extend(isBetween);
dayjs.extend(timezone);
const translator = short();
@@ -27,7 +29,6 @@ const log = logger.getChildLogger({ prefix: ["[api] book:user"] });
function isAvailable(busyTimes, time, length) {
// Check for conflicts
let t = true;
-
if (Array.isArray(busyTimes) && busyTimes.length > 0) {
busyTimes.forEach((busyTime) => {
const startTime = dayjs(busyTime.start);
@@ -148,8 +149,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const calendarAvailability = await getBusyCalendarTimes(
currentUser.credentials,
- dayjs(req.body.start).startOf("day").utc().format(),
- dayjs(req.body.end).endOf("day").utc().format(),
+ dayjs(req.body.start).startOf("day").utc().format("YYYY-MM-DDTHH:mm:ss[Z]"),
+ dayjs(req.body.end).endOf("day").utc().format("YYYY-MM-DDTHH:mm:ss[Z]"),
selectedCalendars
);
const videoAvailability = await getBusyVideoTimes(currentUser.credentials);
@@ -201,6 +202,17 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
},
});
+ const invitee = [{ email: req.body.email, name: req.body.name, timeZone: req.body.timeZone }];
+ const guests = req.body.guests.map((guest) => {
+ const g = {
+ email: guest,
+ name: "",
+ timeZone: req.body.timeZone,
+ };
+ return g;
+ });
+ const attendeesList = [...invitee, ...guests];
+
const evt: CalendarEvent = {
type: selectedEventType.title,
title: getEventName(req.body.name, selectedEventType.title, selectedEventType.eventName),
@@ -208,7 +220,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
startTime: req.body.start,
endTime: req.body.end,
organizer: { email: currentUser.email, name: currentUser.name, timeZone: currentUser.timeZone },
- attendees: [{ email: req.body.email, name: req.body.name, timeZone: req.body.timeZone }],
+ attendees: attendeesList,
location: req.body.location, // Will be processed by the EventManager later.
};
@@ -226,7 +238,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
try {
isAvailableToBeBooked = isAvailable(commonAvailability, req.body.start, selectedEventType.length);
- } catch {
+ } catch (e) {
+ console.log(e);
log.debug({
message: "Unable set isAvailableToBeBooked. Using true. ",
});
diff --git a/pages/auth/error.tsx b/pages/auth/error.tsx
index 450d24a3..cbd57cfe 100644
--- a/pages/auth/error.tsx
+++ b/pages/auth/error.tsx
@@ -9,7 +9,7 @@ export default function Error() {
return (
diff --git a/pages/auth/login.tsx b/pages/auth/login.tsx
index bf83b392..f0a183cc 100644
--- a/pages/auth/login.tsx
+++ b/pages/auth/login.tsx
@@ -43,7 +43,7 @@ export default function Login({ csrfToken }) {
diff --git a/pages/auth/logout.tsx b/pages/auth/logout.tsx
index 7597d9af..a066723c 100644
--- a/pages/auth/logout.tsx
+++ b/pages/auth/logout.tsx
@@ -5,7 +5,7 @@ import { CheckIcon } from "@heroicons/react/outline";
export default function Logout() {
return (