Admin Clock: alerte rouge avec icone si module RTC deconnecte

Detecte rtc_module_time='not connected', affiche un warning
avec icone attention + message 'Verifiez la pile et les cables I2C'.
Le champ RTC passe en bordure rouge. Distingue clairement
deconnexion hardware vs simple desynchronisation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
PaulVua
2026-03-17 20:01:16 +01:00
parent 6a00ab85d9
commit 85596c3882

View File

@@ -612,8 +612,23 @@ window.onload = function() {
// Compare RTC time with browser time
const alertContainer = document.getElementById("alert_container");
alertContainer.innerHTML = "";
const rtcInput = document.getElementById("RTC_utc_time");
if (response.rtc_module_time) {
if (response.rtc_module_time === 'not connected' || !response.rtc_module_time) {
// RTC module disconnected
rtcInput.classList.add('border-danger', 'text-danger');
rtcInput.classList.remove('border-primary');
alertContainer.innerHTML = `
<div class="alert alert-danger d-flex align-items-center" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-exclamation-triangle-fill me-2 flex-shrink-0" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.436-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
</svg>
<div>
<strong>Module RTC deconnecte !</strong><br>
Verifiez la pile du module DS3231 et les cables I2C.
</div>
</div>`;
} else {
const rtcDate = new Date(response.rtc_module_time + ' UTC');
const timeDiff = Math.abs(Math.round((browserDate - rtcDate) / 1000));