rowt/templates/admin/boat/index.html.tera

92 lines
5.5 KiB
Plaintext
Raw Normal View History

{% import "includes/macros" as macros %}
{% extends "base" %}
{% block content %}
<div class="max-w-screen-lg w-full">
{% if flash %}
{{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }}
{% endif %}
<h1 class="h1">Boats</h1>
<form action="/admin/boat/new" method="post" class="mt-4 bg-primary-900 rounded-md text-white px-3 pb-3 pt-2 sm:flex items-end justify-between">
<div class="w-full">
<h2 class="text-md font-bold mb-2 uppercase tracking-wide">Neues Boot hinzufügen</h2>
<div class="grid md:grid-cols-3">
<div>
<label for="name" class="sr-only">Name</label>
<input type="text" name="name" class="relative block rounded-md border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 mb-2 md:mb-0" placeholder="Name"/>
</div>
<div>
<label for="amount_seats" class="sr-only">Anzahl Sitze</label>
<input type="number" min=0 name="amount_seats" class="relative block rounded-md border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 mb-2 md:mb-0" placeholder="Anzahl Sitze"/>
</div>
<div>
<label for="year_built" class="sr-only">Baujahr</label>
<input type="number" min="1950" name="year_built" class="relative block rounded-md border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 mb-2 md:mb-0" placeholder="Baujahr"/>
</div>
<div>
<label for="boatbuilder" class="sr-only">Boatbuilder</label>
<input type="text" name="boatbuilder" class="relative block rounded-md border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 mb-2 md:mb-0" placeholder="Boatbuilder"/>
</div>
<div>
default_shipmaster_only_steering:
<label for="default_shipmaster_only_steering" class="sr-only">default_shipmaster_only_steering</label>
<input type="checkbox" name="default_shipmaster_only_steering" class="relative block rounded-md border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 mb-2 md:mb-0"/>
</div>
<div>
skull:
<label for="skull" class="sr-only">skull</label>
<input type="checkbox" name="skull" class="relative block rounded-md border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 mb-2 md:mb-0" checked="checked"/>
</div>
<div>
external:
<label for="external" class="sr-only">external</label>
<input type="checkbox" name="external" class="relative block rounded-md border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 mb-2 md:mb-0"/>
</div>
</div>
</div>
<div class="text-right">
<input value="Hinzufügen" type="submit" class="w-28 mt-2 sm:mt-0 rounded-md bg-primary-500 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer"/>
</div>
</form>
<div class="bg-primary-100 p-3 rounded-b-md grid gap-4">
<div id="filter-result-js" class="text-primary-950"></div>
{% for boat in boats %}
<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 }}" />
2023-07-22 15:34:42 +02:00
<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">
<a href="/admin/boat/{{ boat.id }}/delete" class="inline-block btn btn-alert" onclick="return confirm('Wirklich löschen?');">
{% include "includes/delete-icon" %}
Löschen
</a>
<input value="Ändern" type="submit" class="w-28 btn btn-primary"/>
</div>
</form>
{% endfor %}
</div>
</div>
{% endblock content %}