Admin : statut détaillé imprimante + message erreur CUPS traduit
- GET /api/imprimante/statut-detail : statut + dernière erreur log - Bouton évacuer retourne le vrai message (format papier, bourrage...) - Bloc d'erreur affiché dans l'onglet Matériel si problème détecté Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -396,7 +396,10 @@
|
||||
</div>
|
||||
<button class="btn-action" onclick="sauvegarderMateriel()">Sauvegarder</button>
|
||||
<div class="champ" style="margin-top:1rem">
|
||||
<button class="btn-danger" onclick="evacuerBourrage()">⚠ Évacuer bourrage papier</button>
|
||||
<button class="btn-danger" onclick="evacuerBourrage()">⚠ Évacuer / Réinitialiser imprimante</button>
|
||||
</div>
|
||||
<div id="imprimante-statut-detail" class="champ" style="display:none">
|
||||
<div id="imprimante-erreur-msg" style="background:rgba(244,67,54,0.1);border-radius:8px;padding:0.8rem;color:#f44336;font-size:0.85rem;margin-top:0.5rem"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ async function chargerMateriel() {
|
||||
|
||||
// Imprimantes
|
||||
await rafraichirImprimantes();
|
||||
rafraichirStatutImprimante();
|
||||
if (imp.imprimante) document.getElementById('admin-imprimante').value = imp.imprimante;
|
||||
if (imp.format) document.getElementById('admin-format-papier').value = imp.format;
|
||||
const fmt = (imp.format || '15x20').replace('-2up', '');
|
||||
@@ -94,6 +95,31 @@ function _getOrientations() {
|
||||
async function evacuerBourrage() {
|
||||
const r = await apiPost('/api/imprimante/evacuer', {});
|
||||
afficherStatut(r.message || 'Imprimante réactivée', r.succes ? 'succes' : 'erreur');
|
||||
const el = document.getElementById('imprimante-erreur-msg');
|
||||
const bloc = document.getElementById('imprimante-statut-detail');
|
||||
if (r.message && r.message !== 'Imprimante réactivée') {
|
||||
el.textContent = '⚠ ' + r.message;
|
||||
bloc.style.display = 'block';
|
||||
} else {
|
||||
bloc.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
async function rafraichirStatutImprimante() {
|
||||
const r = await apiGet('/api/imprimante/statut-detail').catch(() => null);
|
||||
if (!r) return;
|
||||
const el = document.getElementById('imprimante-erreur-msg');
|
||||
const bloc = document.getElementById('imprimante-statut-detail');
|
||||
if (r.derniere_erreur) {
|
||||
let msg = r.derniere_erreur;
|
||||
if (msg.includes('media does not match')) msg = '⚠ Format papier incorrect — vérifiez que le format configuré correspond à la cassette chargée dans l\'imprimante';
|
||||
else if (msg.includes('jam')) msg = '⚠ Bourrage papier détecté';
|
||||
else msg = '⚠ ' + msg.split(']').pop().trim();
|
||||
el.textContent = msg;
|
||||
bloc.style.display = 'block';
|
||||
} else {
|
||||
bloc.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
async function sauvegarderMateriel() {
|
||||
|
||||
Reference in New Issue
Block a user