<?php
require_once "server_files/views/header.php";
?>

<div class="mt-4 mb-4">
	<h1 class="display-4">Notes de synthèse</h1>
</div>

<?php
/** @var Tournament $tournament */
foreach ($tournaments as $tournament) {
	echo "<h1>Tournoi de " . $tournament->getName() . "</h1>\n";
	$syntheses = $tournament->getAllSyntheses();
	/** @var Synthesis $synthesis */
	foreach ($syntheses as $synthesis) {
		$file_id = $synthesis->getFileId();
		$dest = $synthesis->getDest();
		$round = $synthesis->getRound();
		$version = $synthesis->getVersion();
		$team = Team::fromId($synthesis->getTeamId());
		$team_name = $team->getName();
		$team_trigram = $team->getTrigram();
		echo "<div class=\"alert alert-info\"><strong>Note de synthèse de l'équipe $team_name ($team_trigram) pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur")
			. ", tour $round</strong>, version $version : <a data-turbolinks=\"false\" href=\"/file/$file_id\">Télécharger</a></div>";
	}

	echo "<form method=\"POST\">\n";
	echo "<input type=\"hidden\" name=\"tournament\" value=\"" . $tournament->getId() . "\" />\n";
	echo "<input class=\"btn btn-lg btn-primary btn-block\" type=\"submit\" name=\"download_zip\" value=\"Télécharger l'archive\" />\n";
	echo "</form>\n";
}

require_once "server_files/views/footer.php";