admin features
This commit is contained in:
@@ -24,6 +24,34 @@
|
||||
<label class="label"><span class="label-text">{{ t(key="date", lang=lang) }}</span></label>
|
||||
<input type="date" name="date" value="{{ date }}" required class="input input-bordered w-full">
|
||||
</div>
|
||||
{% if mode == "new" %}
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="form-control">
|
||||
<label class="label"><span class="label-text">{{ t(key="hour-from", lang=lang) }}</span></label>
|
||||
<select name="hour_start" id="hour_start" class="select select-bordered w-full">
|
||||
{% for h in hours %}
|
||||
<option value="{{ h.v }}" {% if h.v == hour_start %}selected{% endif %}>{{ h.label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-control">
|
||||
<label class="label"><span class="label-text">{{ t(key="hour-to", lang=lang) }}</span></label>
|
||||
<select name="hour_end" id="hour_end" class="select select-bordered w-full">
|
||||
{% for h in hours_end %}
|
||||
<option value="{{ h.v }}" {% if h.v == hour_end %}selected{% endif %}>{{ h.label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-control">
|
||||
<label class="label"><span class="label-text">{{ t(key="repeat-weeks", lang=lang) }}</span></label>
|
||||
<input type="number" name="repeat_weeks" value="{{ repeat_weeks }}" min="1" max="52" required
|
||||
class="input input-bordered w-full">
|
||||
<label class="label">
|
||||
<span class="label-text-alt opacity-60">{{ t(key="repeat-hint", lang=lang) }}</span>
|
||||
</label>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="form-control">
|
||||
<label class="label"><span class="label-text">{{ t(key="hour", lang=lang) }}</span></label>
|
||||
<select name="hour" class="select select-bordered w-full">
|
||||
@@ -32,6 +60,7 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="form-control">
|
||||
<label class="label"><span class="label-text">{{ t(key="booking-color", lang=lang) }}</span></label>
|
||||
<input type="color" name="color" value="{{ color }}"
|
||||
@@ -69,3 +98,21 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
||||
{% block js %}
|
||||
{% if mode == "new" %}
|
||||
<script>
|
||||
// Keep the "until" time after the "from" time as the start hour changes.
|
||||
(function () {
|
||||
var s = document.getElementById('hour_start');
|
||||
var e = document.getElementById('hour_end');
|
||||
if (!s || !e) return;
|
||||
s.addEventListener('change', function () {
|
||||
if (parseInt(e.value, 10) <= parseInt(s.value, 10)) {
|
||||
e.value = String(parseInt(s.value, 10) + 1);
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock js %}
|
||||
|
||||
Reference in New Issue
Block a user