Impression : affiche photos restantes sur le rouleau avant validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 10:55:36 +02:00
parent 6d58fe5d57
commit d845c2606e
3 changed files with 27 additions and 2 deletions

View File

@@ -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;

View File

@@ -7,7 +7,7 @@
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta name="google" content="notranslate">
<meta http-equiv="Content-Language" content="fr">
<link rel="stylesheet" href="/css/style.css?v=18">
<link rel="stylesheet" href="/css/style.css?v=19">
<link rel="stylesheet" href="/css/themes.css?v=2">
</head>
<body>
@@ -199,6 +199,7 @@
<button class="btn-exemplaire" onclick="changerExemplaires(1)">+</button>
</div>
<span class="exemplaires-label">exemplaire(s)</span>
<div id="impression-restant" class="impression-restant"></div>
<button class="btn-action" onclick="lancerImpression()">Imprimer</button>
<button class="btn-secondaire" onclick="fermerImpression()">Annuler</button>
</div>
@@ -1181,7 +1182,7 @@
<script src="/js/camera.js?v=26"></script>
<script src="/js/effects.js?v=4"></script>
<script src="/js/gallery.js?v=5"></script>
<script src="/js/share.js?v=11"></script>
<script src="/js/share.js?v=12"></script>
<script src="/js/admin.js?v=17"></script>
</body>
</html>

View File

@@ -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() {