APmanageur Wi-Fi V1.0

This commit is contained in:
yoannmultigaming committed 2026-11-18 16:33:43 +01:00
1 parent ef6c9a53fd
commit 49240da546
1 file changed
+94 -2
+94 -2
View File
@@ -1909,12 +1909,15 @@
ultérieurement depuis le tableau de bord. ultérieurement depuis le tableau de bord.
</div> </div>
<div id="step4Error" class="muted"
style="color:var(--red);font-weight:600;font-size:13px;display:none;margin-top:8px"></div>
<div class="step-actions"> <div class="step-actions">
<button type="button" class="secondary" onclick="goToStep(3)" data-i18n="btn_prev">← Précédent</button> <button type="button" class="secondary" onclick="goToStep(3)" data-i18n="btn_prev">← Précédent</button>
<div class="step-actions-right"> <div class="step-actions-right">
<button type="button" class="secondary" onclick="goToStep(5)" style="margin-right:6px" <button type="button" class="secondary" onclick="skipStep4()" style="margin-right:6px"
data-i18n="btn_skip">Ignorer</button> data-i18n="btn_skip">Ignorer</button>
<button type="button" onclick="goToStep(5)" data-i18n="btn_continue"> <button type="button" id="btnStep4Continue" onclick="validateStep4()" data-i18n="btn_continue">
<span>Continuer</span> <span>→</span> <span>Continuer</span> <span>→</span>
</button> </button>
</div> </div>
@@ -2774,6 +2777,7 @@
renderSetupVpnList(); renderSetupVpnList();
updateStatsReportCronFromFields(); updateStatsReportCronFromFields();
if (typeof updateStep4ContinueState === 'function') updateStep4ContinueState();
if (currentStep === 6) { if (currentStep === 6) {
updateRecap(); updateRecap();
@@ -2802,6 +2806,7 @@
toggleNotifFields(); toggleNotifFields();
initStatsReportTimeSelects(); initStatsReportTimeSelects();
} }
updateStep4ContinueState();
} }
function selectSetupNotifSubTab(tab) { function selectSetupNotifSubTab(tab) {
@@ -2831,6 +2836,7 @@
const f = $('notif' + cap + 'Fields'); const f = $('notif' + cap + 'Fields');
if (f) f.style.display = en ? 'block' : 'none'; if (f) f.style.display = en ? 'block' : 'none';
}); });
updateStep4ContinueState();
} }
function toggleStatsReportSchedule(isEn) { function toggleStatsReportSchedule(isEn) {
@@ -3407,6 +3413,14 @@
function goToStep(stepNum) { function goToStep(stepNum) {
if (stepNum < 1 || stepNum > 6) return; if (stepNum < 1 || stepNum > 6) return;
if (currentStep === 4 && stepNum > 4) {
const st = getStep4NotificationStatus();
if (st.enabled && !st.anyConfigured) {
updateStep4ContinueState();
selectSetupNotifSubTab('services');
return;
}
}
currentStep = stepNum; currentStep = stepNum;
maxStepReached = Math.max(maxStepReached, stepNum); maxStepReached = Math.max(maxStepReached, stepNum);
@@ -3497,6 +3511,76 @@
goToStep(4); goToStep(4);
} }
function getStep4NotificationStatus() {
const notifOn = !!($('notifEnabledSwitch') && $('notifEnabledSwitch').checked);
if (!notifOn) return { enabled: false, anyChecked: false, anyConfigured: false };
const p = getNotificationFormPayload();
const checks = [
{ en: p.email.enabled, ok: !!(p.email.smtp_host && p.email.to_addr) },
{ en: p.gotify.enabled, ok: !!(p.gotify.server_url && p.gotify.token) },
{ en: p.discord.enabled, ok: !!p.discord.webhook_url },
{ en: p.ntfy.enabled, ok: !!(p.ntfy.server_url && p.ntfy.topic) },
{ en: p.pushbullet.enabled, ok: !!p.pushbullet.api_token },
{ en: p.pushover.enabled, ok: !!(p.pushover.user_key && p.pushover.api_token) },
{ en: p.slack.enabled, ok: !!p.slack.webhook_url },
{ en: p.telegram.enabled, ok: !!(p.telegram.bot_token && p.telegram.chat_id) },
{ en: p.webhook.enabled, ok: !!p.webhook.url }
];
return {
enabled: true,
anyChecked: checks.some(c => c.en),
anyConfigured: checks.some(c => c.en && c.ok)
};
}
function updateStep4ContinueState() {
const btn = $('btnStep4Continue');
const errEl = $('step4Error');
const st = getStep4NotificationStatus();
const isEn = currentLanguage.startsWith('en');
if (st.enabled && !st.anyConfigured) {
if (btn) {
btn.disabled = true;
btn.style.opacity = '0.5';
btn.style.cursor = 'not-allowed';
}
const msg = st.anyChecked
? (isEn
? '⚠️ Please fill in the required fields for the enabled notification service (URL, token, recipient...) or disable automatic notifications to continue.'
: '⚠️ Veuillez compléter les champs obligatoires du service de notification activé (URL, jeton, destinataire...) ou désactiver les notifications automatiques pour continuer.')
: (isEn
? '⚠️ Please enable and configure at least one notification service (or disable automatic notifications) to continue.'
: '⚠️ Veuillez activer et configurer au moins un service de notification (ou désactiver les notifications automatiques) pour continuer.');
showError(errEl, msg);
} else {
if (btn) {
btn.disabled = false;
btn.style.opacity = '';
btn.style.cursor = '';
}
if (errEl) errEl.style.display = 'none';
}
}
function skipStep4() {
if ($('notifEnabledSwitch')) {
$('notifEnabledSwitch').checked = false;
onNotifToggle();
}
goToStep(5);
}
function validateStep4() {
updateStep4ContinueState();
const st = getStep4NotificationStatus();
if (st.enabled && !st.anyConfigured) {
selectSetupNotifSubTab('services');
return;
}
goToStep(5);
}
function showError(el, msg) { function showError(el, msg) {
if (!el) return; if (!el) return;
el.textContent = msg; el.textContent = msg;
@@ -3658,6 +3742,12 @@
setSetupTheme(currentTheme); setSetupTheme(currentTheme);
initStatsReportTimeSelects(); initStatsReportTimeSelects();
loadNotificationSettingsInSetup(); loadNotificationSettingsInSetup();
const notifBox = $('notifChannelsBox');
if (notifBox) {
notifBox.addEventListener('input', updateStep4ContinueState);
notifBox.addEventListener('change', updateStep4ContinueState);
}
updateStep4ContinueState();
// 1. Vérification du statut d'authentification et de configuration // 1. Vérification du statut d'authentification et de configuration
try { try {
@@ -3718,6 +3808,8 @@
if (!ssid) { goToStep(2); return validateStep2(); } if (!ssid) { goToStep(2); return validateStep2(); }
if (!password || password !== confirmation) { goToStep(2); return validateStep2(); } if (!password || password !== confirmation) { goToStep(2); return validateStep2(); }
if (!adminUser || !adminPass) { goToStep(3); return validateStep3(); } if (!adminUser || !adminPass) { goToStep(3); return validateStep3(); }
const notifSt = getStep4NotificationStatus();
if (notifSt.enabled && !notifSt.anyConfigured) { goToStep(4); return validateStep4(); }
isConfiguring = true; isConfiguring = true;
btn.disabled = true; btn.disabled = true;