106 lines
4.9 KiB
PHP
106 lines
4.9 KiB
PHP
<section class="detail-hero console-detail-hero">
|
|
<div class="detail-cover console-cover">
|
|
<img
|
|
src="<?php print Helpers::echapper(Helpers::urlPhotoConsole($console["photo"] ?? null)); ?>"
|
|
alt="Photo de <?php print Helpers::echapper($console["nom"]); ?>"
|
|
>
|
|
</div>
|
|
<div class="detail-info">
|
|
<p class="eyebrow"><?php print Helpers::echapper($console["constructeur"]); ?><?php if (!empty($console["annee"])): ?> · <?php print (int) $console["annee"]; ?><?php endif; ?></p>
|
|
<h1 class="page-title"><?php print Helpers::echapper($console["nom"]); ?></h1>
|
|
<?php if (!empty($console["notes"])): ?>
|
|
<p class="lead-text"><?php print nl2br(Helpers::echapper($console["notes"])); ?></p>
|
|
<?php endif; ?>
|
|
|
|
<div class="page-actions mt-3">
|
|
<a href="/consoles/<?php print Helpers::echapper($console["id"]); ?>/modifier" class="btn btn-outline-neon">
|
|
<i class="mdi mdi-pencil"></i> Modifier
|
|
</a>
|
|
<a href="/jeux/creer?consoleId=<?php print Helpers::echapper($console["id"]); ?>" class="btn btn-neon">
|
|
<i class="mdi mdi-plus"></i> Ajouter un jeu
|
|
</a>
|
|
</div>
|
|
|
|
<form
|
|
method="post"
|
|
action="/consoles/<?php print Helpers::echapper($console["id"]); ?>/photo"
|
|
enctype="multipart/form-data"
|
|
class="photo-upload-bar mt-4"
|
|
>
|
|
<?php print Csrf::champCache(); ?>
|
|
<label class="form-label" for="photoConsole">
|
|
<i class="mdi mdi-camera-outline"></i>
|
|
<?php print Helpers::photoConsoleAbsente($console["photo"] ?? null) ? "Envoyer une photo" : "Remplacer la photo"; ?>
|
|
</label>
|
|
<div class="photo-upload-row">
|
|
<input
|
|
type="file"
|
|
class="form-control"
|
|
id="photoConsole"
|
|
name="photo"
|
|
accept="image/jpeg,image/png,image/webp,image/gif,image/*"
|
|
capture="environment"
|
|
required
|
|
>
|
|
<button type="submit" class="btn btn-neon">
|
|
<i class="mdi mdi-upload"></i> Envoyer
|
|
</button>
|
|
</div>
|
|
<div class="form-text">Prenez une photo ou choisissez un fichier (JPG, PNG, WebP, GIF — 5 Mo max).</div>
|
|
</form>
|
|
|
|
<?php if (!Helpers::photoConsoleAbsente($console["photo"] ?? null)): ?>
|
|
<form
|
|
method="post"
|
|
action="/consoles/<?php print Helpers::echapper($console["id"]); ?>/photo/supprimer"
|
|
class="mt-2"
|
|
onsubmit="return confirm('Supprimer la photo de cette console ?');"
|
|
>
|
|
<?php print Csrf::champCache(); ?>
|
|
<button type="submit" class="btn btn-sm btn-outline-danger">
|
|
<i class="mdi mdi-image-remove-outline"></i> Supprimer la photo
|
|
</button>
|
|
</form>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="mt-4">
|
|
<div class="section-heading">
|
|
<h2>Jeux sur cette console</h2>
|
|
<span><?php print count($jeux); ?> jeu<?php print count($jeux) > 1 ? "x" : ""; ?></span>
|
|
</div>
|
|
|
|
<?php if ($jeux === []): ?>
|
|
<div class="empty-state">
|
|
<i class="mdi mdi-controller-classic-outline"></i>
|
|
<p>Aucun jeu associé à cette console.</p>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="game-grid">
|
|
<?php foreach ($jeux as $jeu): ?>
|
|
<a class="game-card" href="/jeux/<?php print Helpers::echapper($jeu["id"]); ?>">
|
|
<img
|
|
src="<?php print Helpers::echapper(Helpers::urlJaquette($jeu["jaquette"] ?? null)); ?>"
|
|
alt="Jaquette de <?php print Helpers::echapper($jeu["titre"]); ?>"
|
|
loading="lazy"
|
|
>
|
|
<div class="game-card-body">
|
|
<h3><?php print Helpers::echapper($jeu["titre"]); ?></h3>
|
|
<div class="game-card-badges">
|
|
<span class="badge-etat etat-<?php print Helpers::echapper($jeu["etat"]); ?>">
|
|
<?php print Helpers::echapper(Helpers::libelleEtat($jeu["etat"])); ?>
|
|
</span>
|
|
<?php foreach (Helpers::normaliserFormats($jeu["formats"] ?? []) as $format): ?>
|
|
<span class="badge-format format-<?php print Helpers::echapper($format); ?>">
|
|
<?php print Helpers::echapper(Helpers::libelleFormat($format)); ?>
|
|
</span>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|