{# Shows a fancy, optional lists of boats. They are grouped by boat category. Inputs: boats #} {% macro show_boats() %} {% for cat, grouped_boats in boats | group_by(attribute="cat") %}
{{ cat }} ({{ grouped_boats | length }})
{% for boat in grouped_boats | sort(attribute="name") %}
{{ boat.name }} {% if boat.owner %}(privat){% endif %}
{% endfor %}
{% endfor %} {% endmacro show_boats %} {# Shows the form for creating a new logbook entry. #} {% macro new(shipmaster) %}
{{ log::boat_select() }}
Bootssteuerung
{{ macros::checkbox(label='handgesteuert', name='shipmaster_only_steering', readonly=true) }}
{{ log::rower_select(id="newrower", selected=[], class="col-span-4", init=true) }} {{ macros::select(label="Schiffsführer", data=[], name='shipmaster', id="shipmaster-newrowerjs", wrapper_class="col-span-2") }} {{ macros::select(label="Steuerperson", data=[], name='steering_person', id="steering_person-newrowerjs", wrapper_class="col-span-2") }} {{ macros::input(label='Abfahrtszeit', name='departure', type='datetime-local', required=true, wrapper_class='col-span-2') }} {{ macros::input(label='Ankunftszeit', name='arrival', type='datetime-local', wrapper_class='col-span-2') }}
{% for distance in distances %}
{{ macros::input(label="Distanz", name="distance_in_km", id="distance_in_km" , type="number", min=0, value='', class="rounded-md") }} km
{{ macros::input(label="Kommentar", name="comments", type="text", wrapper_class="col-span-4") }} {{ macros::select(label="Typ", data=logtypes, name='logtype', default="Normal", wrapper_class="col-span-4") }}
{% endmacro new %} {% macro boat_select(id="boat_id") %} {{ 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 ---") }} {% endmacro boat_select %} {% macro rower_select(id, selected, amount_seats='', class='', init='false', cox_on_boat='', steering_person_id='') %} {#{% if not amount_seats or amount_seats > 1 %}#}
{#{% endif %}#} {% endmacro rower_select %} {% macro show(log, state, allowed_to_close=false) %}
{% endmacro show %} {% macro show_old(log, state, allowed_to_close=false, allowed_to_edit=false, index, hide_type=false) %}
{% if log.logtype and not hide_type %}
{% if log.logtype == 1 %} Wanderfahrt {% else %} {% if log.logtype == 2 %} Regatta {% else %} {{ log.logtype }} {% endif %} {% endif %}
{% endif %}
{{ log.boat.name }} ({{ log.shipmaster_user.name -}} {% if log.shipmaster_only_steering %} - handgesteuert {%- endif -%} ) {% 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') }}) {% else %} {{ log.departure | date(format='%d.%m.%Y (%H:%M)') }} {% if state == "completed" %} - {{ log.arrival | date(format='%d.%m.%Y (%H:%M)') }} {% endif %} {% endif %} {% set amount_rowers = log.rowers | length %} {% set amount_guests = log.boat.amount_seats - amount_rowers %} {% if allowed_to_close and state == "on_water" %} {{ log::home(log=log) }} {% else %}
{{ log.destination }} {% if state == "completed" %} ({{ log.distance_in_km }} km) {% endif %} {% if log.comments %}- "{{ log.comments }}"{% endif %}
{% if amount_guests > 0 or log.rowers | length > 0 %} {% if not log.boat.amount_seats == 1 %}
Ruderer: {% for rower in log.rowers -%} {{ rower.name }} {%- if rower.id == log.steering_user.id and rower.id != log.shipmaster_user.id %} (Steuerperson){%- endif -%} {%- if not loop.last or amount_guests > 0 and not log.boat.external %},{% endif %} {% endfor -%} {% if amount_guests > 0 and not log.boat.external %} Gäste (ohne Account): {{ amount_guests }} {% endif %}
{% endif %} {% endif %} {% endif %}
{% if allowed_to_edit %}
Handgesteuert:
{% include "includes/delete-icon" %} Löschen {% endif %}
{% endmacro show_old %} {% macro home(log) %}
{{ macros::input(label='Ankunftszeit', name='arrival', type='datetime-local', required=true, class="change-id-js rounded-md current-date-time") }}
{{ macros::input(label="Distanz", name="distance_in_km", id="distance_in_km" ~ log.id , type="number", min=0, value=log.distance_in_km, required=true, class="rounded-md change-id-js") }} km
{{ macros::input(label="Kommentar", name="comments", id="comments" ~ log.id, type="text", value=log.comments, class="rounded-md change-id-js") }}
Details ändern
{{ macros::input(label='Abfahrtszeit', name='departure', type='datetime-local', required=true, class="change-id-js rounded-md", value=log.departure) }} {{ log::rower_select(id="rowers"~log.id, selected=log.rowers, amount_seats=log.boat.amount_seats, steering_person_id=log.steering_user.id, cox_on_boat=log.shipmaster_user.id) }} {{ macros::select(label="Schiffsführer", data=[], name='shipmaster', id="shipmaster-rowers"~log.id, class="change-id-js", selected_id=log.shipmaster_user.id, required=true) }} {{ macros::select(label="Steuerperson", data=[], name='steering_person', id="steering_person-rowers"~log.id, class="change-id-js", selected_id=log.steering_user.id, required=true) }}
{{ macros::checkbox(label="Handgesteuert", name="shipmaster_only_steering", id="shipmaster_only_steering" ~ log.id , checked=log.shipmaster_only_steering,class="rounded-md change-id-js") }}
{{ macros::select(label="Typ", data=logtypes, name="logtype", id="logtype" ~ log.id, default="Normal", selected_id=log.logtype, class="rounded-md change-id-js") }}
Löschen {% endmacro home %}