Merge pull request 'be able to unfix a boat damage for tech' (#1217) from unfix-damage into main #1220

Merged
philipp merged 2 commits from boat-reservation-sort into staging 2026-06-04 18:26:30 +02:00
4 changed files with 17 additions and 7 deletions
+2 -2
View File
@@ -261,8 +261,8 @@ WHERE
b.external = false b.external = false
AND b.location_id = (SELECT id FROM location WHERE name = 'Linz') AND b.location_id = (SELECT id FROM location WHERE name = 'Linz')
AND b.deleted = false AND b.deleted = false
ORDER BY ORDER BY
b.name DESC; b.amount_seats ASC, b.name ASC;
" "
) )
.fetch_all(db) .fetch_all(db)
+1 -1
View File
@@ -19,7 +19,7 @@
<div class="hidden"> <div class="hidden">
<div id="new-reservation"> <div id="new-reservation">
<form action="/boatreservation/new" method="post" class="grid gap-3"> <form action="/boatreservation/new" method="post" class="grid gap-3">
{{ log::boat_select(only_ones=false, id='boat') }} {{ log::boat_select(id='boat', allow_on_water=true, grouped_by_boattype=true) }}
{% if not loggedin_user %}{{ macros::select(label='Reserviert von', data=user, name='user_id_applicant') }}{% endif %} {% if not loggedin_user %}{{ macros::select(label='Reserviert von', data=user, name='user_id_applicant') }}{% endif %}
{{ macros::input(label='Beginn', name='start_date', type='date', required=true, wrapper_class='col-span-4') }} {{ macros::input(label='Beginn', name='start_date', type='date', required=true, wrapper_class='col-span-4') }}
{{ macros::input(label='Ende', name='end_date', type='date', required=true, wrapper_class='col-span-4') }} {{ macros::input(label='Ende', name='end_date', type='date', required=true, wrapper_class='col-span-4') }}
+12 -2
View File
@@ -73,8 +73,18 @@
class="btn btn-primary w-full col-span-4 m-auto" /> class="btn btn-primary w-full col-span-4 m-auto" />
</form> </form>
{% endmacro new %} {% endmacro new %}
{% macro boat_select(id="boat_id") %} {% macro boat_select(id="boat_id", allow_on_water=false, grouped_by_boattype=false) %}
{{ macros::select(label="Boot", data=boats, name="boat_id", required=true, id=id, display=["name", " (","cat",")"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water", "default_destination"], wrapper_class="col-span-4", show_seats=true, nonSelectableDefault=" -- Wähle ein Boot aus ---") }} {% if grouped_by_boattype %}
<div class="col-span-4">
<label class="text-sm text-gray-600 dark:text-gray-100">Boot</label>
<select name="boat_id" id="{{ id }}" class="input rounded-md" required>
<option disabled selected value> -- Wähle ein Boot aus ---</option>
{% for cat, g in boats | group_by(attribute="cat") %}<optgroup label="{{ cat }}">{% for b in g %}<option value="{{ b.id }}">{{ b.name }}{% if b.on_water %} (am Wasser){% endif %}</option>{% endfor %}</optgroup>{% endfor %}
</select>
</div>
{% else %}
{{ macros::select(label="Boot", data=boats, name="boat_id", required=true, id=id, display=["name", " (","cat",")"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water", "default_destination"], wrapper_class="col-span-4", show_seats=true, nonSelectableDefault=" -- Wähle ein Boot aus ---", allow_on_water=allow_on_water) }}
{% endif %}
{% endmacro boat_select %} {% endmacro boat_select %}
{% macro rower_select(id, selected, amount_seats='', class='', init='false', cox_on_boat='', steering_person_id='') %} {% macro rower_select(id, selected, amount_seats='', class='', init='false', cox_on_boat='', steering_person_id='') %}
{#{% if not amount_seats or amount_seats > 1 %}#} {#{% if not amount_seats or amount_seats > 1 %}#}
+2 -2
View File
@@ -274,7 +274,7 @@ function setChoiceByLabel(choicesInstance, label) {
{{ label }} {{ label }}
</label> </label>
{% endmacro checkbox %} {% endmacro checkbox %}
{% macro select(label, data, name='trip_type', default='', id='', selected_id='', display='', extras='', class='', wrapper_class='', required=false, show_seats=false, new_last_entry='', nonSelectableDefault=false, only_ergo=false) %} {% macro select(label, data, name='trip_type', default='', id='', selected_id='', display='', extras='', class='', wrapper_class='', required=false, show_seats=false, new_last_entry='', nonSelectableDefault=false, only_ergo=false, allow_on_water=false) %}
<div class="{{ wrapper_class }}"> <div class="{{ wrapper_class }}">
<label for="{{ name }}" class="text-sm text-gray-600 dark:text-gray-100">{{ label }}</label> <label for="{{ name }}" class="text-sm text-gray-600 dark:text-gray-100">{{ label }}</label>
{% if display == '' %} {% if display == '' %}
@@ -290,7 +290,7 @@ function setChoiceByLabel(choicesInstance, label) {
<option value="{{ d.id }}" <option value="{{ d.id }}"
{% if only_ergo and d.id!=4 %}disabled{% endif %} {% if only_ergo and d.id!=4 %}disabled{% endif %}
{% if d.id == selected_id %}selected{% endif %} {% 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 %} {% if extras != '' %} {% for extra in extras %} {% if extra != 'on_water' and d[extra] %} data- {{ extra }}={{ d[extra] }} {% else %} {% if d[extra] and not allow_on_water %}disabled{% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}