add ergo tool

This commit is contained in:
2023-11-02 12:15:10 +01:00
parent 2eba6a0f66
commit 1ff050a247
12 changed files with 486 additions and 95 deletions

View File

@ -54,6 +54,9 @@
{{ 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) }}
{{ macros::input(label='DOB', name='dob', id=loop.index, type="text", value=user.dob) }}
{{ macros::input(label='Weight (kg)', name='weight', id=loop.index, type="text", value=user.weight) }}
{{ macros::input(label='Sex', name='sex', id=loop.index, type="text", value=user.sex) }}
</div>
{% if user.pw %}
<a class="inline-block mt-1 text-primary-600 hover:text-primary-900 underline" href="/admin/user/{{ user.id }}/reset-pw">Passwort zurücksetzen</a>

View File

@ -0,0 +1,31 @@
{% 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">Aktuelle Woche</h1>
<details>
<summary>Dirty Thirty</summary>
<p>
<div class="border-r border-l">{% for stat in thirty %}{{ stat.name }}&#9;{{ stat.dob }}&#9;{{ stat.weight }}&#9;{{ stat.sex }}&#9;&#9;Donau Linz&#9;{{ stat.result }}
{% endfor %}
</div>
</p>
</details>
<details>
<summary>Dirty Dozen</summary>
<p>
<div class="border-r border-l">{% for stat in dozen %}{{ stat.name }}&#9;{{ stat.dob }}&#9;{{ stat.weight }}&#9;{{ stat.sex }}&#9;&#9;Donau Linz&#9;{{ stat.result }}
{% endfor %}
</div>
</p>
</details>
</div>
{% endblock content%}

80
templates/ergo.html.tera Normal file
View File

@ -0,0 +1,80 @@
{% 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">Neuer Eintrag</h1>
<details>
<summary>Dirty Thirty</summary>
<p>
<div class="border-r border-l">
<form action="/ergo/thirty" method="post" enctype="multipart/form-data">
<label for="user-thirty" class="text-sm text-gray-600">Ergo-Fahrer</label>
<select name="user" id="user-thirty" class="input">
{% for user in users %}
<option value="{{ user.id }}">{{ user.name }}</option>
{% endfor %}
</select>
{{ macros::input(label="Zeit [(hh:)mm:ss]/Distanz [m]", name="result", required=true, type="text", class="input") }}
<input type="file" name="proof" class="input">
<input type="submit" value="Speichern" class="btn btn-primary w-full col-span-4 m-auto"/>
</form>
</div>
</p>
</details>
<details>
<summary>Dirty Dozen</summary>
<p>
<div class="border-r border-l">
<form action="/ergo/dozen" method="post" enctype="multipart/form-data">
<label for="user-dozen" class="text-sm text-gray-600">Ergo-Fahrer</label>
<select name="user" id="user-dozen" class="input">
<option disabled="disabled">User auswählen</option>
{% for user in users %}
<option value="{{ user.id }}">{{ user.name }}</option>
{% endfor %}
</select>
{{ macros::input(label="Zeit [(hh:)mm:ss]/Distanz [m]", name="result", required=true, type="text", class="input") }}
<input type="file" name="proof" class="input">
<input type="submit" value="Speichern" class="btn btn-primary w-full col-span-4 m-auto"/>
</form>
</div>
</p>
</details>
<h1 class="h1">Aktuelle Woche</h1>
<details>
<summary>Dirty Thirty</summary>
<p>
<div class="border-r border-l">
<ol>
{% for stat in thirty %}
<li>{{ stat.name }}: {{ stat.result }}</li>
{% endfor %}
</ol>
</div>
</p>
</details>
<details>
<summary>Dirty Dozen</summary>
<p>
<div class="border-r border-l">
<ol>
{% for stat in dozen%}
<li>{{ stat.name }}: {{ stat.result }}</li>
{% endfor %}
</ol>
</div>
</p>
</details>
</div>
{% endblock content%}

View File

@ -1,70 +1,129 @@
{% macro header(loggedin_user) %}
<header class="bg-primary-900 text-white flex justify-center p-3 fixed w-full z-10">
<div class="max-w-screen-xl w-full flex justify-between items-center">
<div class="w-1/3 truncate">
<a href="/">
{{ loggedin_user.name }}
</a>
</div>
<div>
<a href="https://wiki.rudernlinz.at/ruderassistent#faq" target="_blank" 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">
{% include "includes/question-icon" %}
<span class="sr-only">FAQs</span>
</a>
{% if not loggedin_user.is_guest %}
<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="Logbuch" data-body="#mobile-menu">
{% include "includes/book" %}
<span class="sr-only">Logbuch</span>
</a>
<div class="hidden">
<div id="mobile-menu">
<a href="/log" class="block w-100 py-2 hover:text-primary-600">
Ausfahrt eintragen
</a>
<a href="/log/show" class="block w-100 py-2 hover:text-primary-600 border-t">
Logbuch
</a>
<a href="/stat" class="block w-100 py-2 hover:text-primary-600 border-t">
Statistik
</a>
<a href="/stat/boats" class="block w-100 py-2 hover:text-primary-600 border-t">
Bootsauswertung
</a>
{% if loggedin_user.is_admin %}
<a href="/admin/boat" class="block w-100 py-2 hover:text-primary-600 border-t">
Boote
</a>
{% endif %}
<a href="/boatdamage" class="block w-100 py-2 hover:text-primary-600 border-t">
Bootsschaden
</a>
</div>
<header
class="bg-primary-900 text-white flex justify-center p-3 fixed w-full z-10"
>
<div class="max-w-screen-xl w-full flex justify-between items-center">
<div class="w-1/3 truncate">
<a href="/">
{{ loggedin_user.name }}
</a>
</div>
<div>
<a
href="https://wiki.rudernlinz.at/ruderassistent#faq"
target="_blank"
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"
>
{% include "includes/question-icon" %}
<span class="sr-only">FAQs</span>
</a>
{% if not loggedin_user.is_guest %}
<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="Logbuch"
data-body="#mobile-menu"
>
{% include "includes/book" %}
<span class="sr-only">Logbuch</span>
</a>
<div class="hidden">
<div id="mobile-menu">
<a href="/log" class="block w-100 py-2 hover:text-primary-600">
Ausfahrt eintragen
</a>
<a
href="/log/show"
class="block w-100 py-2 hover:text-primary-600 border-t"
>
Logbuch
</a>
{% if loggedin_user.weight and loggedin_user.sex and loggedin_user.dob %}
<a
href="/ergo"
class="block w-100 py-2 hover:text-primary-600 border-t"
>
Ergo
</a>
{% endif %}
<a
href="/stat"
class="block w-100 py-2 hover:text-primary-600 border-t"
>
Statistik
</a>
<a
href="/stat/boats"
class="block w-100 py-2 hover:text-primary-600 border-t"
>
Bootsauswertung
</a>
{% if loggedin_user.is_admin %}
<a
href="/admin/boat"
class="block w-100 py-2 hover:text-primary-600 border-t"
>
Boote
</a>
{% endif %}
<a
href="/boatdamage"
class="block w-100 py-2 hover:text-primary-600 border-t"
>
Bootsschaden
</a>
</div>
{% endif %}
{% if loggedin_user.is_admin %}
<a href="/admin/user" 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">
<svg class="inline h-4" width="16" height="16" fill="currentColor" class="bi bi-person-lines-fill" viewbox="0 0 16 16">
<path d="M6 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-5 6s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H1zM11 3.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5zm.5 2.5a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1h-4zm2 3a.5.5 0 0 0 0 1h2a.5.5 0 0 0 0-1h-2zm0 3a.5.5 0 0 0 0 1h2a.5.5 0 0 0 0-1h-2z"/>
</svg>
<span class="sr-only">Userverwaltung</span>
</a>
{% endif %}
<a href="/auth/logout" class="inline-flex justify-center rounded-md bg-primary-600 ml-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">
<svg class="inline h-4" width="24" height="24" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out">
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
<polyline points="16 17 21 12 16 7"></polyline>
<line x1="21" y1="12" x2="9" y2="12"></line>
</svg>
<span class="sr-only">Ausloggen</span>
</a>
</div>
</div>
</header>
<div class="h-8"></div>
</div>
{% endif %} {% if loggedin_user.is_admin %}
<a
href="/admin/user"
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"
>
<svg
class="inline h-4"
width="16"
height="16"
fill="currentColor"
class="bi bi-person-lines-fill"
viewbox="0 0 16 16"
>
<path
d="M6 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-5 6s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H1zM11 3.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5zm.5 2.5a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1h-4zm2 3a.5.5 0 0 0 0 1h2a.5.5 0 0 0 0-1h-2zm0 3a.5.5 0 0 0 0 1h2a.5.5 0 0 0 0-1h-2z"
/>
</svg>
<span class="sr-only">Userverwaltung</span>
</a>
{% endif %}
<a
href="/auth/logout"
class="inline-flex justify-center rounded-md bg-primary-600 ml-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"
>
<svg
class="inline h-4"
width="24"
height="24"
viewbox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-log-out"
>
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
<polyline points="16 17 21 12 16 7"></polyline>
<line x1="21" y1="12" x2="9" y2="12"></line>
</svg>
<span class="sr-only">Ausloggen</span>
</a>
</div>
</div>
</header>
<div class="h-8"></div>
{% endmacro header %}
{% macro input(label, name, type, required=false, class='rounded-md', value='', min='', hide_label=false, id='', autofocus=false, wrapper_class='') %}