feat: add booking time ranges and repeating series
This commit is contained in:
1 parent
59feca2f8e
commit
d433d271d0
29 files changed
+2135
-180
No files matched your search
@@ -0,0 +1,25 @@
|
||||
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.
|
||||
*
|
||||
* 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'];
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user