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