[TASK] style boat screen

This commit is contained in:
Marie Birner 2023-09-28 16:40:05 +02:00
parent ccc66200a0
commit 926465a11c
3 changed files with 65 additions and 49 deletions

View File

@ -9,11 +9,9 @@
<h1 class="h1">Boats</h1> <h1 class="h1">Boats</h1>
{{ boat::new() }} {{ boat::new() }}
<div class="bg-primary-100 p-3 rounded-b-md grid gap-4"> {% for boat in boats %}
{% for boat in boats %} {{ boat::edit(boat=boat, uuid=loop.index) }}
{{ boat::edit(boat=boat, uuid=loop.index) }} {% endfor %}
{% endfor %}
</div>
</div> </div>

View File

@ -1,49 +1,67 @@
{% macro new() %} {% macro new() %}
<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">
<div class="w-full"> <h2 class="text-md font-bold tracking-wide bg-primary-900 mt-3 p-3 text-white flex justify-between items-center rounded-md">
<h2 class="text-md font-bold mb-2 uppercase tracking-wide"> Neues Boot
Neues Boot hinzufügen
</h2> <a href="#" class="inline-flex justify-center rounded-md bg-primary-600 mx-1 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"
{{ macros::input(label="Name", name="name", type="text", required=true) }} data-sidebar="true" data-trigger="sidebar" data-header="Neues Boot anlegen" data-body="#new-boat">
{{ macros::input(label="Anzahl Sitze", name="amount_seats", type="number", required=true, min=1) }} {% include "includes/plus-icon" %}
{{ macros::input(label="Baujahr", name="year_built", type="number", min=1950, max=2050) }} <span class="sr-only">Neues Boot anlegen</span>
{{ macros::input(label="Bootsbauer", name="boatbuilder", type="text") }} </a>
{{ macros::select(label="Standort", data=locations, name='location_id', selected_id=1) }} </h2>
{{ macros::select(label="Besitzer", data=users, name='owner', default="Verein") }} <div class="hidden">
{{ macros::checkbox(label="handgesteuert", name="default_shipmaster_only_steering")}} <div id="new-boat">
{{ macros::checkbox(label="Skull", name="skull", checked=true)}} <form action="/admin/boat/new" method="post" class="">
{{ macros::checkbox(label="Externes Boot (anderer Verein)", name="external")}} {{ macros::input(label="Name", name="name", type="text", required=true) }}
</div> {{ macros::input(label="Anzahl Sitze", name="amount_seats", type="number", required=true, min=1) }}
<div class="text-right"> {{ macros::input(label="Baujahr", name="year_built", type="number", min=1950, max=2050) }}
<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"/> {{ macros::input(label="Bootsbauer", name="boatbuilder", type="text") }}
</div> {{ macros::select(label="Standort", data=locations, name='location_id', selected_id=1) }}
</form> {{ macros::select(label="Besitzer", data=users, name='owner', default="Verein") }}
<div class="my-3">
{{ macros::checkbox(label="handgesteuert", name="default_shipmaster_only_steering")}}
{{ macros::checkbox(label="Skull", name="skull", checked=true)}}
{{ macros::checkbox(label="Externes Boot (anderer Verein)", name="external")}}
</div>
<input value="Hinzufügen" type="submit" class="w-full mt-2 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"/>
</form>
</div>
</div>
</div>
<div class="bg-gray-200 p-3 mt-4 rounded-t-md">
<label for="name" class="sr-only">Suche</label>
<input type="search" name="name" id="filter-js" class="w-full 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:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 mb-2 md:mb-0" placeholder="Suchen nach Namen...">
</div>
<div id="filter-result-js" class="bg-gray-200 text-primary-950 pb-3 px-3 text-right"></div>
{% endmacro new %} {% endmacro new %}
{% macro edit(boat, uuid) %} {% macro edit(boat, uuid) %}
<form action="/admin/boat/{{ boat.id }}" data-filterable="true" method="post" class="bg-white p-3 rounded-md flex items-end md:items-center justify-between"> <div data-filterable="true" data-filter="{{ boat.name }}" class="w-full border-t">
<div class="w-full"> <form action="/admin/boat/{{ boat.id }}" data-filterable="true" method="post" class="bg-white p-4 w-full">
<input type="hidden" name="id" value="{{ boat.id }}"/> <div class="w-full">
<div class="font-bold mb-1">{{ boat.name }}<br/></div> <input type="hidden" name="id" value="{{ boat.id }}"/>
<div class="grid md:grid-cols-3"> <div class="font-bold mb-1">{{ boat.name }}<br/></div>
{{ macros::input(label='Name', name='name', type='text', value=boat.name) }} <div class="grid md:grid-cols-3 gap-3">
{{ macros::input(label='Amount Seats', name='amount_seats', type='number', min=0, value=boat.amount_seats) }} {{ macros::input(label='Name', name='name', type='text', value=boat.name) }}
{{ macros::select(data=locations, label='Standort', name='location_id', selected_id=boat.location_id) }} {{ macros::input(label='Plätze', name='amount_seats', type='number', min=0, value=boat.amount_seats) }}
{{ macros::select(data=users, label='Besitzer', name='owner', selected_id=boat.owner, default="Vereinsboot") }} {{ macros::select(data=locations, label='Standort', name='location_id', selected_id=boat.location_id) }}
{{ macros::input(label='Baujahr', name='year_built', type='number', min=1950, value=boat.year_built) }} {{ macros::select(data=users, label='Besitzer', name='owner', selected_id=boat.owner, default="Vereinsboot") }}
{{ macros::input(label='Bootsbauer', name='boatbuilder', type='text', value=boat.boatbuilder) }} {{ macros::input(label='Baujahr', name='year_built', type='number', min=1950, value=boat.year_built) }}
{{ macros::checkbox(label='default_shipmaster_only_steering', name='default_shipmaster_only_steering', id=uuid , checked=boat.default_shipmaster_only_steering) }} {{ macros::input(label='Bootsbauer', name='boatbuilder', type='text', value=boat.boatbuilder) }}
{{ macros::checkbox(label='skull', name='skull', id=uuid , checked=boat.skull) }} {{ macros::checkbox(label='hangesteuert', name='default_shipmaster_only_steering', id=uuid , checked=boat.default_shipmaster_only_steering) }}
{{ macros::checkbox(label='external', name='external', id=uuid , checked=boat.external) }} {{ macros::checkbox(label='Skull', name='skull', id=uuid , checked=boat.skull) }}
</div> {{ macros::checkbox(label='Externes Boot', name='external', id=uuid , checked=boat.external) }}
</div> </div>
<div class="grid gap-3"> </div>
<a href="/admin/boat/{{ boat.id }}/delete" class="inline-block btn btn-alert" onclick="return confirm('Wirklich löschen?');"> <div class="text-right mt-3">
{% include "includes/delete-icon" %} <a href="/admin/boat/{{ boat.id }}/delete" class="inline-block btn btn-alert" onclick="return confirm('Wirklich löschen?');">
Löschen {% include "includes/delete-icon" %}
</a> Löschen
<input value="Ändern" type="submit" class="w-28 btn btn-primary"/> </a>
</div> <input value="Ändern" type="submit" class="w-28 btn btn-primary"/>
</form> </div>
</form>
</div>
{% endmacro edit %} {% endmacro edit %}

View File

@ -80,7 +80,7 @@
{% if display == '' %} {% if display == '' %}
{% set display = ["name"] %} {% set display = ["name"] %}
{% endif %} {% endif %}
<select name="{{ name }}" {% if id %} id="{{ id }}" {% else %} id="{{ name }}" {% endif %} class="input rounded-md h-10 {{ class }}"> <select name="{{ name }}" {% if id %} id="{{ id }}" {% else %} id="{{ name }}" {% endif %} class="input rounded-md {{ class }}">
{% if default %} {% if default %}
<option selected value>{{ default }}</option> <option selected value>{{ default }}</option>
{% endif %} {% endif %}