From 9c1b4a518d998f21adb422241f8000baab3d971a Mon Sep 17 00:00:00 2001 From: Rohit Kumar Saini Date: Mon, 10 Jun 2024 16:06:21 +0530 Subject: [PATCH] fix(nrm-booking): selecting logged in user in case of self service while creating booking --- app/routes/_layout+/bookings.new.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/app/routes/_layout+/bookings.new.tsx b/app/routes/_layout+/bookings.new.tsx index 5acaa1e0a..3cbe371fa 100644 --- a/app/routes/_layout+/bookings.new.tsx +++ b/app/routes/_layout+/bookings.new.tsx @@ -87,11 +87,15 @@ export async function loader({ context, request }: LoaderFunctionArgs) { }); } + const selfServiceUser = isSelfService + ? teamMembers.find((member) => member.userId === authSession.userId) + : undefined; + return json( data({ showModal: true, isSelfService, - selfServiceId: authSession.userId, + selfServiceUser, teamMembers, }), { @@ -192,8 +196,9 @@ export const handle = { export const links: LinksFunction = () => [{ rel: "stylesheet", href: styles }]; export default function NewBooking() { - const { isSelfService, selfServiceId } = useLoaderData(); + const { isSelfService, selfServiceUser } = useLoaderData(); const { startDate, endDate } = getBookingDefaultStartEndTimes(); + return (
@@ -208,7 +213,15 @@ export default function NewBooking() {