91 lines
4.0 KiB
PHP
91 lines
4.0 KiB
PHP
<?php
|
|
$enablePrototypeComments = true;
|
|
include '../../header-telemetria.php';
|
|
?>
|
|
|
|
<div class="container-xxl flex-grow-1 container-p-y">
|
|
<h4 class="fw-bold py-3 mb-4">
|
|
Telemetria <span class="text-muted fw-light">/ Ustawienia</span>
|
|
</h4>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6 col-12 mb-4">
|
|
<div class="card shadow-sm border-0">
|
|
<div class="card-header border-bottom">
|
|
<h5 class="card-title mb-0">Powiadomienia i Alerty</h5>
|
|
</div>
|
|
<div class="card-body pt-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<div>
|
|
<h6 class="mb-1">Aktywny moduł alertów</h6>
|
|
<small class="text-muted">Pozwala na ustawianie zaawansowanych wyzwalaczy i powiadomień SMS/Email po przekroczeniu progów alarmowych w instalacjach.</small>
|
|
</div>
|
|
<div class="form-check form-switch form-switch-lg ms-3 mb-0">
|
|
<input class="form-check-input" type="checkbox" id="alertsModuleSwitch">
|
|
</div>
|
|
</div>
|
|
|
|
<button type="button" class="btn btn-primary mt-3" onclick="saveSettings()">Zapisz ustawienia</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal potwierdzenia włączenia -->
|
|
<div class="modal fade" id="confirmPaymentModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content border-warning border-2">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title text-warning"><i class="bx bx-error-circle me-1"></i> Potwierdzenie subskrypcji</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" onclick="cancelSwitch()"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p>Uruchomienie modułu <strong>Powiadomienia i Alerty</strong> wiąże się z dodatkową opłatą abonamentową w wysokości <strong>50 zł / msc</strong> doliczaną do Twojej faktury.</p>
|
|
<p class="mb-0 text-dark fw-bold">Czy na pewno chcesz włączyć ten moduł?</p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal" onclick="cancelSwitch()">Anuluj</button>
|
|
<button type="button" class="btn btn-success" data-bs-dismiss="modal" onclick="confirmSave()">Tak, włączam moduł</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
let isCurrentlyEnabled = false; // Zakładamy że na start jest wyłączone
|
|
|
|
function saveSettings() {
|
|
const switchEl = document.getElementById('alertsModuleSwitch');
|
|
|
|
// Jeśli chcemy włączyć, a wcześniej było wyłączone
|
|
if (switchEl.checked && !isCurrentlyEnabled) {
|
|
var paymentModal = new bootstrap.Modal(document.getElementById('confirmPaymentModal'));
|
|
paymentModal.show();
|
|
} else if (!switchEl.checked && isCurrentlyEnabled) {
|
|
alert('Moduł został pomyślnie wyłączony. Opłata nie będzie naliczana od następnego okresu rozliczeniowego.');
|
|
isCurrentlyEnabled = false;
|
|
} else {
|
|
alert('Ustawienia zapisane bez zmian.');
|
|
}
|
|
}
|
|
|
|
function confirmSave() {
|
|
isCurrentlyEnabled = true;
|
|
document.getElementById('alertsModuleSwitch').checked = true;
|
|
alert('Moduł został włączony! Doliczono 50 zł/msc do Twojego abonamentu. Możesz teraz konfigurować alerty w instalacjach.');
|
|
}
|
|
|
|
function cancelSwitch() {
|
|
// Jeśli anulowano modal, przywracamy przełącznik do stanu wylączonego
|
|
document.getElementById('alertsModuleSwitch').checked = false;
|
|
}
|
|
</script>
|
|
|
|
<div class="content-backdrop fade"></div>
|
|
|
|
<?php include '../../footer.php'; ?>
|
|
|
|
</body>
|
|
</html>
|