feat: auto-fill vehicle booking end date from start date

This commit is contained in:
Arnaud Delcasse
2026-02-26 14:32:24 +01:00
parent 67d38ede79
commit 2f7c3165f1

View File

@@ -89,11 +89,13 @@
<!-- {{ $fieldName := "address" }}
{{ template "address_autocomplete" dict "FieldName" $fieldName }} -->
<div class="py-4 grid grid-cols-2">
<div class="py-4 grid grid-cols-2"
x-data="{ defaultDurationDays: {{.ViewState.default_booking_duration_days}} }">
<div class="lg:col-span-1">
<label for="startdate" class="block text-sm font-medium text-gray-700">Du <span class="text-red-600">*</span></label>
<div class="mt-1">
<input type="date" id="startdate" name="startdate" value="{{if .ViewState.search}}{{(timeFrom .ViewState.search.startdate).Format "2006-01-02"}}{{end}}" required
@change="if ($event.target.value && !document.getElementById('enddate').value) { const d = new Date($event.target.value); d.setDate(d.getDate() + defaultDurationDays); document.getElementById('enddate').value = d.toISOString().split('T')[0]; }"
class="shadow-sm focus:ring-co-blue focus:border-co-blue block w-full sm:text-sm border-gray-300 rounded-l-2xl border-r-1">
</div>
</div>