Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't allow creation of empty series #1577

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ function RecurringReservationForm({
removedReservations
).filter((x) => !x.isOverlapping);

const isDisabled = !isDirty || newReservationsToMake.length === 0;

return (
<FormProvider {...form}>
<form onSubmit={handleSubmit(onSubmit)} noValidate>
Expand Down Expand Up @@ -404,7 +406,7 @@ function RecurringReservationForm({
type="submit"
data-testid="recurring-reservation-form__submit-button"
isLoading={isSubmitting}
disabled={!isDirty}
disabled={isDisabled}
>
{t("common.reserve")}
</Button>
Expand Down
4 changes: 3 additions & 1 deletion apps/admin-ui/src/spa/reservations/[id]/series/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ function SeriesPageInner({ pk }: { pk: number }) {
return <Error404 />;
}

const isDisabled = Object.keys(errors).length > 0 || reservationsCount < 1;

return (
<>
<LinkPrev />
Expand Down Expand Up @@ -402,7 +404,7 @@ function SeriesPageInner({ pk }: { pk: number }) {
}}
>
<ButtonLikeLink to="..">{t("common:cancel")}</ButtonLikeLink>
<Button size="small" type="submit">
<Button size="small" type="submit" disabled={isDisabled}>
{t("ReservationEditSeries.submit")}
</Button>
</ButtonContainer>
Expand Down
Loading