feat:galerie avant/apres backoffice
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Voir la paire avant/après</title>
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
|
||||
<style>
|
||||
body {
|
||||
background: #f4f6f9;
|
||||
padding: 30px;
|
||||
}
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin-top: 100px;
|
||||
}
|
||||
.img-preview {
|
||||
max-width: 250px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<h2 class="mb-5 text-center">Détails de la paire avant/après</h2>
|
||||
|
||||
<!-- Message erreur -->
|
||||
<div id="errorMsg" class="alert alert-danger d-none">
|
||||
Impossible d'afficher cette paire.
|
||||
</div>
|
||||
|
||||
<div id="detailsSection">
|
||||
|
||||
<!-- Titre -->
|
||||
<h4 id="pairTitle" class="text-center mb-4"></h4>
|
||||
|
||||
<div class="d-flex justify-content-around align-items-center mb-4">
|
||||
|
||||
<div class="text-center">
|
||||
<p class="fw-bold">AVANT</p>
|
||||
<img id="beforePreview" class="img-preview border" src="">
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<p class="fw-bold">APRÈS</p>
|
||||
<img id="afterPreview" class="img-preview border" src="">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Bouton retour -->
|
||||
<div class="text-center mt-4">
|
||||
<a href="../liste_avant_apres/liste_avant_apres.html" class="btn btn-secondary">
|
||||
Retour à la liste
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="voir_avant_apres.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
58
prestations/avant_apres/voir_avant_apres/voir_avant_apres.js
Normal file
58
prestations/avant_apres/voir_avant_apres/voir_avant_apres.js
Normal file
@@ -0,0 +1,58 @@
|
||||
// ===============================
|
||||
// Données simulées (à remplacer plus tard par BDD / API)
|
||||
// ===============================
|
||||
let galleryPairs = [
|
||||
{
|
||||
id: 1,
|
||||
titre: "Petit chien poils longs",
|
||||
type: "Chien",
|
||||
avant: "../../img/avant1.jpg",
|
||||
apres: "../../img/apres1.jpg"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
titre: "Coupe ciseaux",
|
||||
type: "Chat",
|
||||
avant: "../../img/avant2.jpg",
|
||||
apres: "../../img/apres2.jpg"
|
||||
}
|
||||
];
|
||||
|
||||
// Sélecteurs
|
||||
const titleEl = document.getElementById("pairTitle");
|
||||
const beforePreview = document.getElementById("beforePreview");
|
||||
const afterPreview = document.getElementById("afterPreview");
|
||||
const errorMsg = document.getElementById("errorMsg");
|
||||
const detailsSection = document.getElementById("detailsSection");
|
||||
|
||||
// ===============================
|
||||
// Récup ID dans l'URL
|
||||
// ===============================
|
||||
function getIdFromUrl() {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
return parseInt(params.get("id"));
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// Charger les infos de la paire
|
||||
// ===============================
|
||||
function loadPairDetails() {
|
||||
const id = getIdFromUrl();
|
||||
const pair = galleryPairs.find(p => p.id === id);
|
||||
|
||||
if (!pair) {
|
||||
errorMsg.classList.remove("d-none");
|
||||
detailsSection.classList.add("d-none");
|
||||
return;
|
||||
}
|
||||
|
||||
// Affichage du titre
|
||||
titleEl.textContent = pair.titre;
|
||||
|
||||
// Affichage des images
|
||||
beforePreview.src = pair.avant;
|
||||
afterPreview.src = pair.apres;
|
||||
}
|
||||
|
||||
// Initialisation
|
||||
loadPairDetails();
|
||||
Reference in New Issue
Block a user