rowt/templates/boatdamages.html.tera

88 lines
4.6 KiB
Plaintext
Raw Normal View History

2023-08-02 14:29:19 +02:00
{% import "includes/macros" as macros %}
{% import "includes/forms/log" as log %}
{% extends "base" %}
{% block content %}
<div class="max-w-screen-lg w-full">
2023-08-02 14:29:19 +02:00
<h1 class="h1">Bootschäden</h1>
{% if flash %}
2023-09-28 17:31:20 +02:00
{{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3 mt-3") }}
2023-08-02 14:29:19 +02:00
{% endif %}
2023-09-28 17:31:20 +02:00
<h2 class="text-md font-bold tracking-wide bg-primary-900 mt-3 p-3 text-white flex justify-between items-center rounded-md">
Neuen Schaden
2023-08-02 14:29:19 +02:00
2023-09-28 17:31:20 +02:00
<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"
data-sidebar="true" data-trigger="sidebar" data-header="Neuen Schaden anlegen" data-body="#new-damage">
{% include "includes/plus-icon" %}
<span class="sr-only">Neuen Schaden eintragen</span>
</a>
</h2>
2023-08-02 14:29:19 +02:00
2023-09-28 17:31:20 +02:00
<div class="hidden">
<div id="new-damage">
<form action="/boatdamage" method="post" class="grid gap-3">
{{ log::boat_select(only_ones=false, id='boat') }}
2023-10-04 13:56:58 +02:00
{% if not loggedin_user %}
2023-10-23 21:38:08 +02:00
{{ macros::select(label='Gemeldet von', data=user, name='user_id') }}
2023-10-04 13:56:58 +02:00
{% endif %}
2023-09-28 17:31:20 +02:00
{{ macros::input(label='Beschreibung des Schadens', name='desc', type='text', required=true, wrapper_class='col-span-4') }}
<div class="col-span-4">
{{ macros::checkbox(label='Boot sperren', name='lock_boat', type='text', required=true) }}
</div>
<input type="submit" class="btn btn-primary w-full col-span-4" value="Schaden eintragen" />
</form>
</div>
</div>
2023-11-04 19:33:36 +01:00
<div class="search-wrapper">
2023-09-28 17:31:20 +02:00
<label for="name" class="sr-only">Suche</label>
2023-11-04 19:33:36 +01:00
<input type="search" name="name" id="filter-js" class="search-bar" placeholder="Suchen nach Namen...">
2023-09-28 17:31:20 +02:00
</div>
2023-11-04 19:33:36 +01:00
<div id="filter-result-js" class="search-result"></div>
2023-08-02 14:29:19 +02:00
{% for boatdamage in boatdamages | sort(attribute="verified") %}
2023-11-04 19:33:36 +01:00
<div data-filterable="true" data-filter="{{ boatdamage.boat.name }} {{ boatdamage.user_created.name }}" class="w-full border-t bg-white dark:bg-primary-900 text-black dark:text-white p-3 {% if boatdamage.verified_at %} opacity-50 {% endif %}">
<div class="w-full">
2023-11-04 19:33:36 +01:00
<strong>{{ boatdamage.created_at | date(format='%d.%m.%Y') }} <span class="font-normal text-gray-600 dark:text-gray-100">({{ boatdamage.boat.name }})</span></strong>{% if boatdamage.boat.damage %}<small class="block text-gray-600 dark:text-gray-100">(Boot gesperrt)</small>{% endif %}
2023-09-28 17:31:20 +02:00
<div>{{ boatdamage.desc }}</div>
2023-11-04 19:33:36 +01:00
<small class="block text-gray-600 dark:text-gray-100">
2023-09-28 17:31:20 +02:00
Schaden eingetragen von {{ boatdamage.user_created.name }} am/um {{ boatdamage.created_at | date(format='%d.%m.%Y (%H:%M)') }}
</small>
2023-08-02 14:29:19 +02:00
2023-09-28 17:31:20 +02:00
{% if boatdamage.fixed_at %}
2023-11-04 19:33:36 +01:00
<small class="block text-gray-600 dark:text-gray-100">Repariert von {{ boatdamage.user_fixed.name }} am/um {{ boatdamage.fixed_at | date(format='%d.%m.%Y (%H:%M)') }}</small>
2023-09-28 17:31:20 +02:00
{% else %}
{% if "cox" in loggedin_user.roles %}
<form action="/boatdamage/{{ boatdamage.id }}/fixed" method="post" class="flex justify-between mt-3">
<input type="text" name="desc" value="{{ boatdamage.desc }}" class="grow input rounded-s" />
{% if "tech" in loggedin_user.roles %}
<input type="submit" class="btn btn-primary" style="border-top-left-radius: 0; border-bottom-left-radius: 0;" value="Repariert und verifiziert" />
2023-09-28 17:31:20 +02:00
{% else %}
<input type="submit" class="btn btn-primary" style="border-top-left-radius: 0; border-bottom-left-radius: 0;" value="Repariert" />
2023-09-28 17:31:20 +02:00
{% endif %}
</form>
{% endif %}
{% endif %}
{% if boatdamage.verified_at %}
2023-11-04 19:33:36 +01:00
<small class="block text-gray-600 dark:text-gray-100">Verifziert von {{ boatdamage.user_verified.name }} am/um {{ boatdamage.verified_at | date(format='%d.%m.%Y (%H:%M)') }}</small>
2023-09-28 17:31:20 +02:00
{% else %}
{% if "tech" in loggedin_user.roles and boatdamage.fixed_at %}
<form action="/boatdamage/{{ boatdamage.id }}/verified" method="post" class="flex justify-between mt-3">
<input type="text" name="desc" value="{{ boatdamage.desc }}" class="grow input rounded-s"/>
<input type="submit" class="btn btn-dark" style="border-top-left-radius: 0; border-bottom-left-radius: 0;" value="Verifiziert" />
2023-09-28 17:31:20 +02:00
</form>
{% endif %}
{% endif %}
</div>
</div>
{% endfor %}
2023-08-02 14:29:19 +02:00
</div>
{% endblock content%}