[TASK] refactor roles and move elements around
Some checks failed
CI/CD Pipeline / test (push) Has started running
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled

This commit is contained in:
Marie Birner 2025-05-03 15:54:10 +02:00
parent 25c3a28c7d
commit 5b78afff63

View File

@ -6,7 +6,7 @@
<h1 class="h1">{{ user.name }}</h1> <h1 class="h1">{{ user.name }}</h1>
<div class="grid sm:grid-cols-2 gap-3"> <div class="grid sm:grid-cols-2 gap-3">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5" <div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert"> >
<h2 class="h2"> <h2 class="h2">
Grunddaten Grunddaten
<br /> <br />
@ -18,7 +18,7 @@
{% endif %} {% endif %}
</small> </small>
</h2> </h2>
<div class="mx-2 divide-y divide-gray-200 dark:divide-primary-600"> <div class="mx-3 divide-y divide-gray-200 dark:divide-primary-600">
<div class="py-3 grid gap-3"> <div class="py-3 grid gap-3">
<form action="/admin/user/{{ user.id }}/change-mail" method="post"> <form action="/admin/user/{{ user.id }}/change-mail" method="post">
{{ macros::inputgroup(label='Mailadresse', name='mail', type="text", value=user.mail, readonly=not allowed_to_edit) }} {{ macros::inputgroup(label='Mailadresse', name='mail', type="text", value=user.mail, readonly=not allowed_to_edit) }}
@ -30,11 +30,17 @@
{{ macros::inputgroup(label='Spitzname', name='nickname', type="text", value=user.nickname, readonly=not allowed_to_edit) }} {{ macros::inputgroup(label='Spitzname', name='nickname', type="text", value=user.nickname, readonly=not allowed_to_edit) }}
</form> </form>
<span>Notizen: to be replaced with activity :-)</span> <span>Notizen: to be replaced with activity :-)</span>
{% if user.pw and allowed_to_edit %}
<div class="text-right">
<a class="block my-1 font-normal text-[#f43f5e] dark:text-primary-200 hover:text-primary-900 dark:hover:text-primary-300 underline"
href="/admin/user/{{ user.id }}/reset-pw"
onclick="return confirm('Willst du wirklich das Passwort zurücksetzen?');">Passwort zurücksetzen</a>
</div>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5" <div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5">
role="alert">
<h2 class="h2"> <h2 class="h2">
Mitgliedschaft Mitgliedschaft
<br /> <br />
@ -55,7 +61,7 @@
{% endif %} {% endif %}
</small> </small>
</h2> </h2>
<div class="mx-2 divide-y divide-gray-200 dark:divide-primary-600"> <div class="mx-3 divide-y divide-gray-200 dark:divide-primary-600">
{% if is_clubmember %} {% if is_clubmember %}
<div class="py-3 grid gap-3"> <div class="py-3 grid gap-3">
<form action="/admin/user/{{ user.id }}/change-member-since" method="post"> <form action="/admin/user/{{ user.id }}/change-member-since" method="post">
@ -104,9 +110,11 @@
{% endif %} {% endif %}
{% elif "Scheckbuch" in member %} {% elif "Scheckbuch" in member %}
<div class="grid gap-3 pb-3"> <div class="grid gap-3 pb-3">
<div class="max-h-60 overflow-y-scroll">
{% for log in logbook %} {% for log in logbook %}
{{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index, allowed_to_edit=false) }} {{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index, allowed_to_edit=false) }}
{% endfor %} {% endfor %}
</div>
{% if allowed_to_edit %} {% if allowed_to_edit %}
<button type="button" <button type="button"
onclick="document.getElementById('call-for-action').showModal()" onclick="document.getElementById('call-for-action').showModal()"
@ -134,7 +142,18 @@
method="post" method="post"
enctype="multipart/form-data" enctype="multipart/form-data"
class="grid gap-3"> class="grid gap-3">
Type: Select -> normales Mitglied, förderndes Mitglied, unterstützendes Mitglied <div>
<label for="membertype" class="text-sm text-gray-600 dark:text-gray-100">Mitgliedstyp</label>
<select name="membertype" id="membertype" class="input rounded-md ">
<option selected="" value="regular">Reguläres Vereinsmitglied</option>
<option value="unterstuetzend">
Unterstützendes Vereinsmitglied
</option>
<option value="foerdend">
Förderndes Vereinsmitglied
</option>
</select>
</div>
{{ macros::input(label='Mitglied seit', name='member_since', type="date", value=now() | date(), required=true) }} {{ macros::input(label='Mitglied seit', name='member_since', type="date", value=now() | date(), required=true) }}
{{ macros::input(label='Geburtsdatum', name='birthdate', type="date", value=user.birthdate, required=true) }} {{ macros::input(label='Geburtsdatum', name='birthdate', type="date", value=user.birthdate, required=true) }}
{{ macros::input(label='Telefonnummer', name='phone', type="text", value=user.phone, required=true) }} {{ macros::input(label='Telefonnummer', name='phone', type="text", value=user.phone, required=true) }}
@ -152,14 +171,13 @@
</div> </div>
{% if is_clubmember %} {% if is_clubmember %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5" <div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert"> >
<h2 class="h2">Rollen</h2> <h2 class="h2">Rollen</h2>
<div class="mx-2 divide-y divide-gray-200 dark:divide-primary-600"> <div>
<div class="py-3"> <ul class="divide-y divide-gray-200 dark:divide-primary-60 w-full">
<ul>
{% for role in user.proper_roles -%} {% for role in user.proper_roles -%}
{% if not role.cluster and not role.hide_in_lists %} {% if not role.cluster and not role.hide_in_lists %}
<li class="flex my-2 w-full justify-between items-center hover:bg-gray-100"> <li class="flex w-full justify-between items-center p-3 {% if allowed_to_edit %} hover:bg-gray-100 dark:hover:bg-primary-950 {% endif %}">
<span> <span>
<strong> <strong>
{% if role.formatted_name %} {% if role.formatted_name %}
@ -180,38 +198,59 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% if allowed_to_edit %} {% if allowed_to_edit %}
<details> <div class="m-3">
<summary>+ Rolle</summary> <button type="button"
<form action="/admin/user/{{ user.id }}/add-role" method="post"> onclick="document.getElementById('role-modal').showModal()"
<fieldset> class="btn btn-primary w-full">Rolle hinzufügen</button>
<select name="role_id"> </div>
{% for role in roles %} <dialog id="role-modal"
{% if not role.cluster and role not in user.proper_roles and not role.hide_in_lists %} class="max-w-screen-sm w-full dark:bg-primary-600 dark:text-white rounded-md"
<option value="{{ role.id }}"> onclick="document.getElementById('role-modal').close()">
{% if role.formatted_name %} <div onclick="event.stopPropagation();" class="p-3">
{{ role.formatted_name }} <button type="button"
{% else %} onclick="document.getElementById('role-modal').close()"
{{ role.name }} title="Schließen"
{% endif %} class="sidebar-close border-0 bg-primary-100 focus:bg-primary-50 text-black flex items-center justify-center transform rotate-45 absolute right-0 mr-3">
{% if role.desc %}({{ role.desc }}){% endif %} <svg class="inline h-5 w-5"
</option> width="16"
{% endif %} height="16"
{% endfor %} fill="currentColor"
</select> viewBox="0 0 16 16">
<input value="Rolle hinzufügen" type="submit" class="btn btn-primary ml-1" /> <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"></path>
</fieldset> </svg>
</button>
<div class="mt-8">
<form action="/admin/user/{{ user.id }}/add-role" method="post" class="grid gap-3">
<div>
<label for="role_id" class="text-sm text-gray-600 dark:text-gray-100">Rollen</label>
<select name="role_id" id="role_id" class="input rounded-md ">
{% for role in roles %}
{% if not role.cluster and role not in user.proper_roles and not role.hide_in_lists %}
<option value="{{ role.id }}">
{% if role.formatted_name %}
{{ role.formatted_name }}
{% else %}
{{ role.name }}
{% endif %}
</option>
{% endif %}
{% endfor %}
</select>
</div>
<input value="Rolle hinzufügen" type="submit" class="btn btn-primary" />
</form> </form>
</details> </div>
</div>
</dialog>
{% endif %} {% endif %}
</div> </div>
</div>
</div> </div>
{% endif %} {% endif %}
{% if supposed_to_pay %} {% if supposed_to_pay %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5" <div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert"> >
<h2 class="h2">💸-Beitrag</h2> <h2 class="h2">💸-Beitrag</h2>
<div class="mx-2 divide-y divide-gray-200 dark:divide-primary-600"> <div class="mx-3 divide-y divide-gray-200 dark:divide-primary-600">
<div class="py-3"> <div class="py-3">
{% if fee %} {% if fee %}
<div> <div>
@ -245,9 +284,9 @@
</div> </div>
{% endif %} {% endif %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5" <div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert"> >
<h2 class="h2">Aktivität von und mit {{ user.name }}</h2> <h2 class="h2">Aktivitäten</h2>
<div class="mx-2 divide-y divide-gray-200 dark:divide-primary-600"> <div class="mx-3 divide-y divide-gray-200 dark:divide-primary-600">
<div class="py-3"> <div class="py-3">
<ul class="list-disc ms-4"> <ul class="list-disc ms-4">
<li>Passwort zurückgesetzt am/um X</li> <li>Passwort zurückgesetzt am/um X</li>
@ -257,7 +296,7 @@
</div> </div>
</div> </div>
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5" <div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert"> >
<h2 class="h2">TODO</h2> <h2 class="h2">TODO</h2>
<div class="border-t bg-white dark:bg-primary-900 py-3 px-4 relative"> <div class="border-t bg-white dark:bg-primary-900 py-3 px-4 relative">
<span class="text-black dark:text-white cursor-pointer"> <span class="text-black dark:text-white cursor-pointer">
@ -279,11 +318,6 @@
method="post" method="post"
enctype="multipart/form-data" enctype="multipart/form-data"
class="w-full mt-2"> class="w-full mt-2">
{% if user.pw %}
<a class="block my-1 font-normal text-[#f43f5e] dark:text-primary-200 hover:text-primary-900 dark:hover:text-primary-300 underline"
href="/admin/user/{{ user.id }}/reset-pw"
onclick="return confirm('Willst du wirklich das Passwort zurücksetzen?');">Passwort zurücksetzen</a>
{% endif %}
<div class="w-full grid gap-3 mt-3"> <div class="w-full grid gap-3 mt-3">
<input type="hidden" name="id" value="{{ user.id }}" /> <input type="hidden" name="id" value="{{ user.id }}" />
<div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-3"> <div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-3">
@ -321,9 +355,9 @@
</div> </div>
</div> </div>
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5" <div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert"> >
<h2 class="h2">Ergo-Challenge</h2> <h2 class="h2">Ergo-Challenge</h2>
<div class="mx-2 divide-y divide-gray-200 dark:divide-primary-600"> <div class="mx-3 divide-y divide-gray-200 dark:divide-primary-600">
<div class="py-3"> <div class="py-3">
{{ macros::input(label='DOB', name='dob', type="text", value=user.dob, readonly=allowed_to_edit == false) }} {{ macros::input(label='DOB', name='dob', type="text", value=user.dob, readonly=allowed_to_edit == false) }}
{{ macros::input(label='Weight (kg)', name='weight', type="text", value=user.weight, readonly=allowed_to_edit == false) }} {{ macros::input(label='Weight (kg)', name='weight', type="text", value=user.weight, readonly=allowed_to_edit == false) }}