[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>
<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"
role="alert">
>
<h2 class="h2">
Grunddaten
<br />
@ -18,7 +18,7 @@
{% endif %}
</small>
</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">
<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) }}
@ -30,11 +30,17 @@
{{ macros::inputgroup(label='Spitzname', name='nickname', type="text", value=user.nickname, readonly=not allowed_to_edit) }}
</form>
<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 class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5">
<h2 class="h2">
Mitgliedschaft
<br />
@ -55,7 +61,7 @@
{% endif %}
</small>
</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 %}
<div class="py-3 grid gap-3">
<form action="/admin/user/{{ user.id }}/change-member-since" method="post">
@ -104,9 +110,11 @@
{% endif %}
{% elif "Scheckbuch" in member %}
<div class="grid gap-3 pb-3">
<div class="max-h-60 overflow-y-scroll">
{% for log in logbook %}
{{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index, allowed_to_edit=false) }}
{% endfor %}
</div>
{% if allowed_to_edit %}
<button type="button"
onclick="document.getElementById('call-for-action').showModal()"
@ -134,7 +142,18 @@
method="post"
enctype="multipart/form-data"
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='Geburtsdatum', name='birthdate', type="date", value=user.birthdate, required=true) }}
{{ macros::input(label='Telefonnummer', name='phone', type="text", value=user.phone, required=true) }}
@ -152,14 +171,13 @@
</div>
{% if is_clubmember %}
<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>
<div class="mx-2 divide-y divide-gray-200 dark:divide-primary-600">
<div class="py-3">
<ul>
<div>
<ul class="divide-y divide-gray-200 dark:divide-primary-60 w-full">
{% for role in user.proper_roles -%}
{% 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>
<strong>
{% if role.formatted_name %}
@ -180,11 +198,32 @@
{% endfor %}
</ul>
{% if allowed_to_edit %}
<details>
<summary>+ Rolle</summary>
<form action="/admin/user/{{ user.id }}/add-role" method="post">
<fieldset>
<select name="role_id">
<div class="m-3">
<button type="button"
onclick="document.getElementById('role-modal').showModal()"
class="btn btn-primary w-full">Rolle hinzufügen</button>
</div>
<dialog id="role-modal"
class="max-w-screen-sm w-full dark:bg-primary-600 dark:text-white rounded-md"
onclick="document.getElementById('role-modal').close()">
<div onclick="event.stopPropagation();" class="p-3">
<button type="button"
onclick="document.getElementById('role-modal').close()"
title="Schließen"
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">
<svg class="inline h-5 w-5"
width="16"
height="16"
fill="currentColor"
viewBox="0 0 16 16">
<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>
</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 }}">
@ -193,25 +232,25 @@
{% else %}
{{ role.name }}
{% endif %}
{% if role.desc %}({{ role.desc }}){% endif %}
</option>
{% endif %}
{% endfor %}
</select>
<input value="Rolle hinzufügen" type="submit" class="btn btn-primary ml-1" />
</fieldset>
</form>
</details>
{% endif %}
</div>
<input value="Rolle hinzufügen" type="submit" class="btn btn-primary" />
</form>
</div>
</div>
</dialog>
{% endif %}
</div>
</div>
{% endif %}
{% if supposed_to_pay %}
<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>
<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">
{% if fee %}
<div>
@ -245,9 +284,9 @@
</div>
{% endif %}
<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>
<div class="mx-2 divide-y divide-gray-200 dark:divide-primary-600">
>
<h2 class="h2">Aktivitäten</h2>
<div class="mx-3 divide-y divide-gray-200 dark:divide-primary-600">
<div class="py-3">
<ul class="list-disc ms-4">
<li>Passwort zurückgesetzt am/um X</li>
@ -257,7 +296,7 @@
</div>
</div>
<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>
<div class="border-t bg-white dark:bg-primary-900 py-3 px-4 relative">
<span class="text-black dark:text-white cursor-pointer">
@ -279,11 +318,6 @@
method="post"
enctype="multipart/form-data"
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">
<input type="hidden" name="id" value="{{ user.id }}" />
<div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-3">
@ -321,9 +355,9 @@
</div>
</div>
<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>
<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">
{{ 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) }}