<?php
$typ=$_GET['typ'] ?? 'regular';
$tit = "";
if ($typ == 'regular') {
  $titel = 'Anmeldungen zur regulären Führung';
} elseif ($typ == 'sonnen') {
  $titel = 'Anmeldungen zur Sonnenführung';
  $tit = "-Sonne";
} else {
  http_response_code(400);
  die('Ungültiger Typ.');
}
?>

<!DOCTYPE html>
<html lang="de">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Anmeldungen<?echo $tit?></title>
  <link rel="stylesheet" href="css/anmeld.css"> <!-- Falls du ein Stylesheet hast -->
</head>
<body>

  <div id="container">
    <h1><?= $titel ?></h1>

    <h3>Führung am</h3>
    <div id="auswahl"></div>

    <table id="tabAnmeld">
      <thead></thead>
      <tbody></tbody>
    </table>

    <div id="names" style="display:none;">
      <table id="tnames"></table>
    </div>

    <div class="controls">
      <button id="absagen">Absage senden</button>
    </div>

    <!-- Detail-Dialog -->
    <dialog id="detaildialog">
      <div id="detailtext"></div>
      <button onclick="document.getElementById('detaildialog').close()">Schließen</button>
    </dialog>

    <!-- Eintrage-Dialog -->
    <dialog id="eintragedialog">
      <p id="eintragetext"></p>
      <button onclick="document.getElementById('eintragedialog').close()">OK</button>
    </dialog>

    <!-- Absage-Dialog -->
    <dialog id="absagedialog">
      <p id="absagetext"></p>
      <p id="bittegrund"></p>
      <div id="absagegrund"></div>
      <div id="absagebuttons">
        <button id="absagedialog-send">Senden</button>
        <button id="absagedialog-cancel">Abbrechen</button>
      </div>
    </dialog>

    <!-- Error Dialog -->
    <dialog id="errordialog">
      <p id="errortext"></p>
      <div id="errorbutton">
        <button id="errordialog-ok">OK</button>
      </div>
    </dialog>

  <!-- Info unter Tabelle -->
    <div id="author">
      <div>
          <a href="mailto:rxf@gmx.de">mailto:rxf@gmx.de</a>
      </div>
      <div id="versn"></div>
    </div>

  </div>

  <!-- Scripts -->
  <script src="https://cdn.jsdelivr.net/npm/luxon@3.7.1/build/global/luxon.min.js"></script>
  <script src="js/version.js" defer></script>
  <script src="js/anmeld.js" defer></script>

</body>
</html>