Files

48 lines
2.3 KiB
Plaintext

<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Admin — IP WhiteList v<%= version %></title>
<style>
body{font-family:sans-serif;max-width:1100px;margin:20px auto;color:#222}
table{width:100%;border-collapse:collapse;margin:10px 0}
th,td{border:1px solid #ccc;padding:6px;text-align:left}
th{background:#263238;color:#fff}
.bar{display:flex;justify-content:space-between;align-items:center;background:#263238;color:#fff;padding:10px;margin-bottom:15px}
.bar a{color:#80cbc4}
button,input,select{padding:4px 8px}
.msg{background:#4caf50;color:#fff;padding:8px;margin-bottom:10px}
.err{background:#f44336;color:#fff;padding:8px;margin-bottom:10px}
</style></head><body>
<div class="bar">
<span><strong>🛡️ ADMIN</strong> v<%= version %></span>
<span><%= user.email || '—' %> | <a href="/v2/app">← Пользовательский</a> | <a href="/v2/logout">Выйти</a></span>
</div>
<script>
const p=new URLSearchParams(location.search);
if(p.get('msg')){document.write('<div class="msg">'+p.get('msg')+'</div>');history.replaceState(null,'','/v2/admin');}
if(p.get('error')){document.write('<div class="err">'+p.get('error')+'</div>');history.replaceState(null,'','/v2/admin');}
</script>
<h2>Компании (<%= companies.length %>)</h2>
<table>
<tr><th>Компания</th><th>Client ID</th><th>Записей</th><th>Лимит</th><th></th><th>Новый лимит</th></tr>
<% if (companies.length === 0) { %><tr><td colspan="6">Нет компаний</td></tr><% } %>
<% companies.forEach(function(c) { %>
<tr>
<td><%= c.name || c.client_id %></td>
<td><code><%= c.client_id %></code></td>
<td><strong><%= c.active_count %></strong> / <%= c.custom_limit != null ? c.custom_limit : 15 %></td>
<td><%= c.custom_limit != null ? c.custom_limit : '—' %></td>
<td>
<a href="/v2/admin/audit?companyId=<%= c.id %>">аудит</a> |
<a href="/v2/admin/entries?companyId=<%= c.id %>">записи</a>
</td>
<td>
<form method="POST" action="/v2/admin/limit" style="display:inline">
<input type="hidden" name="companyId" value="<%= c.id %>">
<input name="limit" value="<%= c.custom_limit || 15 %>" size="3">
<button>установить</button>
</form>
</td>
</tr>
<% }) %>
</table>
</body></html>