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:
co-authored by
Udit Takkar
parent
65484e7d01
commit
ff2754f663
@@ -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"),
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user