rowt/templates/admin/user/index.html.tera
2023-04-06 09:30:43 +02:00

49 lines
3.2 KiB
Plaintext

{% import "includes/macros" as macros %}
{% extends "base" %}
{% block content %}
<div class="max-w-screen-lg w-full grid gap-4">
<h1 class="text-center text-3xl uppercase tracking-wide font-bold text-primary-900">Users</h1>
<form action="/admin/user/new" method="post" class="bg-primary-900 text-white px-3 pb-3 pt-2 rounded-md flex items-end md:items-center 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:z-10 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 class="flex items-center">
<label for="is_guest" class="flex items-center cursor-pointer hover:text-gray-100"><input type="checkbox" id="is_guest" name="is_guest" class="h-4 w-4 accent-gray-200 mr-2" checked="true"/> Gast</label>
</div>
</div>
</div>
<div>
<input value="Hinzufügen" type="submit" class="w-28 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>
{% for user in users %}
<form action="/admin/user" method="post" class="bg-white p-3 rounded-md flex items-end md:items-center justify-between">
<div class="w-full">
<input type="hidden" name="id" value="{{ user.id }}" />
<div class="font-bold mb-1">{{ user.name }}</div>
<div class="grid md:grid-cols-3">
<label for="is_guest{{ loop.index }}" class="flex items-center cursor-pointer hover:text-gray-900"><input type="checkbox" id="is_guest{{ loop.index }}" name="is_guest" {% if user.is_guest %} checked="true"{% endif %} class="h-4 w-4 accent-primary-600 mr-2"/> Gast</label>
<label for="is_cox{{ loop.index }}" class="flex items-center cursor-pointer hover:text-gray-900"><input type="checkbox" id="is_cox{{ loop.index }}" name="is_cox" {% if user.is_cox %} checked="true"{% endif %} class="h-4 w-4 accent-primary-600 mr-2"/> Steuerberechtigter</label>
<label for="is_admin{{ loop.index }}" class="flex items-center cursor-pointer hover:text-gray-900"><input type="checkbox" id="is_admin{{ loop.index }}" name="is_admin" {% if user.is_admin %} checked="true"{% endif %} class="h-4 w-4 accent-primary-600 mr-2"/> Admin</label>
</div>
{% if user.pw %}
<a class="inline-block mt-1 text-primary-600 hover:text-primary-900 underline" href="/admin/user/{{ user.id }}/reset-pw">Passwort zurücksetzen</a>
{% endif %}
</div>
<div>
<input value="Ändern" type="submit" class="w-28 rounded-md bg-primary-600 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>
{% endfor %}
</div>
{% endblock content %}