2023-04-06 09:30:43 +02:00
|
|
|
{% import "includes/macros" as macros %}
|
2023-04-04 10:44:14 +02:00
|
|
|
{% extends "base" %}
|
|
|
|
{% block content %}
|
2024-03-04 13:28:42 +01:00
|
|
|
<div class="max-w-screen-lg w-full">
|
|
|
|
<h1 class="h1">Users</h1>
|
|
|
|
{% if allowed_to_edit %}
|
|
|
|
<form action="/admin/user/new"
|
|
|
|
method="post"
|
|
|
|
class="mt-4 bg-primary-900 rounded-md text-white px-3 pb-3 pt-2 sm:flex items-end justify-between">
|
|
|
|
<div class="w-full">
|
|
|
|
<h2 class="text-md font-bold mb-2 uppercase tracking-wide">Neuen User hinzufügen</h2>
|
|
|
|
<div class="grid md:grid-cols-3">
|
|
|
|
<div>
|
|
|
|
<label for="name" class="sr-only">Name</label>
|
|
|
|
<input type="text"
|
|
|
|
name="name"
|
|
|
|
class="relative block rounded-md border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 mb-2 md:mb-0"
|
|
|
|
placeholder="Name" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="text-right">
|
|
|
|
<input value="Hinzufügen"
|
|
|
|
type="submit"
|
|
|
|
class="w-28 mt-2 sm:mt-0 rounded-md bg-primary-500 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer" />
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
<!-- START filterBar -->
|
|
|
|
<div class="search-wrapper">
|
|
|
|
<label for="name" class="sr-only">Suche</label>
|
|
|
|
<input type="search"
|
|
|
|
name="name"
|
|
|
|
id="filter-js"
|
|
|
|
class="search-bar"
|
2024-03-20 20:59:41 +01:00
|
|
|
placeholder="Suchen nach (Name, [yes|no]-role:<name>, has-[no-]membership-pdf)" />
|
2023-09-27 15:36:07 +02:00
|
|
|
</div>
|
2024-03-04 13:28:42 +01:00
|
|
|
<!-- END filterBar -->
|
|
|
|
<div class="bg-primary-100 dark:bg-primary-950 p-3 rounded-b-md grid gap-4">
|
|
|
|
<div id="filter-result-js"
|
|
|
|
class="text-primary-950 dark:text-white text-right"></div>
|
|
|
|
{% for user in users %}
|
|
|
|
<div data-filterable="true"
|
2024-03-20 20:59:41 +01:00
|
|
|
data-filter="{{ user.name }} {% for role in roles %} {% if role.name in user.roles %} yes-role:{{ role.name }} {% else %} no-role:{{ role.name }} {% endif %} role-{{ role }} {% endfor %} {% if user.membership_pdf %}has-membership-pdf{% else %}has-no-membership-pdf{% endif %} ">
|
2024-03-04 13:28:42 +01:00
|
|
|
<form action="/admin/user"
|
|
|
|
method="post"
|
2024-03-20 20:59:41 +01:00
|
|
|
enctype="multipart/form-data"
|
2024-03-04 13:28:42 +01:00
|
|
|
class="bg-white dark:bg-primary-900 p-3 rounded-md w-full">
|
|
|
|
<div class="w-full grid gap-3">
|
|
|
|
<input type="hidden" name="id" value="{{ user.id }}" />
|
|
|
|
<div class="font-bold mb-1 text-black dark:text-white">
|
|
|
|
{{ user.name }}
|
|
|
|
{% if user.last_access %}
|
|
|
|
(last access:
|
|
|
|
{{ user.last_access | date }})
|
|
|
|
{% endif %}
|
|
|
|
{% if user.pw %}
|
|
|
|
<a class="block mt-1 font-normal text-primary-600 dark:text-primary-200 hover:text-primary-900 dark:hover:text-primary-300 underline"
|
|
|
|
href="/admin/user/{{ user.id }}/reset-pw">Passwort zurücksetzen</a>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
<div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-3">
|
|
|
|
{% for role in roles %}
|
|
|
|
{{ macros::checkbox(label=role.name, name="roles[" ~ role.id ~ "]", id=loop.index , checked=role.name in user.roles, disabled=allowed_to_edit == false) }}
|
|
|
|
{% endfor %}
|
2024-03-20 20:59:41 +01:00
|
|
|
{% if user.membership_pdf %}
|
|
|
|
<a href="/admin/user/{{ user.id }}/membership"
|
|
|
|
class="text-black dark:text-white">Beitrittserklärung herunterladen</a>
|
2024-03-20 22:13:18 +01:00
|
|
|
{% else %}
|
|
|
|
{{ macros::input(label='Beitrittserklärung', name='membership_pdf', id=loop.index, type="file", readonly=allowed_to_edit == false, accept='application/pdf') }}
|
2024-03-20 20:59:41 +01:00
|
|
|
{% endif %}
|
2024-03-04 13:28:42 +01:00
|
|
|
{{ macros::input(label='DOB', name='dob', id=loop.index, type="text", value=user.dob, readonly=allowed_to_edit == false) }}
|
|
|
|
{{ macros::input(label='Weight (kg)', name='weight', id=loop.index, type="text", value=user.weight, readonly=allowed_to_edit == false) }}
|
|
|
|
{{ macros::input(label='Sex', name='sex', id=loop.index, type="text", value=user.sex, readonly=allowed_to_edit == false) }}
|
|
|
|
{{ macros::input(label='Mitglied seit', name='member_since_date', id=loop.index, type="text", value=user.member_since_date, readonly=allowed_to_edit == false) }}
|
|
|
|
{{ macros::input(label='Geburtsdatum', name='birthdate', id=loop.index, type="text", value=user.birthdate, readonly=allowed_to_edit == false) }}
|
|
|
|
{{ macros::input(label='Mail', name='mail', id=loop.index, type="text", value=user.mail, readonly=allowed_to_edit == false) }}
|
|
|
|
{{ macros::input(label='Nickname', name='nickname', id=loop.index, type="text", value=user.nickname, readonly=allowed_to_edit == false) }}
|
|
|
|
{{ macros::input(label='Notizen', name='notes', id=loop.index, type="text", value=user.notes, readonly=allowed_to_edit == false) }}
|
|
|
|
{{ macros::input(label='Telefon', name='phone', id=loop.index, type="text", value=user.phone, readonly=allowed_to_edit == false) }}
|
|
|
|
{{ macros::input(label='Adresse', name='address', id=loop.index, type="text", value=user.address, readonly=allowed_to_edit == false) }}
|
|
|
|
{% if allowed_to_edit %}
|
|
|
|
{{ macros::select(label="Familie", data=families, name='family_id', selected_id=user.family_id, display=['names'], default="Keine Familie", new_last_entry='Neue Familie anlegen') }}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% if allowed_to_edit %}
|
|
|
|
<div class="mt-3 text-right">
|
|
|
|
<a href="/admin/user/{{ user.id }}/delete"
|
|
|
|
class="w-28 btn btn-alert"
|
|
|
|
onclick="return confirm('Wirklich löschen?');">
|
|
|
|
{% include "includes/delete-icon" %}
|
|
|
|
Löschen
|
|
|
|
</a>
|
|
|
|
<input value="Ändern" type="submit" class="w-28 btn btn-primary ml-1" />
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-04-04 10:44:14 +02:00
|
|
|
{% endblock content %}
|