Compare commits
5 Commits
f0fbae505f
...
david
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ee026f439 | |||
| 9a8891fc9d | |||
| 4f85fe3250 | |||
| a2ecb6bf84 | |||
| f79ee1e7b6 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
@@ -1,7 +0,0 @@
|
||||
function confirmerSuppression(titre) {
|
||||
const confirmation = confirm(`Êtes-vous sûr de vouloir supprimer l'article "${titre}" ?`);
|
||||
if (confirmation) {
|
||||
alert(`L'article "${titre}" a été supprimé.`);
|
||||
// Ici tu peux rediriger ou supprimer réellement
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
const form = document.getElementById('editArticleForm');
|
||||
const imgField = document.getElementById('articleImage');
|
||||
const titleField = document.getElementById('articleTitle');
|
||||
const contentField = document.getElementById('articleContent');
|
||||
const categoryField = document.getElementById('articleCategory');
|
||||
const publishedField = document.getElementById('articlePublished');
|
||||
|
||||
const errorEmpty = document.getElementById('errorEmpty');
|
||||
const errorImage = document.getElementById('errorImage');
|
||||
const errorExists = document.getElementById('errorExists');
|
||||
const successMsg = document.getElementById('successMsg');
|
||||
|
||||
// Simulation BDD pour vérifier doublons
|
||||
const titresExistants = [
|
||||
"article de test",
|
||||
"nouveautés chiens",
|
||||
"actualité du mois"
|
||||
];
|
||||
|
||||
form.addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const titre = titleField.value.trim().toLowerCase();
|
||||
const fichierImage = imgField.files[0];
|
||||
|
||||
// Reset messages
|
||||
errorEmpty.classList.add('d-none');
|
||||
errorImage.classList.add('d-none');
|
||||
errorExists.classList.add('d-none');
|
||||
successMsg.classList.add('d-none');
|
||||
|
||||
//Titre obligatoire
|
||||
if (titre === "") {
|
||||
errorEmpty.classList.remove('d-none');
|
||||
return;
|
||||
}
|
||||
|
||||
// Titre déjà existant ?
|
||||
if (titresExistants.includes(titre)) {
|
||||
errorExists.classList.remove('d-none');
|
||||
return;
|
||||
}
|
||||
|
||||
//Vérification image
|
||||
if (fichierImage) {
|
||||
const validFormats = ['image/jpeg', 'image/png', 'image/gif'];
|
||||
if (!validFormats.includes(fichierImage.type)) {
|
||||
errorImage.classList.remove('d-none');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Succès
|
||||
successMsg.classList.remove('d-none');
|
||||
|
||||
console.log("Article modifié :", {
|
||||
titre,
|
||||
contenu: contentField.value,
|
||||
categorie: categoryField.value,
|
||||
publie: publishedField.checked,
|
||||
image: fichierImage ? fichierImage.name : "Image inchangée"
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
<title>Ajouter un article</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<script src="https://cdn.ckeditor.com/ckeditor5/39.0.1/classic/ckeditor.js"></script>
|
||||
<script src="https://cdn.ckeditor.com/ckeditor5/39.0.1/classic/translations/fr.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +20,9 @@
|
||||
max-width: 700px;
|
||||
margin: 40px auto;
|
||||
}
|
||||
.ck-editor__editable {
|
||||
min-height: 350px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -78,27 +84,39 @@
|
||||
<!--Publié-->
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" id="articlePublished">
|
||||
<label class="form-check-label" for="articlePublished">Publié</label>
|
||||
<label class="form-check-label" for="articlePublished">Publié (sera publié sur le blog)</label>
|
||||
</div>
|
||||
|
||||
|
||||
<!--Boutons-->
|
||||
<div class="d-flex gap-3 mt-4">
|
||||
<a href="../../../blog/categories/articles/liste_article.html" class="btn btn-secondary w-50">Annuler</a>
|
||||
<a href="../html/liste_article.html" class="btn btn-secondary w-50">Annuler</a>
|
||||
<button type="submit" class="btn btn-primary w-50">Ajouter</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="ajouter_article.js"></script>
|
||||
<script src="../js/ajouter_article.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
ClassicEditor
|
||||
.create(document.querySelector('#articleContent'))
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
ClassicEditor
|
||||
.create(document.querySelector('#articleContent'), {
|
||||
language: 'fr',
|
||||
toolbar: [
|
||||
'heading',
|
||||
'bold', 'italic', 'underline',
|
||||
'bulletedList', 'numberedList',
|
||||
'undo', 'redo'
|
||||
]
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
@@ -50,7 +50,7 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="ajouter.js"></script>
|
||||
<script src="../js/ajouter_categorie.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
</body>
|
||||
@@ -33,22 +33,32 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!--Exemple d'article-->
|
||||
<tr>
|
||||
<td>Mon premier article</td>
|
||||
<td>Chien</td>
|
||||
<td>Oui</td>
|
||||
<td>
|
||||
<a href="voir_article.html" class="btn btn-sm btn-outline-secondary">Voir</a>
|
||||
<a href="modifier_article.html" class="btn btn-sm btn-outline-primary">Modifier</a>
|
||||
<button class="btn btn-sm btn-outline-danger" onclick="confirmerSuppression('Mon premier article')">Supprimer</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tr>
|
||||
<td>Mon premier article</td>
|
||||
<td>Chien</td>
|
||||
<td>Oui</td>
|
||||
<td>
|
||||
<a href="voir_article.html" class="btn btn-sm btn-outline-secondary">Voir</a>
|
||||
<a href="../html/modifier_article.html" class="btn btn-sm btn-outline-primary">Modifier</a>
|
||||
<button class="btn btn-sm btn-outline-danger delete-btn">Supprimer</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Mon deuxième article</td>
|
||||
<td>Chat</td>
|
||||
<td>Oui</td>
|
||||
<td>
|
||||
<a href="voir_article.html" class="btn btn-sm btn-outline-secondary">Voir</a>
|
||||
<a href="../html/modifier_article.html" class="btn btn-sm btn-outline-primary">Modifier</a>
|
||||
<button class="btn btn-sm btn-outline-danger delete-btn">Supprimer</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="../js/liste_articles.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<!-- Bouton ajouter -->
|
||||
<div class="d-flex justify-content-end mb-4">
|
||||
<a href="../ajouter_categorie/ajouter_categorie.html" class="btn btn-primary">
|
||||
<a href="../html/ajouter_categorie.html" class="btn btn-primary">
|
||||
Ajouter une catégorie
|
||||
</a>
|
||||
</div>
|
||||
@@ -48,7 +48,7 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script src="liste_categorie.js"></script>
|
||||
<script src="../js/liste_categorie.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
</body>
|
||||
@@ -6,6 +6,7 @@
|
||||
<title>Modifier un article</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<script src="https://cdn.ckeditor.com/ckeditor5/39.0.1/classic/ckeditor.js"></script>
|
||||
<script src="https://cdn.ckeditor.com/ckeditor5/39.0.1/classic/translations/fr.js"></script>
|
||||
|
||||
|
||||
<style>
|
||||
@@ -17,9 +18,12 @@
|
||||
margin-top: 40px;
|
||||
}
|
||||
.preview-img {
|
||||
max-width: 15Opx;
|
||||
max-width: 15px;
|
||||
border-radius: 8px
|
||||
}
|
||||
.ck-editor__editable {
|
||||
min-height: 350px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -99,7 +103,7 @@
|
||||
|
||||
<!--Boutons-->
|
||||
<div class="d-flex gap-3 mt-4">
|
||||
<a href="../../../blog/categories/articles/liste_article.html" class="btn btn-secondary w-50">Annuler</a>
|
||||
<a href="../html/liste_article.html" class="btn btn-secondary w-50">Annuler</a>
|
||||
<button type="submit" class="btn btn-primary w-50">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
@@ -109,37 +113,22 @@
|
||||
|
||||
<script>
|
||||
ClassicEditor
|
||||
.create(document.querySelector('#articleContent'))
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
.create(document.querySelector('#articleContent'), {
|
||||
language: 'fr',
|
||||
toolbar: [
|
||||
'heading',
|
||||
'bold', 'italic', 'underline',
|
||||
'bulletedList', 'numberedList',
|
||||
'undo', 'redo'
|
||||
]
|
||||
})
|
||||
</script>
|
||||
|
||||
<script src="modifier_article.js"></script>
|
||||
<script src="../js/modifier_article.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="../js/modifier_categorie.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const form = document.getElementById('addArticleForm');
|
||||
const form = document.getElementById('ajouterArticleForm');
|
||||
const imgField = document.getElementById('articleImage');
|
||||
const titleField = document.getElementById('articleTitle');
|
||||
const contentField = document.getElementById('articleContent');
|
||||
@@ -16,7 +16,7 @@ const titreExistants = ['décoration noel', 'coupe de chien'];
|
||||
form.addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const titre = titleField.value.trim() .toLowerCase();
|
||||
const titre = titleField.value.trim().toLowerCase();
|
||||
const fichierImage = imgField.files[0];
|
||||
|
||||
// Reset messages
|
||||
@@ -49,4 +49,11 @@ form.addEventListener('submit', function(e) {
|
||||
// Simuler enregistrement
|
||||
titreExistants.push(titre);
|
||||
|
||||
// Succès
|
||||
successMsg.classList.remove('d-none');
|
||||
|
||||
// Redirection après 1 seconde
|
||||
setTimeout(() => {
|
||||
window.location.href = "../html/liste_article.html";
|
||||
}, 1000);
|
||||
});
|
||||
@@ -32,12 +32,16 @@ form.addEventListener("submit", function (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Succès
|
||||
successMessage.classList.remove("d-none");
|
||||
// Succès
|
||||
successMessage.classList.remove("d-none");
|
||||
|
||||
// Ajout d'une nouvelle catégorie
|
||||
existingCategories.push(nom);
|
||||
|
||||
//Ajout d'une nouvelle catégorie en BDD
|
||||
existingCategories.push(nom);
|
||||
// Redirection après 1 seconde
|
||||
setTimeout(() => {
|
||||
window.location.href = "../html/liste_categorie.html";
|
||||
}, 1000);
|
||||
|
||||
|
||||
});
|
||||
14
blog/js/liste_articles.js
Normal file
14
blog/js/liste_articles.js
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
document.addEventListener("click", function (e) {
|
||||
const btn = e.target.closest(".delete-btn");
|
||||
if (!btn) return; // on a cliqué ailleurs
|
||||
|
||||
// On récupère la ligne de l'article
|
||||
const row = btn.closest("tr");
|
||||
const titre = row.querySelector("td").textContent.trim();
|
||||
|
||||
if (confirm(`Voulez-vous vraiment supprimer l'article : "${titre}" ?`)) {
|
||||
row.remove(); // supprime la ligne
|
||||
alert("Article supprimé !");
|
||||
}
|
||||
});
|
||||
@@ -20,7 +20,7 @@ function afficherCategories() {
|
||||
<td>${cat.description || "-"}</td>
|
||||
|
||||
<td class="text-center">
|
||||
<a href="../modifier_categorie/modifier_categorie.html?id=${cat.id}" class="btn btn-warning btn-sm">
|
||||
<a href="../html/modifier_categorie.html?id=${cat.id}" class="btn btn-warning btn-sm">
|
||||
Modifier
|
||||
</a>
|
||||
|
||||
60
blog/js/modifier_article.js
Normal file
60
blog/js/modifier_article.js
Normal file
@@ -0,0 +1,60 @@
|
||||
const form = document.getElementById("editArticleForm");
|
||||
const imgField = document.getElementById("articleImage");
|
||||
const titleField = document.getElementById("articleTitle");
|
||||
const contentField = document.getElementById("articleContent");
|
||||
const categoryField = document.getElementById("articleCategory");
|
||||
const publishedField = document.getElementById("articlePublished");
|
||||
|
||||
const errorEmpty = document.getElementById("errorEmpty");
|
||||
const errorImage = document.getElementById("errorImage");
|
||||
const errorExists = document.getElementById("errorExists");
|
||||
const successMsg = document.getElementById("successMsg");
|
||||
|
||||
// Simulation BDD pour vérifier doublons
|
||||
const titresExistants = [
|
||||
"article de test",
|
||||
"nouveautés chiens",
|
||||
"actualité du mois",
|
||||
];
|
||||
|
||||
form.addEventListener("submit", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const titre = titleField.value.trim().toLowerCase();
|
||||
const fichierImage = imgField.files[0];
|
||||
|
||||
// Reset messages
|
||||
errorEmpty.classList.add("d-none");
|
||||
errorImage.classList.add("d-none");
|
||||
errorExists.classList.add("d-none");
|
||||
successMsg.classList.add("d-none");
|
||||
|
||||
//Titre obligatoire
|
||||
if (titre === "") {
|
||||
errorEmpty.classList.remove("d-none");
|
||||
return;
|
||||
}
|
||||
|
||||
// Titre déjà existant ?
|
||||
if (titresExistants.includes(titre)) {
|
||||
errorExists.classList.remove("d-none");
|
||||
return;
|
||||
}
|
||||
|
||||
//Vérification image
|
||||
if (fichierImage) {
|
||||
const validFormats = ["image/jpeg", "image/png", "image/gif"];
|
||||
if (!validFormats.includes(fichierImage.type)) {
|
||||
errorImage.classList.remove("d-none");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Succès
|
||||
successMsg.classList.remove("d-none");
|
||||
|
||||
// Redirection après succès
|
||||
setTimeout(() => {
|
||||
window.location.href = "../html/liste_article.html";
|
||||
}, 1500);
|
||||
});
|
||||
@@ -21,6 +21,6 @@ form.addEventListener("submit", function (e) {
|
||||
|
||||
// Redirection après succès
|
||||
setTimeout(() => {
|
||||
window.location.href = "../../../blog/categories/liste_categorie/liste_categorie.html";
|
||||
window.location.href = "../html/liste_categorie.html";
|
||||
}, 1500);
|
||||
});
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<style>
|
||||
body {
|
||||
background: #f4f6f981;
|
||||
background: #f4f6f981;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -27,10 +27,14 @@
|
||||
<div class="card shadow forgot-password-card">
|
||||
<div class="card-body p-4">
|
||||
<h3 class="text-center mb-4">Mot de passe oublié</h3>
|
||||
|
||||
<p>
|
||||
Nous avons besoin de votre adresse mail pour pouvoir réinitialiser
|
||||
votre mot de passe.
|
||||
</p>
|
||||
<form>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Adresse e-mail</label>
|
||||
|
||||
<input
|
||||
type="email"
|
||||
class="form-control"
|
||||
@@ -43,7 +47,9 @@
|
||||
</button>
|
||||
|
||||
<div class="text-center mt-3">
|
||||
<a href="../page_de_connexion/page_de_connexion.html" class="text-decoration-none"
|
||||
<a
|
||||
href="../html/page_de_connexion.html"
|
||||
class="text-decoration-none"
|
||||
>Retour à la connexion</a
|
||||
>
|
||||
</div>
|
||||
@@ -30,14 +30,15 @@
|
||||
|
||||
<form>
|
||||
<div class="mb-3">
|
||||
|
||||
<label class="form-label">Mot de passe</label>
|
||||
<input
|
||||
type="password"
|
||||
class="form-control"
|
||||
id="password"
|
||||
placeholder="••••••••"
|
||||
|
||||
/>
|
||||
<label for="showPassword">
|
||||
<label for="showPassword" class="mt-2">
|
||||
<input type="checkbox" id="showPassword" />
|
||||
Voir le mot de passe
|
||||
</label>
|
||||
@@ -46,12 +47,12 @@
|
||||
<button class="btn btn-primary w-100">Se connecter</button>
|
||||
|
||||
<div class="text-center mt-3">
|
||||
<a href="../mot_de_passe_oublie/mot_de_passe_oublie.html" class="text-decoration-none">Mot de passe oublié ?</a>
|
||||
<a href="../html/mot_de_passe_oublie.html" class="text-decoration-none">Mot de passe oublié ?</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src="page_de_connexion.js"></script>
|
||||
<script src="../js/page_de_connexion.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -52,7 +52,7 @@
|
||||
id="password"
|
||||
required
|
||||
/>
|
||||
<small id="passwordIndicator" class="fw-bold"</small>
|
||||
<small id="passwordIndicator" class="fw-bold"></small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
@@ -65,7 +65,7 @@
|
||||
id="confirmPassword"
|
||||
required
|
||||
/>
|
||||
<label for="showPassword">
|
||||
<label for="showPassword" class="mt-3">
|
||||
<input type="checkbox" id="showPassword" />
|
||||
Voir le mot de passe
|
||||
</label>
|
||||
@@ -89,7 +89,7 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src="reinitialisation_du_mot_de_passe.js"></script>
|
||||
<script src="../js/reinitialisation_du_mot_de_passe.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -49,6 +49,12 @@ form.addEventListener('submit', function(e) {
|
||||
errorMsg.textContent = 'Les mots de passe ne correspondent pas.';
|
||||
return;
|
||||
}
|
||||
successMsg.style.display = 'block';
|
||||
|
||||
// Redirection après 1 seconde
|
||||
setTimeout(() => {
|
||||
window.location.href = "../html/page_de_connexion.html";
|
||||
}, 1000);
|
||||
|
||||
|
||||
});
|
||||
BIN
favicon.png
Normal file
BIN
favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 980 B |
121
header.html
Normal file
121
header.html
Normal file
@@ -0,0 +1,121 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>CE sera le titre de la page</title>
|
||||
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="node_modules/bs-icon/icons.css">
|
||||
<link rel="shortcut icon" href="favicon.png" type="image/png">
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
|
||||
.navbar-brand { font-size: 1.2rem; line-height: 1; padding-top: 0.25rem; padding-bottom: 0.25rem; }
|
||||
|
||||
.brand-sep { height: 1.2rem; }
|
||||
|
||||
|
||||
@media (max-width: 1399.98px) {
|
||||
.navbar .nav-item {
|
||||
background-color: var(--bs-light);
|
||||
border: 1px solid var(--bs-border-color);
|
||||
border-radius: .25rem;
|
||||
margin-bottom: .375rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#navbarSupportedContent > ul:first-child { margin-top: .5rem; }
|
||||
#navbarSupportedContent > ul:last-child { margin-top: 1rem; }
|
||||
|
||||
.bi{
|
||||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-xxl bg-body-tertiary">
|
||||
<div class="container-fluid align-items-center">
|
||||
<a class="navbar-brand" href="#">L'Il'eau chiens - Admin</a>
|
||||
|
||||
|
||||
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active left-label" aria-current="page" href="#">Blog</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link left-label" href="#">Boutique</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link left-label" href="#">Prestations</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link left-label" href="#">FAQ</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link left-label" href="#">Fiche de renseignements</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link left-label" href="#">Partenaires</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#"><i class="bi bi-megaphone me-1"></i> Message d'actu</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#"><i class="bi bi-box-arrow-up-right me-1"></i> Voir le site</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#"><i class="bi bi-gear me-1"></i> Configuration</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="userMenu" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="bi bi-person-circle me-1"></i> <span id="userFirstName">Prénom</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="userMenu">
|
||||
<li><a class="dropdown-item" href="#">Profil</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="#">Sortir</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
<main class="my-5 fs-6">
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1 class="title fs-2">Titre de la page</h1>
|
||||
</header>
|
||||
<main>
|
||||
Contenu de la page
|
||||
</main>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
</html>
|
||||
93
package-lock.json
generated
Normal file
93
package-lock.json
generated
Normal file
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"name": "backoffice_il_eau_chien",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "backoffice_il_eau_chien",
|
||||
"version": "1.0.0",
|
||||
"license": "OSEF",
|
||||
"dependencies": {
|
||||
"bootstrap": "^5.3.8",
|
||||
"bs-icon": "^0.0.8",
|
||||
"tinymce": "^8.2.2",
|
||||
"tinymce-i18n": "^25.11.17"
|
||||
}
|
||||
},
|
||||
"node_modules/@popperjs/core": {
|
||||
"version": "2.11.8",
|
||||
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
|
||||
"integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/popperjs"
|
||||
}
|
||||
},
|
||||
"node_modules/bootstrap": {
|
||||
"version": "5.3.8",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.8.tgz",
|
||||
"integrity": "sha512-HP1SZDqaLDPwsNiqRqi5NcP0SSXciX2s9E+RyqJIIqGo+vJeN5AJVM98CXmW/Wux0nQ5L7jeWUdplCEf0Ee+tg==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/twbs"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/bootstrap"
|
||||
}
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@popperjs/core": "^2.11.8"
|
||||
}
|
||||
},
|
||||
"node_modules/bs-icon": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/bs-icon/-/bs-icon-0.0.8.tgz",
|
||||
"integrity": "sha512-tL+KDhh5VF/sEDUZquFXxrKrYnj91pGp4XHxSPbmVnTYIigsF9KyA+ts8x4RnjFT+s7HeZqpTB3k6CgmJcwfLw==",
|
||||
"peerDependencies": {
|
||||
"react": ">=16.13.1",
|
||||
"react-dom": ">=16.13.1"
|
||||
}
|
||||
},
|
||||
"node_modules/react": {
|
||||
"version": "19.2.1",
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.1.tgz",
|
||||
"integrity": "sha512-DGrYcCWK7tvYMnWh79yrPHt+vdx9tY+1gPZa7nJQtO/p8bLTDaHp4dzwEhQB7pZ4Xe3ok4XKuEPrVuc+wlpkmw==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-dom": {
|
||||
"version": "19.2.1",
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.1.tgz",
|
||||
"integrity": "sha512-ibrK8llX2a4eOskq1mXKu/TGZj9qzomO+sNfO98M6d9zIPOEhlBkMkBUBLd1vgS0gQsLDBzA+8jJBVXDnfHmJg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"scheduler": "^0.27.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^19.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/scheduler": {
|
||||
"version": "0.27.0",
|
||||
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",
|
||||
"integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/tinymce": {
|
||||
"version": "8.2.2",
|
||||
"resolved": "https://registry.npmjs.org/tinymce/-/tinymce-8.2.2.tgz",
|
||||
"integrity": "sha512-CFDSZwciMvFGW2czK/Xig1HcOGpXI0qcQMIqaIcG2F4RuuTdf+LQTreyEZunAJoFTQ9L0KAugOqL7OA5TJkoAA=="
|
||||
},
|
||||
"node_modules/tinymce-i18n": {
|
||||
"version": "25.11.17",
|
||||
"resolved": "https://registry.npmjs.org/tinymce-i18n/-/tinymce-i18n-25.11.17.tgz",
|
||||
"integrity": "sha512-Fi5hGRDL9o42VsdahgNgHRHO/4ClAAqIew45QMu8sa5LQT2wTaVPf/tAXnVDHxR7c6NWZQmZp/E18LosxLq42A=="
|
||||
}
|
||||
}
|
||||
}
|
||||
21
package.json
Normal file
21
package.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "backoffice_il_eau_chien",
|
||||
"version": "1.0.0",
|
||||
"description": "Le header du back office",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "ssh://git@git.lalanguebleue.fr:2222/ileauchiens/maquette_backoffice.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "OSEF",
|
||||
"dependencies": {
|
||||
"bootstrap": "^5.3.8",
|
||||
"bs-icon": "^0.0.8",
|
||||
"tinymce": "^8.2.2",
|
||||
"tinymce-i18n": "^25.11.17"
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Ajouter une 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: 150px;
|
||||
border-radius: 8px;
|
||||
display: none; /* cachée tant qu'il n'y a pas d'image */
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<h2 class="mb-5 text-center">Ajouter une paire avant/après</h2>
|
||||
|
||||
<!-- Message succès -->
|
||||
<div id="successMsg" class="alert alert-success d-none">
|
||||
Nouvelle paire ajoutée avec succès !
|
||||
</div>
|
||||
|
||||
<!-- Message erreur -->
|
||||
<div id="errorMsg" class="alert alert-danger d-none">
|
||||
Merci de remplir tous les champs obligatoires.
|
||||
</div>
|
||||
|
||||
<form id="addPairForm">
|
||||
|
||||
<!-- Titre / label -->
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Titre de la paire *</label>
|
||||
<input type="text" id="pairTitle" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<!-- Type -->
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Type *</label>
|
||||
<select id="pairType" class="form-select" required>
|
||||
<option value="">-- Choisir --</option>
|
||||
<option value="Chien">Chien</option>
|
||||
<option value="Chat">Chat</option>
|
||||
<option value="Autre">Autre</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Image AVANT -->
|
||||
<div class="mb-4">
|
||||
<label class="form-label">Image AVANT *</label>
|
||||
<input type="file" id="beforeImage" class="form-control" accept="image/*">
|
||||
|
||||
<img id="beforePreview" class="img-preview border mt-2">
|
||||
</div>
|
||||
|
||||
<!-- Image APRÈS -->
|
||||
<div class="mb-4">
|
||||
<label class="form-label">Image APRÈS *</label>
|
||||
<input type="file" id="afterImage" class="form-control" accept="image/*">
|
||||
|
||||
<img id="afterPreview" class="img-preview border mt-2">
|
||||
</div>
|
||||
|
||||
<!-- Boutons -->
|
||||
<div class="d-flex justify-content-between">
|
||||
<a href="../liste_avant_apres/liste_avant_apres.html" class="btn btn-secondary">Annuler</a>
|
||||
<button type="submit" class="btn btn-primary">Ajouter</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="ajouter_avant_apres.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,60 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Liste des paires avant/apres</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 {
|
||||
margin-top: 100px;
|
||||
}
|
||||
.action-btns button,
|
||||
.action-btns a {
|
||||
margin-right: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<h2 class="mb-5 text-center">Liste des paires avant/apres</h2>
|
||||
|
||||
<!--Message succès-->
|
||||
<div id="succesDeleteMsg" class="alert alert-success d-none">Paire supprimée avec succès !</div>
|
||||
|
||||
<div class="d-flex justify-content-end mb-4">
|
||||
<a href="../ajouter_avant_apres/ajouter_avant_apres.html" class="btn btn-primary">Ajouter une paire</a>
|
||||
</div>
|
||||
|
||||
|
||||
<table class="table table-striped table-hover align-middle">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Titre paire</th>
|
||||
<th>Type</th>
|
||||
<th>Avant</th>
|
||||
<th>Apres</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="prestationTableBody">
|
||||
<!--JS-->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script src="liste_avant_apres.js"></script>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,90 +0,0 @@
|
||||
// ===============================
|
||||
// Données simulées (à remplacer plus tard par une BDD)
|
||||
// ===============================
|
||||
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 tableBody = document.getElementById("prestationTableBody");
|
||||
const succesDeleteMsg = document.getElementById("succesDeleteMsg");
|
||||
|
||||
// ===============================
|
||||
// Fonction d'affichage
|
||||
// ===============================
|
||||
function displayPairs() {
|
||||
tableBody.innerHTML = ""; // reset tableau
|
||||
|
||||
galleryPairs.forEach(pair => {
|
||||
const row = document.createElement("tr");
|
||||
|
||||
row.innerHTML = `
|
||||
<td>${pair.titre}</td>
|
||||
<td>${pair.type}</td>
|
||||
|
||||
<td>
|
||||
<img src="${pair.avant}" width="80" class="rounded">
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<img src="${pair.apres}" width="80" class="rounded">
|
||||
</td>
|
||||
|
||||
<td class="text-center action-btns">
|
||||
|
||||
<!-- Bouton Voir -->
|
||||
<a href="../voir_avant_apres/voir_avant_apres.html?id=${pair.id}"
|
||||
class="btn btn-info btn-sm">Voir</a>
|
||||
|
||||
<!-- Bouton Modifier -->
|
||||
<a href="../modifier_avant_apres/modifier_avant_apres.html?id=${pair.id}"
|
||||
class="btn btn-warning btn-sm">Modifier</a>
|
||||
|
||||
<!-- Bouton Supprimer -->
|
||||
<button class="btn btn-danger btn-sm" onclick="deletePair(${pair.id})">
|
||||
Supprimer
|
||||
</button>
|
||||
</td>
|
||||
`;
|
||||
|
||||
tableBody.appendChild(row);
|
||||
});
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// Fonction de suppression
|
||||
// ===============================
|
||||
function deletePair(id) {
|
||||
if (!confirm("Voulez-vous vraiment supprimer cette paire ?")) {
|
||||
return;
|
||||
}
|
||||
|
||||
galleryPairs = galleryPairs.filter(pair => pair.id !== id);
|
||||
displayPairs();
|
||||
|
||||
succesDeleteMsg.classList.remove("d-none");
|
||||
|
||||
// Disparaît après 2 secondes
|
||||
setTimeout(() => {
|
||||
succesDeleteMsg.classList.add("d-none");
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// Chargement initial
|
||||
// ===============================
|
||||
displayPairs();
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Modifier une 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 {
|
||||
margin-top: 100px;
|
||||
max-width: 800px;
|
||||
}
|
||||
.img-preview {
|
||||
max-width: 150px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<h2 class="mb-5 text-center">Modifier une paire avant/après</h2>
|
||||
|
||||
<!-- Messages -->
|
||||
<div id="successMsg" class="alert alert-success d-none">
|
||||
La paire avant/après a été modifiée avec succès.
|
||||
</div>
|
||||
<div id="errorMsg" class="alert alert-danger d-none">
|
||||
Une erreur est survenue. Merci de vérifier le formulaire.
|
||||
</div>
|
||||
|
||||
<!-- Formulaire de modification -->
|
||||
<form id="editPairForm">
|
||||
|
||||
<!-- ID caché -->
|
||||
<input type="hidden" id="pairId">
|
||||
|
||||
<!-- Titre / label -->
|
||||
<div class="mb-3">
|
||||
<label for="pairTitle" class="form-label">Titre / label de la paire *</label>
|
||||
<input type="text" class="form-control" id="pairTitle" required>
|
||||
</div>
|
||||
|
||||
<!-- Type -->
|
||||
<div class="mb-3">
|
||||
<label for="pairType" class="form-label">Type</label>
|
||||
<select id="pairType" class="form-select">
|
||||
<option value="Chien">Chien</option>
|
||||
<option value="Chat">Chat</option>
|
||||
<option value="Autre">Autre</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Image AVANT -->
|
||||
<div class="mb-4 row">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="beforeImage">Image AVANT</label>
|
||||
<input type="file" class="form-control" id="beforeImage" accept="image/*">
|
||||
<div class="form-text">
|
||||
Laisser vide pour conserver l'image actuelle.
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 text-center">
|
||||
<p class="mb-1">Aperçu actuel AVANT</p>
|
||||
<img id="beforePreview" src="" alt="Image avant" class="img-preview border">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Image APRES -->
|
||||
<div class="mb-4 row">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="afterImage">Image APRÈS</label>
|
||||
<input type="file" class="form-control" id="afterImage" accept="image/*">
|
||||
<div class="form-text">
|
||||
Laisser vide pour conserver l'image actuelle.
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 text-center">
|
||||
<p class="mb-1">Aperçu actuel APRÈS</p>
|
||||
<img id="afterPreview" src="" alt="Image après" class="img-preview border">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Boutons -->
|
||||
<div class="d-flex justify-content-between">
|
||||
<a href="../liste_avant_apres/liste_avant_apres.html" class="btn btn-secondary">
|
||||
Annuler
|
||||
</a>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Enregistrer les modifications
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="modifier_avant_apres.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
98
prestations/html/ajouter_avant_apres.html
Normal file
98
prestations/html/ajouter_avant_apres.html
Normal file
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Ajouter une paire avant/après</title>
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
|
||||
<style>
|
||||
.img-preview {
|
||||
max-width: 150px;
|
||||
border-radius: 8px;
|
||||
display: none; /* cachée tant qu'il n'y a pas d'image */
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="bg-light py-4 py-md-5">
|
||||
|
||||
<div class="container" style="max-width: 800px;">
|
||||
|
||||
<h1 class="mb-4 mb-md-5 text-center">Ajouter une paire avant/après</h1>
|
||||
|
||||
<!-- Message succès -->
|
||||
<div id="successMsg" class="alert alert-success d-none">
|
||||
Nouvelle paire ajoutée avec succès !
|
||||
</div>
|
||||
|
||||
<!-- Message erreur -->
|
||||
<div id="errorMsg" class="alert alert-danger d-none">
|
||||
Merci de remplir tous les champs obligatoires.
|
||||
</div>
|
||||
|
||||
<!-- Erreur : format invalide -->
|
||||
<div id="errorFormat" class="alert alert-danger d-none">
|
||||
Format d'image invalide. Formats acceptés : JPG, PNG, WEBP.
|
||||
</div>
|
||||
|
||||
<form id="addPairForm" class="mt-3">
|
||||
|
||||
<!-- Titre / label -->
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="pairTitle">Titre de la paire (obligatoire)</label>
|
||||
<input type="text" id="pairTitle" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<!-- Type -->
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="pairType">Type (obligatoire)</label>
|
||||
<select id="pairType" class="form-select" required>
|
||||
<option value="">-- Choisir --</option>
|
||||
<option value="Chien">Chien</option>
|
||||
<option value="Chat">Chat</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Image AVANT -->
|
||||
<div class="mb-4">
|
||||
<label class="form-label" for="beforeImage">Image AVANT (obligatoire)</label>
|
||||
<input type="file" id="beforeImage" class="form-control" accept="image/*" required>
|
||||
|
||||
<img id="beforePreview" class="img-preview border mt-2" src="#" alt="image avant">
|
||||
</div>
|
||||
|
||||
<!-- Image APRÈS -->
|
||||
<div class="mb-4">
|
||||
<label class="form-label" for="afterImage">Image APRÈS (obligatoire)</label>
|
||||
<input type="file" id="afterImage" class="form-control" accept="image/*" required>
|
||||
|
||||
<img id="afterPreview" class="img-preview border mt-2" src="#" alt="image après">
|
||||
</div>
|
||||
|
||||
<!-- Boutons : empilés en mobile, côte à côte en md+ -->
|
||||
<div class="row mt-4 g-3">
|
||||
<div class="col-12 col-md-6">
|
||||
<a href="../liste_avant_apres/liste_avant_apres.html" class="btn btn-secondary w-100">
|
||||
Annuler
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<button type="submit" class="btn btn-primary w-100">
|
||||
Ajouter
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="ajouter_avant_apres.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
84
prestations/html/liste_avant_apres.html
Normal file
84
prestations/html/liste_avant_apres.html
Normal file
@@ -0,0 +1,84 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Liste des paires avant/après</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
</head>
|
||||
|
||||
<body class="bg-light py-4 py-md-5">
|
||||
|
||||
<div class="container" style="max-width: 1000px;">
|
||||
<h1 class="mb-4 mb-md-5 text-center">Liste des paires avant/après</h1>
|
||||
|
||||
<!-- Message succès -->
|
||||
<div id="succesDeleteMsg" class="alert alert-success d-none">
|
||||
Paire supprimée avec succès !
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end mb-4">
|
||||
<a href="../ajouter_avant_apres/ajouter_avant_apres.html" class="btn btn-primary">
|
||||
Ajouter une paire
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Table responsive -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover align-middle mb-0">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Titre paire</th>
|
||||
<th>Type</th>
|
||||
<th>Avant</th>
|
||||
<th>Après</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="prestationTableBody">
|
||||
<!-- JS -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-title" id="deleteModalLabel">Confirmer la suppression</h2>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Fermer"></button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
Voulez-vous vraiment supprimer cette paire avant/après ?
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-danger" id="confirmDeleteBtn">Supprimer</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="liste_avant_apres.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
98
prestations/html/modifier_avant_apres.html
Normal file
98
prestations/html/modifier_avant_apres.html
Normal file
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Modifier une paire avant/après</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
|
||||
<style>
|
||||
.img-preview {
|
||||
max-width: 150px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="bg-light py-4 py-md-5">
|
||||
|
||||
<div class="container" style="max-width: 800px;">
|
||||
<h2 class="mb-4 mb-md-5 text-center">Modifier une paire avant/après</h2>
|
||||
|
||||
<!-- Messages -->
|
||||
<div id="successMsg" class="alert alert-success d-none">
|
||||
La paire avant/après a été modifiée avec succès.
|
||||
</div>
|
||||
<div id="errorMsg" class="alert alert-danger d-none">
|
||||
Une erreur est survenue. Merci de vérifier le formulaire.
|
||||
</div>
|
||||
|
||||
<!-- Erreur : format invalide -->
|
||||
<div id="errorFormat" class="alert alert-danger d-none">
|
||||
Format d'image invalide. Formats acceptés : JPG, PNG, WEBP.
|
||||
</div>
|
||||
|
||||
<!-- Formulaire de modification -->
|
||||
<form id="editPairForm" class="mt-3">
|
||||
|
||||
<!-- ID caché -->
|
||||
<input type="hidden" id="pairId">
|
||||
|
||||
<!-- Titre / label -->
|
||||
<div class="mb-3">
|
||||
<label for="pairTitle" class="form-label">Titre / label de la paire (obligatoire)</label>
|
||||
<input type="text" class="form-control" id="pairTitle" required>
|
||||
</div>
|
||||
|
||||
<!-- Type -->
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="pairType">Type (obligatoire)</label>
|
||||
<select id="pairType" class="form-select" required>
|
||||
<option value="">-- Choisir --</option>
|
||||
<option value="Chien">Chien</option>
|
||||
<option value="Chat">Chat</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Images AVANT / APRÈS sur une ligne en md+, empilées en mobile -->
|
||||
<div class="row gy-4 mb-4">
|
||||
<!-- Image AVANT -->
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label" for="beforeImage">Image AVANT (obligatoire)</label>
|
||||
<input type="file" class="form-control" id="beforeImage" accept="image/*" required>
|
||||
<!-- Aperçu éventuel -->
|
||||
<img id="beforePreview" class="img-preview mt-2 d-none" src="#" alt="Aperçu avant">
|
||||
</div>
|
||||
|
||||
<!-- Image APRÈS -->
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label" for="afterImage">Image APRÈS (obligatoire)</label>
|
||||
<input type="file" class="form-control" id="afterImage" accept="image/*" required>
|
||||
<!-- Aperçu éventuel -->
|
||||
<img id="afterPreview" class="img-preview mt-2 d-none" src="#" alt="Aperçu après">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Boutons : empilés en mobile, côte à côte en md+ -->
|
||||
<div class="row mt-4 g-3">
|
||||
<div class="col-12 col-md-6">
|
||||
<a href="../liste_avant_apres/liste_avant_apres.html" class="btn btn-secondary w-100">
|
||||
Annuler
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<button type="submit" class="btn btn-primary w-100">
|
||||
Enregistrer les modifications
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="modifier_avant_apres.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -8,46 +8,39 @@
|
||||
<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>
|
||||
<body class="bg-light py-4 py-md-5">
|
||||
|
||||
<div class="container">
|
||||
<div class="container" style="max-width: 800px;">
|
||||
|
||||
<h2 class="mb-5 text-center">Détails de la paire avant/après</h2>
|
||||
<h1 class="mb-4 mb-md-5 text-center">Détails de la paire avant/après</h1>
|
||||
|
||||
<!-- Message erreur -->
|
||||
<div id="errorMsg" class="alert alert-danger d-none">
|
||||
Impossible d'afficher cette paire.
|
||||
</div>
|
||||
|
||||
<div id="detailsSection">
|
||||
<div id="detailsSection" class="mt-3">
|
||||
|
||||
<!-- Titre -->
|
||||
<h4 id="pairTitle" class="text-center mb-4"></h4>
|
||||
<h2 id="pairTitle" class="text-center mb-4" aria-live="polite">Chargement...</h2>
|
||||
|
||||
<div class="d-flex justify-content-around align-items-center mb-4">
|
||||
|
||||
<div class="text-center">
|
||||
<!-- AVANT / APRÈS : empilés en mobile, côte à côte en md+ -->
|
||||
<div class="row justify-content-center align-items-start mb-4 g-4">
|
||||
|
||||
<div class="col-12 col-md-6 text-center">
|
||||
<p class="fw-bold">AVANT</p>
|
||||
<img id="beforePreview" class="img-preview border" src="">
|
||||
<img id="beforePreview" class="img-preview border img-fluid" src="#" alt="Photo avant">
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<div class="col-12 col-md-6 text-center">
|
||||
<p class="fw-bold">APRÈS</p>
|
||||
<img id="afterPreview" class="img-preview border" src="">
|
||||
<img id="afterPreview" class="img-preview border img-fluid" src="#" alt="Photo après" >
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -68,3 +61,4 @@
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -30,13 +30,48 @@ const afterPreview = document.getElementById("afterPreview");
|
||||
|
||||
const successMsg = document.getElementById("successMsg");
|
||||
const errorMsg = document.getElementById("errorMsg");
|
||||
const errorFormat = document.getElementById("errorFormat");
|
||||
|
||||
// Formats autorisés
|
||||
const allowedTypes = ["image/jpeg", "image/png", "image/webp"];
|
||||
|
||||
// ===============================
|
||||
// Prévisualisation images
|
||||
// Fonctions utilitaires
|
||||
// ===============================
|
||||
function hideMessages() {
|
||||
successMsg.classList.add("d-none");
|
||||
errorMsg.classList.add("d-none");
|
||||
errorFormat.classList.add("d-none");
|
||||
}
|
||||
|
||||
function isValidFormat(file) {
|
||||
if (!file) return false;
|
||||
return allowedTypes.includes(file.type);
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// Prévisualisation image AVANT
|
||||
// + contrôle du format
|
||||
// ===============================
|
||||
beforeInput.addEventListener("change", function () {
|
||||
hideMessages();
|
||||
|
||||
const file = this.files[0];
|
||||
if (!file) return;
|
||||
|
||||
if (!file) {
|
||||
beforePreview.style.display = "none";
|
||||
beforePreview.src = "#";
|
||||
return;
|
||||
}
|
||||
|
||||
// Vérif format
|
||||
if (!isValidFormat(file)) {
|
||||
errorFormat.classList.remove("d-none");
|
||||
this.value = ""; // reset le champ
|
||||
beforePreview.style.display = "none";
|
||||
beforePreview.src = "#";
|
||||
return;
|
||||
}
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = e => {
|
||||
@@ -46,9 +81,29 @@ beforeInput.addEventListener("change", function () {
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
|
||||
// ===============================
|
||||
// Prévisualisation image APRÈS
|
||||
// + contrôle du format
|
||||
// ===============================
|
||||
afterInput.addEventListener("change", function () {
|
||||
hideMessages();
|
||||
|
||||
const file = this.files[0];
|
||||
if (!file) return;
|
||||
|
||||
if (!file) {
|
||||
afterPreview.style.display = "none";
|
||||
afterPreview.src = "#";
|
||||
return;
|
||||
}
|
||||
|
||||
// Vérif format
|
||||
if (!isValidFormat(file)) {
|
||||
errorFormat.classList.remove("d-none");
|
||||
this.value = ""; // reset le champ
|
||||
afterPreview.style.display = "none";
|
||||
afterPreview.src = "#";
|
||||
return;
|
||||
}
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = e => {
|
||||
@@ -64,23 +119,35 @@ afterInput.addEventListener("change", function () {
|
||||
form.addEventListener("submit", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Reset messages
|
||||
errorMsg.classList.add("d-none");
|
||||
successMsg.classList.add("d-none");
|
||||
hideMessages();
|
||||
|
||||
// Validation simple
|
||||
if (!titleInput.value.trim() || !typeInput.value.trim() || !beforeInput.files[0] || !afterInput.files[0]) {
|
||||
// Champs obligatoires
|
||||
if (
|
||||
!titleInput.value.trim() ||
|
||||
!typeInput.value.trim() ||
|
||||
!beforeInput.files[0] ||
|
||||
!afterInput.files[0]
|
||||
) {
|
||||
errorMsg.classList.remove("d-none");
|
||||
return;
|
||||
}
|
||||
|
||||
const beforeFile = beforeInput.files[0];
|
||||
const afterFile = afterInput.files[0];
|
||||
|
||||
// Vérification format des deux images
|
||||
if (!isValidFormat(beforeFile) || !isValidFormat(afterFile)) {
|
||||
errorFormat.classList.remove("d-none");
|
||||
return;
|
||||
}
|
||||
|
||||
// Nouvelle entrée (simulation)
|
||||
const newPair = {
|
||||
id: galleryPairs.length + 1,
|
||||
titre: titleInput.value.trim(),
|
||||
type: typeInput.value.trim(),
|
||||
avant: URL.createObjectURL(beforeInput.files[0]),
|
||||
apres: URL.createObjectURL(afterInput.files[0])
|
||||
avant: URL.createObjectURL(beforeFile),
|
||||
apres: URL.createObjectURL(afterFile)
|
||||
};
|
||||
|
||||
galleryPairs.push(newPair);
|
||||
117
prestations/js/liste_avant_apres.js
Normal file
117
prestations/js/liste_avant_apres.js
Normal file
@@ -0,0 +1,117 @@
|
||||
// ===============================
|
||||
// Données simulées (à remplacer plus tard par une BDD)
|
||||
// ===============================
|
||||
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 tableBody = document.getElementById("prestationTableBody");
|
||||
const succesDeleteMsg = document.getElementById("succesDeleteMsg");
|
||||
|
||||
// Modal & bouton de confirmation
|
||||
const deleteModalEl = document.getElementById("deleteModal");
|
||||
const confirmDeleteBtn = document.getElementById("confirmDeleteBtn");
|
||||
const deleteModal = new bootstrap.Modal(deleteModalEl);
|
||||
|
||||
// ID de la paire en attente de suppression
|
||||
let pairIdToDelete = null;
|
||||
|
||||
// ===============================
|
||||
// Fonction d'affichage
|
||||
// ===============================
|
||||
function displayPairs() {
|
||||
tableBody.innerHTML = ""; // reset tableau
|
||||
|
||||
galleryPairs.forEach(pair => {
|
||||
const row = document.createElement("tr");
|
||||
|
||||
row.innerHTML = `
|
||||
<td>${pair.titre}</td>
|
||||
<td>${pair.type}</td>
|
||||
|
||||
<td>
|
||||
<img src="${pair.avant}" class="img-thumbnail" style="max-width: 80px;">
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<img src="${pair.apres}" class="img-thumbnail" style="max-width: 80px;">
|
||||
</td>
|
||||
|
||||
<td class="text-center text-md-start">
|
||||
<div class="d-flex flex-column flex-md-row justify-content-center justify-content-md-start gap-2">
|
||||
|
||||
<!-- Bouton Voir -->
|
||||
<a href="../voir_avant_apres/voir_avant_apres.html?id=${pair.id}"
|
||||
class="btn btn-info btn-sm">
|
||||
Voir
|
||||
</a>
|
||||
|
||||
<!-- Bouton Modifier -->
|
||||
<a href="../modifier_avant_apres/modifier_avant_apres.html?id=${pair.id}"
|
||||
class="btn btn-warning btn-sm">
|
||||
Modifier
|
||||
</a>
|
||||
|
||||
<!-- Bouton Supprimer -->
|
||||
<button class="btn btn-danger btn-sm" onclick="openDeleteModal(${pair.id})">
|
||||
Supprimer
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
`;
|
||||
|
||||
tableBody.appendChild(row);
|
||||
});
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// Ouvrir le modal de suppression
|
||||
// ===============================
|
||||
function openDeleteModal(id) {
|
||||
pairIdToDelete = id; // on mémorise l'id
|
||||
deleteModal.show(); // on ouvre le modal
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// Fonction de suppression réelle
|
||||
// ===============================
|
||||
function deletePair(id) {
|
||||
galleryPairs = galleryPairs.filter(pair => pair.id !== id);
|
||||
displayPairs();
|
||||
|
||||
succesDeleteMsg.classList.remove("d-none");
|
||||
|
||||
setTimeout(() => {
|
||||
succesDeleteMsg.classList.add("d-none");
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// Clic sur "Supprimer" dans le modal
|
||||
// ===============================
|
||||
confirmDeleteBtn.addEventListener("click", () => {
|
||||
if (pairIdToDelete !== null) {
|
||||
deletePair(pairIdToDelete);
|
||||
pairIdToDelete = null;
|
||||
}
|
||||
deleteModal.hide();
|
||||
});
|
||||
|
||||
// ===============================
|
||||
// Chargement initial
|
||||
// ===============================
|
||||
displayPairs();
|
||||
@@ -19,6 +19,11 @@ const galleryPairs = [
|
||||
}
|
||||
];
|
||||
|
||||
// ===============================
|
||||
// Formats d'images autorisés
|
||||
// ===============================
|
||||
const allowedTypes = ["image/jpeg", "image/png", "image/webp"];
|
||||
|
||||
// Sélecteurs
|
||||
const editForm = document.getElementById("editPairForm");
|
||||
const pairIdInput = document.getElementById("pairId");
|
||||
@@ -31,6 +36,7 @@ const afterPreview = document.getElementById("afterPreview");
|
||||
|
||||
const successMsg = document.getElementById("successMsg");
|
||||
const errorMsg = document.getElementById("errorMsg");
|
||||
const errorFormat = document.getElementById("errorFormat");
|
||||
|
||||
// ===============================
|
||||
// Récup ID dans l'URL
|
||||
@@ -71,23 +77,39 @@ function loadPairData() {
|
||||
afterPreview.src = pair.apres;
|
||||
}
|
||||
|
||||
// Prévisu des nouvelles images
|
||||
beforeInput.addEventListener("change", function () {
|
||||
const file = this.files[0];
|
||||
// ===============================
|
||||
// Gestion du changement d'image
|
||||
// ===============================
|
||||
function handleImageChange(inputEl, previewEl) {
|
||||
const file = inputEl.files[0];
|
||||
if (!file) return;
|
||||
|
||||
// Vérification format
|
||||
if (!allowedTypes.includes(file.type)) {
|
||||
// Format non autorisé
|
||||
errorFormat.classList.remove("d-none");
|
||||
inputEl.value = ""; // reset du champ
|
||||
previewEl.src = ""; // reset de la prévisu
|
||||
return;
|
||||
}
|
||||
|
||||
// Format OK → on cache le message d'erreur
|
||||
errorFormat.classList.add("d-none");
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = e => beforePreview.src = e.target.result;
|
||||
reader.onload = e => {
|
||||
previewEl.src = e.target.result;
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
||||
// Prévisu des nouvelles images + contrôle format
|
||||
beforeInput.addEventListener("change", function () {
|
||||
handleImageChange(beforeInput, beforePreview);
|
||||
});
|
||||
|
||||
afterInput.addEventListener("change", function () {
|
||||
const file = this.files[0];
|
||||
if (!file) return;
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = e => afterPreview.src = e.target.result;
|
||||
reader.readAsDataURL(file);
|
||||
handleImageChange(afterInput, afterPreview);
|
||||
});
|
||||
|
||||
// Soumission
|
||||
@@ -96,6 +118,7 @@ editForm.addEventListener("submit", function (e) {
|
||||
|
||||
errorMsg.classList.add("d-none");
|
||||
successMsg.classList.add("d-none");
|
||||
errorFormat.classList.add("d-none");
|
||||
|
||||
if (!titleInput.value.trim()) {
|
||||
errorMsg.textContent = "Le titre est obligatoire.";
|
||||
@@ -103,7 +126,16 @@ editForm.addEventListener("submit", function (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ici ce serait un fetch vers l'API en vrai.
|
||||
// Double check format côté submit (au cas où)
|
||||
const filesToCheck = [beforeInput.files[0], afterInput.files[0]];
|
||||
for (const file of filesToCheck) {
|
||||
if (!file || !allowedTypes.includes(file.type)) {
|
||||
errorFormat.classList.remove("d-none");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
successMsg.classList.remove("d-none");
|
||||
|
||||
setTimeout(() => {
|
||||
Reference in New Issue
Block a user