Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
<?php
require_once __DIR__ . '/../includes/auth.php';
// Redirect to login if not logged in
if (!isLoggedIn()) {
header('Location: login.php');
exit;
}
$pageTitle = 'Dashboard';
$currentUser = getCurrentUser();
// Get user's signups
require_once __DIR__ . '/../controllers/SignupController.php';
$signupController = new SignupController();
$mySignups = $signupController->getActiveSignupsByUser($currentUser['id']);
include __DIR__ . '/../includes/header.php';
?>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<div class="card hover:shadow-lg transition-shadow duration-200">
<div class="p-6">
<div class="text-4xl mb-4">📋</div>
<h3 class="text-lg font-semibold text-gray-900 mb-2">Beschikbare Taken</h3>
<p class="text-gray-600 mb-4">Schrijf in op beschikbare vrijwilligerstaken</p>
<a href="tasks.php" class="w-full inline-block text-center px-4 py-2 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 transition-colors duration-200">Bekijk Taken</a>
</div>
</div>
<?php if (isAdmin()): ?>
<div class="card hover:shadow-lg transition-shadow duration-200">
<div class="p-6">
<div class="text-4xl mb-4">⚙️</div>
<h3 class="text-lg font-semibold text-gray-900 mb-2">Beheer Taken</h3>
<p class="text-gray-600 mb-4">Maak nieuwe taken aan of wijzig bestaande taken</p>
<a href="admin_tasks.php" class="w-full inline-block text-center px-4 py-2 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 transition-colors duration-200">Beheer</a>
</div>
</div>
<?php endif; ?>
<div class="card hover:shadow-lg transition-shadow duration-200">
<div class="p-6">
<div class="text-4xl mb-4">📊</div>
<h3 class="text-lg font-semibold text-gray-900 mb-2">Mijn Inschrijvingen</h3>
<p class="text-gray-600 mb-4"><?php echo count($mySignups); ?> actieve inschrijving(en)</p>
<a href="#my-signups" class="w-full inline-block text-center px-4 py-2 bg-gray-600 text-white font-medium rounded-lg hover:bg-gray-700 transition-colors duration-200">Bekijk</a>
</div>
</div>
</div>
<div id="my-signups">
<h2 class="text-2xl font-bold text-gray-900 my-7">Mijn Inschrijvingen</h2>
<?php if (empty($mySignups)): ?>
<div class="card">
<div class="p-6 text-center">
<p class="text-gray-600">
Geen ingeschreven taken
</p>
</div>
</div>
<?php else: ?>
<div class="card overflow-hidden">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Taak</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Datum</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Locatie</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Acties</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<?php foreach ($mySignups as $signup): ?>
<tr class="hover:bg-gray-50">
<td class="px-6 py-4">
<div class="text-sm font-medium text-gray-900"><?php echo e($signup['title']); ?></div>
</td>
<td class="px-6 py-4 text-sm text-gray-500">
<?php echo formatDate($signup['date']); ?>
</td>
<td class="px-6 py-4 text-sm text-gray-500">
<?php echo e($signup['location']); ?>
</td>
<td class="px-6 py-4 text-sm">
<form method="POST" action="tasks.php" class="inline">
<input type="hidden" name="action" value="unsubscribe">
<input type="hidden" name="task_id" value="<?php echo $signup['task_id']; ?>">
<button type="submit" class="px-3 py-1.5 text-xs bg-red-600 text-white font-medium rounded-lg hover:bg-red-700 transition-colors duration-200" onclick="return confirm('Weet je zeker dat je wilt uitschrijven?')">
Uitschrijven
</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php include __DIR__ . '/../includes/footer.php'; ?>