[TASK] refactor ui user detail page

This commit is contained in:
Marie Birner
2025-05-03 12:44:46 +02:00
parent c47b1988b2
commit 540c122248
3 changed files with 193 additions and 150 deletions

View File

@ -199,14 +199,55 @@ function setChoiceByLabel(choicesInstance, label) {
{% if pattern %}pattern="{{ pattern }}"{% endif %}
readonly/>
{% if allowed_to_edit %}
<button type="button" class="btn btn-primary rounded-l-none-important edit-js">Ändern</button>
<button type="button" class="btn btn-dark rounded-l-none-important edit-js">{% include "includes/pencil" %}</button>
<input value="x" type="reset" class="edit-js btn btn-alert btn-hidden rounded-none-important"/>
<input value="💾" type="submit" class="btn btn-primary btn-hidden rounded-l-none-important" />
{% endif %}
</div>
</div>
{% endmacro inputgroup %}
{% macro selectgroup(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, readonly=false) %}
<div class="{{ wrapper_class }}">
<label for="{{ name }}" class="text-sm text-gray-600 dark:text-gray-100">{{ label }}</label>
{% if display == '' %}
{% set display = ["name"] %}
{% endif %}
<div class="input-group">
<select name="{{ name }}"
{% if id %} id="{{ id }}" {% else %} id="{{ name }}" {% endif %}
class="input {% if readonly %}rounded-md{% else %}rounded-l-md{% endif %} {{ class }}"
{% if required %}required="required"{% endif %}
disabled>
{% if default %}<option selected value>{{ default }}</option>{% endif %}
{% if nonSelectableDefault %}<option disabled selected value>{{ nonSelectableDefault }}</option>{% endif %}
{% for d in data %}
<option value="{{ d.id }}"
{% if only_ergo and d.id!=4 %}disabled{% 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 %}
{% 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 -%}
{%- if d[displa] -%}
{{- d[displa] -}}
{%- else -%}
{{- displa -}}
{%- endif -%}
{%- endfor %}
</option>
{% endfor %}
{% if new_last_entry %}<option value="-1">{{ new_last_entry }}</option>{% endif %}
</select>
{% if allowed_to_edit %}
<button type="button" class="btn btn-dark rounded-l-none-important edit-js">{% include "includes/pencil" %}</button>
<input value="x" type="reset" class="edit-js btn btn-alert btn-hidden rounded-none-important"/>
<input value="💾" type="submit" class="btn btn-primary btn-hidden rounded-l-none-important" />
{% endif %}
</div>
</div>
{% endmacro selectgroup %}
{% macro checkbox(label, name, id='', checked=false, class='', disabled=false, readonly=false) %}
<label for="{{ name }}{{ id }}"