137 lines
8.6 KiB
HTML
137 lines
8.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Admin Dashboard</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
|
<style>
|
|
/* Hier kannst du noch eigene Anpassungen vornehmen */
|
|
</style>
|
|
</head>
|
|
<body class="bg-gray-100 dark:bg-gray-900 text-gray-800 dark:text-gray-100">
|
|
<!-- Navigation -->
|
|
<nav class="bg-white dark:bg-gray-800 shadow">
|
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
<div class="flex justify-between h-16">
|
|
<div class="flex">
|
|
<div class="flex-shrink-0 flex items-center">
|
|
<img class="h-8 w-auto" src="{{ url_for('static', filename='clickcandit.png') }}" alt="Logo">
|
|
</div>
|
|
<div class="hidden sm:-my-px sm:ml-6 sm:flex sm:space-x-8">
|
|
<a href="{{ url_for('dashboard') }}" class="border-indigo-500 text-gray-900 dark:text-gray-100 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Dashboard</a>
|
|
<a href="{{ url_for('admin') }}" class="border-transparent text-gray-500 dark:text-gray-400 hover:border-gray-300 hover:text-gray-700 dark:hover:text-gray-200 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Admin Panel</a>
|
|
</div>
|
|
</div>
|
|
<div class="hidden sm:ml-6 sm:flex sm:items-center">
|
|
<div class="ml-3 relative">
|
|
<button type="button" class="max-w-xs bg-white dark:bg-gray-800 flex items-center text-sm rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" id="user-menu-button">
|
|
<span class="sr-only">Benutzermenü öffnen</span>
|
|
<img class="h-8 w-8 rounded-full" src="https://via.placeholder.com/150" alt="User Avatar">
|
|
</button>
|
|
<div class="origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg py-1 bg-white dark:bg-gray-800 ring-1 ring-black ring-opacity-5 hidden" id="user-dropdown">
|
|
<a href="{{ url_for('dashboard') }}" class="block px-4 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700">Dashboard</a>
|
|
<a href="{{ url_for('logout') }}" class="block px-4 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700">Abmelden</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="-mr-2 flex items-center sm:hidden">
|
|
<button type="button" class="bg-white dark:bg-gray-800 inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500" id="mobile-menu-button">
|
|
<span class="sr-only">Menü öffnen</span>
|
|
<svg class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
|
|
</svg>
|
|
<svg class="hidden h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Mobile Menü -->
|
|
<div class="sm:hidden hidden" id="mobile-menu">
|
|
<div class="pt-2 pb-3 space-y-1">
|
|
<a href="{{ url_for('dashboard') }}" class="bg-indigo-50 border-indigo-500 text-indigo-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Dashboard</a>
|
|
<a href="{{ url_for('admin') }}" class="border-transparent text-gray-600 dark:text-gray-400 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-800 dark:hover:text-gray-200 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Admin Panel</a>
|
|
</div>
|
|
<div class="pt-4 pb-3 border-t border-gray-200 dark:border-gray-700">
|
|
<div class="flex items-center px-4">
|
|
<div class="flex-shrink-0">
|
|
<img class="h-10 w-10 rounded-full" src="https://via.placeholder.com/150" alt="User Avatar">
|
|
</div>
|
|
<div class="ml-3">
|
|
<div class="text-base font-medium text-gray-800 dark:text-gray-100">{{ user }}</div>
|
|
<div class="text-sm font-medium text-gray-500 dark:text-gray-400">{{ session['user_email'] if session.get('user_email') else '' }}</div>
|
|
</div>
|
|
</div>
|
|
<div class="mt-3 space-y-1">
|
|
<a href="{{ url_for('dashboard') }}" class="block px-4 py-2 text-base font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700">Dashboard</a>
|
|
<a href="{{ url_for('logout') }}" class="block px-4 py-2 text-base font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700">Abmelden</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- Hauptinhalt -->
|
|
<main class="max-w-7xl mx-auto p-6">
|
|
<h2 class="text-2xl font-semibold text-gray-700 dark:text-gray-300 mb-4">Benutzerverwaltung</h2>
|
|
<div class="bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden">
|
|
<div class="px-4 py-5 sm:px-6">
|
|
<h3 class="text-lg leading-6 font-medium text-gray-900 dark:text-gray-100">Übersicht aller Benutzer</h3>
|
|
<p class="mt-1 max-w-2xl text-sm text-gray-500">Alle registrierten Benutzer werden hier aufgelistet.</p>
|
|
</div>
|
|
<div class="border-t border-gray-200 dark:border-gray-700">
|
|
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
|
|
<thead class="bg-gray-50 dark:bg-gray-700">
|
|
<tr>
|
|
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
|
|
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
|
|
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
|
|
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Rolle</th>
|
|
<th scope="col" class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Aktionen</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
|
|
{% for user in users %}
|
|
<tr>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-gray-100">{{ user.id }}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100">{{ user.name }}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ user.email }}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ user.role }}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
|
<a href="{{ url_for('edit_bookmarks', user_id=user.id) }}" class="text-indigo-600 dark:text-indigo-400 hover:text-indigo-900 mr-4">Lesezeichen bearbeiten</a>
|
|
{% if session['user_id'] != user.id %}
|
|
<form action="{{ url_for('delete_user', user_id=user.id) }}" method="POST" class="inline">
|
|
<button type="submit" class="text-red-600 dark:text-red-400 hover:text-red-900" onclick="return confirm('Benutzer wirklich löschen?');">Löschen</button>
|
|
</form>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="mt-6 flex justify-between items-center">
|
|
<a href="{{ url_for('register') }}" class="bg-indigo-600 text-white px-4 py-2 rounded hover:bg-indigo-700">Neuen Benutzer anlegen</a>
|
|
<a href="{{ url_for('dashboard') }}" class="text-indigo-600 hover:underline">Zurück zum Dashboard</a>
|
|
</div>
|
|
</main>
|
|
|
|
<script>
|
|
// Mobile Menü
|
|
const mobileMenuButton = document.getElementById('mobile-menu-button');
|
|
const mobileMenu = document.getElementById('mobile-menu');
|
|
mobileMenuButton.addEventListener('click', () => {
|
|
mobileMenu.style.display = mobileMenu.style.display === 'none' || mobileMenu.style.display === '' ? 'block' : 'none';
|
|
});
|
|
// User-Dropdown
|
|
const userMenuButton = document.getElementById('user-menu-button');
|
|
const userDropdown = document.getElementById('user-dropdown');
|
|
userMenuButton.addEventListener('click', () => {
|
|
userDropdown.classList.toggle('hidden');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|