diff --git a/pages/bookings/index.tsx b/pages/bookings/index.tsx index 5ad5183130..58fbe412b8 100644 --- a/pages/bookings/index.tsx +++ b/pages/bookings/index.tsx @@ -3,6 +3,8 @@ import prisma from "../../lib/prisma"; import { getSession, useSession } from "next-auth/client"; import Shell from "../../components/Shell"; import { useRouter } from "next/router"; +import dayjs from "dayjs"; + export default function Bookings({ bookings }) { const [, loading] = useSession(); @@ -37,6 +39,28 @@ export default function Bookings({ bookings }) {
+ + + + + + + + {bookings .filter((booking) => !booking.confirmed && !booking.rejected) @@ -70,11 +94,14 @@ export default function Bookings({ bookings }) { You and {booking.attendees[0].name} - {/* */} +
+ Person + + Event + + Date + + Actions +
-
- {dayjs(booking.startTime).format("D MMMM YYYY HH:mm")} -
-
+
+ {dayjs(booking.startTime).format("D MMMM YYYY")} +
+
+ {dayjs(booking.startTime).format("HH:mm")} - {dayjs(booking.endTime).format("HH:mm")} +
+
{!booking.confirmed && !booking.rejected && ( <> @@ -137,7 +164,7 @@ export async function getServerSideProps(context) { }, }); - const bookings = await prisma.booking.findMany({ + const b = await prisma.booking.findMany({ where: { userId: user.id, }, @@ -149,11 +176,17 @@ export async function getServerSideProps(context) { confirmed: true, rejected: true, id: true, + startTime: true, + endTime: true, }, orderBy: { - startTime: "desc", + startTime: "asc", }, }); + const bookings = b.map(booking=>{ + return ({...booking, startTime:booking.startTime.toISOString(), endTime:booking.endTime.toISOString(),}) + }); + return { props: { bookings } }; }