Actualiser test.html
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
This commit is contained in:
@@ -2,48 +2,63 @@
|
|||||||
<html lang="fr">
|
<html lang="fr">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>EverShelf - Réconciliation (Session Hijack)</title>
|
<title>EverShelf - Liste des Produits</title>
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
||||||
<style>
|
<style>
|
||||||
body { font-family: sans-serif; background: #222; color: #eee; padding: 20px; }
|
body { font-family: sans-serif; background: #121212; color: #e0e0e0; padding: 20px; }
|
||||||
.card { background: #444; padding: 20px; border-radius: 8px; margin-bottom: 20px; }
|
table { width: 100%; border-collapse: collapse; background: #1e1e1e; margin-top: 20px; }
|
||||||
button { padding: 8px 15px; background: #1976d2; color: white; border: none; border-radius: 5px; cursor: pointer; }
|
th, td { border: 1px solid #333; padding: 12px; text-align: left; }
|
||||||
|
th { background: #252525; color: #1976d2; }
|
||||||
|
tr:hover { background: #2a2a2a; }
|
||||||
|
.loading { color: #ff9800; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="card">
|
|
||||||
<h3>Modification en masse (Mode Bypass)</h3>
|
|
||||||
<button id="save-btn" onclick="runBypass()">DÉMARRER LA RÉCONCILIATION</button>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
async function runBypass() {
|
|
||||||
// Cette fonction utilise la fonction de sauvegarde du site officiel
|
|
||||||
// au lieu de faire un 'fetch' qui est bloqué par le serveur.
|
|
||||||
const btn = document.getElementById('save-btn');
|
|
||||||
btn.disabled = true;
|
|
||||||
|
|
||||||
// On récupère les éléments de la page originale EverShelf
|
|
||||||
// Tu dois ouvrir ton interface officielle dans un onglet,
|
|
||||||
// et exécuter ce script via la console F12 de CET onglet.
|
|
||||||
|
|
||||||
const selected = document.querySelectorAll('input.prod-check:checked');
|
|
||||||
const targetCat = document.getElementById('cat-mass').value;
|
|
||||||
|
|
||||||
for (let item of selected) {
|
<h2>Inventaire des produits</h2>
|
||||||
// Ici, on appelle la fonction interne du site.
|
<div id="status" class="loading">Chargement des données...</div>
|
||||||
// Recherche dans le code source du site officiel une fonction nommée 'saveProduct', 'updateProduct', ou 'ajax'
|
|
||||||
try {
|
<table id="prod-table">
|
||||||
// EXEMPLE : si ton site a une fonction 'saveProduct'
|
<thead>
|
||||||
await saveProduct(item.dataset.index, { category: targetCat });
|
<tr>
|
||||||
console.log("Succès");
|
<th>Produit</th>
|
||||||
} catch (e) {
|
<th>Catégorie</th>
|
||||||
console.error("Erreur d'injection : ", e);
|
<th>Emplacement</th>
|
||||||
}
|
<th>Stock/Quantité</th>
|
||||||
await new Promise(r => setTimeout(r, 500));
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
async function fetchProducts() {
|
||||||
|
try {
|
||||||
|
// Appel à l'API
|
||||||
|
const res = await fetch('api/index.php?action=products_list');
|
||||||
|
const data = await res.json();
|
||||||
|
|
||||||
|
// Extraction de la liste (s'adapte à la structure retournée)
|
||||||
|
const products = data.inventory || data.products || data;
|
||||||
|
const tbody = document.querySelector('#prod-table tbody');
|
||||||
|
|
||||||
|
tbody.innerHTML = "";
|
||||||
|
products.forEach(p => {
|
||||||
|
let row = document.createElement('tr');
|
||||||
|
row.innerHTML = `
|
||||||
|
<td>${p.name || '---'}</td>
|
||||||
|
<td>${p.category || 'Non classé'}</td>
|
||||||
|
<td>${p.location || 'N/A'}</td>
|
||||||
|
<td>${p.quantity !== undefined ? p.quantity : '---'}</td>
|
||||||
|
`;
|
||||||
|
tbody.appendChild(row);
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('status').textContent = "Données chargées.";
|
||||||
|
} catch (e) {
|
||||||
|
document.getElementById('status').textContent = "Erreur de chargement : " + e.message;
|
||||||
}
|
}
|
||||||
alert("Processus terminé.");
|
|
||||||
btn.disabled = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetchProducts();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user