Files
2026-01-28 15:57:24 +01:00

179 lines
8.8 KiB
HTML

{% extends 'base.html' %}
{% block title %}Admin Dashboard - Digitale Liturgie{% endblock %}
{% block content %}
<div class="space-y-8 max-w-6xl mx-auto px-4">
<section>
<h2 class="text-3xl font-semibold mb-6">Admin Dashboard</h2>
<form method="POST" class="space-y-6">
<input type="hidden" name="form_type" value="church_activation">
<div>
<h3 class="text-2xl font-semibold mb-4">Kerken</h3>
<div class="overflow-x-auto rounded-lg border border-gray-300">
<table class="min-w-full divide-y divide-gray-200 bg-white">
<thead class="bg-gray-100">
<tr>
<th scope="col" class="px-6 py-3 text-left text-sm font-semibold text-gray-700">Kerknaam</th>
<th scope="col" class="px-6 py-3 text-center text-sm font-semibold text-gray-700">Actief</th>
<th scope="col" class="px-6 py-3 text-left text-sm font-semibold text-gray-700">URL</th>
<th scope="col" class="px-6 py-3 text-center text-sm font-semibold text-gray-700">Acties</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
{% for church in churches %}
<tr>
<td class="whitespace-nowrap px-6 py-4 text-sm text-gray-900">{{ church.name }}</td>
<td class="text-center px-6 py-4">
<input type="checkbox" name="church_active_{{ church.id }}" {% if church.is_active %}checked{% endif %} class="h-5 w-5 text-blue-600">
</td>
<td class="px-6 py-4 text-sm text-blue-600">
{% if church.is_active %}
{% for board in church.boards %}
<div class="mb-1 break-all"><a href="{{ url_for('display_board_unique', unique_id=board.unique_id) }}" target="_blank" class="underline hover:text-blue-800 transition">{{ url_for('display_board_unique', unique_id=board.unique_id, _external=True) }}</a></div>
{% endfor %}
{% endif %}
</td>
<td class="text-center px-6 py-4">
<a href="#" class="bg-[#f7d91a] text-black px-6 py-3 rounded font-semibold hover:bg-yellow-300 transition">Weergeven</a>
<form action="{{ url_for('admin_delete_church', church_id=church.id) }}" method="post" style="display:inline;margin-left:8px;" onsubmit="return confirm('Weet je zeker dat je deze kerk en alle bijbehorende data wilt verwijderen?');">
<button type="submit" class="bg-red-600 text-white px-6 py-3 rounded font-semibold hover:bg-red-700 transition">Verwijderen</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div>
<button type="submit" class="bg-[#f7d91a] text-black px-6 py-3 rounded-md font-semibold shadow hover:bg-yellow-300 transition">Opslaan</button>
</div>
</form>
</section>
<section>
<h3 class="text-2xl font-semibold mb-4">SMTP instellingen (wachtwoord reset)</h3>
<div class="bg-white rounded-lg border border-gray-300 p-6 space-y-6">
<form method="POST" class="grid grid-cols-1 md:grid-cols-2 gap-6">
<input type="hidden" name="form_type" value="smtp_settings">
<div>
<label class="block mb-2 font-semibold text-gray-700">SMTP host</label>
<input type="text" name="smtp_host" value="{{ smtp_settings.host }}" class="w-full rounded-md border border-gray-300 p-3 shadow-sm">
</div>
<div>
<label class="block mb-2 font-semibold text-gray-700">SMTP port</label>
<input type="number" name="smtp_port" value="{{ smtp_settings.port }}" class="w-full rounded-md border border-gray-300 p-3 shadow-sm">
</div>
<div>
<label class="block mb-2 font-semibold text-gray-700">Gebruikersnaam</label>
<input type="text" name="smtp_username" value="{{ smtp_settings.username }}" class="w-full rounded-md border border-gray-300 p-3 shadow-sm">
</div>
<div>
<label class="block mb-2 font-semibold text-gray-700">Wachtwoord</label>
<input type="password" name="smtp_password" value="" placeholder="(leeg laten om niet te wijzigen)" class="w-full rounded-md border border-gray-300 p-3 shadow-sm">
</div>
<div>
<label class="block mb-2 font-semibold text-gray-700">Van email</label>
<input type="email" name="smtp_from_email" value="{{ smtp_settings.from_email }}" class="w-full rounded-md border border-gray-300 p-3 shadow-sm">
</div>
<div>
<label class="block mb-2 font-semibold text-gray-700">Van naam</label>
<input type="text" name="smtp_from_name" value="{{ smtp_settings.from_name }}" class="w-full rounded-md border border-gray-300 p-3 shadow-sm">
</div>
<div class="flex items-center gap-3">
<input type="checkbox" name="smtp_use_tls" {% if smtp_settings.use_tls %}checked{% endif %} class="h-5 w-5 text-blue-600">
<span class="text-gray-700 font-semibold">STARTTLS (TLS)</span>
</div>
<div class="flex items-center gap-3">
<input type="checkbox" name="smtp_use_ssl" {% if smtp_settings.use_ssl %}checked{% endif %} class="h-5 w-5 text-blue-600">
<span class="text-gray-700 font-semibold">SSL (SMTP_SSL)</span>
</div>
<div class="md:col-span-2 flex items-center gap-3">
<input type="checkbox" name="smtp_verify_tls" {% if smtp_settings.verify_tls %}checked{% endif %} class="h-5 w-5 text-blue-600">
<span class="text-gray-700 font-semibold">TLS certificaat verifiëren (aanbevolen)</span>
<span class="text-xs text-gray-500">(zet uit bij SSLCertVerificationError / self-signed certificaten)</span>
</div>
<div class="md:col-span-2 flex gap-3">
<button type="submit" class="bg-[#f7d91a] text-black px-6 py-3 rounded-md font-semibold shadow hover:bg-yellow-300 transition">SMTP opslaan</button>
</div>
</form>
<form method="POST" class="flex flex-col md:flex-row gap-3 items-start md:items-end">
<input type="hidden" name="form_type" value="smtp_test">
<div class="flex-1 w-full">
<label class="block mb-2 font-semibold text-gray-700">Test email naar</label>
<input type="email" name="smtp_test_to" placeholder="test@voorbeeld.nl" class="w-full rounded-md border border-gray-300 p-3 shadow-sm">
</div>
<button type="submit" class="bg-gray-800 text-white px-6 py-3 rounded-md font-semibold shadow hover:bg-gray-900 transition">Test email sturen</button>
</form>
</div>
</section>
<section>
<h3 class="text-2xl font-semibold mb-4">Gebruikers</h3>
<div class="overflow-x-auto rounded-lg border border-gray-300">
<table class="min-w-full divide-y divide-gray-200 bg-white">
<thead class="bg-gray-100">
<tr>
<th scope="col" class="px-6 py-3 text-left text-sm font-semibold text-gray-700">Gebruikersnaam</th>
<th scope="col" class="px-6 py-3 text-sm font-semibold text-gray-700">Kerk</th>
<th scope="col" class="px-6 py-3 text-sm font-semibold text-gray-700">Admin</th>
<th scope="col" class="px-6 py-3 text-center text-sm font-semibold text-gray-700">Impersonalisatie</th>
<th scope="col" class="px-6 py-3 text-center text-sm font-semibold text-gray-700">Acties</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
{% for user in users %}
<tr>
<td class="whitespace-nowrap px-6 py-4 text-sm text-gray-900">{{ user.username }}</td>
<td class="px-6 py-4 text-sm text-gray-900">{{ user.church.name }}</td>
<td class="px-6 py-4 text-sm text-gray-900">{% if user.is_admin %}Ja{% else %}Nee{% endif %}</td>
<td class="text-center px-6 py-4">
{% if not user.is_admin %}
<a href="{{ url_for('admin_impersonate', user_id=user.id) }}" class="bg-[#f7d91a] text-black text-xs px-6 py-3 rounded font-semibold hover:bg-yellow-300 transition">Impersonate</a>
{% else %}-{% endif %}
</td>
<td class="text-center px-6 py-4">
{% if not user.is_admin %}
<form action="{{ url_for('admin_delete_user', user_id=user.id) }}" method="post" style="display:inline;" onsubmit="return confirm('Weet je zeker dat je deze gebruiker en alle bijbehorende kerkdata wilt verwijderen?');">
<button type="submit" class="bg-red-600 text-white text-xs px-6 py-3 rounded font-semibold hover:bg-red-700 transition">Verwijderen</button>
</form>
{% else %}-{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
</div>
{% endblock %}