add optional min=0 field; add time for starting time

This commit is contained in:
philipp 2023-04-18 21:41:16 +02:00
parent 044fd43d42
commit 55ca9a5c15
2 changed files with 8 additions and 8 deletions

View File

@ -24,9 +24,9 @@
<div class="h-8"></div>
{% endmacro header %}
{% macro input(label, name, type, required=false, class='rounded-md', value='') %}
{% macro input(label, name, type, required=false, class='rounded-md', value='', min='') %}
<label for="{{ name }}" class="sr-only">{{ label }}</label>
<input id="{{ name }}" name="{{ name }}" type="{{ type }}" {% if required %} required {% endif %} value="{{ value }}" class="input {{ class }}" placeholder="{{ label }}">
<input id="{{ name }}" name="{{ name }}" type="{{ type }}" {% if required %} required {% endif %} value="{{ value }}" class="input {{ class }}" placeholder="{{ label }}" {% if min %} min="{{ min }}" {% endif %}>
{% endmacro input %}
{% macro checkbox(label, name, id='', checked=false) %}

View File

@ -193,7 +193,7 @@
<div class="bg-gray-100 p-3 mt-4 rounded-md">
<h3 class="text-primary-950 font-bold uppercase tracking-wide mb-2">Ausfahrt bearbeiten</h3>
<form action="/cox/trip/{{ trip.id }}" method="post" class="grid gap-3">
{{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true, value=trip.max_people) }}
{{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true, value=trip.max_people, min='0') }}
{{ macros::input(label='Anmerkungen', name='notes', type='input', value=trip.notes) }}
<input value="Bearbeiten" class="btn btn-primary" type="submit" />
</form>
@ -277,8 +277,8 @@
<div class="hidden">
<form action="/cox/trip" method="post" class="grid gap-3" id="sidebarForm">
<input class="day-js" type="hidden" name="day" value="" />
{{ macros::input(label='Startzeit (zB "10:00")', name='planned_starting_time', type='input', required=true) }}
{{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true) }}
{{ macros::input(label='Startzeit (zB "10:00")', name='planned_starting_time', type='time', required=true) }}
{{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true, min='0') }}
{{ macros::input(label='Anmerkungen', name='notes', type='input') }}
<input value="Erstellen" class="w-full btn btn-primary" type="submit" />
</form>
@ -290,9 +290,9 @@
<form action="/admin/planned-event" method="post" class="grid gap-3" id="addEventForm">
<input class="day-js" type="hidden" name="day" value="" />
{{ macros::input(label='Titel (z.B. Firmenrudern)', name='name', type='input', required=true) }}
{{ macros::input(label='Startzeit', name='planned_starting_time', type='input', required=true) }}
{{ macros::input(label='Anzahl Steuerleute', name='planned_amount_cox', type='number', required=true) }}
{{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true) }}
{{ macros::input(label='Startzeit', name='planned_starting_time', type='time', required=true) }}
{{ macros::input(label='Anzahl Steuerleute', name='planned_amount_cox', type='number', required=true, min='0') }}
{{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true, min='0') }}
{{ macros::checkbox(label='Gäste erlauben', name='max_allow_guestspeople') }}
{{ macros::input(label='Anmerkungen', name='notes', type='input') }}
<input value="Erstellen" class="w-full btn btn-primary" type="submit" />