staging #337

Merged
philipp merged 3 commits from staging into main 2024-04-03 08:07:54 +02:00
8 changed files with 119 additions and 89 deletions
Showing only changes of commit 06f9fcc427 - Show all commits

View File

@ -139,9 +139,8 @@ function selectBoatChange() {
const event = e as ChoiceBoatEvent; const event = e as ChoiceBoatEvent;
boat_reserved_today = event.detail.customProperties.boat_reserved_today; boat_reserved_today = event.detail.customProperties.boat_reserved_today;
console.log(event.detail.customProperties);
if (boat_reserved_today){ if (boat_reserved_today){
alert(event.detail.label+' wurde heute reserviert. Bitte kontrolliere, dass du die Reservierung nicht störst.'); alert(event.detail.label.trim()+' wurde heute reserviert. Bitte kontrolliere, dass du die Reservierung nicht störst.');
} }
boat_in_ottensheim = event.detail.customProperties.boat_in_ottensheim; boat_in_ottensheim = event.detail.customProperties.boat_in_ottensheim;

View File

@ -1,11 +0,0 @@
CREATE TABLE IF NOT EXISTS "boat_reservation" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"boat_id" INTEGER NOT NULL REFERENCES boat(id),
"start_date" DATE NOT NULL,
"end_date" DATE NOT NULL,
"time_desc" TEXT NOT NULL,
"usage" TEXT NOT NULL,
"user_id_applicant" INTEGER NOT NULL REFERENCES user(id),
"user_id_confirmation" INTEGER REFERENCES user(id),
"created_at" datetime not null default CURRENT_TIMESTAMP
);

View File

@ -42,22 +42,37 @@
<div id="filter-result-js" class="search-result"></div> <div id="filter-result-js" class="search-result"></div>
{% for reservation in boatreservations %} {% for reservation in boatreservations %}
<div data-filterable="true" <div data-filterable="true"
data-filter="TODO: ADD FILTER" data-filter="{{ reservation.user_applicant.name }} {{ reservation.boat.name }}"
class="w-full border-t bg-white dark:bg-primary-900 text-black dark:text-white p-3"> class="w-full border-t bg-white dark:bg-primary-900 text-black dark:text-white p-3">
<div class="w-full"> <div class="w-full">
Boot: {{ reservation.boat.name }} <strong>Boot:</strong>
{{ reservation.boat.name }}
<br /> <br />
Datum: {{ reservation.start_date }} <strong>Reservierung:</strong>
{% if reservation.end_date != reservation.start_date %}- {{ reservation.end_date }}{% endif %} {{ reservation.user_applicant.name }}
<br /> <br />
Uhrzeit: {{ reservation.time_desc }} <strong>Datum:</strong>
{{ reservation.start_date }}
{% if reservation.end_date != reservation.start_date %}
-
{{ reservation.end_date }}
{% endif %}
<br /> <br />
Zweck: {{ reservation.usage }} <strong>Uhrzeit:</strong>
{{ reservation.time_desc }}
<br /> <br />
Reserviert von {{ reservation.user_applicant.name }} <strong>Zweck:</strong>
{{ reservation.usage }}
{% if loggedin_user %} {% if loggedin_user %}
{% if loggedin_user.id == reservation.user_applicant.id or "admin" in loggedin_user.roles %} {% if loggedin_user.id == reservation.user_applicant.id or "admin" in loggedin_user.roles %}
<a href="/boatreservation/{{ reservation.id }}/delete">RESERVIERUNG LÖSCHEN</a> <div class="mt-3 text-right">
<a href="/boatreservation/{{ reservation.id }}/delete"
class="w-28 btn btn-alert"
onclick="return confirm('Willst du diese Reservierung wirklich löschen?');">
{% include "includes/delete-icon" %}
Löschen
</a>
</div>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>

View File

@ -104,6 +104,7 @@
<strong class="block text-primary-900 dark:text-white"> <strong class="block text-primary-900 dark:text-white">
{{ log.departure | date(format="%H:%M") }} {{ log.departure | date(format="%H:%M") }}
Uhr Uhr
<small>({{ log.departure | date(format="%d.%m.%Y") }})</small>
</strong> </strong>
<a href="#" <a href="#"
data-sidebar="true" data-sidebar="true"
@ -149,7 +150,8 @@
{% set amount_rowers = log.rowers | length %} {% set amount_rowers = log.rowers | length %}
{% set amount_guests = log.boat.amount_seats - amount_rowers %} {% set amount_guests = log.boat.amount_seats - amount_rowers %}
{% if amount_guests > 0 %} {% if amount_guests > 0 %}
Gäste <small class="text-gray-600">(ohne Account)</small>: Gäste
<small class="text-gray-600">(ohne Account)</small>:
{{ amount_guests }} {{ amount_guests }}
{% endif %} {% endif %}
{% if allowed_to_close and state == "on_water" %} {% if allowed_to_close and state == "on_water" %}
@ -182,18 +184,23 @@
</div> </div>
{% endif %} {% endif %}
<div {% if log.logtype %}class="mt-4 sm:mt-0"{% endif %}> <div {% if log.logtype %}class="mt-4 sm:mt-0"{% endif %}>
<strong class="text-black dark:text-white">{{ log.boat.name }}</strong> <small class="text-gray-600 dark:text-gray-100">({{ log.shipmaster_user.name -}} <strong class="text-black dark:text-white">{{ log.boat.name }}</strong>
<small class="text-gray-600 dark:text-gray-100">({{ log.shipmaster_user.name -}}
{% if log.shipmaster_only_steering %} {% if log.shipmaster_only_steering %}
- handgesteuert - handgesteuert
{% endif -%} {% endif -%}
)</small> )</small>
<small class="block text-gray-600 dark:text-gray-100"> <small class="block text-gray-600 dark:text-gray-100">
{% if state == "completed" and log.departure | date(format='%d.%m.%Y') == log.arrival | date(format='%d.%m.%Y') %} {% if state == "completed" and log.departure | date(format='%d.%m.%Y') == log.arrival | date(format='%d.%m.%Y') %}
{{ log.departure | date(format='%d.%m.%Y') }} ({{ log.departure | date(format='%H:%M') }} - {{ log.arrival | date(format='%H:%M') }}) {{ log.departure | date(format='%d.%m.%Y') }}
({{ log.departure | date(format='%H:%M') }}
-
{{ log.arrival | date(format='%H:%M') }})
{% else %} {% else %}
{{ log.departure | date(format='%d.%m.%Y (%H:%M)') }} {{ log.departure | date(format='%d.%m.%Y (%H:%M)') }}
{% if state == "completed" %} {% if state == "completed" %}
- {{ log.arrival | date(format='%d.%m.%Y (%H:%M)') }} -
{{ log.arrival | date(format='%d.%m.%Y (%H:%M)') }}
{% endif %} {% endif %}
{% endif %} {% endif %}
</small> </small>
@ -205,7 +212,8 @@
<div class="text-black dark:text-white"> <div class="text-black dark:text-white">
{{ log.destination }} {{ log.destination }}
{% if state == "completed" %} {% if state == "completed" %}
<small class="text-gray-600 dark:text-gray-100">({{ log.distance_in_km }} km)</small> <small class="text-gray-600 dark:text-gray-100">({{ log.distance_in_km }}
km)</small>
{% endif %} {% endif %}
{% if log.comments %}<span class="text-sm italic">- "{{ log.comments }}"</span>{% endif %} {% if log.comments %}<span class="text-sm italic">- "{{ log.comments }}"</span>{% endif %}
</div> </div>
@ -217,7 +225,9 @@
{% if not loop.last or amount_guests > 0 and log.boat.name != 'Externes Boot' %},{% endif %} {% if not loop.last or amount_guests > 0 and log.boat.name != 'Externes Boot' %},{% endif %}
{% endfor %} {% endfor %}
{% if amount_guests > 0 and log.boat.name != 'Externes Boot' %} {% if amount_guests > 0 and log.boat.name != 'Externes Boot' %}
Gäste <small class="text-gray-600 dark:text-gray-100">(ohne Account)</small>: {{ amount_guests }} Gäste
<small class="text-gray-600 dark:text-gray-100">(ohne Account)</small>:
{{ amount_guests }}
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}

View File

@ -1,18 +1,25 @@
{% macro boatreservation() %} {% macro boatreservation() %}
{% if reservations %} {% if reservations %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow grid gap-3" <div class="bg-white dark:bg-primary-900 rounded-md shadow pb-2 mt-3">
style="margin-top: 10px"> <h2 class="h2">Reservierungen ({{ reservations | length }})</h2>
<h2 class="h2">Bootsreservierungen</h2> <div class="grid grid-cols-1 gap-3 mb-3 w-full">
<div class="p2 text-center" style="margin-bottom: 10px;">
<ul style=" justify-content: space-around; padding: 0; list-style: none">
{% for reservation in reservations %} {% for reservation in reservations %}
<li> <div class="pt-2 px-3 border-t text-primary-900 dark:text-white">
{{ reservation.boat.name }} &bullet; {{ reservation.start_date }} <strong class="block">
{% if reservation.end_date != reservation.start_date %}- {{ reservation.end_date }}{% endif %} {{ reservation.start_date | date(format="%d.%m.%Y") }}
&bullet; Uhrzeit: {{ reservation.time_desc }} &bullet; Zweck: {{ reservation.usage }} {% if reservation.end_date != reservation.start_date %}
</li> -
{{ reservation.end_date | date(format="%d.%m.%Y") }}
{% endif %}
<small>({{ reservation.time_desc }})</small>
</strong>
<span class="block">
{{ reservation.boat.name }}
<small>({{ reservation.user_applicant.name }})</small>
</span>
<span class="text-sm italic">{{ reservation.usage }}</span>
</div>
{% endfor %} {% endfor %}
</ul>
</div> </div>
</div> </div>
{% endif %} {% endif %}
@ -75,6 +82,8 @@
{% endif %} {% endif %}
<a href="/boatdamage" <a href="/boatdamage"
class="block w-100 py-2 hover:text-primary-600 border-t">Bootsschaden</a> class="block w-100 py-2 hover:text-primary-600 border-t">Bootsschaden</a>
<a href="/boatreservation"
class="block w-100 py-2 hover:text-primary-600 border-t">Bootsreservierung</a>
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@ -54,19 +54,6 @@
</div> </div>
</details> </details>
</div> </div>
{% if loggedin_user.weight and loggedin_user.sex and loggedin_user.dob %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert">
<h2 class="h2">Ergo</h2>
<div class="p-3">
<ul class="list-none ms-2">
<li class="py-1">
<a href="/ergo" class="block w-100 py-2 hover:text-primary-600">Ergo</a>
</li>
</ul>
</div>
</div>
{% endif %}
{% if "Donau Linz" in loggedin_user.roles and "Unterstützend" not in loggedin_user.roles and "Förderndes Mitglied" not in loggedin_user.roles %} {% if "Donau Linz" in loggedin_user.roles and "Unterstützend" not in loggedin_user.roles and "Förderndes Mitglied" not in loggedin_user.roles %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5" <div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert"> role="alert">
@ -166,6 +153,19 @@
</ul> </ul>
</div> </div>
{% endif %} {% endif %}
{% if loggedin_user.weight and loggedin_user.sex and loggedin_user.dob %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert">
<h2 class="h2">Ergo</h2>
<div class="p-3">
<ul class="list-none ms-2">
<li class="py-1">
<a href="/ergo" class="block w-100 py-2 hover:text-primary-600">Ergo</a>
</li>
</ul>
</div>
</div>
{% endif %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5" <div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert"> role="alert">
<h2 class="h2">Allgemein</h2> <h2 class="h2">Allgemein</h2>

View File

@ -9,16 +9,18 @@
{{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }} {{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }}
</div> </div>
{% endif %} {% endif %}
{{ macros::boatreservation() }} <div class="w-full grid lg:grid-cols-5 gap-3 mt-5">
<div class="w-full grid md:grid-cols-5 gap-3 mt-5"> <div>
<div class="bg-white dark:bg-primary-900 rounded-md hidden md:block shadow"> <div class="bg-white dark:bg-primary-900 rounded-md hidden md:block shadow">
<h2 class="h2">Boote</h2> <h2 class="h2">Boote</h2>
<div>{{ log::show_boats(only_ones=false) }}</div> <div>{{ log::show_boats(only_ones=false) }}</div>
</div> </div>
</div>
<div class="md:col-span-3 bg-white dark:bg-primary-900 rounded-md shadow"> <div class="md:col-span-3 bg-white dark:bg-primary-900 rounded-md shadow">
<h2 class="h2">Neue Ausfahrt</h2> <h2 class="h2">Neue Ausfahrt</h2>
<div class="p-3">{{ log::new(only_ones=false, shipmaster=-1) }}</div> <div class="p-3">{{ log::new(only_ones=false, shipmaster=-1) }}</div>
</div> </div>
<div>
<div class="bg-white dark:bg-primary-900 rounded-md shadow"> <div class="bg-white dark:bg-primary-900 rounded-md shadow">
<h2 class="h2">Am Wasser</h2> <h2 class="h2">Am Wasser</h2>
<div> <div>
@ -31,6 +33,8 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
{{ macros::boatreservation() }}
</div>
</div> </div>
</div> </div>
<script src="/public/logbook.js"></script> <script src="/public/logbook.js"></script>

View File

@ -4,17 +4,19 @@
{% block content %} {% block content %}
<div class="w-full"> <div class="w-full">
<h1 class="h1">Logbuch</h1> <h1 class="h1">Logbuch</h1>
{{ macros::boatreservation() }} <div class="w-full grid lg:grid-cols-5 gap-3 mt-5">
<div class="w-full grid md:grid-cols-5 gap-3 mt-5"> <div>
<div class="bg-white dark:bg-primary-900 rounded-md hidden md:block shadow"> <div class="bg-white dark:bg-primary-900 rounded-md hidden md:block shadow">
<h2 class="h2">Boote</h2> <h2 class="h2">Boote</h2>
<div>{{ log::show_boats(only_ones=false) }}</div> <div>{{ log::show_boats(only_ones=false) }}</div>
</div> </div>
</div>
<div class="md:col-span-3 bg-white dark:bg-primary-900 rounded-md shadow"> <div class="md:col-span-3 bg-white dark:bg-primary-900 rounded-md shadow">
<h2 class="h2">Neue Ausfahrt</h2> <h2 class="h2">Neue Ausfahrt</h2>
<div class="p-3">{{ log::new(shipmaster=loggedin_user.id) }}</div> <div class="p-3">{{ log::new(shipmaster=loggedin_user.id) }}</div>
</div> </div>
<div class="bg-white dark:bg-primary-900 rounded-md shadow"> <div>
<div class="bg-white dark:bg-primary-900 rounded-md shadow pb-2">
<h2 class="h2">Am Wasser</h2> <h2 class="h2">Am Wasser</h2>
{% if on_water | length > 0 %} {% if on_water | length > 0 %}
{% for log in on_water %} {% for log in on_water %}
@ -30,6 +32,8 @@
<p class="p-3 text-center text-black dark:text-white">Kein Boot am Wasser</p> <p class="p-3 text-center text-black dark:text-white">Kein Boot am Wasser</p>
{% endif %} {% endif %}
</div> </div>
{{ macros::boatreservation() }}
</div>
</div> </div>
</div> </div>
<script src="/public/logbook.js"></script> <script src="/public/logbook.js"></script>