76 lines
3.9 KiB
PHP
76 lines
3.9 KiB
PHP
|
|
<?php
|
||
|
|
$pageTitle = 'Accounts';
|
||
|
|
$users = $users ?? [];
|
||
|
|
$error = $error ?? '';
|
||
|
|
ob_start();
|
||
|
|
?>
|
||
|
|
<section class="admin-card">
|
||
|
|
<div class="badge">Accounts</div>
|
||
|
|
<div style="display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:16px;">
|
||
|
|
<div>
|
||
|
|
<h1 style="font-size:28px; margin:0;">Accounts</h1>
|
||
|
|
<p style="color: var(--muted); margin-top:6px;">Manage admin access and roles.</p>
|
||
|
|
</div>
|
||
|
|
<a href="/admin/accounts/new" class="btn small">New Account</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php if ($error): ?>
|
||
|
|
<div style="margin-top:16px; color:#f3b0b0; font-size:13px;"><?= htmlspecialchars($error, ENT_QUOTES, 'UTF-8') ?></div>
|
||
|
|
<?php endif; ?>
|
||
|
|
|
||
|
|
<div style="margin-top:18px; display:grid; gap:12px;">
|
||
|
|
<div class="badge" style="opacity:0.7;">Permissions</div>
|
||
|
|
<div style="display:grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap:12px; font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:0.2em;">
|
||
|
|
<div>Capability</div>
|
||
|
|
<div>Admin</div>
|
||
|
|
<div>Manager</div>
|
||
|
|
<div>Editor</div>
|
||
|
|
</div>
|
||
|
|
<div style="display:grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap:12px; align-items:center; padding:10px 12px; border-radius:16px; border:1px solid var(--stroke); background: rgba(14,14,16,0.9);">
|
||
|
|
<div>Full access</div>
|
||
|
|
<div style="color:var(--accent-2); font-weight:600;">✓</div>
|
||
|
|
<div style="color:#f3b0b0;">✕</div>
|
||
|
|
<div style="color:#f3b0b0;">✕</div>
|
||
|
|
</div>
|
||
|
|
<div style="display:grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap:12px; align-items:center; padding:10px 12px; border-radius:16px; border:1px solid var(--stroke); background: rgba(14,14,16,0.9);">
|
||
|
|
<div>Restricted modules</div>
|
||
|
|
<div style="color:var(--accent-2); font-weight:600;">✓</div>
|
||
|
|
<div style="color:var(--accent-2); font-weight:600;">✓</div>
|
||
|
|
<div style="color:#f3b0b0;">✕</div>
|
||
|
|
</div>
|
||
|
|
<div style="display:grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap:12px; align-items:center; padding:10px 12px; border-radius:16px; border:1px solid var(--stroke); background: rgba(14,14,16,0.9);">
|
||
|
|
<div>Edit pages</div>
|
||
|
|
<div style="color:var(--accent-2); font-weight:600;">✓</div>
|
||
|
|
<div style="color:var(--accent-2); font-weight:600;">✓</div>
|
||
|
|
<div style="color:var(--accent-2); font-weight:600;">✓</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div style="margin-top:24px; display:grid; gap:10px;">
|
||
|
|
<div style="display:grid; grid-template-columns: 1.4fr 1.2fr 160px 140px; gap:12px; font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:0.2em;">
|
||
|
|
<div>Name</div>
|
||
|
|
<div>Email</div>
|
||
|
|
<div>Role</div>
|
||
|
|
<div>Actions</div>
|
||
|
|
</div>
|
||
|
|
<?php if (!$users): ?>
|
||
|
|
<div style="color: var(--muted); font-size:13px;">No accounts yet.</div>
|
||
|
|
<?php else: ?>
|
||
|
|
<?php foreach ($users as $user): ?>
|
||
|
|
<div style="display:grid; grid-template-columns: 1.4fr 1.2fr 160px 140px; gap:12px; align-items:center; padding:10px 12px; border-radius:16px; border:1px solid var(--stroke); background: rgba(14,14,16,0.9);">
|
||
|
|
<div style="font-weight:600;"><?= htmlspecialchars((string)($user['name'] ?? ''), ENT_QUOTES, 'UTF-8') ?></div>
|
||
|
|
<div style="font-size:12px; color:var(--muted);"><?= htmlspecialchars((string)($user['email'] ?? ''), ENT_QUOTES, 'UTF-8') ?></div>
|
||
|
|
<div style="text-transform:uppercase; font-size:12px; color:var(--accent);"><?= htmlspecialchars((string)($user['role'] ?? ''), ENT_QUOTES, 'UTF-8') ?></div>
|
||
|
|
<form method="post" action="/admin/accounts/delete" onsubmit="return confirm('Delete this account?');">
|
||
|
|
<input type="hidden" name="id" value="<?= (int)($user['id'] ?? 0) ?>">
|
||
|
|
<button type="submit" class="btn outline small">Delete</button>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
<?php
|
||
|
|
$content = ob_get_clean();
|
||
|
|
require __DIR__ . '/layout.php';
|