mj add another admin

This commit is contained in:
2026-04-26 22:39:52 +03:00
parent bfdfaa142c
commit 8ed964f3bb
5 changed files with 160 additions and 19 deletions

View File

@@ -175,7 +175,18 @@
<div class="page-title">Ρυθμίσεις Clan</div>
<div class="page-subtitle">Διαχείριση της ομάδας σας και του κλειδιού πρόσβασης</div>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="warn-box" style="margin-bottom: 20px; color: {% if category == 'error' %}#f85149{% else %}#3fb950{% endif %}; border-color: {% if category == 'error' %}rgba(248,81,73,0.3){% else %}rgba(63,185,80,0.3){% endif %}; background: {% if category == 'error' %}rgba(248,81,73,0.1){% else %}rgba(63,185,80,0.1){% endif %};">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
{% if clan %}
{% if clan.owner_id == current_user.id %}
<!-- ===================== Clan Key Section ===================== -->
<div class="card">
<div class="card-title">🔑 Clan Key</div>
@@ -195,6 +206,49 @@
</form>
</div>
<!-- ===================== Website Admins Section ===================== -->
<div class="card">
<div class="card-title">👨‍💻 Website Admins</div>
<p style="color:#8b949e; font-size:0.875rem; margin-bottom:14px;">
Προσθέστε το username άλλων παικτών που έχουν ήδη εγγραφεί στο site για να τους δώσετε πρόσβαση στο dashboard σας.
</p>
<form method="POST" action="/auth/clan/add-admin" class="inline-form" style="margin-bottom: 20px;">
<input type="text" name="admin_username" placeholder="π.χ. player123" required>
<button type="submit" class="btn-primary">Προσθήκη Admin</button>
</form>
{% if admins %}
<table class="members-table">
<thead>
<tr>
<th>Admin Username</th>
<th>Ημερομηνία Προσθήκης</th>
<th></th>
</tr>
</thead>
<tbody>
{% for a in admins %}
<tr>
<td><div class="player-name">{{ a.username }}</div></td>
<td style="color:#8b949e; font-size:0.8rem;">{{ a.created_at[:10] }}</td>
<td style="text-align:right;">
<form method="POST" action="/auth/clan/remove-admin/{{ a.id }}" onsubmit="return confirm('Αφαίρεση του admin {{ a.username }}?');">
<button type="submit" class="btn-danger">Αφαίρεση</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="empty-state" style="padding: 16px 0;">
Δεν έχετε προσθέσει κανέναν website admin ακόμη.
</div>
{% endif %}
</div>
{% endif %}
<!-- ===================== Members Section ===================== -->
<div class="card">
<div class="card-title">👥 Μέλη Clan — {{ clan.name }}</div>
@@ -224,6 +278,7 @@
{% endif %}
</td>
<td>
{% if clan.owner_id == current_user.id %}
<form method="POST" action="/auth/clan/update-features/{{ m.player_id }}" style="display:inline;">
<div class="toggle-group">
<label class="toggle-label">
@@ -234,13 +289,21 @@
</label>
</div>
</form>
{% else %}
<div class="toggle-group" style="opacity: 0.8;">
<span class="toggle-label" style="cursor:default; border-color: {{ '#3fb950' if m.feat_farm else '#30363d' }}; color: {{ '#3fb950' if m.feat_farm else '#8b949e' }};">🌾 Farm</span>
<span class="toggle-label" style="cursor:default; border-color: {{ '#3fb950' if m.feat_admin else '#30363d' }}; color: {{ '#3fb950' if m.feat_admin else '#8b949e' }};">🏛 Admin</span>
</div>
{% endif %}
</td>
<td style="color:#8b949e; font-size:0.8rem;">{{ m.joined_at }}</td>
<td style="text-align:right;">
{% if clan.owner_id == current_user.id %}
<form method="POST" action="/auth/clan/remove-member/{{ m.player_id }}"
onsubmit="return confirm('Αφαίρεση παίκτη {{ m.player_name }}?');">
<button type="submit" class="btn-danger">Αφαίρεση</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}