routeros_update/templates/settings.html
Mateusz Gruszczyński 0267e4c2bb init
2025-02-23 17:47:54 +01:00

88 lines
4.3 KiB
HTML

{% extends "base.html" %}
{% block title %}Ustawienia - RouterOS Update{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-md-8">
<h2>Ustawienia powiadomień</h2>
<form method="POST">
<fieldset class="border p-3 mb-3">
<legend class="w-auto">Pushover</legend>
<div class="form-check mb-2">
<input type="checkbox" class="form-check-input" name="pushover_enabled" id="pushover_enabled" {% if settings.pushover_enabled %}checked{% endif %}>
<label class="form-check-label" for="pushover_enabled">Włącz powiadomienia Pushover</label>
</div>
<div class="mb-3">
<label for="pushover_user_key" class="form-label">Pushover User Key</label>
<input type="text" class="form-control" name="pushover_user_key" id="pushover_user_key" value="{{ settings.pushover_user_key or '' }}">
</div>
<div class="mb-3">
<label for="pushover_token" class="form-label">Pushover Token</label>
<input type="text" class="form-control" name="pushover_token" id="pushover_token" value="{{ settings.pushover_token or '' }}">
</div>
</fieldset>
<!-- Pozostała część formularza SMTP oraz interwału -->
<fieldset class="border p-3 mb-3">
<legend class="w-auto">SMTP (E-mail)</legend>
<div class="form-check mb-2">
<input type="checkbox" class="form-check-input" name="email_notifications_enabled" id="email_notifications_enabled" {% if settings.email_notifications_enabled %}checked{% endif %}>
<label class="form-check-label" for="email_notifications_enabled">Włącz powiadomienia e-mail</label>
</div>
<div class="mb-3">
<label for="smtp_server" class="form-label">SMTP Server</label>
<input type="text" class="form-control" name="smtp_server" id="smtp_server" value="{{ settings.smtp_server or '' }}">
</div>
<div class="mb-3">
<label for="smtp_port" class="form-label">SMTP Port</label>
<input type="number" class="form-control" name="smtp_port" id="smtp_port" value="{{ settings.smtp_port or '' }}">
</div>
<div class="mb-3">
<label for="smtp_username" class="form-label">SMTP Username</label>
<input type="text" class="form-control" name="smtp_username" id="smtp_username" value="{{ settings.smtp_username or '' }}">
</div>
<div class="mb-3">
<label for="smtp_password" class="form-label">SMTP Password</label>
<input type="password" class="form-control" name="smtp_password" id="smtp_password" value="{{ settings.smtp_password or '' }}">
</div>
</fieldset>
<fieldset class="border p-3 mb-3">
<legend class="w-auto">Interwał sprawdzania</legend>
<div class="mb-3">
<label for="check_interval" class="form-label">Interwał (sekundy)</label>
<input type="number" class="form-control" name="check_interval" id="check_interval" value="{{ settings.check_interval or 60 }}">
</div>
<div class="mb-3">
<label for="time_input" class="form-label">Czas (HH:MM:SS)</label>
<input type="text" class="form-control" id="time_input" placeholder="np. 01:30:00">
<button type="button" class="btn btn-secondary mt-2" onclick="convertTime()">Konwertuj na sekundy</button>
</div>
</fieldset>
<fieldset class="border p-3 mb-3">
<legend class="w-auto">Retencja logów</legend>
<div class="mb-3">
<label for="log_retention_days" class="form-label">Przechowywać logi przez (dni)</label>
<input type="number" class="form-control" name="log_retention_days" id="log_retention_days" value="{{ settings.log_retention_days or 30 }}">
</div>
</fieldset>
<button type="submit" class="btn btn-primary">Zapisz ustawienia</button>
</form>
</div>
</div>
<script>
function convertTime() {
var timeStr = document.getElementById("time_input").value;
var parts = timeStr.split(':');
if (parts.length !== 3) {
alert("Podaj czas w formacie HH:MM:SS");
return;
}
var seconds = parseInt(parts[0]) * 3600 + parseInt(parts[1]) * 60 + parseInt(parts[2]);
document.getElementById("check_interval").value = seconds;
}
</script>
{% endblock %}