<?php


include "../classes/database.php";
include "../classes/themes.php";
include "../classes/sessie.php";


$sessie = Sessie::vindActieveSessie();
if ($sessie == null) {
    header("location: index.php");
    exit;
}
$user_id = $sessie->userId;




if (isset($_GET["id"])) {
    $geenIdee = $_GET["id"];
} else {
    $geenIdee = 1;
}


$themess = Themes::allethemeslatenzien();


$nummer = 0;


?>

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Themes overzicht</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet">
</head>

<body class="bg-light">
    <!-- Navbar -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary shadow">
        <div class="container-fluid">
            <a class="navbar-brand fw-bold" href="home.php">Dashboard</a>
            <div class="collapse navbar-collapse">
                <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                    <li class="nav-item"><a class="nav-link" href="setsadmin.php">Sets</a></li>
                    <li class="nav-item"><a class="nav-link active" href="themeadmin.php">Themes</a></li>
                    <li class="nav-item"><a class="nav-link" href="brandadmin.php">Brands</a></li>
                    <li class="nav-item"><a class="nav-link" href="voegtoetheme.php">Voeg toe</a></li>
                </ul>
                <a href="index.php" class="btn btn-outline-light">
                    Logout <i class="bi bi-box-arrow-right"></i>
                </a>
            </div>
        </div>
    </nav>

    <!-- Content -->
    <div class="container my-5">
        <h2 class="mb-4 text-center">Overzicht van Themes</h2>
        <div class="row g-4">
            <?php foreach ($themess as $themes): ?>
                <div class="col-sm-6 col-lg-4">
                    <div class="card shadow-sm h-100 border-0">
                        <div class="card-body">
                            <h5 class="card-title fw-semibold"><?= htmlspecialchars($themes->theme_name) ?></h5>
                            <h6 class="card-subtitle mb-2 text-muted">Theme ID: <?= htmlspecialchars($themes->theme_id) ?></h6>
                            <p class="card-text">Theme nummer <?= ++$nummer ?></p>
                        </div>
                        <div class="card-footer bg-white border-0 d-flex justify-content-between">
                            <a href="./bewerk/bewerkthemes.php?id=<?= $themes->theme_id ?>" class="btn btn-sm btn-outline-primary">
                                <i class="bi bi-pencil"></i> Bewerken
                            </a>
                            <a href="./groetjes/groetjesThemes.php?id=<?= $themes->theme_id ?>" class="btn btn-sm btn-outline-danger">
                                <i class="bi bi-trash"></i> Verwijderen
                            </a>
                        </div>
                    </div>
                </div>
            <?php endforeach; ?>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>