feat: allow marking no show after booking has started (#17625)

* feat: allow marking no show after booking has started

* fix

---------

Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
This commit is contained in:
Kartik Saini
2024-11-14 09:55:39 +00:00
committed by GitHub
co-authored by Udit Takkar
parent 65484e7d01
commit ff2754f663
2 changed files with 12 additions and 1 deletions
@@ -132,6 +132,7 @@ function BookingListItem(booking: BookingItemProps) {
});
const isUpcoming = new Date(booking.endTime) >= new Date();
const isOngoing = isUpcoming && new Date() >= new Date(booking.startTime);
const isBookingInPast = new Date(booking.endTime) < new Date();
const isCancelled = booking.status === BookingStatus.CANCELLED;
const isConfirmed = booking.status === BookingStatus.ACCEPTED;
@@ -269,7 +270,7 @@ function BookingListItem(booking: BookingItemProps) {
});
}
if (isBookingInPast) {
if (isBookingInPast || isOngoing) {
editBookingActions.push({
id: "no_show",
label: t("mark_as_no_show"),
+10
View File
@@ -216,6 +216,16 @@ const assertCanAccessBooking = async (bookingUid: string, userId?: number) => {
if (!booking)
throw new HttpError({ statusCode: 403, message: "You are not allowed to access this booking" });
const isUpcoming = new Date(booking.endTime) >= new Date();
const isOngoing = isUpcoming && new Date() >= new Date(booking.startTime);
const isBookingInPast = new Date(booking.endTime) < new Date();
if (!isBookingInPast && !isOngoing) {
throw new HttpError({
statusCode: 403,
message: "Cannot mark no-show before the meeting has started.",
});
}
};
export default handleMarkNoShow;