Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit b34602d

Browse files
committed
fix: remove interval options in edit reservation
fix: edit time validation missing that admin reservation intervals max out at 30 minutes.
1 parent c4e6887 commit b34602d

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

apps/admin-ui/src/component/reservations/EditTimeModal.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,15 @@ const DialogContent = ({ reservation, onAccept, onClose }: Props) => {
172172
const startDateTime = new Date(reservation.begin);
173173
const endDateTime = new Date(reservation.end);
174174

175+
const reservationUnit = reservation.reservationUnits?.find(() => true);
176+
177+
// TODO this matches the CreateReservationModal logic (should use a common function that is documented)
178+
// not doing it right now because of open question and because of breaking enum name change.
175179
const interval =
176-
reservation.reservationUnits?.find(() => true)?.reservationStartInterval ??
177-
ReservationUnitsReservationUnitReservationStartIntervalChoices.Interval_15Mins;
180+
reservationUnit?.reservationStartInterval ===
181+
ReservationUnitsReservationUnitReservationStartIntervalChoices.Interval_15Mins
182+
? ReservationUnitsReservationUnitReservationStartIntervalChoices.Interval_15Mins
183+
: ReservationUnitsReservationUnitReservationStartIntervalChoices.Interval_30Mins;
178184

179185
const form = useForm<FormValueType>({
180186
resolver: zodResolver(TimeChangeFormSchemaRefined(interval)),
@@ -218,8 +224,6 @@ const DialogContent = ({ reservation, onAccept, onClose }: Props) => {
218224
});
219225
};
220226

221-
const reservationUnit = reservation.reservationUnits?.find(() => true);
222-
223227
const formDate = watch("date");
224228
const formEndTime = watch("endTime");
225229
const formStartTime = watch("startTime");

0 commit comments

Comments
 (0)