drink-it-cold/views/admin_users.php

88 lines
4.3 KiB
PHP
Raw Normal View History

<?php
/** @var array $users */
/** @var array $pushCounts */
/** @var array $pushLastUpdate */
/** @var bool $pushConfigured */
?>
<div class="page-head page-head--compact">
<div>
<p class="eyebrow">Verwaltung</p>
<h1>Benutzer</h1>
<p class="page-head__lede">Zugänge werden ausschließlich hier angelegt – eine Selbstregistrierung gibt es nicht.</p>
</div>
<div class="page-head__actions">
<a class="btn primary" href="<?= e(url('/admin/users/new')) ?>"><svg class="ico" aria-hidden="true"><use href="#i-plus"/></svg> Benutzer anlegen</a>
</div>
</div>
<?php require __DIR__ . '/_admin_nav.php'; ?>
<section class="panel">
<div class="panel__head">
<div>
<h2><?= count($users) ?> Benutzerkonto<?= count($users) === 1 ? '' : 'en' ?></h2>
<p>Angemeldet wird mit Vorname, Nachname und Passwort.</p>
</div>
</div>
<div class="table-wrap">
<table class="data-table">
<thead>
<tr>
<th>Name</th>
<th>Rolle</th>
<th>Mitarbeiterkonto</th>
<th>Status</th>
<th>App-Erinnerungen</th>
<th>Letzte Anmeldung</th>
<th class="ta-right">Aktionen</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $row): ?>
<tr>
<td>
<span class="table-person">
<span class="avatar avatar--small"><?= e(initials($row['first_name'] . ' ' . $row['last_name'])) ?></span>
<span><strong><?= e($row['first_name'] . ' ' . $row['last_name']) ?></strong>
<small><?= e($row['email'] ?: 'keine E-Mail hinterlegt') ?></small></span>
</span>
</td>
<td><span class="pill <?= $row['role'] === 'admin' ? 'pill--blue' : 'pill--grey' ?>"><?= $row['role'] === 'admin' ? 'Administrator' : 'Mitarbeiter' ?></span></td>
<td><?= e($row['employee_name'] ?: '–') ?></td>
<td><span class="pill <?= $row['status'] === 'active' ? 'pill--green' : 'pill--red' ?>"><?= $row['status'] === 'active' ? 'aktiv' : 'deaktiviert' ?></span></td>
<td>
<?php $devices = (int) ($pushCounts[(int) $row['id']] ?? 0); ?>
<?php if ($devices > 0): ?>
<span class="pill pill--green" title="Zuletzt aktualisiert: <?= e(fmt_datetime($pushLastUpdate[(int) $row['id']] ?? null)) ?>">
<svg class="ico" aria-hidden="true"><use href="#i-bell"/></svg>
<?= $devices ?> Gerät<?= $devices === 1 ? '' : 'e' ?>
</span>
<?php elseif ($pushConfigured): ?>
<span class="muted small">nicht aktiviert</span>
<?php else: ?>
<span class="muted small">–</span>
<?php endif; ?>
</td>
<td><?= e(fmt_datetime($row['last_login_at'])) ?></td>
<td class="ta-right">
<a class="btn small" href="<?= e(url('/admin/users/' . (int) $row['id'])) ?>"><svg class="ico" aria-hidden="true"><use href="#i-edit"/></svg> Bearbeiten</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</section>
<div class="info-grid">
<section class="card card--note">
<h2>So funktioniert die Anmeldung</h2>
<p>Benutzer melden sich mit <strong>Vorname</strong>, <strong>Nachname</strong> und <strong>Passwort</strong> an. Namen sind eindeutig; ein Benutzer kann nur vom Administrator angelegt, geändert oder deaktiviert werden.</p>
</section>
<section class="card card--note">
<h2>Erinnerungen zuordnen</h2>
<p>Verknüpfen Sie einen Benutzer mit einem Mitarbeiterkonto, damit er nur die für ihn relevanten Erinnerungen und Aufgaben sieht. Administratoren sehen alle Erinnerungen.</p>
</section>
</div>