32da374e57
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
64 lines
2.2 KiB
HTML
64 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>EverShelf - Liste des Produits</title>
|
|
<style>
|
|
body { font-family: sans-serif; background: #121212; color: #e0e0e0; padding: 20px; }
|
|
table { width: 100%; border-collapse: collapse; background: #1e1e1e; margin-top: 20px; }
|
|
th, td { border: 1px solid #333; padding: 12px; text-align: left; }
|
|
th { background: #252525; color: #1976d2; }
|
|
tr:hover { background: #2a2a2a; }
|
|
.loading { color: #ff9800; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<h2>Inventaire des produits</h2>
|
|
<div id="status" class="loading">Chargement des données...</div>
|
|
|
|
<table id="prod-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Produit</th>
|
|
<th>Catégorie</th>
|
|
<th>Emplacement</th>
|
|
<th>Stock/Quantité</th>
|
|
</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;
|
|
}
|
|
}
|
|
|
|
fetchProducts();
|
|
</script>
|
|
</body>
|
|
</html> |