updated to work
This commit is contained in:
@@ -201,18 +201,23 @@
|
||||
<h5 class="mb-0"><i class="bi bi-display"></i> Players Management</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post" action="/admin/add_player" class="mb-3">
|
||||
<form method="post" action="{{ url_for('add_player') }}" class="mb-3">
|
||||
<div class="row g-2">
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" name="name" placeholder="Player Name" required>
|
||||
<div class="col-md-3">
|
||||
<input type="text" class="form-control" name="name" placeholder="Player Name">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
<input type="text" class="form-control" name="device_id" placeholder="Device ID" required>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" name="location" placeholder="Location">
|
||||
<div class="col-md-3">
|
||||
<select class="form-control" name="channel_id">
|
||||
<option value="">No Channel</option>
|
||||
{% for channel in all_channels %}
|
||||
<option value="{{ channel.id }}">{{ channel.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="col-md-3">
|
||||
<button type="submit" class="btn btn-success btn-sm">
|
||||
<i class="bi bi-plus-circle"></i> Add Player
|
||||
</button>
|
||||
@@ -226,16 +231,17 @@
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Device ID</th>
|
||||
<th>Location</th>
|
||||
<th>Channel</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for player in players %}
|
||||
{% for player in all_players %}
|
||||
<tr>
|
||||
<td>{{ player.name }}</td>
|
||||
<td>{{ player.name or player.device_id }}</td>
|
||||
<td><code>{{ player.device_id }}</code></td>
|
||||
<td>{{ player.location or '-' }}</td>
|
||||
<td>{{ player.channel.name if player.channel else 'No Channel' }}</td>
|
||||
<td>
|
||||
{% if player.is_active %}
|
||||
<span class="badge bg-success">Active</span>
|
||||
@@ -243,6 +249,13 @@
|
||||
<span class="badge bg-secondary">Inactive</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url_for('delete_player', player_id=player.id) }}"
|
||||
class="btn btn-danger btn-sm"
|
||||
onclick="return confirm('Are you sure you want to delete this player?')">
|
||||
<i class="bi bi-trash"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -259,23 +272,26 @@
|
||||
<h5 class="mb-0"><i class="bi bi-people"></i> Users Management</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post" action="/admin/add_user" class="mb-3">
|
||||
<form method="post" action="{{ url_for('add_user') }}" class="mb-3">
|
||||
<div class="row g-2">
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-3">
|
||||
<input type="text" class="form-control" name="username" placeholder="Username" required>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="password" class="form-control" name="password" placeholder="Password" required>
|
||||
<div class="col-md-3">
|
||||
<input type="email" class="form-control" name="email" placeholder="Email" required>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="is_admin" id="is_admin">
|
||||
<label class="form-check-label" for="is_admin">Admin</label>
|
||||
</div>
|
||||
<input type="password" class="form-control" name="password" placeholder="Password" required>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" name="role" required>
|
||||
<option value="user">User</option>
|
||||
<option value="admin">Admin</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<button type="submit" class="btn btn-success btn-sm">
|
||||
<i class="bi bi-person-plus"></i> Add User
|
||||
<i class="bi bi-person-plus"></i> Add
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -286,20 +302,32 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<th>Email</th>
|
||||
<th>Role</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
{% for user in all_users %}
|
||||
<tr>
|
||||
<td>{{ user.username }}</td>
|
||||
<td>{{ user.email }}</td>
|
||||
<td>
|
||||
{% if user.is_admin %}
|
||||
{% if user.role == 'admin' %}
|
||||
<span class="badge bg-warning">Admin</span>
|
||||
{% else %}
|
||||
<span class="badge bg-primary">User</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if user.id != current_user.id %}
|
||||
<a href="{{ url_for('delete_user', user_id=user.id) }}"
|
||||
class="btn btn-danger btn-sm"
|
||||
onclick="return confirm('Are you sure you want to delete this user?')">
|
||||
<i class="bi bi-trash"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user