<?php

session_start();

if (!isset($_SESSION['user_id'])) {
    header("Location: ../login.php");
    exit;
}

?>

<!DOCTYPE html>
<html lang="id">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Tambah Pengumuman - Admin DISPUSIP</title>

    <link
        href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
        rel="stylesheet">

    <style>
        body {
            background: #f4f7fb;
            font-family: Arial, sans-serif;
        }

        .container {
            max-width: 900px;
        }

        .card {
            border: none;
            border-radius: 15px;
            overflow: hidden;
        }

        .card-header {
            background: #07357e;
            color: white;
            padding: 20px 30px;
        }

        .card-header h4 {
            font-weight: 600;
        }

        .card-body {
            padding: 30px;
        }

        .form-label {
            font-weight: 600;
        }

        .form-control {
            border-radius: 8px;
        }

        .btn-primary {
            background: #07357e;
            border-color: #07357e;
        }

        .btn-primary:hover {
            background: #05285f;
            border-color: #05285f;
        }
    </style>

</head>

<body>

    <div class="container mt-5 mb-5">

        <div class="card shadow">

            <div class="card-header">

                <h4 class="mb-1">
                    Tambah Pengumuman
                </h4>

                <small>
                    Tambahkan pengumuman baru untuk website DISPUSIP Kabupaten Banyuwangi.
                </small>

            </div>

            <div class="card-body">

                <form
                    action="proses-tambah.php"
                    method="POST">

                    <!-- JUDUL -->

                    <div class="mb-4">

                        <label class="form-label">
                            Judul Pengumuman
                        </label>

                        <input
                            type="text"
                            name="judul"
                            class="form-control"
                            placeholder="Masukkan judul pengumuman"
                            required>

                    </div>


                    <!-- TANGGAL -->

                    <div class="mb-4">

                        <label class="form-label">
                            Tanggal Pengumuman
                        </label>

                        <input
                            type="date"
                            name="tanggal"
                            class="form-control"
                            value="<?= date('Y-m-d'); ?>"
                            required>

                    </div>


                    <!-- ISI -->

                    <div class="mb-4">

                        <label class="form-label">
                            Isi Pengumuman
                        </label>

                        <textarea
                            name="isi"
                            class="form-control"
                            rows="8"
                            placeholder="Tuliskan isi pengumuman..."
                            required></textarea>

                    </div>


                    <!-- BUTTON -->

                    <button
                        type="submit"
                        class="btn btn-primary">
                        Simpan Pengumuman
                    </button>

                    <a
                        href="index.php"
                        class="btn btn-secondary">
                        ← Kembali
                    </a>

                </form>

            </div>

        </div>

    </div>

</body>

</html>