(function () { const typeEl = document.getElementById('type'); const listEl = document.getElementById('quantites-list'); async function load() { hideError(); const type = typeEl.value || null; try { const params = type ? { type } : {}; const data = await apiGet('/quantites-clients.php', params); if (!data.quantites_par_client || data.quantites_par_client.length === 0) { listEl.innerHTML = '
Aucune donnée.
'; return; } listEl.innerHTML = `| Client | Qté facturée | Qté livrée | Action |
|---|---|---|---|
| ${escapeHtml(c.nom)} | ${formatNumber(c.qte_facturee)} | ${formatNumber(c.qte_livree)} | Voir |
Erreur de chargement.
'; } } function escapeHtml(text) { const div = document.createElement('div'); div.textContent = text; return div.innerHTML; } document.getElementById('btn-refresh').addEventListener('click', load); typeEl.addEventListener('change', load); load(); })();