68 lines
3.3 KiB
PHP
68 lines
3.3 KiB
PHP
<?php
|
||
require_once __DIR__ . '/../includes/bootstrap.php';
|
||
$staff = require_staff_login();
|
||
$pdo = get_db();
|
||
|
||
$agents = $pdo->query(
|
||
"SELECT s.*, d.name AS dept_name,
|
||
(SELECT COUNT(*) FROM tickets t WHERE t.assigned_staff_id=s.id AND t.status NOT IN ('closed','resolved')) AS open_tickets,
|
||
r.name AS role_name
|
||
FROM staff s
|
||
LEFT JOIN departments d ON d.id = s.department_id
|
||
LEFT JOIN roles r ON r.id = s.role_id
|
||
WHERE s.is_active = 1
|
||
ORDER BY s.name"
|
||
)->fetchAll();
|
||
|
||
$pageTitle = 'Mitarbeiter-Verzeichnis'; $activePage = 'agent_directory';
|
||
require __DIR__ . '/_header.php';
|
||
?>
|
||
<h1>Mitarbeiter-Verzeichnis</h1>
|
||
|
||
<div style="display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:16px; margin-top:8px">
|
||
<?php foreach ($agents as $a): ?>
|
||
<div class="card" style="padding:18px 20px; position:relative; <?= $a['is_on_vacation'] ? 'opacity:.75' : '' ?>">
|
||
<?php if ($a['is_on_vacation']): ?>
|
||
<span class="badge" style="position:absolute;top:14px;right:14px;background:var(--accent);font-size:.68rem">🌴 Urlaub</span>
|
||
<?php endif; ?>
|
||
<div style="display:flex; align-items:center; gap:12px; margin-bottom:12px">
|
||
<?php if ($a['avatar_path']): ?>
|
||
<img src="<?= e($a['avatar_path']) ?>" alt="" style="width:48px;height:48px;border-radius:50%;object-fit:cover;flex-shrink:0;border:2px solid var(--border)">
|
||
<?php else: ?>
|
||
<div style="width:48px;height:48px;border-radius:50%;background:var(--primary-lt);display:flex;align-items:center;justify-content:center;font-size:1.2rem;font-weight:700;color:var(--primary);flex-shrink:0">
|
||
<?= mb_strtoupper(mb_substr($a['name'], 0, 1)) ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
<div>
|
||
<div style="font-weight:700;color:var(--ink)"><?= e($a['name']) ?></div>
|
||
<div style="font-size:.76rem;color:var(--muted)"><?= $a['role'] === 'admin' ? 'Administrator' : ($a['role_name'] ?? 'Mitarbeiter') ?></div>
|
||
</div>
|
||
</div>
|
||
<div style="display:flex;flex-direction:column;gap:5px;font-size:.82rem">
|
||
<div style="display:flex;gap:8px">
|
||
<span style="color:var(--muted);width:70px;flex-shrink:0">E-Mail</span>
|
||
<a href="mailto:<?= e($a['email']) ?>" style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap"><?= e($a['email']) ?></a>
|
||
</div>
|
||
<?php if ($a['phone']): ?>
|
||
<div style="display:flex;gap:8px">
|
||
<span style="color:var(--muted);width:70px;flex-shrink:0">Telefon</span>
|
||
<span><?= e($a['phone']) ?></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
<div style="display:flex;gap:8px">
|
||
<span style="color:var(--muted);width:70px;flex-shrink:0">Abteilung</span>
|
||
<span><?= $a['dept_name'] ? e($a['dept_name']) : '<span class="muted">–</span>' ?></span>
|
||
</div>
|
||
<div style="display:flex;gap:8px">
|
||
<span style="color:var(--muted);width:70px;flex-shrink:0">Offen</span>
|
||
<span>
|
||
<a href="/staff/tickets.php?assigned=<?= $a['id'] ?>" style="font-weight:600"><?= (int)$a['open_tickets'] ?></a>
|
||
<span class="muted"> Tickets</span>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php require __DIR__ . '/_footer.php'; ?>
|