Files
RadMac/app/templates/group_list.html
2025-04-02 14:52:23 -04:00

64 lines
2.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends 'base.html' %}
{% block title %}VLAN Groups{% endblock %}
{% block content %}
<h1 class="page-title">VLAN Groups</h1>
<form method="POST" action="{{ url_for('group.add_group_route') }}" style="margin-bottom: 1rem;">
<input type="text" name="vlan_id" placeholder="VLAN ID" required pattern="[0-9]+" style="width: 80px;">
<input type="text" name="description" placeholder="Group Description">
<button type="submit"> Add Group</button>
</form>
<table class="styled-table">
<thead>
<tr>
<th>VLAN ID</th>
<th>Description</th>
<th>User Count</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for group in groups %}
<tr>
<td>{{ group.vlan_id }}</td>
<td>
<form method="POST" action="{{ url_for('group.update_description_route') }}" class="preserve-scroll">
<input type="hidden" name="group_id" value="{{ group.vlan_id }}">
<input type="text" name="description" value="{{ group.description or '' }}" class="description-input">
</form>
</td>
<td>{{ group.user_count }}</td>
<td>
<form method="POST" action="{{ url_for('group.update_description_route') }}" class="preserve-scroll" style="display:inline;">
<input type="hidden" name="group_id" value="{{ group.vlan_id }}">
<input type="hidden" name="description" value="{{ group.description }}">
<button type="submit" title="Save">💾</button>
</form>
<form method="POST" action="{{ url_for('group.delete_group_route') }}" class="preserve-scroll" style="display:inline;" onsubmit="return confirm('Delete this group?');">
<input type="hidden" name="group_id" value="{{ group.vlan_id }}">
<button type="submit"></button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<script>
document.querySelectorAll('form.preserve-scroll').forEach(form => {
form.addEventListener('submit', () => {
localStorage.setItem('scrollY', window.scrollY);
});
});
window.addEventListener('load', () => {
const scrollY = localStorage.getItem('scrollY');
if (scrollY) {
window.scrollTo(0, parseInt(scrollY));
localStorage.removeItem('scrollY');
}
});
</script>
{% endblock %}