Strip 10x15 : - Envoie la strip simple avec format 10x15-2up (w288h432-div2) le K60 duplique et coupe automatiquement → plus de papier non coupé - Supprime creer_impression_strip et le 2-up manuel avec marges blanches - api/imprimer accepte format_papier depuis le frontend - Frontend stocke formatImpression et le passe à l'impression Diagnostic preview : - GET /api/camera/debug : teste capture_preview(), liste les widgets config gphoto2, état du thread → permet de voir l'erreur exacte Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
97 lines
3.0 KiB
JavaScript
97 lines
3.0 KiB
JavaScript
/* 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;
|
|
fermerImpression();
|
|
// Pour les strips, imprimer la version 2 bandes sur 10x15
|
|
const fichierImpression = photoImpression || photoFinale;
|
|
afficherStatut(`Impression de ${nbExemplaires} exemplaire(s)...`, 'succes');
|
|
const resultat = await apiPost('/api/imprimer', {
|
|
photo: fichierImpression,
|
|
copies: nbExemplaires,
|
|
cadre: cadreChoisi || undefined,
|
|
format_papier: formatImpression || undefined,
|
|
});
|
|
if (resultat.succes) {
|
|
afficherStatut(`${nbExemplaires} exemplaire(s) envoye(s) a l'imprimante !`, 'succes');
|
|
} else {
|
|
afficherStatut('Erreur d\'impression', 'erreur');
|
|
}
|
|
}
|
|
|
|
function ouvrirEmail() {
|
|
document.getElementById('form-email').classList.remove('cache');
|
|
document.getElementById('input-email').value = '';
|
|
}
|
|
|
|
function fermerEmail() {
|
|
document.getElementById('form-email').classList.add('cache');
|
|
document.getElementById('input-email').value = '';
|
|
}
|
|
|
|
function clavierTape(car) {
|
|
const input = document.getElementById('input-email');
|
|
input.value += car;
|
|
}
|
|
|
|
function clavierEffacer() {
|
|
const input = document.getElementById('input-email');
|
|
input.value = input.value.slice(0, -1);
|
|
}
|
|
|
|
async function envoyerEmail() {
|
|
const email = document.getElementById('input-email').value.trim();
|
|
if (!email || !photoFinale) return;
|
|
|
|
afficherStatut('Envoi en cours...', 'succes');
|
|
const resultat = await apiPost('/api/email', { email, photo: photoFinale });
|
|
if (resultat.succes) {
|
|
afficherStatut('Email envoye !', 'succes');
|
|
fermerEmail();
|
|
} else {
|
|
afficherStatut('Erreur d\'envoi email', 'erreur');
|
|
}
|
|
}
|
|
|
|
async function afficherQR() {
|
|
const zone = document.getElementById('zone-qr');
|
|
zone.classList.toggle('cache');
|
|
|
|
if (!zone.classList.contains('cache')) {
|
|
const booth = config.booth || {};
|
|
if (booth.actif && booth.url) {
|
|
// QR vers la galerie live
|
|
const eventId = booth.event_id || 'default';
|
|
const qrUrl = `${booth.url}/${eventId}`;
|
|
document.getElementById('img-qr').src = `/api/qr?url=${encodeURIComponent(qrUrl)}`;
|
|
} else {
|
|
const resultat = await apiGet('/api/qr/galerie');
|
|
if (resultat.chemin) {
|
|
document.getElementById('img-qr').src = resultat.chemin;
|
|
} else {
|
|
afficherStatut('QR Code non configure', 'erreur');
|
|
zone.classList.add('cache');
|
|
}
|
|
}
|
|
}
|
|
}
|