eduardogsilva.routerfleet/templates/backup/backup_profile_form.html
2024-03-17 17:24:56 -03:00

65 lines
No EOL
2.4 KiB
HTML

{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block content %}
<div class='row'>
<div class='{% if form_size %}{{ form_size }}{% else %}col-lg-6{% endif %}'>
<div class="card card-primary card-outline">
{% if page_title %}
<div class="card-header">
<h3 class="card-title">{{ page_title }}</h3>
</div>
{% endif %}
<div class="card-body row">
<div class="col-lg-12">
{% csrf_token %}
{% crispy form %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block custom_page_scripts %}
<script>
function openCommandDialog(element) {
var command = element.getAttribute('data-command');
var confirmation = prompt("{% if delete_confirmation_message %}{{ delete_confirmation_message }}{% else %}Please type 'delete' to proceed.{% endif %}");
if (confirmation) {
var url = "?uuid={{ instance.uuid }}&action=delete&confirmation=" + encodeURIComponent(confirmation);
window.location.href = url;
}
}
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
function toggleSectionVisibility(checkboxId, sectionId) {
var checkbox = document.getElementById(checkboxId);
var section = document.getElementById(sectionId);
if (checkbox && section) {
section.style.display = checkbox.checked ? '' : 'none';
}
}
var controls = [
{checkboxId: 'id_daily_backup', sectionId: 'daily_settings'},
{checkboxId: 'id_weekly_backup', sectionId: 'weekly_settings'},
{checkboxId: 'id_monthly_backup', sectionId: 'monthly_settings'}
];
controls.forEach(function (control) {
var checkbox = document.getElementById(control.checkboxId);
if (checkbox) {
checkbox.addEventListener('change', function () {
toggleSectionVisibility(control.checkboxId, control.sectionId);
});
toggleSectionVisibility(control.checkboxId, control.sectionId);
}
});
});
</script>
{% endblock %}