A live bird collage card for your Home Assistant dashboard.
Merge branch 'main' into offline-time-testy
Patrick McGuire6c6e4b6bb6f9
diff --cc scripts/config.phpindex f63259a9,f5924482..c662dfb4--- a/scripts/config.php+++ b/scripts/config.php@@@ -178,38 -163,7 +178,38 @@@ https://discordapp.com/api/webhooks/{We<option value="labels_th.txt">Thai</option><option value="labels_uk.txt">Ukrainian</option></select>- <br>+ <br><br>+ <script>+ function handleChange(checkbox) {+ // this disables the input of manual date and time if the user wants to use the internet time+ var date=document.getElementById("date");+ var time=document.getElementById("time");+ if(checkbox.checked) {+ date.setAttribute("disabled", "disabled");+ time.setAttribute("disabled", "disabled");+ } else {+ date.removeAttribute("disabled");+ time.removeAttribute("disabled");+ }+ }+ </script>+ <?php+ // if NTP service is active, show the checkboxes as checked, and disable the manual input+ $tdc = trim(exec("sudo timedatectl | grep \"NTP service: active\""));+ if (strlen($tdc) > 0) {+ $checkedvalue = "checked";+ $disabledvalue = "disabled";+ } else {+ $checkedvalue = "";+ $disabledvalue = "";+ }+ ?>+ <label for="appt">Select a Date and Time:</label><br>+ <span>If connected to the internet, retrieve time automatically?</span>+ <input type="checkbox" onchange='handleChange(this)' name="apprise_notify_each_detection" <?php echo $checkedvalue; ?> ><br>+ <input onclick="this.showPicker()" type="date" id="date" name="date" value="<?php echo date('Y-m-d') ?>" <?php echo $disabledvalue; ?>>+ <input onclick="this.showPicker()" type="time" id="time" name="time" value="<?php echo date('H:i') ?>" <?php echo $disabledvalue; ?>>+ <br><br><br><input type="hidden" name="status" value="success"><input type="hidden" name="submit" value="settings">