Amélioration ; ajout de photo de console et ajout de checkbox physique, demat ou ROM
This commit is contained in:
1 parent
df11d023f0
commit
3235bc50c7
22 files changed
+710
-62
No files matched your search
@@ -1,18 +1,67 @@
|
||||
<section class="page-header">
|
||||
<div>
|
||||
<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>
|
||||
<div class="page-actions">
|
||||
<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 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>
|
||||
|
||||
@@ -38,9 +87,16 @@
|
||||
>
|
||||
<div class="game-card-body">
|
||||
<h3><?php print Helpers::echapper($jeu["titre"]); ?></h3>
|
||||
<span class="badge-etat etat-<?php print Helpers::echapper($jeu["etat"]); ?>">
|
||||
<?php print Helpers::echapper(Helpers::libelleEtat($jeu["etat"])); ?>
|
||||
</span>
|
||||
<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; ?>
|
||||
|
||||
@@ -4,7 +4,8 @@ $valeurs = $console ?? [
|
||||
"nom" => Helpers::champ("nom"),
|
||||
"constructeur" => Helpers::champ("constructeur"),
|
||||
"annee" => Helpers::champ("annee"),
|
||||
"notes" => Helpers::champ("notes")
|
||||
"notes" => Helpers::champ("notes"),
|
||||
"photo" => null
|
||||
];
|
||||
?>
|
||||
|
||||
@@ -18,25 +19,47 @@ $valeurs = $console ?? [
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<form method="post" action="<?php print Helpers::echapper($action); ?>" class="form-panel">
|
||||
<form method="post" action="<?php print Helpers::echapper($action); ?>" class="form-panel" enctype="multipart/form-data">
|
||||
<?php print Csrf::champCache(); ?>
|
||||
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="nom">Nom</label>
|
||||
<input type="text" class="form-control" id="nom" name="nom" required value="<?php print Helpers::echapper($valeurs["nom"] ?? ""); ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="constructeur">Constructeur</label>
|
||||
<input type="text" class="form-control" id="constructeur" name="constructeur" required value="<?php print Helpers::echapper($valeurs["constructeur"] ?? ""); ?>">
|
||||
</div>
|
||||
<div class="row g-4">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label" for="annee">Année</label>
|
||||
<input type="number" class="form-control" id="annee" name="annee" min="1970" max="<?php print (int) date("Y") + 2; ?>" value="<?php print Helpers::echapper((string) ($valeurs["annee"] ?? "")); ?>">
|
||||
<div class="console-photo-preview">
|
||||
<img
|
||||
src="<?php print Helpers::echapper(Helpers::urlPhotoConsole($valeurs["photo"] ?? null)); ?>"
|
||||
alt="Photo de la console"
|
||||
id="apercuPhotoConsole"
|
||||
>
|
||||
</div>
|
||||
<label class="form-label mt-3" for="photo">Photo de la console</label>
|
||||
<input
|
||||
type="file"
|
||||
class="form-control"
|
||||
id="photo"
|
||||
name="photo"
|
||||
accept="image/jpeg,image/png,image/webp,image/gif"
|
||||
>
|
||||
<div class="form-text">JPG, PNG, WebP ou GIF — 5 Mo max.</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label" for="notes">Notes personnelles</label>
|
||||
<textarea class="form-control" id="notes" name="notes" rows="4"><?php print Helpers::echapper($valeurs["notes"] ?? ""); ?></textarea>
|
||||
<div class="col-md-8">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="nom">Nom</label>
|
||||
<input type="text" class="form-control" id="nom" name="nom" required value="<?php print Helpers::echapper($valeurs["nom"] ?? ""); ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="constructeur">Constructeur</label>
|
||||
<input type="text" class="form-control" id="constructeur" name="constructeur" required value="<?php print Helpers::echapper($valeurs["constructeur"] ?? ""); ?>">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label" for="annee">Année</label>
|
||||
<input type="number" class="form-control" id="annee" name="annee" min="1970" max="<?php print (int) date("Y") + 2; ?>" value="<?php print Helpers::echapper((string) ($valeurs["annee"] ?? "")); ?>">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label" for="notes">Notes personnelles</label>
|
||||
<textarea class="form-control" id="notes" name="notes" rows="4"><?php print Helpers::echapper($valeurs["notes"] ?? ""); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -22,8 +22,12 @@
|
||||
<?php foreach ($consoles as $console): ?>
|
||||
<article class="console-card">
|
||||
<a href="/consoles/<?php print Helpers::echapper($console["id"]); ?>" class="console-card-link">
|
||||
<div class="console-icon">
|
||||
<i class="mdi mdi-gamepad-variant"></i>
|
||||
<div class="console-photo">
|
||||
<img
|
||||
src="<?php print Helpers::echapper(Helpers::urlPhotoConsole($console["photo"] ?? null)); ?>"
|
||||
alt="Photo de <?php print Helpers::echapper($console["nom"]); ?>"
|
||||
loading="lazy"
|
||||
>
|
||||
</div>
|
||||
<h2><?php print Helpers::echapper($console["nom"]); ?></h2>
|
||||
<p><?php print Helpers::echapper($console["constructeur"]); ?><?php if (!empty($console["annee"])): ?> · <?php print (int) $console["annee"]; ?><?php endif; ?></p>
|
||||
|
||||