feat: add two- and four-weekly series and drop the weekday picker

This commit is contained in:
fromme committed 2026-09-14 08:25:05 +02:00
1 parent 8b88384d68
commit faef4d70a8
10 files changed
+166 -103

No files matched your search

+4 -7
View File
@@ -2,24 +2,21 @@ import { Controller } from '@hotwired/stimulus';
/*
* Shows and hides the parts of the booking form that only apply in some states: the time fields
* when "ganzer Tag" is off, the recurrence fields when a repetition is picked, and the weekday
* boxes only for a weekly rule.
* when "ganzer Tag" is off, and the recurrence fields when a repetition is picked. The weekday a
* series runs on is derived from its start date, so there is nothing to toggle for it.
*
* Purely client-side, so it is Stimulus rather than an htmx form refresh -- there is nothing the
* server needs to decide here. The server still validates every one of these rules, because a
* hidden field is not an absent one.
*/
export default class extends Controller {
static targets = ['times', 'repeat', 'weekdays'];
static targets = ['times', 'repeat'];
toggleTimes(event) {
this.timesTarget.classList.toggle('hidden', event.target.checked);
}
toggleRepeat(event) {
const rule = event.target.value;
this.repeatTarget.classList.toggle('hidden', rule === '');
this.weekdaysTarget.classList.toggle('hidden', rule !== 'weekly');
this.repeatTarget.classList.toggle('hidden', event.target.value === '');
}
}