Userverwaltung
This commit is contained in:
32
srv/poe_manager/templates/base.html
Normal file
32
srv/poe_manager/templates/base.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ title or "PoE Manager" }}</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body class="p-4">
|
||||
|
||||
<!-- Navbar -->
|
||||
<nav class="mb-4">
|
||||
<div class="btn-group" role="group">
|
||||
<a href="{{ url_for('index') }}" class="btn btn-secondary">Dashboard</a>
|
||||
<a href="{{ url_for('devices') }}" class="btn btn-secondary">Devices</a>
|
||||
{% if current_user.is_admin %}
|
||||
<a href="{{ url_for('switches') }}" class="btn btn-secondary">Switches</a>
|
||||
<a href="{{ url_for('users') }}" class="btn btn-secondary">Users</a>
|
||||
<a href="{{ url_for('logs') }}" class="btn btn-secondary">Live-Log</a>
|
||||
<a href="{{ url_for('settings') }}" class="btn btn-secondary">Settings</a>
|
||||
{% endif %}
|
||||
<a href="{{ url_for('logout') }}" class="btn btn-danger">Logout</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="container-fluid">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
<script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,13 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Devices</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body class="p-5">
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<h2>Devices</h2>
|
||||
<a href="{{ url_for('index') }}" class="btn btn-secondary mb-3">Zurück zum Dashboard</a>
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
@@ -20,14 +14,13 @@
|
||||
<p>Prüfintervall: <strong>{{ interval }} Minuten</strong></p>
|
||||
|
||||
{% if current_user.is_admin %}
|
||||
<!-- Inline-Add Form -->
|
||||
<h4>Neues Gerät hinzufügen</h4>
|
||||
<form method="post" class="row g-2 mb-4">
|
||||
<input type="hidden" name="add_device" value="1">
|
||||
<div class="col"><input type="text" name="mac" placeholder="MAC" class="form-control" required></div>
|
||||
<div class="col"><input type="text" name="rpi_ip" placeholder="RPI IP" class="form-control" required></div>
|
||||
<div class="col"><input type="text" name="name" placeholder="Hostname" class="form-control" required></div>
|
||||
<div class="col"><input type="text" name="rpi_ip" placeholder="IP-Adresse" class="form-control" required></div>
|
||||
<div class="col"><input type="text" name="mac" placeholder="MAC-Adresse" class="form-control" required></div>
|
||||
<div class="col"><input type="text" name="port" placeholder="Port" class="form-control" required></div>
|
||||
<div class="col"><input type="text" name="name" placeholder="Name" class="form-control" required></div>
|
||||
<div class="col">
|
||||
<select name="switch_hostname" class="form-control" required>
|
||||
<option value="">Switch wählen</option>
|
||||
@@ -40,15 +33,14 @@
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<!-- Devices Table -->
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>MAC</th>
|
||||
<th>RPI IP</th>
|
||||
<th>Port</th>
|
||||
<th>Name</th>
|
||||
<th>Hostname</th>
|
||||
<th>IP-Adresse</th>
|
||||
<th>MAC-Adresse</th>
|
||||
<th>Switch</th>
|
||||
<th>Port</th>
|
||||
{% if current_user.is_admin %}<th>Aktionen</th>{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -56,14 +48,12 @@
|
||||
{% for d in devices %}
|
||||
<tr>
|
||||
{% if current_user.is_admin %}
|
||||
<!-- Inline-Edit Form -->
|
||||
<form method="post">
|
||||
<input type="hidden" name="edit_device" value="1">
|
||||
<input type="hidden" name="old_mac" value="{{ d['mac'] }}">
|
||||
<td><input name="mac" value="{{ d['mac'] }}" class="form-control" required></td>
|
||||
<td><input name="rpi_ip" value="{{ d['rpi_ip'] }}" class="form-control" required></td>
|
||||
<td><input name="port" value="{{ d['port'] }}" class="form-control" required></td>
|
||||
<td><input name="name" value="{{ d['name'] }}" class="form-control" required></td>
|
||||
<td><input name="rpi_ip" value="{{ d['rpi_ip'] }}" class="form-control" required></td>
|
||||
<td><input name="mac" value="{{ d['mac'] }}" class="form-control" required></td>
|
||||
<td>
|
||||
<select name="switch_hostname" class="form-control" required>
|
||||
{% for sw in switches %}
|
||||
@@ -73,21 +63,23 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
<td><input name="port" value="{{ d['port'] }}" class="form-control" required></td>
|
||||
<td class="d-flex gap-1">
|
||||
<button class="btn btn-primary btn-sm">Speichern</button>
|
||||
<button name="delete_device" value="{{ d['mac'] }}" class="btn btn-danger btn-sm" onclick="return confirm('Willst du das Gerät wirklich löschen?');"> Löschen </button>
|
||||
<button name="delete_device" value="{{ d['mac'] }}" class="btn btn-danger btn-sm"
|
||||
onclick="return confirm('Willst du das Gerät wirklich löschen?');">Löschen</button>
|
||||
</td>
|
||||
</form>
|
||||
{% else %}
|
||||
<td>{{ d['mac'] }}</td>
|
||||
<td>{{ d['rpi_ip'] }}</td>
|
||||
<td>{{ d['port'] }}</td>
|
||||
<td>{{ d['name'] }}</td>
|
||||
<td>{{ d['rpi_ip'] }}</td>
|
||||
<td>{{ d['mac'] }}</td>
|
||||
<td>{{ d['switch_hostname'] }}</td>
|
||||
<td>{{ d['port'] }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,44 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Device Dashboard</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body class="p-3">
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<h2>Device Dashboard</h2>
|
||||
|
||||
<div class="mb-3">
|
||||
<a href="{{ url_for('logs') }}" class="btn btn-primary">Live Log</a>
|
||||
<a href="{{ url_for('devices') }}" class="btn btn-secondary">Devices verwalten</a>
|
||||
<a href="{{ url_for('switches') }}" class="btn btn-secondary">Switches verwalten</a>
|
||||
<a href="{{ url_for('settings') }}" class="btn btn-warning">Einstellungen</a>
|
||||
<h2>Dashboard</h2>
|
||||
<div class="row">
|
||||
{% for d in devices %}
|
||||
<div class="col-md-2 col-sm-4 col-6 mb-3">
|
||||
<div class="card text-center shadow-sm">
|
||||
<div class="card-body">
|
||||
<h6 class="card-title">{{ d['name'] }}</h6>
|
||||
{% if d['status'] == 'online' %}
|
||||
<p class="text-success">Online</p>
|
||||
{% else %}
|
||||
<p class="text-danger">Offline</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<p>Prüfintervall: <strong>{{ interval }} Minuten</strong></p>
|
||||
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Device-Name</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for d in devices %}
|
||||
<tr>
|
||||
<td>{{ d['name'] }}</td>
|
||||
<td>
|
||||
{% if status[d['name']] == 'online' %}
|
||||
<span class="badge bg-success">Online</span>
|
||||
{% else %}
|
||||
<span class="badge bg-danger">Offline</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
@@ -2,19 +2,32 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Login</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body class="p-5">
|
||||
<h2>Login</h2>
|
||||
<form method="post">
|
||||
<input class="form-control mb-2" name="username" placeholder="Benutzername" required>
|
||||
<input type="password" class="form-control mb-2" name="password" placeholder="Passwort" required>
|
||||
<button class="btn btn-primary">Login</button>
|
||||
</form>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="mt-2 alert alert-danger">{{ messages[0] }}</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<h2>Login</h2>
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="mt-2 alert alert-danger">
|
||||
{% for message in messages %}{{ message }}<br>{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<form method="post" class="w-25">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Username</label>
|
||||
<input type="text" name="username" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Password</label>
|
||||
<input type="password" name="password" class="form-control" required>
|
||||
</div>
|
||||
<button class="btn btn-primary">Login</button>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,37 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Live Log</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
<meta http-equiv="refresh" content="5"> <!-- automatische Aktualisierung alle 5 Sekunden -->
|
||||
</head>
|
||||
<body>
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<h2>Live Log</h2>
|
||||
|
||||
<div class="mb-3">
|
||||
<a href="{{ url_for('index') }}" class="btn btn-secondary">Dashboard</a>
|
||||
<a href="{{ url_for('devices') }}" class="btn btn-secondary">Devices verwalten</a>
|
||||
<a href="{{ url_for('switches') }}" class="btn btn-secondary">Switches verwalten</a>
|
||||
</div>
|
||||
<div id="log-box" class="border p-3 bg-light" style="height:500px; overflow:auto; white-space: pre-wrap; font-family: monospace;"></div>
|
||||
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Timestamp</th>
|
||||
<th>Log</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for line in log_lines %}
|
||||
<tr>
|
||||
{% set parts = line.split(' ', 1) %}
|
||||
<td>{{ parts[0] if parts|length > 0 else '' }}</td>
|
||||
<td>{{ parts[1] if parts|length > 1 else line }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
function fetchLog() {
|
||||
fetch("{{ url_for('get_log') }}")
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
document.getElementById("log-box").innerText = data;
|
||||
let box = document.getElementById("log-box");
|
||||
box.scrollTop = box.scrollHeight;
|
||||
});
|
||||
}
|
||||
setInterval(fetchLog, 3000);
|
||||
fetchLog();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Einstellungen</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body class="p-5">
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<h2>PoE-Check Intervall</h2>
|
||||
<a href="{{ url_for('index') }}" class="btn btn-secondary mb-3">Zurück zum Dashboard</a>
|
||||
<h2>Settings</h2>
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
@@ -17,15 +11,14 @@
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<form method="post" class="row g-2">
|
||||
<div class="col-auto">
|
||||
<label for="interval" class="form-label">Intervall (Minuten)</label>
|
||||
<input type="number" name="interval" id="interval" class="form-control" value="{{ interval }}" min="1" required>
|
||||
<form method="post" class="row g-3">
|
||||
<div class="col-md-4">
|
||||
<label for="interval" class="form-label">Prüfintervall (Minuten)</label>
|
||||
<input type="number" class="form-control" id="interval" name="interval" value="{{ interval }}" min="1" required>
|
||||
</div>
|
||||
<div class="col-auto align-self-end">
|
||||
<div class="col-12">
|
||||
<button class="btn btn-primary">Speichern</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
53
srv/poe_manager/templates/switche.html
Normal file
53
srv/poe_manager/templates/switche.html
Normal file
@@ -0,0 +1,53 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<h2>Switche</h2>
|
||||
|
||||
{% if current_user.is_admin %}
|
||||
<h4>Neuen Switch hinzufügen</h4>
|
||||
<form method="post" class="row g-2 mb-4">
|
||||
<input type="hidden" name="add_switch" value="1">
|
||||
<div class="col"><input type="text" name="hostname" placeholder="Hostname" class="form-control" required></div>
|
||||
<div class="col"><input type="text" name="ip" placeholder="IP-Adresse" class="form-control" required></div>
|
||||
<div class="col"><input type="text" name="username" placeholder="Username" class="form-control" required></div>
|
||||
<div class="col"><input type="password" name="password" placeholder="Password" class="form-control" required></div>
|
||||
<div class="col"><button class="btn btn-success w-100">Hinzufügen</button></div>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Hostname</th>
|
||||
<th>IP-Adresse</th>
|
||||
<th>Username</th>
|
||||
{% if current_user.is_admin %}<th>Aktionen</th>{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for s in switches %}
|
||||
<tr>
|
||||
{% if current_user.is_admin %}
|
||||
<form method="post">
|
||||
<input type="hidden" name="edit_switch" value="1">
|
||||
<input type="hidden" name="old_hostname" value="{{ s['hostname'] }}">
|
||||
<td><input name="hostname" value="{{ s['hostname'] }}" class="form-control" required></td>
|
||||
<td><input name="ip" value="{{ s['ip'] }}" class="form-control" required></td>
|
||||
<td><input name="username" value="{{ s['username'] }}" class="form-control" required></td>
|
||||
<td class="d-flex gap-1">
|
||||
<button class="btn btn-primary btn-sm">Speichern</button>
|
||||
<button name="delete_switch" value="{{ s['hostname'] }}" class="btn btn-danger btn-sm"
|
||||
onclick="return confirm('Willst du den Switch wirklich löschen?');">Löschen</button>
|
||||
</td>
|
||||
</form>
|
||||
{% else %}
|
||||
<td>{{ s['hostname'] }}</td>
|
||||
<td>{{ s['ip'] }}</td>
|
||||
<td>{{ s['username'] }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,69 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Switches</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body class="p-5">
|
||||
|
||||
<h2>Switches</h2>
|
||||
<a href="{{ url_for('index') }}" class="btn btn-secondary mb-3">Zurück zum Dashboard</a>
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="mt-2 alert alert-info">
|
||||
{% for message in messages %}{{ message }}<br>{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% if current_user.is_admin %}
|
||||
<!-- Inline-Add Form -->
|
||||
<h4>Neuen Switch hinzufügen</h4>
|
||||
<form method="post" class="row g-2 mb-4">
|
||||
<input type="hidden" name="add_switch" value="1">
|
||||
<div class="col"><input type="text" name="hostname" placeholder="Hostname" class="form-control" required></div>
|
||||
<div class="col"><input type="text" name="ip" placeholder="IP" class="form-control" required></div>
|
||||
<div class="col"><input type="text" name="username" placeholder="Username" class="form-control" required></div>
|
||||
<div class="col"><input type="password" name="password" placeholder="Passwort" class="form-control" required></div>
|
||||
<div class="col"><button class="btn btn-success w-100">Hinzufügen</button></div>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<!-- Switches Table -->
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Hostname</th>
|
||||
<th>IP</th>
|
||||
<th>Username</th>
|
||||
{% if current_user.is_admin %}<th>Aktionen</th>{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for sw in switches %}
|
||||
<tr>
|
||||
{% if current_user.is_admin %}
|
||||
<!-- Inline-Edit Form -->
|
||||
<form method="post">
|
||||
<input type="hidden" name="edit_switch" value="1">
|
||||
<input type="hidden" name="old_hostname" value="{{ sw['hostname'] }}">
|
||||
<td><input name="hostname" value="{{ sw['hostname'] }}" class="form-control" required></td>
|
||||
<td><input name="ip" value="{{ sw['ip'] }}" class="form-control" required></td>
|
||||
<td><input name="username" value="{{ sw['username'] }}" class="form-control" required></td>
|
||||
<td class="d-flex gap-1">
|
||||
<button class="btn btn-primary btn-sm">Speichern</button>
|
||||
<button name="delete_switch" value="{{ sw['hostname'] }}" class="btn btn-danger btn-sm" onclick="return confirm('Willst du den Switch wirklich löschen?');"> Löschen </button>
|
||||
</td>
|
||||
</form>
|
||||
{% else %}
|
||||
<td>{{ sw['hostname'] }}</td>
|
||||
<td>{{ sw['ip'] }}</td>
|
||||
<td>{{ sw['username'] }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
87
srv/poe_manager/templates/users.html
Normal file
87
srv/poe_manager/templates/users.html
Normal file
@@ -0,0 +1,87 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<h2>Users</h2>
|
||||
|
||||
{% if current_user.is_admin %}
|
||||
<!-- Button Neues User-Popup -->
|
||||
<button class="btn btn-success mb-3" data-bs-toggle="modal" data-bs-target="#userModal" onclick="openUserModal()">Neuer Benutzer</button>
|
||||
{% endif %}
|
||||
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<th>Funktion</th>
|
||||
{% if current_user.is_admin %}<th>Aktionen</th>{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for u in users %}
|
||||
<tr>
|
||||
<td>{{ u['username'] }}</td>
|
||||
<td>{% if u['is_admin'] %}Admin{% else %}User{% endif %}</td>
|
||||
{% if current_user.is_admin %}
|
||||
<td>
|
||||
<button class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#userModal"
|
||||
onclick="openUserModal({{ u['id'] }}, '{{ u['username'] }}', {{ u['is_admin'] }})">Bearbeiten</button>
|
||||
<form method="post" style="display:inline;">
|
||||
<button name="delete_user" value="{{ u['id'] }}" class="btn btn-danger btn-sm"
|
||||
onclick="return confirm('Willst du den Benutzer wirklich löschen?');">Löschen</button>
|
||||
</form>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="userModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form method="post" id="userForm">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="userModalTitle">Benutzer</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="user_id" id="user_id">
|
||||
<input type="hidden" name="edit_user" id="edit_user">
|
||||
<div class="mb-3">
|
||||
<label>Username</label>
|
||||
<input type="text" name="username" id="modal_username" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label>Passwort</label>
|
||||
<input type="password" name="password" id="modal_password" class="form-control" placeholder="Nur eintragen, wenn Passwort geändert werden soll">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label>Rolle</label>
|
||||
<select name="is_admin" id="modal_is_admin" class="form-control">
|
||||
<option value="0">User</option>
|
||||
<option value="1">Admin</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Abbrechen</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function openUserModal(id=null, username='', is_admin=0) {
|
||||
document.getElementById('user_id').value = id || '';
|
||||
document.getElementById('modal_username').value = username || '';
|
||||
document.getElementById('modal_password').value = '';
|
||||
document.getElementById('modal_is_admin').value = is_admin;
|
||||
document.getElementById('edit_user').value = id ? 1 : '';
|
||||
document.getElementById('userModalTitle').innerText = id ? 'Benutzer bearbeiten' : 'Neuen Benutzer anlegen';
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user