allow deletion of logs

This commit is contained in:
philipp 2023-10-01 17:57:22 +02:00
parent fb27bc1609
commit 78bb6cfa75
3 changed files with 10 additions and 7 deletions

View File

@ -27,11 +27,10 @@
{% endmacro show_boats %} {% endmacro show_boats %}
{# Shows the form for creating a new logbook entry. #} {# Shows the form for creating a new logbook entry. #}
{% macro new(only_ones, allow_any_shipmaster, shipmaster) %} {% macro new(only_ones, shipmaster) %}
<form action="/log" method="post" id="form" class="grid grid-cols-4 gap-3" onsubmit="Array.from(this.elements).forEach(e=>!e.value.trim()&&(e.disabled=true));"> <form action="/log" method="post" id="form" class="grid grid-cols-4 gap-3" onsubmit="Array.from(this.elements).forEach(e=>!e.value.trim()&&(e.disabled=true));">
{{ log::boat_select(only_ones=only_ones) }} {{ log::boat_select(only_ones=only_ones) }}
{% if allow_any_shipmaster %}
<div class="col-span-4 md:col-span-3"> <div class="col-span-4 md:col-span-3">
<label for="shipmaster" class=" text-sm text-gray-600 ">Schiffsführer</label> <label for="shipmaster" class=" text-sm text-gray-600 ">Schiffsführer</label>
@ -56,9 +55,6 @@
</optgroup> </optgroup>
</select> </select>
</div> </div>
{% else %}
<input type="hidden" name="shipmaster" value="{{shipmaster}}"/>
{% endif %}
{% if not only_ones %} {% if not only_ones %}
<div class="col-span-4 md:col-span-1"> <div class="col-span-4 md:col-span-1">
<div class="text-sm text-gray-600">Bootssteuerung</div> <div class="text-sm text-gray-600">Bootssteuerung</div>
@ -161,6 +157,9 @@
<div id="close{{ log.id }}"> <div id="close{{ log.id }}">
{{ log::home(log=log, only_ones=only_ones) }} {{ log::home(log=log, only_ones=only_ones) }}
</div> </div>
<div>
LÖSCHEN
</div>
{% endif %} {% endif %}
<div id="log{{ log.id }}"> <div id="log{{ log.id }}">
{% if log.destination %} {% if log.destination %}
@ -178,6 +177,10 @@
{% for rower in log.rowers %} {% for rower in log.rowers %}
<p>{{ rower.name }}</p> <p>{{ rower.name }}</p>
{% endfor %} {% endfor %}
{% if allowed_to_close and state == "on_water" %}
<a href="/log/{{ log.id }}/delete" onclick="return confirm('Willst du diesen Eintrag wirklich löschen? Die Daten gehen verloren :O');">LÖSCHEN</a>
{% endif %}
</div> </div>
</div> </div>
</div> </div>

View File

@ -23,7 +23,7 @@
<div class="md:col-span-3 bg-white rounded-md shadow"> <div class="md:col-span-3 bg-white rounded-md shadow">
<h2 class="h2">Neue Ausfahrt</h2> <h2 class="h2">Neue Ausfahrt</h2>
<div class="p-3"> <div class="p-3">
{{ log::new(only_ones=false, allow_any_shipmaster=true, shipmaster=-1) }} {{ log::new(only_ones=false, shipmaster=-1) }}
</div> </div>
</div> </div>
<div class="bg-white rounded-md shadow"> <div class="bg-white rounded-md shadow">

View File

@ -25,7 +25,7 @@
<div class="md:col-span-3 bg-white rounded-md shadow"> <div class="md:col-span-3 bg-white rounded-md shadow">
<h2 class="h2">Neue Ausfahrt</h2> <h2 class="h2">Neue Ausfahrt</h2>
<div class="p-3"> <div class="p-3">
{{ log::new(only_ones=loggedin_user.is_cox==false, allow_any_shipmaster=loggedin_user.is_cox, shipmaster=loggedin_user.id) }} {{ log::new(only_ones=loggedin_user.is_cox==false, shipmaster=loggedin_user.id) }}
</div> </div>
</div> </div>
<div class="bg-white rounded-md shadow"> <div class="bg-white rounded-md shadow">