[TASK] style boat reservation
Some checks are pending
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions
CI/CD Pipeline / test (push) Successful in 11m15s

This commit is contained in:
philipp 2024-04-02 20:59:09 +02:00
parent 1783527f39
commit 53afb4ee6f
6 changed files with 106 additions and 65 deletions

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

@ -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;"> {% for reservation in reservations %}
<ul style=" justify-content: space-around; padding: 0; list-style: none"> <div class="pt-2 px-3 border-t text-primary-900 dark:text-white">
{% for reservation in reservations %} <strong class="block">
<li> {{ reservation.start_date | date(format="%d.%m.%Y") }}
{{ reservation.boat.name }} &bullet; {{ reservation.start_date }} {% if reservation.end_date != reservation.start_date %}
{% if reservation.end_date != reservation.start_date %}- {{ reservation.end_date }}{% endif %} -
&bullet; Uhrzeit: {{ reservation.time_desc }} &bullet; Zweck: {{ reservation.usage }} {{ reservation.end_date | date(format="%d.%m.%Y") }}
</li> {% endif %}
{% endfor %} <small>({{ reservation.time_desc }})</small>
</ul> </strong>
<span class="block">
{{ reservation.boat.name }}
<small>({{ reservation.user_applicant.name }})</small>
</span>
<span class="text-sm italic">{{ reservation.usage }}</span>
</div>
{% endfor %}
</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 %}
@ -146,7 +155,7 @@
{% if required %}required="required"{% endif %}> {% if required %}required="required"{% endif %}>
{% if default %}<option selected value>{{ default }}</option>{% endif %} {% if default %}<option selected value>{{ default }}</option>{% endif %}
{% for d in data %} {% for d in data %}
<option value="{{ d.id }}" {% if d.id == selected_id %}selected{% endif %} {% if extras != '' %} {% for extra in extras %} {% if extra != 'on_water' and d[extra] %} data-{{ extra }}={{ d[extra] }} {% else %} {% if d[extra] %}disabled{% endif %} {% endif %} {% endfor %} {% endif %} {% if show_seats %} data-custom-properties='{"amount_seats": {{ d["amount_seats"] }}, "owner": "{{ d["owner"] }}", "default_destination": "{{ d["default_destination"] }}", "boat_in_ottensheim": {{ d["location_id"] == 2 }}, "boat_reserved_today": {{ d["reserved_today"] }}}'{% endif %}> <option value="{{ d.id }}" {% if d.id == selected_id %}selected{% endif %} {% if extras != '' %} {% for extra in extras %} {% if extra != 'on_water' and d[extra] %} data- {{ extra }}={{ d[extra] }} {% else %} {% if d[extra] %}disabled{% endif %} {% endif %} {% endfor %} {% endif %} {% if show_seats %} data-custom-properties='{"amount_seats": {{ d["amount_seats"] }}, "owner": "{{ d["owner"] }}", "default_destination": "{{ d["default_destination"] }}", "boat_in_ottensheim": {{ d["location_id"] == 2 }}, "boat_reserved_today": {{ d["reserved_today"] }}}' {% endif %}>
{% for displa in display -%} {% for displa in display -%}
{%- if d[displa] -%} {%- if d[displa] -%}
{{- d[displa] -}} {{- d[displa] -}}

View File

@ -9,27 +9,31 @@
{{ 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 class="bg-white dark:bg-primary-900 rounded-md shadow"> <div>
<h2 class="h2">Am Wasser</h2> <div class="bg-white dark:bg-primary-900 rounded-md shadow">
<div> <h2 class="h2">Am Wasser</h2>
{% if on_water | length > 0 %} <div>
{% for log in on_water %} {% if on_water | length > 0 %}
{{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones=false) }} {% for log in on_water %}
{% endfor %} {{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones=false) }}
{% else %} {% endfor %}
<p class="p-3 text-center text-black dark:text-white">Kein Boot am Wasser</p> {% else %}
{% endif %} <p class="p-3 text-center text-black dark:text-white">Kein Boot am Wasser</p>
{% endif %}
</div>
</div> </div>
{{ macros::boatreservation() }}
</div> </div>
</div> </div>
</div> </div>

View File

@ -4,31 +4,35 @@
{% 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>
<h2 class="h2">Am Wasser</h2> <div class="bg-white dark:bg-primary-900 rounded-md shadow pb-2">
{% if on_water | length > 0 %} <h2 class="h2">Am Wasser</h2>
{% for log in on_water %} {% if on_water | length > 0 %}
{% if log.shipmaster == loggedin_user.id %} {% for log in on_water %}
{{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones="cox" not in loggedin_user.roles) }} {% if log.shipmaster == loggedin_user.id %}
{% elif "Vorstand" in loggedin_user.roles %} {{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones="cox" not in loggedin_user.roles) }}
{{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones="cox" not in loggedin_user.roles) }} {% elif "Vorstand" in loggedin_user.roles %}
{% else %} {{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones="cox" not in loggedin_user.roles) }}
{{ log::show(log=log, state="on_water", only_ones=true) }} {% else %}
{% endif %} {{ log::show(log=log, state="on_water", only_ones=true) }}
{% endfor %} {% endif %}
{% else %} {% endfor %}
<p class="p-3 text-center text-black dark:text-white">Kein Boot am Wasser</p> {% else %}
{% endif %} <p class="p-3 text-center text-black dark:text-white">Kein Boot am Wasser</p>
{% endif %}
</div>
{{ macros::boatreservation() }}
</div> </div>
</div> </div>
</div> </div>