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 %}
|
2023-07-30 14:33:50 +02:00
|
|
|
<div class="max-w-screen-lg w-full">
|
|
|
|
{% if flash %}
|
|
|
|
{{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }}
|
|
|
|
{% endif %}
|
2023-04-28 19:44:32 +02:00
|
|
|
|
2023-07-30 14:33:50 +02:00
|
|
|
<h1 class="h1">Users</h1>
|
2023-04-05 22:20:12 +02:00
|
|
|
|
2023-07-30 14:33:50 +02:00
|
|
|
<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>
|
2023-09-28 11:52:14 +02:00
|
|
|
<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"/>
|
2023-07-30 14:33:50 +02:00
|
|
|
</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>
|
2023-04-05 20:56:36 +02:00
|
|
|
|
2023-07-30 14:33:50 +02:00
|
|
|
<!-- START filterBar -->
|
2023-11-04 19:33:36 +01:00
|
|
|
<div class="search-wrapper">
|
2023-07-30 14:33:50 +02:00
|
|
|
<label for="name" class="sr-only">Suche</label>
|
2023-12-30 21:30:27 +01:00
|
|
|
<input type="search" name="name" id="filter-js" class="search-bar" placeholder="Suchen nach (Name, [yes|no]-role:<name>)"/>
|
2023-07-30 14:33:50 +02:00
|
|
|
</div>
|
|
|
|
<!-- END filterBar -->
|
2023-04-06 10:27:04 +02:00
|
|
|
|
2023-11-04 19:33:36 +01:00
|
|
|
<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>
|
2023-07-30 14:33:50 +02:00
|
|
|
{% for user in users %}
|
2023-12-30 21:21:30 +01:00
|
|
|
<div data-filterable="true" data-filter="{{ user.name }}
|
2023-12-30 21:30:27 +01:00
|
|
|
{% for role in roles %}
|
|
|
|
{% if role.name in user.roles %}
|
|
|
|
yes-role:{{role.name}}
|
|
|
|
{% else %}
|
|
|
|
no-role:{{role.name}}
|
|
|
|
{% endif %}
|
2023-12-30 21:21:30 +01:00
|
|
|
role-{{role}}
|
|
|
|
{% endfor%}
|
|
|
|
|
|
|
|
">
|
2023-11-04 19:33:36 +01:00
|
|
|
<form action="/admin/user" method="post" class="bg-white dark:bg-primary-900 p-3 rounded-md w-full">
|
|
|
|
<div class="w-full grid gap-3">
|
2023-09-27 15:36:07 +02:00
|
|
|
<input type="hidden" name="id" value="{{ user.id }}"/>
|
2023-11-04 19:33:36 +01:00
|
|
|
<div class="font-bold mb-1 text-black dark:text-white">{{ user.name }}
|
2023-09-27 15:36:07 +02:00
|
|
|
{% if user.last_access %}
|
|
|
|
(last access:
|
|
|
|
{{ user.last_access | date }})
|
|
|
|
{% endif %}
|
2023-11-04 19:33:36 +01:00
|
|
|
{% 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 %}
|
2023-09-27 15:36:07 +02:00
|
|
|
</div>
|
2023-11-04 19:33:36 +01:00
|
|
|
<div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-3">
|
2023-12-23 21:27:52 +01:00
|
|
|
{% for role in roles %}
|
|
|
|
{{ macros::checkbox(label=role.name, name="roles[" ~ role.id ~ "]", id=loop.index , checked=role.name in user.roles) }}
|
|
|
|
{% endfor%}
|
2023-11-02 12:15:10 +01:00
|
|
|
{{ macros::input(label='DOB', name='dob', id=loop.index, type="text", value=user.dob) }}
|
|
|
|
{{ macros::input(label='Weight (kg)', name='weight', id=loop.index, type="text", value=user.weight) }}
|
|
|
|
{{ macros::input(label='Sex', name='sex', id=loop.index, type="text", value=user.sex) }}
|
2023-12-30 21:21:30 +01:00
|
|
|
{{ macros::input(label='Mitglied seit', name='member_since_date', id=loop.index, type="text", value=user.member_since_date) }}
|
|
|
|
{{ macros::input(label='Geburtsdatum', name='birthdate', id=loop.index, type="text", value=user.birthdate) }}
|
|
|
|
{{ macros::input(label='Mail', name='mail', id=loop.index, type="text", value=user.mail) }}
|
|
|
|
{{ macros::input(label='Nickname', name='nickname', id=loop.index, type="text", value=user.nickname) }}
|
|
|
|
{{ macros::input(label='Notizen', name='notes', id=loop.index, type="text", value=user.notes) }}
|
|
|
|
{{ macros::input(label='Telefon', name='phone', id=loop.index, type="text", value=user.phone) }}
|
|
|
|
{{ macros::input(label='Adresse', name='address', id=loop.index, type="text", value=user.address) }}
|
2024-01-18 16:37:54 +01:00
|
|
|
{{ 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') }}
|
2023-09-27 15:36:07 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-11-04 19:33:36 +01:00
|
|
|
<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?');">
|
2023-09-27 15:36:07 +02:00
|
|
|
{% include "includes/delete-icon" %}
|
|
|
|
Löschen
|
|
|
|
</a>
|
2023-11-04 19:33:36 +01:00
|
|
|
<input value="Ändern" type="submit" class="w-28 btn btn-primary ml-1"/>
|
2023-09-27 15:36:07 +02:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
2023-07-30 14:33:50 +02:00
|
|
|
{% endfor %}
|
|
|
|
</div>
|
2023-04-04 10:44:14 +02:00
|
|
|
|
2023-07-30 14:33:50 +02:00
|
|
|
</div>
|
2023-04-06 10:27:04 +02:00
|
|
|
|
2023-04-04 10:44:14 +02:00
|
|
|
{% endblock content %}
|