diff --git a/frontend/css/style.css b/frontend/css/style.css index 90a9ae7..0cf2908 100644 --- a/frontend/css/style.css +++ b/frontend/css/style.css @@ -820,6 +820,13 @@ html, body { font-size: 1rem; } +.impression-restant { + color: var(--texte-secondaire); + font-size: 0.85rem; + opacity: 0.7; + margin: 0.3rem 0; +} + .form-email { position: fixed; inset: 0; diff --git a/frontend/index.html b/frontend/index.html index 6b5ab86..62b40c3 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -7,7 +7,7 @@ - + @@ -199,6 +199,7 @@ exemplaire(s) +
@@ -1181,7 +1182,7 @@ - + diff --git a/frontend/js/share.js b/frontend/js/share.js index b9a54ad..46d31df 100644 --- a/frontend/js/share.js +++ b/frontend/js/share.js @@ -2,18 +2,31 @@ let nbExemplaires = 1; let copiesMax = 2; +let _restantActuel = null; function _masquerBoutonsBas(masquer) { const bas = document.querySelector('#ecran-partage .partage-bas'); if (bas) bas.style.display = masquer ? 'none' : ''; } +async function _majRestantImpression() { + const el = document.getElementById('impression-restant'); + if (!el) return; + try { + const etat = await apiGet('/api/compteur'); + _restantActuel = etat.restantes; + const apres = Math.max(0, _restantActuel - nbExemplaires); + el.textContent = `${apres} photo(s) restante(s) sur le rouleau`; + } catch (e) { el.textContent = ''; } +} + async function ouvrirImpression() { copiesMax = config.impression?.copies_max || 2; nbExemplaires = 1; document.getElementById('nb-exemplaires').textContent = nbExemplaires; cadreChoisi = null; _masquerBoutonsBas(true); + _majRestantImpression(); if (modeActuel === 'multi') { document.getElementById('form-impression').classList.remove('cache'); @@ -109,6 +122,10 @@ async function chargerCadresChoixImpression() { function changerExemplaires(delta) { nbExemplaires = Math.max(1, Math.min(copiesMax, nbExemplaires + delta)); document.getElementById('nb-exemplaires').textContent = nbExemplaires; + if (_restantActuel !== null) { + const apres = Math.max(0, _restantActuel - nbExemplaires); + document.getElementById('impression-restant').textContent = `${apres} photo(s) restante(s) sur le rouleau`; + } } async function lancerImpression() {