add full CRUD for boats
This commit is contained in:
@ -59,7 +59,20 @@
|
||||
<form action="/admin/boat" data-filterable="true" method="post" class="bg-white p-3 rounded-md flex items-end md:items-center justify-between">
|
||||
<div class="w-full">
|
||||
<input type="hidden" name="id" value="{{ boat.id }}" />
|
||||
<div class="font-bold mb-1">{{ boat.name }}
|
||||
<div class="font-bold mb-1">{{ boat.name }}<br />
|
||||
</div>
|
||||
<div class="grid md:grid-cols-3">
|
||||
|
||||
|
||||
{{ macros::input(label='Name', name='name', type='text', value=boat.name) }}
|
||||
{{ macros::input(label='Amount Seats', name='amount_seats', type='number', min=0, value=boat.amount_seats) }}
|
||||
{{ macros::select(data=locations, label='location', select_name='location_id', selected_id=boat.location_id) }}
|
||||
{{ macros::select(data=users, label='users', select_name='owner', selected_id=boat.owner, default="Vereinsboot") }}
|
||||
{{ macros::input(label='Baujahr', name='year_built', type='number', min=1950, value=boat.year_built) }}
|
||||
{{ macros::input(label='Bootsbauer', name='boatbuilder', type='text', value=boat.boatbuilder) }}
|
||||
{{ macros::checkbox(label='default_shipmaster_only_steering', name='default_shipmaster_only_steering', id=loop.index , checked=boat.default_shipmaster_only_steering) }}
|
||||
{{ macros::checkbox(label='skull', name='skull', id=loop.index , checked=boat.skull) }}
|
||||
{{ macros::checkbox(label='external', name='external', id=loop.index , checked=boat.external) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid gap-3">
|
||||
|
@ -10,7 +10,7 @@
|
||||
{{ macros::checkbox(label='Gäste erlauben', name='allow_guests') }}
|
||||
{{ macros::checkbox(label='Immer anzeigen', name='always_show') }}
|
||||
{{ macros::input(label='Anmerkungen', name='notes', type='input') }}
|
||||
{{ macros::select(select_name='trip_type', trip_types=trip_types, default='Reguläre Ausfahrt') }}
|
||||
{{ macros::select(data=trip_types, select_name='trip_type', default='Reguläre Ausfahrt') }}
|
||||
|
||||
<input value="Erstellen" class="w-full btn btn-primary" type="submit" />
|
||||
</form>
|
||||
|
@ -7,7 +7,7 @@
|
||||
{{ macros::input(label='Anzahl Ruderer (ohne Steuerperson)', name='max_people', type='number', required=true, min='0') }}
|
||||
{{ macros::checkbox(label='Gäste erlauben', name='allow_guests') }}
|
||||
{{ macros::input(label='Anmerkungen', name='notes', type='input') }}
|
||||
{{ macros::select(select_name='trip_type', trip_types=trip_types, default='Reguläre Ausfahrt') }}
|
||||
{{ macros::select(data=trip_types, select_name='trip_type', default='Reguläre Ausfahrt') }}
|
||||
|
||||
<input value="Erstellen" class="w-full btn btn-primary" type="submit" />
|
||||
</form>
|
||||
|
@ -47,11 +47,13 @@
|
||||
</label>
|
||||
{% endmacro checkbox %}
|
||||
|
||||
{% macro select(trip_types, select_name='trip_type', default='', selected_id='') %}
|
||||
{% macro select(data, select_name='trip_type', default='', selected_id='') %}
|
||||
<select name="{{ select_name }}" class="input rounded-md h-10">
|
||||
<option selected value>{{ default }}</option>
|
||||
{% for trip_type in trip_types %}
|
||||
<option value="{{ trip_type.id }}" {% if trip_type.id == selected_id %} selected {% endif %}>{{ trip_type.name }}</option>
|
||||
{% if default %}
|
||||
<option selected value>{{ default }}</option>
|
||||
{% endif %}
|
||||
{% for d in data %}
|
||||
<option value="{{ d.id }}" {% if d.id == selected_id %} selected {% endif %}>{{ d.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% endmacro select %}
|
||||
|
Reference in New Issue
Block a user