add boatdamages functionality

This commit is contained in:
2023-08-02 14:29:19 +02:00
parent f7e623b8c3
commit ff31ad83fe
11 changed files with 419 additions and 16 deletions

View File

@ -51,6 +51,7 @@
<div class="grid md:grid-cols-3">
{{ macros::checkbox(label='Gast', name='is_guest', id=loop.index , checked=user.is_guest) }}
{{ macros::checkbox(label='Steuerberechtigter', name='is_cox', id=loop.index , checked=user.is_cox) }}
{{ macros::checkbox(label='Technical', name='is_tech', id=loop.index , checked=user.is_tech) }}
{{ macros::checkbox(label='Admin', name='is_admin', id=loop.index , checked=user.is_admin) }}
</div>
{% if user.pw %}

View File

@ -0,0 +1,59 @@
{% import "includes/macros" as macros %}
{% import "includes/forms/log" as log %}
{% extends "base" %}
{% block content %}
<div class="w-full">
<h1 class="h1">Bootschäden</h1>
{% if flash %}
{{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }}
{% endif %}
<h1>Neuen Schaden eintragen</h1>
<form action="/boatdamage" method="post">
{{ log::boat_select(only_ones=false) }}
{{ macros::input(label='Beschreibung des Schadens', name='desc', type='text', required=true) }}
<input type="submit" value="Schaden eintragen" />
</form>
<hr />
{% for boatdamage in boatdamages %}
Boat: {{ boatdamage.boat.name }}
Desc: {{ boatdamage.desc }}
Schaden eingetragen von {{ boatdamage.user_created.name }} am/um {{ boatdamage.created_at | date(format='%d. %m. %Y %H:%M') }}
{% if boatdamage.is_lock %}
Boot gesperrt
{% endif %}
{% if boatdamage.fixed_at %}
Repariert von {{ boatdamage.user_fixed.name }} am/um {{ boatdamage.fixed_at | date(format='%d. %m. %Y %H:%M') }}
{% elif loggedin_user.is_cox %}
<form action="/boatdamage/{{ boatdamage.id }}/fixed" method="post">
<input type="text" name="desc" value="{{ boatdamage.desc }}" />
{% if loggedin_user.is_tech %}
<input type="submit" value="Ich hab's repariert + verifiziert" />
{% else %}
<input type="submit" value="Ich hab's repariert" />
{% endif %}
</form>
{% endif %}
{% if boatdamage.verified_at %}
Verifziert von {{ boatdamage.user_verified.name }} am/um {{ boatdamage.verified_at | date(format='%d. %m. %Y %H:%M') }}
{% elif loggedin_user.is_tech and boatdamage.fixed_at %}
<form action="/boatdamage/{{ boatdamage.id }}/verified" method="post">
<input type="text" name="desc" value="{{ boatdamage.desc }}" />
<input type="submit" value="Ich hab's verifiziert" />
</form>
{% endif %}
<hr />
{% endfor %}
</div>
{% include "dynamics/sidebar" %}
{% endblock content%}

View File

@ -13,6 +13,13 @@
{% include "includes/question-icon" %}
<span class="sr-only">FAQs</span>
</a>
{% if loggedin_user.is_admin%}
<a href="/boatdamage" 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">
Bootsschaden
<span class="sr-only">Bootsschaden</span>
</a>
{% endif %}
{% if loggedin_user.is_admin %}
<a href="/stat" 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">
STATS