Choix du nombre d'exemplaires a l'impression
- Boutons +/- pour choisir le nombre d'exemplaires (1 a copies_max) - copies_max configurable dans le backoffice (defaut: 5) - Backend limite les copies au max configure Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -54,7 +54,7 @@ async function chargerMateriel() {
|
||||
// Imprimantes
|
||||
await rafraichirImprimantes();
|
||||
if (imp.imprimante) document.getElementById('admin-imprimante').value = imp.imprimante;
|
||||
setValue('admin-copies', imp.copies || 1);
|
||||
setValue('admin-copies-max', imp.copies_max || 5);
|
||||
}
|
||||
|
||||
async function rafraichirImprimantes() {
|
||||
@@ -82,7 +82,7 @@ async function sauvegarderMateriel() {
|
||||
},
|
||||
impression: {
|
||||
imprimante: getValue('admin-imprimante'),
|
||||
copies: parseInt(getValue('admin-copies')) || 1,
|
||||
copies_max: parseInt(getValue('admin-copies-max')) || 5,
|
||||
},
|
||||
});
|
||||
afficherStatut('Materiel sauvegarde', 'succes');
|
||||
|
||||
@@ -1,11 +1,31 @@
|
||||
/* Module partage - Impression, email, QR code */
|
||||
|
||||
let nbExemplaires = 1;
|
||||
let copiesMax = 5;
|
||||
|
||||
function ouvrirImpression() {
|
||||
copiesMax = config.impression?.copies_max || 5;
|
||||
nbExemplaires = 1;
|
||||
document.getElementById('nb-exemplaires').textContent = nbExemplaires;
|
||||
document.getElementById('form-impression').classList.remove('cache');
|
||||
}
|
||||
|
||||
function fermerImpression() {
|
||||
document.getElementById('form-impression').classList.add('cache');
|
||||
}
|
||||
|
||||
function changerExemplaires(delta) {
|
||||
nbExemplaires = Math.max(1, Math.min(copiesMax, nbExemplaires + delta));
|
||||
document.getElementById('nb-exemplaires').textContent = nbExemplaires;
|
||||
}
|
||||
|
||||
async function lancerImpression() {
|
||||
if (!photoFinale) return;
|
||||
afficherStatut('Impression en cours...', 'succes');
|
||||
const resultat = await apiPost('/api/imprimer', { photo: photoFinale });
|
||||
fermerImpression();
|
||||
afficherStatut(`Impression de ${nbExemplaires} exemplaire(s)...`, 'succes');
|
||||
const resultat = await apiPost('/api/imprimer', { photo: photoFinale, copies: nbExemplaires });
|
||||
if (resultat.succes) {
|
||||
afficherStatut('Photo envoyee a l\'imprimante !', 'succes');
|
||||
afficherStatut(`${nbExemplaires} exemplaire(s) envoye(s) a l'imprimante !`, 'succes');
|
||||
} else {
|
||||
afficherStatut('Erreur d\'impression', 'erreur');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user