no boat is selected by default in the logbook -> users don't accidentally 'select' external boat
This commit is contained in:
parent
8e5661b2f3
commit
311e611d5f
@ -31,7 +31,7 @@
|
|||||||
method="post"
|
method="post"
|
||||||
id="form"
|
id="form"
|
||||||
class="grid grid-cols-4 gap-3"
|
class="grid grid-cols-4 gap-3"
|
||||||
onsubmit="Array.from(this.elements).forEach(e=>!e.value.trim()&&(e.disabled=true));">
|
onsubmit="if (!this.elements['boat_id'].value) { alert('Kein Boot ausgewählt'); return false; }Array.from(this.elements).forEach(e=>!e.value.trim()&&(e.disabled=true));">
|
||||||
{{ log::boat_select() }}
|
{{ log::boat_select() }}
|
||||||
<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 dark:text-gray-100">Bootssteuerung</div>
|
<div class="text-sm text-gray-600 dark:text-gray-100">Bootssteuerung</div>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
</form>
|
</form>
|
||||||
{% endmacro new %}
|
{% endmacro new %}
|
||||||
{% macro boat_select(id="boat_id") %}
|
{% macro boat_select(id="boat_id") %}
|
||||||
{{ macros::select(label="Boot", data=boats, name="boat_id", id=id, display=["name", " (","cat",")"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water", "default_destination"], wrapper_class="col-span-4", show_seats=true) }}
|
{{ macros::select(label="Boot", data=boats, name="boat_id", 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 %}
|
{% 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 %}#}
|
||||||
|
@ -147,7 +147,7 @@
|
|||||||
{{ 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='') %}
|
{% 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) %}
|
||||||
<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 == '' %}
|
||||||
@ -158,6 +158,7 @@
|
|||||||
class="input rounded-md {{ class }}"
|
class="input rounded-md {{ class }}"
|
||||||
{% 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 %}
|
||||||
|
{% if nonSelectableDefault %}<option disabled selected value>{{ nonSelectableDefault }}</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"] }}, "convert_handoperated_possible": {{ d["convert_handoperated_possible"] }}, "default_handoperated": {{ d["default_shipmaster_only_steering"] }}}' {% 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"] }}, "convert_handoperated_possible": {{ d["convert_handoperated_possible"] }}, "default_handoperated": {{ d["default_shipmaster_only_steering"] }}}' {% endif %}>
|
||||||
{% for displa in display -%}
|
{% for displa in display -%}
|
||||||
|
Loading…
Reference in New Issue
Block a user