Consommables : ajout compteur poses perdues + ratio corrige 0.5 (10/20)

- Nouvelle carte 'Poses perdues' dans le panneau consommables
- Le ratio ruban optimal pour 10x15 est 0.5 (10cm sur 20cm de panneau)
- Diagnostic enrichi : alerte epuisement, ruban avant papier, % gaspille
- Reset poses perdues avec le ruban

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 16:41:30 +02:00
parent 3b6f376ded
commit 5e482a89e7
4 changed files with 54 additions and 13 deletions

View File

@@ -937,7 +937,7 @@ html, body {
.conso-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-columns: repeat(4, 1fr);
gap: 1rem;
margin-bottom: 1.5rem;
}

View File

@@ -502,6 +502,12 @@
<div class="conso-titre">Photos sorties</div>
<div class="conso-gros" id="conso-photos">--</div>
</div>
<div class="conso-card" id="conso-card-perdues">
<div class="conso-icon">&#9888;</div>
<div class="conso-titre">Poses perdues</div>
<div class="conso-gros" id="conso-perdues" style="color:#fb8c00">--</div>
<div class="conso-chiffres">ruban gaspille sans rembobinage</div>
</div>
</div>
<h3 style="margin-top:1.5rem">Capacites</h3>

View File

@@ -1424,21 +1424,46 @@ async function chargerConsommables() {
barrePapier.style.background = pctPapier < 10 ? '#f44336' : pctPapier < 25 ? '#fb8c00' : '#43a047';
barreRuban.style.background = pctRuban < 10 ? '#f44336' : pctRuban < 25 ? '#fb8c00' : '#43a047';
const perdues = data.poses_perdues || 0;
document.getElementById('conso-perdues').textContent = perdues;
const cardPerdues = document.getElementById('conso-card-perdues');
if (perdues > 0) {
document.getElementById('conso-perdues').style.color = '#f44336';
cardPerdues.style.borderLeft = '3px solid #f44336';
} else {
document.getElementById('conso-perdues').style.color = '#43a047';
cardPerdues.style.borderLeft = '3px solid #43a047';
}
const diag = document.getElementById('conso-diagnostic');
const papierUsed = data.papier_utilise;
const rubanUsed = data.ruban_utilise;
let html = '<strong>Diagnostic</strong><br>';
html += `Feuilles consommees : ${papierUsed}<br>`;
const photos = data.photos_imprimees;
let html = '<strong>Diagnostic consommables</strong><br>';
html += `Feuilles papier consommees : ${papierUsed}<br>`;
html += `Poses ruban consommees : ${rubanUsed}<br>`;
html += `Photos imprimees : ${data.photos_imprimees}<br>`;
html += `Photos imprimees : ${photos}<br>`;
html += `Poses perdues (gaspillees) : ${perdues}<br>`;
if (papierUsed > 0) {
const ratio = (rubanUsed / papierUsed).toFixed(2);
html += `<br>Ratio ruban/papier : <strong>${ratio}</strong>`;
html += `<br>Ratio ruban/papier : <strong>${ratio}</strong><br>`;
if (parseFloat(ratio) <= 0.75) {
html += ' &#9989; Rembobinage actif (economie ruban)';
html += '&#9989; <strong>Rembobinage efficace</strong> — le ruban est economise';
} else if (parseFloat(ratio) >= 0.95) {
html += ' &#9888; Ratio 1:1 — pas d\'economie ruban';
html += '&#9888; <strong>Pas d\'economie ruban</strong> — activez le rembobinage dans Materiel';
} else {
html += '&#128260; Rembobinage partiel';
}
if (perdues > 0) {
const pctPerdu = ((perdues / (rubanUsed + perdues)) * 100).toFixed(0);
html += `<br>&#128308; ${pctPerdu}% du ruban gaspille (${perdues} poses pour rien)`;
}
}
if (data.papier_restant <= 20 || data.ruban_restant <= 20) {
html += '<br><br>&#128680; <strong>Consommable bientot epuise !</strong>';
}
if (data.ruban_restant < data.papier_restant - 10) {
html += '<br>&#9888; Le ruban va s\'epuiser avant le papier';
}
diag.innerHTML = html;
} catch (e) {