Onglet admin Galerie Live (booth) + config booth sur la borne
- Onglet Galerie Live dans admin : activer, URL, API key, event ID - Affichage du code invites + bouton regenerer - QR code + code sur ecran d'accueil (si active) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -150,6 +150,7 @@
|
||||
<button class="onglet" data-onglet="evenement">Evenement</button>
|
||||
<button class="onglet" data-onglet="fonctionnalites">Fonctions</button>
|
||||
<button class="onglet" data-onglet="email-admin">Email</button>
|
||||
<button class="onglet" data-onglet="booth-admin">Galerie Live</button>
|
||||
<button class="onglet" data-onglet="galerie-admin">Galerie</button>
|
||||
<button class="onglet" data-onglet="systeme">Systeme</button>
|
||||
</div>
|
||||
@@ -359,6 +360,26 @@
|
||||
<button class="btn-action" onclick="sauvegarderEmail()">Sauvegarder</button>
|
||||
</div>
|
||||
|
||||
<!-- Panneau Galerie Live (Booth) -->
|
||||
<div class="admin-panneau" id="panneau-booth-admin">
|
||||
<h3>Galerie Live</h3>
|
||||
<p class="aide">Les photos sont envoyees en temps reel sur un site web. Les invites scannent le QR code sur l'ecran d'accueil.</p>
|
||||
<div class="champ">
|
||||
<label class="toggle-label">
|
||||
<span>Activer la galerie live</span>
|
||||
<label class="toggle"><input type="checkbox" id="admin-booth-actif" onchange="sauvegarderBooth()"><span class="toggle-slider"></span></label>
|
||||
</label>
|
||||
</div>
|
||||
<div class="champ"><label>URL du serveur</label><input type="text" id="admin-booth-url" placeholder="https://booth.copydev.fr" value="https://booth.copydev.fr"></div>
|
||||
<div class="champ"><label>Cle API</label><input type="text" id="admin-booth-apikey" placeholder="booth-photobooth-2026" value="booth-photobooth-2026"></div>
|
||||
<div class="champ"><label>ID evenement</label><input type="text" id="admin-booth-eventid" placeholder="default" value="default"></div>
|
||||
<div id="booth-status" class="champ">
|
||||
<label>Code invites : <span id="admin-booth-password" style="font-size:1.5rem;font-weight:bold;letter-spacing:4px">--</span></label>
|
||||
</div>
|
||||
<button class="btn-action" onclick="sauvegarderBooth()">Sauvegarder</button>
|
||||
<button class="btn-secondaire" onclick="regenererBoothPassword()">Nouveau code</button>
|
||||
</div>
|
||||
|
||||
<!-- Panneau Galerie -->
|
||||
<div class="admin-panneau" id="panneau-galerie-admin">
|
||||
<div class="champ">
|
||||
|
||||
@@ -24,6 +24,7 @@ async function chargerAdmin() {
|
||||
chargerEmailAdmin();
|
||||
chargerFondsAdmin();
|
||||
chargerGalerieAdmin();
|
||||
chargerBoothAdmin();
|
||||
}
|
||||
|
||||
// === MATERIEL ===
|
||||
@@ -635,3 +636,60 @@ function getValue(id) {
|
||||
const el = document.getElementById(id);
|
||||
return el ? el.value : '';
|
||||
}
|
||||
|
||||
// === BOOTH (Galerie Live) ===
|
||||
|
||||
async function chargerBoothAdmin() {
|
||||
const booth = config.booth || {};
|
||||
document.getElementById('admin-booth-actif').checked = booth.actif || false;
|
||||
setValue('admin-booth-url', booth.url || 'https://booth.copydev.fr');
|
||||
setValue('admin-booth-apikey', booth.api_key || 'booth-photobooth-2026');
|
||||
setValue('admin-booth-eventid', booth.event_id || 'default');
|
||||
|
||||
// Recuperer le code actuel
|
||||
if (booth.actif && booth.url) {
|
||||
try {
|
||||
const info = await apiGet('/api/booth/info');
|
||||
if (info.password) {
|
||||
document.getElementById('admin-booth-password').textContent = info.password;
|
||||
}
|
||||
} catch (e) {
|
||||
document.getElementById('admin-booth-password').textContent = '--';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function sauvegarderBooth() {
|
||||
await apiPost('/api/config', {
|
||||
booth: {
|
||||
actif: document.getElementById('admin-booth-actif').checked,
|
||||
url: getValue('admin-booth-url'),
|
||||
api_key: getValue('admin-booth-apikey'),
|
||||
event_id: getValue('admin-booth-eventid'),
|
||||
}
|
||||
});
|
||||
afficherStatut('Galerie live sauvegardee', 'succes');
|
||||
chargerBoothAdmin();
|
||||
chargerBoothInfo();
|
||||
}
|
||||
|
||||
async function regenererBoothPassword() {
|
||||
const booth = config.booth || {};
|
||||
const url = getValue('admin-booth-url').replace(/\/$/, '');
|
||||
const apiKey = getValue('admin-booth-apikey');
|
||||
const eventId = getValue('admin-booth-eventid') || 'default';
|
||||
|
||||
try {
|
||||
const resp = await fetch(`${url}/api/${eventId}/reset-password`, {
|
||||
method: 'POST',
|
||||
headers: { 'X-Api-Key': apiKey },
|
||||
});
|
||||
const data = await resp.json();
|
||||
if (data.password) {
|
||||
document.getElementById('admin-booth-password').textContent = data.password;
|
||||
afficherStatut('Nouveau code genere : ' + data.password, 'succes');
|
||||
}
|
||||
} catch (e) {
|
||||
afficherStatut('Erreur connexion au serveur booth', 'erreur');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user