Upload via GUI (364 Dateien)
This commit is contained in:
@@ -167,46 +167,46 @@ if ('serviceWorker' in navigator) {
|
|||||||
</nav>
|
</nav>
|
||||||
<div class="sidebar-footer">
|
<div class="sidebar-footer">
|
||||||
<?php if ($staff): ?>
|
<?php if ($staff): ?>
|
||||||
<div style="display:flex; align-items:center; gap:10px; margin-bottom:8px">
|
|
||||||
<?php if (!empty($staff['avatar_path'])): ?>
|
|
||||||
<img src="<?= e($staff['avatar_path']) ?>" alt="" style="width:32px; height:32px; border-radius:50%; object-fit:cover; flex-shrink:0; border:1px solid #2a3744">
|
|
||||||
<?php else: ?>
|
|
||||||
<div style="width:32px; height:32px; border-radius:50%; background:rgba(15,111,106,.3); display:flex; align-items:center; justify-content:center; font-size:.85rem; font-weight:700; color:#8bc4c2; flex-shrink:0">
|
|
||||||
<?= mb_strtoupper(mb_substr($staff['name'], 0, 1)) ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div style="min-width:0">
|
|
||||||
<div style="font-size:.82rem; font-weight:600; color:#fff; overflow:hidden; text-overflow:ellipsis; white-space:nowrap"><?= e($staff['name']) ?></div>
|
|
||||||
<div style="font-size:.72rem; color:#4e6278"><?= $staff['role']==='admin'?'Administrator':'Mitarbeiter' ?></div>
|
|
||||||
<?php if (!empty($staff['is_on_vacation'])): ?>
|
|
||||||
<div style="font-size:.7rem; color:var(--accent)">🌴 Im Urlaub</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="lang-row" style="margin-bottom:10px"><?= i18n_switcher_html('dark') ?></div>
|
|
||||||
<div style="display:flex; gap:14px; align-items:center">
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$__unreadMentions = 0;
|
$__unreadMentions = 0;
|
||||||
$__unreadChat = 0;
|
$__unreadChat = 0;
|
||||||
if ($staff) {
|
|
||||||
$__ms = get_db()->prepare('SELECT COUNT(*) FROM staff_mentions WHERE mentioned_staff_id=? AND is_read=0');
|
$__ms = get_db()->prepare('SELECT COUNT(*) FROM staff_mentions WHERE mentioned_staff_id=? AND is_read=0');
|
||||||
$__ms->execute([$staff['id']]);
|
$__ms->execute([$staff['id']]);
|
||||||
$__unreadMentions = (int)$__ms->fetchColumn();
|
$__unreadMentions = (int)$__ms->fetchColumn();
|
||||||
$__cs = get_db()->prepare('SELECT COUNT(*) FROM staff_chat_messages WHERE to_staff_id=? AND is_read=0');
|
$__cs = get_db()->prepare('SELECT COUNT(*) FROM staff_chat_messages WHERE to_staff_id=? AND is_read=0');
|
||||||
$__cs->execute([$staff['id']]);
|
$__cs->execute([$staff['id']]);
|
||||||
$__unreadChat = (int)$__cs->fetchColumn();
|
$__unreadChat = (int)$__cs->fetchColumn();
|
||||||
}
|
$__onVacation = !empty($staff['is_on_vacation']);
|
||||||
?>
|
?>
|
||||||
<a href="/staff/chat.php" title="Interner Chat" style="position:relative; color:#8b97a3; font-size:.78rem; text-decoration:none">
|
<div class="sf-user">
|
||||||
💬<?php if ($__unreadChat > 0): ?><span style="position:absolute;top:-6px;right:-8px;background:#dc2626;color:#fff;border-radius:50%;font-size:.6rem;font-weight:700;width:15px;height:15px;display:flex;align-items:center;justify-content:center;line-height:1"><?= $__unreadChat > 9 ? '9+' : $__unreadChat ?></span><?php endif; ?>
|
<?php if (!empty($staff['avatar_path'])): ?>
|
||||||
</a>
|
<img class="sf-avatar" src="<?= e($staff['avatar_path']) ?>" alt="">
|
||||||
<a href="/staff/mentions.php" title="Erwähnungen" style="position:relative; color:#8b97a3; font-size:.78rem; text-decoration:none">
|
<?php else: ?>
|
||||||
🔔<?php if ($__unreadMentions > 0): ?><span style="position:absolute;top:-6px;right:-8px;background:#dc2626;color:#fff;border-radius:50%;font-size:.6rem;font-weight:700;width:15px;height:15px;display:flex;align-items:center;justify-content:center;line-height:1"><?= $__unreadMentions > 9 ? '9+' : $__unreadMentions ?></span><?php endif; ?>
|
<div class="sf-avatar sf-avatar-letter"><?= mb_strtoupper(mb_substr($staff['name'], 0, 1)) ?></div>
|
||||||
</a>
|
<?php endif; ?>
|
||||||
<a href="/staff/profile.php" style="color:#8b97a3; font-size:.78rem">Profil</a>
|
<div class="sf-who">
|
||||||
<a href="/staff/logout.php" style="color:#8b97a3; font-size:.78rem">Abmelden</a>
|
<div class="sf-name"><?= e($staff['name']) ?></div>
|
||||||
|
<div class="sf-role"><?= $staff['role']==='admin'?'Administrator':'Mitarbeiter' ?></div>
|
||||||
|
<?php if ($__onVacation): ?><span class="sf-vac">🌴 Im Urlaub</span><?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sf-actions">
|
||||||
|
<a class="sf-btn" href="/staff/chat.php" title="Interner Chat" aria-label="Interner Chat">
|
||||||
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L3 21l1.9-5.4A8 8 0 1 1 21 12z"/></svg>
|
||||||
|
<?php if ($__unreadChat > 0): ?><span class="sf-badge"><?= $__unreadChat > 9 ? '9+' : $__unreadChat ?></span><?php endif; ?>
|
||||||
|
</a>
|
||||||
|
<a class="sf-btn" href="/staff/mentions.php" title="Erwähnungen" aria-label="Erwähnungen">
|
||||||
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9M13.7 21a2 2 0 0 1-3.4 0"/></svg>
|
||||||
|
<?php if ($__unreadMentions > 0): ?><span class="sf-badge"><?= $__unreadMentions > 9 ? '9+' : $__unreadMentions ?></span><?php endif; ?>
|
||||||
|
</a>
|
||||||
|
<a class="sf-btn" href="/staff/profile.php" title="Profil" aria-label="Profil">
|
||||||
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 21a8 8 0 0 0-16 0M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z"/></svg>
|
||||||
|
</a>
|
||||||
|
<a class="sf-btn sf-btn-out" href="/staff/logout.php" title="Abmelden" aria-label="Abmelden">
|
||||||
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9"/></svg>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="lang-row"><?= i18n_switcher_html('dark') ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead><tr>
|
<thead><tr>
|
||||||
<th style="width:24px"><input type="checkbox" onclick="document.querySelectorAll('.ticket-check').forEach(c=>c.checked=this.checked)"></th>
|
<th style="width:24px"><input type="checkbox" onclick="document.querySelectorAll('.ticket-check').forEach(c=>c.checked=this.checked)"></th>
|
||||||
<th>Ticket</th><th>Betreff</th><th>Abteilung</th><th>Priorität</th><th>Status</th><th>Zugewiesen</th><th>Eingang</th><th>Fällig</th>
|
<th>Ticket</th><th>Betreff</th><th>Abteilung</th><th>Priorität</th><th>Status</th><th>Zugewiesen</th><th>Letzte Aktivität</th><th>Fällig</th>
|
||||||
</tr></thead>
|
</tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($tickets as $t):
|
<?php foreach ($tickets as $t):
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
<td><span class="badge" style="background:<?= e($t['priority_color']) ?>"><?= e($t['priority_name']) ?></span></td>
|
<td><span class="badge" style="background:<?= e($t['priority_color']) ?>"><?= e($t['priority_name']) ?></span></td>
|
||||||
<td><span class="badge" style="background:<?= $color ?>"><?= e($label) ?></span></td>
|
<td><span class="badge" style="background:<?= $color ?>"><?= e($label) ?></span></td>
|
||||||
<td><?= $t['staff_name'] ? e($t['staff_name']) : '<span class="muted">–</span>' ?></td>
|
<td><?= $t['staff_name'] ? e($t['staff_name']) : '<span class="muted">–</span>' ?></td>
|
||||||
<td class="muted" style="white-space:nowrap" title="Ticket eingegangen"><?= e(format_dt($t['created_at'] ?? null)) ?></td>
|
<td class="muted" style="white-space:nowrap" title="Eingegangen: <?= e(format_dt($t['created_at'] ?? null)) ?>"><?= e(format_dt($t['updated_at'] ?? $t['created_at'] ?? null)) ?></td>
|
||||||
<td class="muted"><?= $isPaused ? 'Pausiert' : time_until($t['resolution_due_at']) ?></td>
|
<td class="muted"><?= $isPaused ? 'Pausiert' : time_until($t['resolution_due_at']) ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
flash('success', 'Ticket wurde mit dem Problem verknüpft.');
|
flash('success', 'Ticket wurde mit dem Problem verknüpft.');
|
||||||
} elseif ($action === 'ticket_unlink') {
|
} elseif ($action === 'ticket_unlink') {
|
||||||
$ticketId = (int) ($_POST['ticket_id'] ?? 0);
|
$ticketId = (int) ($_POST['ticket_id'] ?? 0);
|
||||||
ticket_problem_unlink($pdo, $problemId, $ticketId);
|
if (!ticket_problem_unlink($pdo, $problemId, $ticketId)) throw new InvalidArgumentException('Dieses Ticket ist mit dem Problem nicht verknüpft.');
|
||||||
log_activity($pdo, $ticketId, (int) $staff['id'], 'Verknüpfung mit ' . ticket_problem_number($problemId) . ' entfernt');
|
log_activity($pdo, $ticketId, (int) $staff['id'], 'Verknüpfung mit ' . ticket_problem_number($problemId) . ' entfernt');
|
||||||
audit_log($staff['id'], 'Ticket von ' . ticket_problem_number($problemId) . ' getrennt');
|
audit_log($staff['id'], 'Ticket von ' . ticket_problem_number($problemId) . ' getrennt');
|
||||||
flash('success', 'Ticket-Verknüpfung wurde entfernt.');
|
flash('success', 'Ticket-Verknüpfung wurde entfernt.');
|
||||||
@@ -65,13 +65,18 @@ $activePage = 'problems';
|
|||||||
$pageTitle = 'Problemmanagement';
|
$pageTitle = 'Problemmanagement';
|
||||||
require __DIR__ . '/_header.php';
|
require __DIR__ . '/_header.php';
|
||||||
?>
|
?>
|
||||||
<h1>Problemmanagement</h1>
|
<div class="pm-head">
|
||||||
<p class="muted">Bündeln Sie Tickets mit derselben Ursache. Ursache, Workaround und dauerhafte Lösung werden zentral dokumentiert.</p>
|
<div>
|
||||||
|
<h1 style="margin:0">Problemmanagement</h1>
|
||||||
|
<p class="muted" style="margin:4px 0 0">Bündeln Sie Tickets mit derselben Ursache. Ursache, Workaround und dauerhafte Lösung werden zentral dokumentiert.</p>
|
||||||
|
</div>
|
||||||
|
<?php if ($activeTab === 'create' || $problem): ?>
|
||||||
|
<a class="btn secondary" href="/staff/problems.php">← Alle Probleme</a>
|
||||||
|
<?php else: ?>
|
||||||
|
<a class="btn" href="/staff/problems.php?tab=create">+ Neues Problem</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
<?php foreach ($errors as $error): ?><div class="flash error"><?= e($error) ?></div><?php endforeach; ?>
|
<?php foreach ($errors as $error): ?><div class="flash error"><?= e($error) ?></div><?php endforeach; ?>
|
||||||
<nav class="problem-tabs" role="tablist" aria-label="Problemmanagement">
|
|
||||||
<a role="tab" aria-selected="<?= $activeTab === 'list' ? 'true' : 'false' ?>" class="<?= $activeTab === 'list' ? 'active' : '' ?>" href="/staff/problems.php?tab=list<?= $problemId ? '&id=' . $problemId : '' ?>">Probleme</a>
|
|
||||||
<a role="tab" aria-selected="<?= $activeTab === 'create' ? 'true' : 'false' ?>" class="<?= $activeTab === 'create' ? 'active' : '' ?>" href="/staff/problems.php?tab=create">Neues Problem</a>
|
|
||||||
</nav>
|
|
||||||
<?php if ($activeTab === 'create'): ?>
|
<?php if ($activeTab === 'create'): ?>
|
||||||
<section class="card">
|
<section class="card">
|
||||||
<h2 style="margin-top:0">Neues Problem erfassen</h2>
|
<h2 style="margin-top:0">Neues Problem erfassen</h2>
|
||||||
@@ -86,22 +91,36 @@ require __DIR__ . '/_header.php';
|
|||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div style="display:grid;grid-template-columns:minmax(240px,320px) minmax(0,1fr);gap:16px;align-items:start">
|
|
||||||
<aside class="card">
|
|
||||||
<h3 style="margin-top:0">Probleme</h3>
|
|
||||||
<?php if (!$problems): ?><p class="muted">Noch keine Probleme erfasst.</p><?php endif; ?>
|
|
||||||
<?php foreach ($problems as $item): ?>
|
|
||||||
<a href="/staff/problems.php?id=<?= (int) $item['id'] ?>" style="display:block;padding:9px 4px;border-top:1px solid var(--border,#e3e9ee);text-decoration:none;<?= (int) $item['id'] === $problemId ? 'font-weight:700;color:var(--primary)' : '' ?>">
|
|
||||||
<strong><?= e(ticket_problem_number((int) $item['id'])) ?></strong> · <?= e($item['title']) ?><br>
|
|
||||||
<span class="muted" style="font-size:.78rem"><?= e($problemStatuses[$item['status']] ?? $item['status']) ?> · <?= (int) $item['ticket_count'] ?> Tickets</span>
|
|
||||||
</a>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
<main>
|
|
||||||
<?php if (!$problem): ?>
|
<?php if (!$problem): ?>
|
||||||
<section class="card"><h3>Problem auswählen</h3><p class="muted">Wählen Sie links ein Problem aus oder legen Sie ein neues an.</p></section>
|
<?php $openCount = 0; foreach ($problems as $item) { if ($item['status'] !== 'resolved') $openCount++; } ?>
|
||||||
|
<section class="card" style="padding:0;overflow:hidden">
|
||||||
|
<?php if (!$problems): ?>
|
||||||
|
<div class="empty-state" style="padding:32px">Noch keine Probleme erfasst. <a href="/staff/problems.php?tab=create">Erstes Problem anlegen</a></div>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
<div class="muted" style="padding:14px 20px;border-bottom:1px solid var(--border,#e3e9ee)"><?= count($problems) ?> Probleme · <?= $openCount ?> offen</div>
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>Nr.</th><th>Titel</th><th>Status</th><th>Tickets</th><th>Zuletzt geändert</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($problems as $item):
|
||||||
|
$pColor = ['investigating' => '#dc2626', 'workaround' => '#d97706', 'monitoring' => '#2563eb', 'resolved' => '#16a34a'][$item['status']] ?? '#64748b';
|
||||||
|
$pUrl = '/staff/problems.php?id=' . (int) $item['id'];
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td style="white-space:nowrap"><a href="<?= $pUrl ?>" class="ticket-no"><?= e(ticket_problem_number((int) $item['id'])) ?></a></td>
|
||||||
|
<td><a href="<?= $pUrl ?>"><strong><?= e($item['title']) ?></strong></a>
|
||||||
|
<?php if (!empty($item['description'])): ?><div class="muted" style="font-size:.8rem;max-width:560px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"><?= e($item['description']) ?></div><?php endif; ?></td>
|
||||||
|
<td><span class="badge" style="background:<?= $pColor ?>"><?= e($problemStatuses[$item['status']] ?? $item['status']) ?></span></td>
|
||||||
|
<td><?= (int) $item['ticket_count'] ?></td>
|
||||||
|
<td class="muted" style="white-space:nowrap"><?= e(format_dt((string) ($item['updated_at'] ?? $item['created_at']))) ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php endif; ?>
|
||||||
|
</section>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="pm-detail">
|
||||||
|
<main>
|
||||||
<section class="card">
|
<section class="card">
|
||||||
<div style="display:flex;justify-content:space-between;align-items:start;gap:12px;flex-wrap:wrap">
|
<div style="display:flex;justify-content:space-between;align-items:start;gap:12px;flex-wrap:wrap">
|
||||||
<div><span class="muted"><?= e(ticket_problem_number($problemId)) ?></span><h2 style="margin:2px 0 12px"><?= e($problem['title']) ?></h2></div>
|
<div><span class="muted"><?= e(ticket_problem_number($problemId)) ?></span><h2 style="margin:2px 0 12px"><?= e($problem['title']) ?></h2></div>
|
||||||
@@ -116,8 +135,9 @@ require __DIR__ . '/_header.php';
|
|||||||
<div style="display:flex;gap:12px;align-items:end;flex-wrap:wrap;margin-top:8px"><div><label for="problem_status">Status</label><select id="problem_status" name="status"><?php foreach ($problemStatuses as $key => $label): ?><option value="<?= e($key) ?>" <?= $problem['status'] === $key ? 'selected' : '' ?>><?= e($label) ?></option><?php endforeach; ?></select></div><button class="btn" type="submit">Problem speichern</button></div>
|
<div style="display:flex;gap:12px;align-items:end;flex-wrap:wrap;margin-top:8px"><div><label for="problem_status">Status</label><select id="problem_status" name="status"><?php foreach ($problemStatuses as $key => $label): ?><option value="<?= e($key) ?>" <?= $problem['status'] === $key ? 'selected' : '' ?>><?= e($label) ?></option><?php endforeach; ?></select></div><button class="btn" type="submit">Problem speichern</button></div>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
</main>
|
||||||
<section class="card" style="margin-top:16px">
|
<aside>
|
||||||
|
<section class="card">
|
||||||
<h3 style="margin-top:0">Verknüpfte Tickets (<?= count($linkedTickets) ?>)</h3>
|
<h3 style="margin-top:0">Verknüpfte Tickets (<?= count($linkedTickets) ?>)</h3>
|
||||||
<form method="post" style="display:flex;gap:8px;flex-wrap:wrap;align-items:end;margin-bottom:12px"><?= csrf_field() ?><input type="hidden" name="action" value="ticket_link"><input type="hidden" name="problem_id" value="<?= $problemId ?>"><div style="flex:1;min-width:200px"><label for="link_ticket_number">Ticketnummer</label><input id="link_ticket_number" type="text" name="ticket_number" required placeholder="z. B. 260001"></div><button class="btn secondary" type="submit">Ticket verknüpfen</button></form>
|
<form method="post" style="display:flex;gap:8px;flex-wrap:wrap;align-items:end;margin-bottom:12px"><?= csrf_field() ?><input type="hidden" name="action" value="ticket_link"><input type="hidden" name="problem_id" value="<?= $problemId ?>"><div style="flex:1;min-width:200px"><label for="link_ticket_number">Ticketnummer</label><input id="link_ticket_number" type="text" name="ticket_number" required placeholder="z. B. 260001"></div><button class="btn secondary" type="submit">Ticket verknüpfen</button></form>
|
||||||
<?php if (!$linkedTickets): ?><p class="muted">Noch keine Tickets mit diesem Problem verknüpft.</p><?php endif; ?>
|
<?php if (!$linkedTickets): ?><p class="muted">Noch keine Tickets mit diesem Problem verknüpft.</p><?php endif; ?>
|
||||||
@@ -128,15 +148,13 @@ require __DIR__ . '/_header.php';
|
|||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</section>
|
</section>
|
||||||
<?php endif; ?>
|
</aside>
|
||||||
</main>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
<style>
|
<style>
|
||||||
.problem-tabs{display:flex;gap:8px;margin:18px 0 12px;border-bottom:1px solid var(--border,#d8e0e8)}
|
.pm-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap;margin-bottom:18px}
|
||||||
.problem-tabs a{border-bottom:3px solid transparent;border-radius:7px 7px 0 0;background:transparent;color:var(--muted,#64748b);padding:10px 16px;font-weight:700;text-decoration:none}
|
.pm-detail{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,400px);gap:16px;align-items:start}
|
||||||
.problem-tabs a.active{color:var(--text,#0f172a);border-bottom-color:var(--primary,#0f766e);background:var(--surface,#fff)}
|
@media(max-width:900px){.pm-detail{grid-template-columns:1fr}}
|
||||||
|
|
||||||
@media(max-width:760px){.card+main{min-width:0}}
|
|
||||||
</style>
|
</style>
|
||||||
<?php require __DIR__ . '/_footer.php'; ?>
|
<?php require __DIR__ . '/_footer.php'; ?>
|
||||||
|
|||||||
+578
-303
@@ -93,8 +93,14 @@ switch ($preset) {
|
|||||||
case 'thismonth': $from = new DateTime(date('Y-m-01')); $to = clone $today; break;
|
case 'thismonth': $from = new DateTime(date('Y-m-01')); $to = clone $today; break;
|
||||||
case 'thisyear': $from = new DateTime(date('Y-01-01')); $to = clone $today; break;
|
case 'thisyear': $from = new DateTime(date('Y-01-01')); $to = clone $today; break;
|
||||||
case 'custom':
|
case 'custom':
|
||||||
$from = !empty($_GET['from']) ? new DateTime($_GET['from']) : (clone $today)->modify('-29 days');
|
// Ungültige Eingaben (kein Datum) fallen auf den Standardzeitraum zurück, statt eine Fehlerseite zu erzeugen
|
||||||
$to = !empty($_GET['to']) ? new DateTime($_GET['to']) : clone $today;
|
$parseDay = function (string $key, DateTime $fallback): DateTime {
|
||||||
|
$raw = (string) ($_GET[$key] ?? '');
|
||||||
|
$d = $raw !== '' ? DateTime::createFromFormat('!Y-m-d', $raw) : false;
|
||||||
|
return $d instanceof DateTime ? $d : $fallback;
|
||||||
|
};
|
||||||
|
$from = $parseDay('from', (clone $today)->modify('-29 days'));
|
||||||
|
$to = $parseDay('to', clone $today);
|
||||||
break;
|
break;
|
||||||
case '30d':
|
case '30d':
|
||||||
default:
|
default:
|
||||||
@@ -375,30 +381,166 @@ $activePage = 'reports';
|
|||||||
require __DIR__ . '/_header.php';
|
require __DIR__ . '/_header.php';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div style="display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:4px">
|
<?php
|
||||||
<h1>Willkommen, <?= e($staff['name']) ?></h1>
|
// Zufriedenheit (CSAT): nur zeigen, wenn die Abfrage eingeschaltet ist oder es schon Antworten gibt
|
||||||
<?php if ($staff['role'] === 'admin'): ?>
|
$csat = null;
|
||||||
<div style="display:flex; align-items:center; gap:10px">
|
try { $csat = csat_stats($pdo, $rangeFrom, $rangeTo, $myDeptIds); } catch (Throwable $e) { $csat = null; }
|
||||||
<span style="font-size:.78rem; color:var(--muted)">v<?= DESKHUB_VERSION ?></span>
|
$showCsat = $csat && (csat_enabled() || $csat['sent'] > 0);
|
||||||
<a href="/staff/update.php" class="btn secondary" style="font-size:.8rem; padding:6px 12px">🔄 Updates</a>
|
$isAdmin = $staff['role'] === 'admin';
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
$pageTabs = ['overview' => 'Überblick', 'activity' => 'Verlauf', 'analysis' => 'Auswertung'];
|
||||||
</div>
|
if ($showCsat) $pageTabs['csat'] = 'Zufriedenheit';
|
||||||
|
$tab = (string) ($_GET['tab'] ?? 'overview');
|
||||||
|
if (!isset($pageTabs[$tab])) $tab = 'overview';
|
||||||
|
|
||||||
<?php if ($staff['role'] === 'admin'):
|
|
||||||
// Update-Check: neuestes Release von Gitea holen
|
|
||||||
$__latestVersion = null;
|
$__latestVersion = null;
|
||||||
|
$__hasUpdate = false;
|
||||||
|
if ($isAdmin && $tab === 'overview') { // der Hinweis steht nur im Überblick
|
||||||
|
// Update-Check: neuestes Release von Gitea holen. Das Ergebnis wird eine Stunde gemerkt (bei Fehlern 15 Minuten), damit nicht jeder Aufruf der Seite wartet.
|
||||||
|
$__cache = json_decode((string) get_setting('update_check_cache', ''), true);
|
||||||
|
if (is_array($__cache) && isset($__cache['at']) && time() - (int) $__cache['at'] < (empty($__cache['tag']) ? 900 : 3600)) {
|
||||||
|
$__latestVersion = $__cache['tag'] ?: null;
|
||||||
|
} else {
|
||||||
if (function_exists('curl_init')) {
|
if (function_exists('curl_init')) {
|
||||||
$__ch = curl_init('https://git.viper.ipv64.net/api/v1/repos/M_Viper/deskhub/releases?limit=1');
|
$__ch = curl_init('https://git.viper.ipv64.net/api/v1/repos/M_Viper/deskhub/releases?limit=1');
|
||||||
curl_setopt_array($__ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 4, CURLOPT_SSL_VERIFYPEER => true, CURLOPT_PROTOCOLS => CURLPROTO_HTTPS, CURLOPT_HTTPHEADER => update_http_headers()]);
|
curl_setopt_array($__ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 4, CURLOPT_SSL_VERIFYPEER => true, CURLOPT_PROTOCOLS => CURLPROTO_HTTPS, CURLOPT_HTTPHEADER => update_http_headers()]);
|
||||||
$__resp = curl_exec($__ch); curl_close($__ch);
|
$__resp = curl_exec($__ch);
|
||||||
|
curl_close($__ch);
|
||||||
$__rel = @json_decode($__resp, true);
|
$__rel = @json_decode($__resp, true);
|
||||||
if (!empty($__rel[0]['tag_name'])) $__latestVersion = $__rel[0]['tag_name'];
|
if (!empty($__rel[0]['tag_name'])) $__latestVersion = $__rel[0]['tag_name'];
|
||||||
}
|
}
|
||||||
|
set_setting('update_check_cache', json_encode(['at' => time(), 'tag' => $__latestVersion]));
|
||||||
|
}
|
||||||
$__hasUpdate = $__latestVersion && version_compare($__latestVersion, DESKHUB_VERSION, '>');
|
$__hasUpdate = $__latestVersion && version_compare($__latestVersion, DESKHUB_VERSION, '>');
|
||||||
|
}
|
||||||
|
$rangeLabel = $from->format('d.m.Y') . ' – ' . $to->format('d.m.Y');
|
||||||
|
$exportParams = ['range' => $preset, 'from' => $from->format('Y-m-d'), 'to' => $to->format('Y-m-d')];
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<div class="ov-head">
|
||||||
|
<div>
|
||||||
|
<h1 style="margin:0">Willkommen, <?= e($staff['name']) ?></h1>
|
||||||
|
<p class="muted" style="margin:4px 0 0"><?= e(date('d.m.Y')) ?><?= $isAdmin ? ' · Version ' . e(DESKHUB_VERSION) : '' ?></p>
|
||||||
|
</div>
|
||||||
|
<?php if ($isAdmin): ?><a href="/staff/update.php" class="btn secondary" style="font-size:.8rem; padding:6px 12px">🔄 Updates</a><?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<nav class="page-tabs" role="tablist" aria-label="Übersicht">
|
||||||
|
<?php foreach ($pageTabs as $key => $label): ?>
|
||||||
|
<button type="button" role="tab" id="ptab-<?= $key ?>" data-tab="<?= $key ?>" aria-controls="pane-<?= $key ?>" aria-selected="<?= $tab === $key ? 'true' : 'false' ?>" class="page-tab<?= $tab === $key ? ' active' : '' ?>">
|
||||||
|
<?= e($label) ?>
|
||||||
|
<?php if ($key === 'overview' && $dashOverdue > 0): ?><span class="page-tab-badge" title="Überfällige Tickets"><?= $dashOverdue ?></span><?php endif; ?>
|
||||||
|
</button>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<!-- Berichtszeitraum: gilt für Verlauf, Auswertung und Zufriedenheit -->
|
||||||
|
<form method="get" class="filters card" id="range-bar" style="<?= $tab === 'overview' ? 'display:none' : '' ?>">
|
||||||
|
<input type="hidden" name="tab" id="range-tab" value="<?= e($tab) ?>">
|
||||||
|
<div>
|
||||||
|
<label>Berichtszeitraum</label>
|
||||||
|
<select name="range" onchange="document.getElementById('custom-range').style.display = this.value==='custom' ? 'flex' : 'none'">
|
||||||
|
<option value="7d" <?= $preset==='7d'?'selected':'' ?>>Letzte 7 Tage</option>
|
||||||
|
<option value="30d" <?= $preset==='30d'?'selected':'' ?>>Letzte 30 Tage</option>
|
||||||
|
<option value="thismonth" <?= $preset==='thismonth'?'selected':'' ?>>Dieser Monat</option>
|
||||||
|
<option value="thisyear" <?= $preset==='thisyear'?'selected':'' ?>>Dieses Jahr</option>
|
||||||
|
<option value="custom" <?= $preset==='custom'?'selected':'' ?>>Benutzerdefiniert</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div id="custom-range" style="display:<?= $preset==='custom'?'flex':'none' ?>; gap:14px">
|
||||||
|
<div><label>Von</label><input type="date" name="from" value="<?= e($from->format('Y-m-d')) ?>"></div>
|
||||||
|
<div><label>Bis</label><input type="date" name="to" value="<?= e($to->format('Y-m-d')) ?>"></div>
|
||||||
|
</div>
|
||||||
|
<div><button type="submit" class="btn secondary">Aktualisieren</button></div>
|
||||||
|
<div class="muted" style="margin-left:auto; font-size:.85rem"><?= e($rangeLabel) ?></div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// ── Daten für den Überblick ───────────────────────────────────────────────
|
||||||
|
[$ovDept, $ovDeptParams] = dept_filter_sql($myDeptIds, 't.department_id');
|
||||||
|
$ovOpen = "t.status NOT IN ('resolved','closed')";
|
||||||
|
$ovVisible = ticket_not_snoozed_sql('t');
|
||||||
|
$ovBase = "SELECT t.id, t.ticket_number, t.subject, t.requester_name, t.status, t.resolution_due_at, t.sla_paused_at, t.is_overdue, t.created_at, t.updated_at,
|
||||||
|
p.name AS priority_name, p.color AS priority_color, d.name AS department_name, s.name AS staff_name
|
||||||
|
FROM tickets t
|
||||||
|
JOIN priorities p ON p.id = t.priority_id
|
||||||
|
JOIN departments d ON d.id = t.department_id
|
||||||
|
LEFT JOIN staff s ON s.id = t.assigned_staff_id";
|
||||||
|
|
||||||
|
$ovMine = $ovUnassigned = $ovTasks = $ovDepts = $ovFeed = [];
|
||||||
|
$ovTodayNew = $ovTodayDone = $ovAtRisk = 0;
|
||||||
|
$ovWeek = [];
|
||||||
|
try {
|
||||||
|
$q = $pdo->prepare("$ovBase WHERE t.assigned_staff_id = ? AND $ovOpen AND $ovVisible{$ovDept} ORDER BY t.resolution_due_at IS NULL, t.resolution_due_at ASC, t.updated_at DESC LIMIT 6");
|
||||||
|
$q->execute([$staff['id'], ...$ovDeptParams]);
|
||||||
|
$ovMine = $q->fetchAll();
|
||||||
|
|
||||||
|
$q = $pdo->prepare("$ovBase WHERE t.assigned_staff_id IS NULL AND $ovOpen AND $ovVisible{$ovDept} ORDER BY t.created_at DESC LIMIT 6");
|
||||||
|
$q->execute($ovDeptParams);
|
||||||
|
$ovUnassigned = $q->fetchAll();
|
||||||
|
|
||||||
|
$todayStart = date('Y-m-d 00:00:00');
|
||||||
|
$q = $pdo->prepare("SELECT COUNT(*) FROM tickets t WHERE t.created_at >= ?{$ovDept}");
|
||||||
|
$q->execute([$todayStart, ...$ovDeptParams]);
|
||||||
|
$ovTodayNew = (int) $q->fetchColumn();
|
||||||
|
$q = $pdo->prepare("SELECT COUNT(*) FROM tickets t WHERE t.resolved_at >= ?{$ovDept}");
|
||||||
|
$q->execute([$todayStart, ...$ovDeptParams]);
|
||||||
|
$ovTodayDone = (int) $q->fetchColumn();
|
||||||
|
|
||||||
|
$soon = date('Y-m-d H:i:s', time() + 4 * 3600);
|
||||||
|
$q = $pdo->prepare("SELECT COUNT(*) FROM tickets t WHERE $ovOpen AND t.sla_paused_at IS NULL AND t.resolution_due_at IS NOT NULL AND t.resolution_due_at >= ? AND t.resolution_due_at < ?{$ovDept}");
|
||||||
|
$q->execute([db_now(), $soon, ...$ovDeptParams]);
|
||||||
|
$ovAtRisk = (int) $q->fetchColumn();
|
||||||
|
|
||||||
|
// Letzte 7 Tage: neue und gelöste Tickets je Tag
|
||||||
|
$weekStart = date('Y-m-d 00:00:00', strtotime('-6 days'));
|
||||||
|
for ($i = 6; $i >= 0; $i--) { $day = date('Y-m-d', strtotime("-$i days")); $ovWeek[$day] = ['new' => 0, 'done' => 0]; }
|
||||||
|
$q = $pdo->prepare("SELECT t.created_at FROM tickets t WHERE t.created_at >= ?{$ovDept}");
|
||||||
|
$q->execute([$weekStart, ...$ovDeptParams]);
|
||||||
|
foreach ($q->fetchAll(PDO::FETCH_COLUMN) as $c) { $k = substr((string) $c, 0, 10); if (isset($ovWeek[$k])) $ovWeek[$k]['new']++; }
|
||||||
|
$q = $pdo->prepare("SELECT t.resolved_at FROM tickets t WHERE t.resolved_at >= ?{$ovDept}");
|
||||||
|
$q->execute([$weekStart, ...$ovDeptParams]);
|
||||||
|
foreach ($q->fetchAll(PDO::FETCH_COLUMN) as $c) { $k = substr((string) $c, 0, 10); if (isset($ovWeek[$k])) $ovWeek[$k]['done']++; }
|
||||||
|
|
||||||
|
$q = $pdo->prepare("SELECT ta.id, ta.title, ta.due_at, ta.status, t.ticket_number FROM tasks ta LEFT JOIN tickets t ON t.id = ta.ticket_id
|
||||||
|
WHERE ta.assigned_to = ? AND ta.status != 'done' ORDER BY ta.due_at IS NULL, ta.due_at ASC, ta.created_at DESC LIMIT 5");
|
||||||
|
$q->execute([$staff['id']]);
|
||||||
|
$ovTasks = $q->fetchAll();
|
||||||
|
|
||||||
|
$q = $pdo->prepare("SELECT d.name, COUNT(*) AS n FROM tickets t JOIN departments d ON d.id = t.department_id WHERE $ovOpen{$ovDept} GROUP BY d.id, d.name ORDER BY n DESC LIMIT 8");
|
||||||
|
$q->execute($ovDeptParams);
|
||||||
|
$ovDepts = $q->fetchAll();
|
||||||
|
|
||||||
|
$q = $pdo->prepare("SELECT a.action, a.created_at, s.name AS staff_name, t.ticket_number, t.subject
|
||||||
|
FROM activity_log a JOIN tickets t ON t.id = a.ticket_id LEFT JOIN staff s ON s.id = a.staff_id
|
||||||
|
WHERE 1=1{$ovDept} ORDER BY a.created_at DESC, a.id DESC LIMIT 8");
|
||||||
|
$q->execute($ovDeptParams);
|
||||||
|
$ovFeed = $q->fetchAll();
|
||||||
|
} catch (Throwable $e) { error_log('Übersicht: ' . $e->getMessage()); }
|
||||||
|
|
||||||
|
/** Eine Ticketzeile für die Listen im Überblick */
|
||||||
|
function ov_ticket_row(array $t): string
|
||||||
|
{
|
||||||
|
$over = !in_array($t['status'], ['resolved', 'closed'], true) && (!empty($t['is_overdue']) || (empty($t['sla_paused_at']) && !empty($t['resolution_due_at']) && strtotime((string) $t['resolution_due_at']) < time()));
|
||||||
|
$due = !empty($t['sla_paused_at']) ? 'Pausiert' : (!empty($t['resolution_due_at']) ? time_until($t['resolution_due_at']) : '');
|
||||||
|
$color = preg_match('/^#[0-9a-fA-F]{3,8}$/', (string) $t['priority_color']) ? $t['priority_color'] : '#94a3b8';
|
||||||
|
return '<a class="ov-row" href="/staff/ticket_view.php?n=' . e(rawurlencode((string) $t['ticket_number'])) . '">'
|
||||||
|
. '<span class="ov-dot" style="background:' . e($color) . '" title="' . e($t['priority_name']) . '"></span>'
|
||||||
|
. '<span class="ov-row-main"><span class="ov-row-title">' . e($t['subject']) . '</span>'
|
||||||
|
. '<span class="ov-row-meta">#' . e($t['ticket_number']) . ' · ' . e($t['requester_name']) . ' · ' . e($t['department_name']) . '</span></span>'
|
||||||
|
. ($due !== '' ? '<span class="ov-row-due' . ($over ? ' over' : '') . '">' . e($due) . '</span>' : '')
|
||||||
|
. '</a>';
|
||||||
|
}
|
||||||
|
$ovWeekMax = 1;
|
||||||
|
foreach ($ovWeek as $__d) { $ovWeekMax = max($ovWeekMax, $__d['new'], $__d['done']); }
|
||||||
|
$ovWeekdays = ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'];
|
||||||
|
$ovDeptMax = 1;
|
||||||
|
foreach ($ovDepts as $__d) { $ovDeptMax = max($ovDeptMax, (int) $__d['n']); }
|
||||||
|
?>
|
||||||
|
<!-- ── Überblick ─────────────────────────────────────────────────────────── -->
|
||||||
|
<section id="pane-overview" class="page-pane" role="tabpanel" aria-labelledby="ptab-overview" <?= $tab === 'overview' ? '' : 'hidden' ?>>
|
||||||
<?php if ($__hasUpdate): ?>
|
<?php if ($__hasUpdate): ?>
|
||||||
<div style="background:linear-gradient(135deg,#0f6f6a,#0b5a56); color:#fff; border-radius:10px; padding:16px 20px; margin-bottom:20px; display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap">
|
<div class="ov-update">
|
||||||
<div style="display:flex; align-items:center; gap:14px">
|
<div style="display:flex; align-items:center; gap:14px">
|
||||||
<span style="font-size:1.8rem">🆕</span>
|
<span style="font-size:1.8rem">🆕</span>
|
||||||
<div>
|
<div>
|
||||||
@@ -406,59 +548,118 @@ require __DIR__ . '/_header.php';
|
|||||||
<div style="font-size:.82rem; opacity:.85; margin-top:2px">Aktuell installiert: v<?= DESKHUB_VERSION ?></div>
|
<div style="font-size:.82rem; opacity:.85; margin-top:2px">Aktuell installiert: v<?= DESKHUB_VERSION ?></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="/staff/update.php" style="background:rgba(255,255,255,.2); color:#fff; border:1px solid rgba(255,255,255,.3); border-radius:8px; padding:8px 16px; font-size:.85rem; font-weight:600; text-decoration:none; white-space:nowrap; flex-shrink:0">
|
<a href="/staff/update.php">Zum Update-Bereich →</a>
|
||||||
Zum Update-Bereich →
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="stat-grid">
|
<h2 class="ov-sec">Jetzt zu tun</h2>
|
||||||
|
<div class="stat-grid" style="grid-template-columns:repeat(auto-fit, minmax(150px, 1fr))">
|
||||||
<div class="stat-card" style="cursor:pointer" onclick="location.href='/staff/tickets.php'"><div class="num" data-live-count="open"><?= $dashOpenTickets ?></div><div class="lbl">Offene Tickets</div></div>
|
<div class="stat-card" style="cursor:pointer" onclick="location.href='/staff/tickets.php'"><div class="num" data-live-count="open"><?= $dashOpenTickets ?></div><div class="lbl">Offene Tickets</div></div>
|
||||||
<div class="stat-card" style="cursor:pointer" onclick="location.href='/staff/tickets.php?assigned=me'"><div class="num" data-live-count="mine"><?= $dashMine ?></div><div class="lbl">Mir zugewiesen</div></div>
|
<div class="stat-card" style="cursor:pointer" onclick="location.href='/staff/tickets.php?assigned=me'"><div class="num" data-live-count="mine"><?= $dashMine ?></div><div class="lbl">Mir zugewiesen</div></div>
|
||||||
<div class="stat-card" style="cursor:pointer" onclick="location.href='/staff/tickets.php?assigned=unassigned'"><div class="num" data-live-count="unassigned"><?= $dashUnassigned ?></div><div class="lbl">Nicht zugewiesen</div></div>
|
<div class="stat-card" style="cursor:pointer" onclick="location.href='/staff/tickets.php?assigned=unassigned'"><div class="num" data-live-count="unassigned"><?= $dashUnassigned ?></div><div class="lbl">Nicht zugewiesen</div></div>
|
||||||
<div class="stat-card overdue" style="cursor:pointer" onclick="location.href='/staff/tickets.php?status=open'"><div class="num" data-live-count="overdue"><?= $dashOverdue ?></div><div class="lbl">Überfällig</div></div>
|
<div class="stat-card overdue" style="cursor:pointer" onclick="location.href='/staff/tickets.php?status=open'"><div class="num" data-live-count="overdue"><?= $dashOverdue ?></div><div class="lbl">Überfällig</div></div>
|
||||||
<div class="stat-card" style="cursor:pointer" onclick="location.href='/staff/tickets.php?status=open'"><div class="num" data-live-count="unanswered"><?= $dashUnanswered ?></div><div class="lbl">Unbeantwortet</div></div>
|
<div class="stat-card" style="cursor:pointer" onclick="location.href='/staff/tickets.php?status=open'"><div class="num" data-live-count="unanswered"><?= $dashUnanswered ?></div><div class="lbl">Unbeantwortet</div></div>
|
||||||
|
<div class="stat-card" style="cursor:pointer<?= $ovAtRisk > 0 ? ';border-color:#f59e0b' : '' ?>" onclick="location.href='/staff/tickets.php?sla=at_risk'" title="Frist läuft in den nächsten 4 Stunden ab"><div class="num" style="<?= $ovAtRisk > 0 ? 'color:#f59e0b' : '' ?>"><?= $ovAtRisk ?></div><div class="lbl">Frist in < 4 Std</div></div>
|
||||||
<?php if ($unreadMentions > 0): ?>
|
<?php if ($unreadMentions > 0): ?>
|
||||||
<div class="stat-card" style="cursor:pointer; border-color:#f59e0b" onclick="location.href='/staff/mentions.php'"><div class="num" style="color:#f59e0b"><?= $unreadMentions ?></div><div class="lbl">🔔 Neue Erwähnungen</div></div>
|
<div class="stat-card" style="cursor:pointer; border-color:#f59e0b" onclick="location.href='/staff/mentions.php'"><div class="num" style="color:#f59e0b"><?= $unreadMentions ?></div><div class="lbl">🔔 Neue Erwähnungen</div></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ── Mein Status + Team ─────────────────────────────────────────────────── -->
|
<div class="ov-grid-2">
|
||||||
|
<div class="card ov-card">
|
||||||
|
<div class="ov-card-head"><h3>Meine fälligsten Tickets</h3><a href="/staff/tickets.php?assigned=me">Alle anzeigen →</a></div>
|
||||||
|
<?php if (!$ovMine): ?><div class="ov-empty">🎉 Nichts offen, was dir zugewiesen ist.</div>
|
||||||
|
<?php else: foreach ($ovMine as $__t) echo ov_ticket_row($__t); endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="card ov-card">
|
||||||
|
<div class="ov-card-head"><h3>Nicht zugewiesen <?php if ($dashUnassigned > 0): ?><span class="ov-count"><?= $dashUnassigned ?></span><?php endif; ?></h3><a href="/staff/tickets.php?assigned=unassigned">Alle anzeigen →</a></div>
|
||||||
|
<?php if (!$ovUnassigned): ?><div class="ov-empty">✅ Alles ist verteilt.</div>
|
||||||
|
<?php else: foreach ($ovUnassigned as $__t) echo ov_ticket_row($__t); endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ov-grid-3">
|
||||||
|
<div class="card ov-card">
|
||||||
|
<div class="ov-card-head"><h3>Heute & letzte 7 Tage</h3></div>
|
||||||
|
<div class="ov-today">
|
||||||
|
<div><div class="ov-today-num"><?= $ovTodayNew ?></div><div class="muted">neu heute</div></div>
|
||||||
|
<div><div class="ov-today-num" style="color:#16a34a"><?= $ovTodayDone ?></div><div class="muted">gelöst heute</div></div>
|
||||||
|
</div>
|
||||||
|
<div class="ov-week" aria-label="Neue und gelöste Tickets der letzten 7 Tage">
|
||||||
|
<?php foreach ($ovWeek as $__day => $__v): ?>
|
||||||
|
<div class="ov-week-col" title="<?= e(date('d.m.', strtotime($__day))) ?>: <?= $__v['new'] ?> neu, <?= $__v['done'] ?> gelöst">
|
||||||
|
<div class="ov-week-bars">
|
||||||
|
<div class="ov-week-bar new" style="height:<?= (int) round($__v['new'] * 100 / $ovWeekMax) ?>%"></div>
|
||||||
|
<div class="ov-week-bar done" style="height:<?= (int) round($__v['done'] * 100 / $ovWeekMax) ?>%"></div>
|
||||||
|
</div>
|
||||||
|
<div class="ov-week-lbl"><?= $ovWeekdays[(int) date('w', strtotime($__day))] ?></div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<div class="ov-legend"><span><i style="background:var(--primary)"></i>Neu</span><span><i style="background:#22c55e"></i>Gelöst</span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card ov-card">
|
||||||
|
<div class="ov-card-head"><h3>Meine Aufgaben</h3><a href="/staff/tasks.php">Alle anzeigen →</a></div>
|
||||||
|
<?php if (!$ovTasks): ?><div class="ov-empty">Keine offenen Aufgaben.</div>
|
||||||
|
<?php else: foreach ($ovTasks as $__k):
|
||||||
|
$__late = !empty($__k['due_at']) && strtotime((string) $__k['due_at']) < time();
|
||||||
|
?>
|
||||||
|
<div class="ov-task">
|
||||||
|
<span class="ov-task-title"><?= e($__k['title']) ?></span>
|
||||||
|
<span class="ov-task-meta<?= $__late ? ' over' : '' ?>"><?= !empty($__k['due_at']) ? ($__late ? 'überfällig seit ' : 'fällig ') . e(format_dt($__k['due_at'])) : 'ohne Termin' ?><?php if (!empty($__k['ticket_number'])): ?> · <a href="/staff/ticket_view.php?n=<?= e(rawurlencode((string) $__k['ticket_number'])) ?>">#<?= e($__k['ticket_number']) ?></a><?php endif; ?></span>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card ov-card">
|
||||||
|
<div class="ov-card-head"><h3>Offen nach Abteilung</h3></div>
|
||||||
|
<?php if (!$ovDepts): ?><div class="ov-empty">Keine offenen Tickets.</div>
|
||||||
|
<?php else: foreach ($ovDepts as $__d): ?>
|
||||||
|
<div class="ov-dept">
|
||||||
|
<span class="ov-dept-name"><?= e($__d['name']) ?></span>
|
||||||
|
<div class="ov-dept-bar"><div style="width:<?= (int) round($__d['n'] * 100 / $ovDeptMax) ?>%"></div></div>
|
||||||
|
<span class="ov-dept-n"><?= (int) $__d['n'] ?></span>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card ov-card" style="margin-bottom:20px">
|
||||||
|
<div class="ov-card-head"><h3>Letzte Aktivität</h3></div>
|
||||||
|
<?php if (!$ovFeed): ?><div class="ov-empty">Noch keine Aktivität.</div>
|
||||||
|
<?php else: foreach ($ovFeed as $__f): ?>
|
||||||
|
<div class="ov-feed">
|
||||||
|
<span class="ov-feed-time"><?= e(format_dt($__f['created_at'])) ?></span>
|
||||||
|
<span class="ov-feed-text"><strong><?= e($__f['staff_name'] ?? 'System') ?></strong> · <span><?= e($__f['action']) ?></span> ·
|
||||||
|
<a href="/staff/ticket_view.php?n=<?= e(rawurlencode((string) $__f['ticket_number'])) ?>">#<?= e($__f['ticket_number']) ?></a> <span class="muted"><?= e(mb_strimwidth((string) $__f['subject'], 0, 60, '…')) ?></span></span>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2 class="ov-sec">Team</h2>
|
||||||
<form id="csrf-dash" style="display:none"><?= csrf_field() ?></form>
|
<form id="csrf-dash" style="display:none"><?= csrf_field() ?></form>
|
||||||
<div class="card" style="margin-bottom:20px">
|
<div class="card" style="margin-bottom:20px">
|
||||||
<div style="display:flex;align-items:center;gap:16px;flex-wrap:wrap">
|
<div style="display:flex;align-items:center;gap:16px;flex-wrap:wrap">
|
||||||
|
<div style="display:flex;align-items:center;gap:8px;flex-shrink:0;flex-wrap:wrap">
|
||||||
<!-- Mein Status -->
|
<span class="ov-label">Mein Status:</span>
|
||||||
<div style="display:flex;align-items:center;gap:8px;flex-shrink:0">
|
<?php foreach ($tsColors as $sk => $sc): $active = $myAvailStatus === $sk; ?>
|
||||||
<span style="font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)">Mein Status:</span>
|
<button type="button" onclick="setDashStatus('<?= $sk ?>')" data-status="<?= $sk ?>" class="dash-status-btn"
|
||||||
<?php foreach ($tsColors as $sk => $sc):
|
|
||||||
$active = $myAvailStatus === $sk;
|
|
||||||
?>
|
|
||||||
<button type="button" onclick="setDashStatus('<?= $sk ?>')"
|
|
||||||
data-status="<?= $sk ?>"
|
|
||||||
class="dash-status-btn"
|
|
||||||
style="display:flex;align-items:center;gap:5px;padding:5px 12px;border:2px solid <?= $active ? $sc : 'var(--border)' ?>;border-radius:20px;background:<?= $active ? $sc.'18' : 'transparent' ?>;cursor:pointer;font-size:.8rem;font-weight:<?= $active ? '600' : '400' ?>;color:<?= $active ? $sc : 'var(--muted)' ?>;transition:all .15s">
|
style="display:flex;align-items:center;gap:5px;padding:5px 12px;border:2px solid <?= $active ? $sc : 'var(--border)' ?>;border-radius:20px;background:<?= $active ? $sc.'18' : 'transparent' ?>;cursor:pointer;font-size:.8rem;font-weight:<?= $active ? '600' : '400' ?>;color:<?= $active ? $sc : 'var(--muted)' ?>;transition:all .15s">
|
||||||
<span style="width:7px;height:7px;border-radius:50%;background:<?= $sc ?>"></span>
|
<span style="width:7px;height:7px;border-radius:50%;background:<?= $sc ?>"></span><?= $tsLabels[$sk] ?>
|
||||||
<?= $tsLabels[$sk] ?>
|
|
||||||
</button>
|
</button>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Trenner -->
|
|
||||||
<?php if ($teamStatus): ?>
|
<?php if ($teamStatus): ?>
|
||||||
<div style="width:1px;height:28px;background:var(--border);flex-shrink:0"></div>
|
<div style="width:1px;height:28px;background:var(--border);flex-shrink:0"></div>
|
||||||
|
|
||||||
<!-- Team -->
|
|
||||||
<div style="display:flex;align-items:center;gap:6px;flex-wrap:wrap;flex:1">
|
<div style="display:flex;align-items:center;gap:6px;flex-wrap:wrap;flex:1">
|
||||||
<span style="font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);flex-shrink:0">Team:</span>
|
<span class="ov-label" style="flex-shrink:0">Team:</span>
|
||||||
<?php foreach ($teamStatus as $tm):
|
<?php foreach ($teamStatus as $tm):
|
||||||
$ts = $tm['is_on_vacation'] ? 'offline' : ($tm['avail_status'] ?? 'offline');
|
$ts = $tm['is_on_vacation'] ? 'offline' : ($tm['avail_status'] ?? 'offline');
|
||||||
$tsc = $tsColors[$ts] ?? '#94a3b8';
|
$tsc = $tsColors[$ts] ?? '#94a3b8';
|
||||||
$tsl = $tm['is_on_vacation'] ? 'Urlaub' : ($tsLabels[$ts] ?? 'Offline');
|
$tsl = $tm['is_on_vacation'] ? 'Urlaub' : ($tsLabels[$ts] ?? 'Offline');
|
||||||
?>
|
?>
|
||||||
<div id="team-member-<?= $tm['id'] ?>"
|
<div id="team-member-<?= $tm['id'] ?>" title="<?= e($tm['name']) ?>: <?= e($tsl) ?><?= $tm['avail_note'] ? ' – '.e($tm['avail_note']) : '' ?>"
|
||||||
title="<?= e($tm['name']) ?>: <?= e($tsl) ?><?= $tm['avail_note'] ? ' – '.e($tm['avail_note']) : '' ?>"
|
|
||||||
style="display:flex;align-items:center;gap:5px;padding:4px 10px;border:1px solid var(--border);border-radius:20px;font-size:.78rem;background:var(--surface)">
|
style="display:flex;align-items:center;gap:5px;padding:4px 10px;border:1px solid var(--border);border-radius:20px;font-size:.78rem;background:var(--surface)">
|
||||||
<span class="team-dot" style="width:7px;height:7px;border-radius:50%;background:<?= $tsc ?>;flex-shrink:0"></span>
|
<span class="team-dot" style="width:7px;height:7px;border-radius:50%;background:<?= $tsc ?>;flex-shrink:0"></span>
|
||||||
<span style="font-weight:500"><?= e($tm['name']) ?></span>
|
<span style="font-weight:500"><?= e($tm['name']) ?></span>
|
||||||
@@ -467,16 +668,211 @@ require __DIR__ . '/_header.php';
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h2 class="ov-sec">Gesamtzahlen</h2>
|
||||||
|
<div class="stat-grid">
|
||||||
|
<div class="stat-card"><div class="num"><?= $totalTickets ?></div><div class="lbl">Tickets gesamt</div></div>
|
||||||
|
<div class="stat-card"><div class="num"><?= $resolvedThisMonth ?></div><div class="lbl">Gelöst diesen Monat</div></div>
|
||||||
|
<div class="stat-card"><div class="num"><?= $avgResponse !== null ? round($avgResponse, 1) . ' Std' : '–' ?></div><div class="lbl">Ø Erstreaktion</div></div>
|
||||||
|
<div class="stat-card"><div class="num"><?= $avgResolution !== null ? round($avgResolution, 1) . ' Std' : '–' ?></div><div class="lbl">Ø Lösungszeit</div></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ── Verlauf ───────────────────────────────────────────────────────────── -->
|
||||||
|
<section id="pane-activity" class="page-pane" role="tabpanel" aria-labelledby="ptab-activity" <?= $tab === 'activity' ? '' : 'hidden' ?>>
|
||||||
|
<div class="card">
|
||||||
|
<h3 style="margin-top:0">Ticketaktivität <span class="muted" style="font-weight:400; font-size:.8rem">(<?= e($rangeLabel) ?>)</span></h3>
|
||||||
|
<div style="position:relative;height:240px"><canvas id="chart-activity"></canvas></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($slaTotal > 0): ?>
|
||||||
|
<div class="card" style="padding:20px;margin-bottom:20px">
|
||||||
|
<div style="display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:16px">
|
||||||
|
<div>
|
||||||
|
<div class="ov-label">SLA-Einhaltung im Zeitraum</div>
|
||||||
|
<div style="font-size:2.2rem;font-weight:900;line-height:1.1;margin-top:4px;color:<?= $slaRate >= 90 ? '#22c55e' : ($slaRate >= 70 ? '#f59e0b' : '#ef4444') ?>"><?= $slaRate ?>%</div>
|
||||||
|
<div style="font-size:.8rem;color:var(--muted);margin-top:2px"><?= $slaOk ?> von <?= $slaTotal ?> Tickets innerhalb der Frist gelöst</div>
|
||||||
|
</div>
|
||||||
|
<div style="flex:1;min-width:220px;max-width:400px">
|
||||||
|
<div style="display:flex;justify-content:space-between;font-size:.75rem;color:var(--muted);margin-bottom:4px"><span>Im Zeitlimit</span><span>Überfällig</span></div>
|
||||||
|
<div style="background:var(--border);border-radius:20px;height:12px;overflow:hidden">
|
||||||
|
<div style="height:100%;width:<?= $slaRate ?>%;background:<?= $slaRate >= 90 ? '#22c55e' : ($slaRate >= 70 ? '#f59e0b' : '#ef4444') ?>;border-radius:20px;transition:width .6s"></div>
|
||||||
|
</div>
|
||||||
|
<div style="display:flex;justify-content:space-between;font-size:.75rem;margin-top:4px">
|
||||||
|
<span style="color:#22c55e;font-weight:600"><?= $slaOk ?> ✓</span><span style="color:#ef4444;font-weight:600"><?= $slaTotal - $slaOk ?> ✗</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="ov-two">
|
||||||
|
<div class="card"><h3 style="margin:0 0 14px">Nach Status</h3><div style="position:relative;height:220px"><canvas id="chart-status"></canvas></div></div>
|
||||||
|
<div class="card"><h3 style="margin:0 0 14px">Nach Priorität</h3><div style="position:relative;height:220px"><canvas id="chart-prio"></canvas></div></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ── Auswertung ────────────────────────────────────────────────────────── -->
|
||||||
|
<section id="pane-analysis" class="page-pane" role="tabpanel" aria-labelledby="ptab-analysis" <?= $tab === 'analysis' ? '' : 'hidden' ?>>
|
||||||
|
<div class="card">
|
||||||
|
<h3 style="margin-top:0">Statistiken <span class="muted" style="font-weight:400; font-size:.8rem">(<?= e($rangeLabel) ?>)</span></h3>
|
||||||
|
<div class="tabs">
|
||||||
|
<button type="button" class="tab-btn active" onclick="showSubTab('dept', this)">Abteilung</button>
|
||||||
|
<button type="button" class="tab-btn" onclick="showSubTab('topic', this)">Themen</button>
|
||||||
|
<?php if ($isAdmin): ?><button type="button" class="tab-btn" onclick="showSubTab('agent', this)">Mitarbeiter</button><?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div id="tab-dept" class="tab-pane" style="overflow-x:auto">
|
||||||
|
<?= render_report_table($deptRows, $departments, '–') ?>
|
||||||
|
<p style="margin-top:8px"><a href="/staff/export.php?type=report&dim=dept&<?= http_build_query($exportParams) ?>" class="btn secondary" style="font-size:.8rem; padding:6px 12px">Exportieren (CSV)</a></p>
|
||||||
|
</div>
|
||||||
|
<div id="tab-topic" class="tab-pane" style="display:none; overflow-x:auto">
|
||||||
|
<?= render_report_table($topicRows, $helpTopics, 'Kein Hilfethema') ?>
|
||||||
|
<p style="margin-top:8px"><a href="/staff/export.php?type=report&dim=topic&<?= http_build_query($exportParams) ?>" class="btn secondary" style="font-size:.8rem; padding:6px 12px">Exportieren (CSV)</a></p>
|
||||||
|
</div>
|
||||||
|
<?php if ($isAdmin && $agentPerf): ?>
|
||||||
|
<div id="tab-agent" class="tab-pane" style="display:none;overflow-x:auto">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>Mitarbeiter</th><th style="text-align:right">Tickets</th><th style="text-align:right">Gelöst</th><th style="text-align:right">Lösungsrate</th><th style="text-align:right">Ø Erstantwort</th><th>Leistung</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
$maxResolved = max(array_column($agentPerf, 'resolved') ?: [1]);
|
||||||
|
foreach ($agentPerf as $ap):
|
||||||
|
$rate = $ap['total'] > 0 ? round($ap['resolved'] / $ap['total'] * 100) : 0;
|
||||||
|
$barPct = $maxResolved > 0 ? round($ap['resolved'] / $maxResolved * 100) : 0;
|
||||||
|
$avgR = $ap['avg_resp'] !== null ? round((float)$ap['avg_resp'], 1) . ' Std' : '–';
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td style="font-weight:500"><?= e($ap['name']) ?></td>
|
||||||
|
<td style="text-align:right"><?= (int)$ap['total'] ?></td>
|
||||||
|
<td style="text-align:right;color:var(--primary);font-weight:600"><?= (int)$ap['resolved'] ?></td>
|
||||||
|
<td style="text-align:right"><span style="color:<?= $rate >= 80 ? '#22c55e' : ($rate >= 50 ? '#f59e0b' : '#ef4444') ?>;font-weight:600"><?= $rate ?>%</span></td>
|
||||||
|
<td style="text-align:right;color:var(--muted)"><?= $avgR ?></td>
|
||||||
|
<td style="min-width:120px"><div style="background:var(--border);border-radius:20px;height:6px;overflow:hidden"><div style="height:100%;width:<?= $barPct ?>%;background:var(--primary);border-radius:20px"></div></div></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p style="margin-top:8px"><a href="/staff/export.php?type=report&dim=agent&<?= http_build_query($exportParams) ?>" class="btn secondary" style="font-size:.8rem;padding:6px 12px">Exportieren (CSV)</a></p>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ── Zufriedenheit ─────────────────────────────────────────────────────── -->
|
||||||
|
<?php if ($showCsat): ?>
|
||||||
|
<?php
|
||||||
|
$csatAnswered = (int) ($csat['answered'] ?? 0);
|
||||||
|
$csatHappy = $csatAnswered > 0 ? (int) round((($csat['dist'][4] ?? 0) + ($csat['dist'][5] ?? 0)) * 100 / $csatAnswered) : null;
|
||||||
|
$csatAvgColor = $csat['avg'] === null ? 'var(--muted)' : ($csat['avg'] >= 4.5 ? '#16a34a' : ($csat['avg'] >= 3.5 ? '#f59e0b' : '#ef4444'));
|
||||||
|
$csatWithComment = 0;
|
||||||
|
foreach ($csat['recent'] ?? [] as $__r) { if ($__r['comment'] !== '') $csatWithComment++; }
|
||||||
|
?>
|
||||||
|
<section id="pane-csat" class="page-pane" role="tabpanel" aria-labelledby="ptab-csat" <?= $tab === 'csat' ? '' : 'hidden' ?>>
|
||||||
|
<?php if (!$csat['sent']): ?>
|
||||||
|
<div class="card" style="text-align:center;padding:36px 20px">
|
||||||
|
<div style="font-size:2rem">⭐</div>
|
||||||
|
<h3 style="margin:8px 0 4px">Noch keine Abfragen im Zeitraum</h3>
|
||||||
|
<p class="muted" style="margin:0">Sobald Kunden nach einem geschlossenen oder gelösten Ticket um eine Bewertung gebeten wurden, erscheint die Auswertung hier.</p>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="csat-kpis">
|
||||||
|
<div class="csat-kpi">
|
||||||
|
<div class="ov-label">Ø Bewertung</div>
|
||||||
|
<div class="csat-big" style="color:<?= $csatAvgColor ?>"><?= $csat['avg'] !== null ? number_format($csat['avg'], 1, ',', '') : '–' ?><span class="csat-of"> / 5</span></div>
|
||||||
|
<div style="color:#f5b301;letter-spacing:2px"><?= $csat['avg'] !== null ? e(csat_stars((int) round($csat['avg']))) : '' ?></div>
|
||||||
|
</div>
|
||||||
|
<div class="csat-kpi">
|
||||||
|
<div class="ov-label">Zufrieden (4–5 ★)</div>
|
||||||
|
<div class="csat-big"><?= $csatHappy !== null ? $csatHappy . ' %' : '–' ?></div>
|
||||||
|
<div class="muted">aller Antworten</div>
|
||||||
|
</div>
|
||||||
|
<div class="csat-kpi">
|
||||||
|
<div class="ov-label">Antworten</div>
|
||||||
|
<div class="csat-big"><?= $csatAnswered ?></div>
|
||||||
|
<div class="muted">von <?= (int) $csat['sent'] ?> Abfragen</div>
|
||||||
|
</div>
|
||||||
|
<div class="csat-kpi">
|
||||||
|
<div class="ov-label">Rücklaufquote</div>
|
||||||
|
<div class="csat-big"><?= $csat['rate'] !== null ? number_format($csat['rate'], 0, ',', '') . ' %' : '–' ?></div>
|
||||||
|
<div class="csat-meter"><div style="width:<?= (int) min(100, round((float) ($csat['rate'] ?? 0))) ?>%"></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="csat-two">
|
||||||
|
<div class="card">
|
||||||
|
<h3 style="margin:0 0 12px">Verteilung</h3>
|
||||||
|
<?php $distMax = max(1, max($csat['dist'])); ?>
|
||||||
|
<?php for ($i = 5; $i >= 1; $i--):
|
||||||
|
$cnt = (int) $csat['dist'][$i];
|
||||||
|
$pct = $csatAnswered > 0 ? (int) round($cnt * 100 / $csatAnswered) : 0;
|
||||||
|
?>
|
||||||
|
<div class="csat-row">
|
||||||
|
<span class="csat-stars"><?= e(csat_stars($i)) ?></span>
|
||||||
|
<div class="csat-bar"><div style="width:<?= (int) round($cnt * 100 / $distMax) ?>%"></div></div>
|
||||||
|
<span class="csat-num"><?= $cnt ?> <span class="muted">(<?= $pct ?> %)</span></span>
|
||||||
|
</div>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h3 style="margin:0 0 12px">Nach Mitarbeiter</h3>
|
||||||
|
<?php if (!$csat['byStaff']): ?>
|
||||||
|
<p class="muted" style="margin:0">Noch keine Bewertungen zugeordnet.</p>
|
||||||
|
<?php else: foreach ($csat['byStaff'] as $row):
|
||||||
|
$sc = $row['avg'] >= 4.5 ? '#16a34a' : ($row['avg'] >= 3.5 ? '#f59e0b' : '#ef4444');
|
||||||
|
?>
|
||||||
|
<div class="csat-row">
|
||||||
|
<span class="csat-name"><?= e($row['name']) ?></span>
|
||||||
|
<div class="csat-bar"><div style="width:<?= (int) round($row['avg'] * 20) ?>%;background:<?= $sc ?>"></div></div>
|
||||||
|
<span class="csat-num"><strong><?= number_format($row['avg'], 1, ',', '') ?></strong> ★ <span class="muted">· <?= (int) $row['count'] ?></span></span>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($csat['recent']): ?>
|
||||||
|
<div class="csat-head">
|
||||||
|
<h3 style="margin:0">Letzte Bewertungen</h3>
|
||||||
|
<?php if ($csatWithComment > 0): ?>
|
||||||
|
<label class="csat-filter"><input type="checkbox" id="csat-only-comments" onchange="document.getElementById('csat-recent').classList.toggle('only-comments', this.checked)"> Nur mit Kommentar (<?= $csatWithComment ?>)</label>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="csat-recent" id="csat-recent">
|
||||||
|
<?php foreach ($csat['recent'] as $row): ?>
|
||||||
|
<div class="csat-box<?= $row['comment'] === '' ? ' no-comment' : '' ?>">
|
||||||
|
<div style="color:#f5b301;font-size:1.05rem;letter-spacing:1px"><?= e(csat_stars($row['rating'])) ?></div>
|
||||||
|
<a href="/staff/ticket_view.php?n=<?= e(rawurlencode($row['number'])) ?>" class="csat-ticket"><span class="muted">#<?= e($row['number']) ?></span><br><?= e($row['subject']) ?></a>
|
||||||
|
<?php if ($row['comment'] !== ''): ?><div class="csat-comment">„<?= e($row['comment']) ?>“</div><?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</section>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$prioColorMap = [];
|
||||||
|
foreach ($pdo->query('SELECT name, color FROM priorities ORDER BY sort_order')->fetchAll() as $pc) {
|
||||||
|
$prioColorMap[$pc['name']] = $pc['color'];
|
||||||
|
}
|
||||||
|
$jsChartLabels = json_encode($chartLabels);
|
||||||
|
$jsChartCreated = json_encode($chartCreated);
|
||||||
|
$jsChartClosed = json_encode($chartClosed);
|
||||||
|
$jsStatusLabels = json_encode(array_keys($byStatus));
|
||||||
|
$jsStatusData = json_encode(array_values($byStatus));
|
||||||
|
$jsPrioLabels = json_encode(array_keys($byPrio));
|
||||||
|
$jsPrioData = json_encode(array_values($byPrio));
|
||||||
|
$jsPrioColors = json_encode($prioColorMap);
|
||||||
|
?>
|
||||||
|
<script src="/assets/js/chart.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var dashStatusColors = <?= json_encode($tsColors) ?>;
|
var dashStatusColors = <?= json_encode($tsColors) ?>;
|
||||||
var dashStatusLabels = <?= json_encode($tsLabels) ?>;
|
var dashStatusLabels = <?= json_encode($tsLabels) ?>;
|
||||||
|
|
||||||
function setDashStatus(s) {
|
function setDashStatus(s) {
|
||||||
// Sofort visuell aktualisieren
|
|
||||||
document.querySelectorAll('.dash-status-btn').forEach(function(btn) {
|
document.querySelectorAll('.dash-status-btn').forEach(function(btn) {
|
||||||
var active = btn.dataset.status === s;
|
var active = btn.dataset.status === s;
|
||||||
var c = dashStatusColors[btn.dataset.status] || '#94a3b8';
|
var c = dashStatusColors[btn.dataset.status] || '#94a3b8';
|
||||||
@@ -485,7 +881,6 @@ function setDashStatus(s) {
|
|||||||
btn.style.color = active ? c : 'var(--muted)';
|
btn.style.color = active ? c : 'var(--muted)';
|
||||||
btn.style.fontWeight = active ? '600' : '400';
|
btn.style.fontWeight = active ? '600' : '400';
|
||||||
});
|
});
|
||||||
// An Server senden
|
|
||||||
var fd = new FormData();
|
var fd = new FormData();
|
||||||
fd.append('status', s);
|
fd.append('status', s);
|
||||||
fd.append('csrf_token', document.querySelector('#csrf-dash input[name=csrf_token]')?.value || '');
|
fd.append('csrf_token', document.querySelector('#csrf-dash input[name=csrf_token]')?.value || '');
|
||||||
@@ -513,291 +908,171 @@ function refreshDashTeam() {
|
|||||||
}).catch(function(){});
|
}).catch(function(){});
|
||||||
}
|
}
|
||||||
setInterval(refreshDashTeam, 20000);
|
setInterval(refreshDashTeam, 20000);
|
||||||
</script>
|
|
||||||
|
|
||||||
<h2 style="margin-top:8px">Berichte</h2>
|
// Diagramme erst zeichnen, wenn der Reiter sichtbar ist (verborgene Zeichenflächen haben keine Größe)
|
||||||
|
var chartsBuilt = false;
|
||||||
<div class="stat-grid">
|
function buildCharts() {
|
||||||
<div class="stat-card"><div class="num"><?= $totalTickets ?></div><div class="lbl">Tickets gesamt</div></div>
|
if (chartsBuilt) return;
|
||||||
<div class="stat-card"><div class="num"><?= $resolvedThisMonth ?></div><div class="lbl">Gelöst diesen Monat</div></div>
|
if (typeof Chart === 'undefined') { setTimeout(buildCharts, 50); return; }
|
||||||
<div class="stat-card"><div class="num"><?= $avgResponse !== null ? round($avgResponse, 1) . ' Std' : '–' ?></div><div class="lbl">Ø Erstreaktion</div></div>
|
chartsBuilt = true;
|
||||||
<div class="stat-card"><div class="num"><?= $avgResolution !== null ? round($avgResolution, 1) . ' Std' : '–' ?></div><div class="lbl">Ø Lösungszeit</div></div>
|
var primary = '#0f6f6a', muted = '#64748b', border = '#e2e8f0';
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
// Zufriedenheit (CSAT): nur zeigen, wenn die Abfrage eingeschaltet ist oder es schon Antworten gibt
|
|
||||||
$csat = null;
|
|
||||||
try { $csat = csat_stats($pdo, $rangeFrom, $rangeTo, $myDeptIds); } catch (Throwable $e) { $csat = null; }
|
|
||||||
if ($csat && (csat_enabled() || $csat['sent'] > 0)):
|
|
||||||
?>
|
|
||||||
<div class="card" style="margin-bottom:16px">
|
|
||||||
<h3>Kundenzufriedenheit <span class="muted" style="font-weight:400; font-size:.8rem">(Bewertungen im gewählten Zeitraum)</span></h3>
|
|
||||||
<?php if (!$csat['sent']): ?>
|
|
||||||
<p class="muted">Im Zeitraum wurden noch keine Abfragen verschickt.</p>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="stat-grid" style="margin-bottom:12px">
|
|
||||||
<div class="stat-card"><div class="num"><?= $csat['avg'] !== null ? number_format($csat['avg'], 1, ',', '') . ' ★' : '–' ?></div><div class="lbl">Ø Bewertung</div></div>
|
|
||||||
<div class="stat-card"><div class="num"><?= $csat['answered'] ?></div><div class="lbl">Antworten von <?= $csat['sent'] ?> Abfragen</div></div>
|
|
||||||
<div class="stat-card"><div class="num"><?= $csat['rate'] !== null ? number_format($csat['rate'], 0, ',', '') . ' %' : '–' ?></div><div class="lbl">Rücklaufquote</div></div>
|
|
||||||
</div>
|
|
||||||
<?php $distMax = max(1, max($csat['dist'])); ?>
|
|
||||||
<table style="width:100%;max-width:520px">
|
|
||||||
<?php for ($i = 5; $i >= 1; $i--): ?>
|
|
||||||
<tr><td style="white-space:nowrap;width:1%;color:#f5b301"><?= e(csat_stars($i)) ?></td>
|
|
||||||
<td><div style="background:#e2e8f0;border-radius:6px;height:12px"><div style="background:#f5b301;height:12px;border-radius:6px;width:<?= (int) round($csat['dist'][$i] * 100 / $distMax) ?>%"></div></div></td>
|
|
||||||
<td style="width:1%;text-align:right"><?= $csat['dist'][$i] ?></td></tr>
|
|
||||||
<?php endfor; ?>
|
|
||||||
</table>
|
|
||||||
<?php if ($csat['byStaff']): ?>
|
|
||||||
<h4 style="margin:14px 0 6px">Nach Mitarbeiter</h4>
|
|
||||||
<table style="width:100%;max-width:520px"><?php foreach ($csat['byStaff'] as $row): ?>
|
|
||||||
<tr><td><?= e($row['name']) ?></td><td style="text-align:right"><?= number_format($row['avg'], 1, ',', '') ?> ★</td><td class="muted" style="text-align:right;width:1%;white-space:nowrap"><?= $row['count'] ?> Bewertung<?= $row['count'] === 1 ? '' : 'en' ?></td></tr>
|
|
||||||
<?php endforeach; ?></table>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($csat['recent']): ?>
|
|
||||||
<h4 style="margin:14px 0 6px">Letzte Bewertungen</h4>
|
|
||||||
<?php foreach ($csat['recent'] as $row): ?>
|
|
||||||
<div style="padding:6px 0;border-top:1px solid var(--border,#e3e9ee);font-size:.88rem">
|
|
||||||
<span style="color:#f5b301"><?= e(csat_stars($row['rating'])) ?></span>
|
|
||||||
<a href="/staff/ticket_view.php?n=<?= e(rawurlencode($row['number'])) ?>">#<?= e($row['number']) ?></a> <?= e($row['subject']) ?>
|
|
||||||
<?php if ($row['comment'] !== ''): ?><div class="muted" style="margin-top:2px">„<?= e($row['comment']) ?>“</div><?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<form method="get" class="filters card">
|
|
||||||
<div>
|
|
||||||
<label>Berichtszeitraum</label>
|
|
||||||
<select name="range" onchange="document.getElementById('custom-range').style.display = this.value==='custom' ? 'flex' : 'none'">
|
|
||||||
<option value="7d" <?= $preset==='7d'?'selected':'' ?>>Letzte 7 Tage</option>
|
|
||||||
<option value="30d" <?= $preset==='30d'?'selected':'' ?>>Letzte 30 Tage</option>
|
|
||||||
<option value="thismonth" <?= $preset==='thismonth'?'selected':'' ?>>Dieser Monat</option>
|
|
||||||
<option value="thisyear" <?= $preset==='thisyear'?'selected':'' ?>>Dieses Jahr</option>
|
|
||||||
<option value="custom" <?= $preset==='custom'?'selected':'' ?>>Benutzerdefiniert</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div id="custom-range" style="display:<?= $preset==='custom'?'flex':'none' ?>; gap:14px">
|
|
||||||
<div>
|
|
||||||
<label>Von</label>
|
|
||||||
<input type="date" name="from" value="<?= e($from->format('Y-m-d')) ?>">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label>Bis</label>
|
|
||||||
<input type="date" name="to" value="<?= e($to->format('Y-m-d')) ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div><button type="submit" class="btn secondary">Aktualisieren</button></div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<h3>Ticketaktivität <span class="muted" style="font-weight:400; font-size:.8rem">(<?= e($from->format('d.m.Y')) ?> – <?= e($to->format('d.m.Y')) ?>)</span></h3>
|
|
||||||
<canvas id="chart-activity" style="max-height:100px"></canvas>
|
|
||||||
<div style="display:flex; gap:16px; flex-wrap:wrap; margin-top:10px">
|
|
||||||
<?php foreach ($chartSeries as $info): ?>
|
|
||||||
<span style="font-size:.78rem; display:flex; align-items:center; gap:6px">
|
|
||||||
<span style="width:10px;height:10px;border-radius:50%;background:<?= e($info['color']) ?>;display:inline-block"></span><?= e($info['label']) ?>
|
|
||||||
</span>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- ── SLA-Kennzahl ────────────────────────────────────────────────────── -->
|
|
||||||
<?php if ($slaTotal > 0): ?>
|
|
||||||
<div class="card" style="padding:20px;margin-bottom:20px">
|
|
||||||
<div style="display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:16px">
|
|
||||||
<div>
|
|
||||||
<div style="font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)">SLA-Einhaltung im Zeitraum</div>
|
|
||||||
<div style="font-size:2.2rem;font-weight:900;line-height:1.1;margin-top:4px;color:<?= $slaRate >= 90 ? '#22c55e' : ($slaRate >= 70 ? '#f59e0b' : '#ef4444') ?>"><?= $slaRate ?>%</div>
|
|
||||||
<div style="font-size:.8rem;color:var(--muted);margin-top:2px"><?= $slaOk ?> von <?= $slaTotal ?> Tickets innerhalb der Frist gelöst</div>
|
|
||||||
</div>
|
|
||||||
<div style="flex:1;max-width:400px">
|
|
||||||
<div style="display:flex;justify-content:space-between;font-size:.75rem;color:var(--muted);margin-bottom:4px">
|
|
||||||
<span>Im Zeitlimit</span><span>Überfällig</span>
|
|
||||||
</div>
|
|
||||||
<div style="background:var(--border);border-radius:20px;height:12px;overflow:hidden">
|
|
||||||
<div style="height:100%;width:<?= $slaRate ?>%;background:<?= $slaRate >= 90 ? '#22c55e' : ($slaRate >= 70 ? '#f59e0b' : '#ef4444') ?>;border-radius:20px;transition:width .6s"></div>
|
|
||||||
</div>
|
|
||||||
<div style="display:flex;justify-content:space-between;font-size:.75rem;margin-top:4px">
|
|
||||||
<span style="color:#22c55e;font-weight:600"><?= $slaOk ?> ✓</span>
|
|
||||||
<span style="color:#ef4444;font-weight:600"><?= $slaTotal - $slaOk ?> ✗</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<!-- ── Status & Priorität als Chart.js ─────────────────────────────────── -->
|
|
||||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:20px">
|
|
||||||
<div class="card">
|
|
||||||
<h3 style="margin:0 0 14px">Nach Status</h3>
|
|
||||||
<canvas id="chart-status" style="max-height:140px"></canvas>
|
|
||||||
</div>
|
|
||||||
<div class="card">
|
|
||||||
<h3 style="margin:0 0 14px">Nach Priorität</h3>
|
|
||||||
<canvas id="chart-prio" style="max-height:140px"></canvas>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<h3>Statistiken <span class="muted" style="font-weight:400; font-size:.8rem">(<?= e($from->format('d.m.Y')) ?> – <?= e($to->format('d.m.Y')) ?>)</span></h3>
|
|
||||||
<div class="tabs">
|
|
||||||
<button type="button" class="tab-btn active" onclick="showTab('dept')">Abteilung</button>
|
|
||||||
<button type="button" class="tab-btn" onclick="showTab('topic')">Themen</button>
|
|
||||||
<?php if ($staff['role'] === 'admin'): ?>
|
|
||||||
<button type="button" class="tab-btn" onclick="showTab('agent')">Mitarbeiter</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
$exportParams = ['range' => $preset, 'from' => $from->format('Y-m-d'), 'to' => $to->format('Y-m-d')];
|
|
||||||
?>
|
|
||||||
<div id="tab-dept" class="tab-pane" style="overflow-x:auto">
|
|
||||||
<?= render_report_table($deptRows, $departments, '–') ?>
|
|
||||||
<p style="margin-top:8px"><a href="/staff/export.php?type=report&dim=dept&<?= http_build_query($exportParams) ?>" class="btn secondary" style="font-size:.8rem; padding:6px 12px">Exportieren (CSV)</a></p>
|
|
||||||
</div>
|
|
||||||
<div id="tab-topic" class="tab-pane" style="display:none; overflow-x:auto">
|
|
||||||
<?= render_report_table($topicRows, $helpTopics, 'Kein Hilfethema') ?>
|
|
||||||
<p style="margin-top:8px"><a href="/staff/export.php?type=report&dim=topic&<?= http_build_query($exportParams) ?>" class="btn secondary" style="font-size:.8rem; padding:6px 12px">Exportieren (CSV)</a></p>
|
|
||||||
</div>
|
|
||||||
<?php if ($staff['role'] === 'admin' && $agentPerf): ?>
|
|
||||||
<div id="tab-agent" class="tab-pane" style="display:none;overflow-x:auto">
|
|
||||||
<table>
|
|
||||||
<thead><tr>
|
|
||||||
<th>Mitarbeiter</th>
|
|
||||||
<th style="text-align:right">Tickets</th>
|
|
||||||
<th style="text-align:right">Gelöst</th>
|
|
||||||
<th style="text-align:right">Lösungsrate</th>
|
|
||||||
<th style="text-align:right">Ø Erstantwort</th>
|
|
||||||
<th>Leistung</th>
|
|
||||||
</tr></thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
$maxResolved = max(array_column($agentPerf, 'resolved') ?: [1]);
|
|
||||||
foreach ($agentPerf as $ap):
|
|
||||||
$rate = $ap['total'] > 0 ? round($ap['resolved'] / $ap['total'] * 100) : 0;
|
|
||||||
$barPct = $maxResolved > 0 ? round($ap['resolved'] / $maxResolved * 100) : 0;
|
|
||||||
$avgR = $ap['avg_resp'] !== null ? round((float)$ap['avg_resp'], 1) . ' Std' : '–';
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td style="font-weight:500"><?= e($ap['name']) ?></td>
|
|
||||||
<td style="text-align:right"><?= (int)$ap['total'] ?></td>
|
|
||||||
<td style="text-align:right;color:var(--primary);font-weight:600"><?= (int)$ap['resolved'] ?></td>
|
|
||||||
<td style="text-align:right">
|
|
||||||
<span style="color:<?= $rate >= 80 ? '#22c55e' : ($rate >= 50 ? '#f59e0b' : '#ef4444') ?>;font-weight:600"><?= $rate ?>%</span>
|
|
||||||
</td>
|
|
||||||
<td style="text-align:right;color:var(--muted)"><?= $avgR ?></td>
|
|
||||||
<td style="min-width:120px">
|
|
||||||
<div style="background:var(--border);border-radius:20px;height:6px;overflow:hidden">
|
|
||||||
<div style="height:100%;width:<?= $barPct ?>%;background:var(--primary);border-radius:20px"></div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<p style="margin-top:8px"><a href="/staff/export.php?type=report&dim=agent&<?= http_build_query($exportParams) ?>" class="btn secondary" style="font-size:.8rem;padding:6px 12px">Exportieren (CSV)</a></p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$prioColorMap = [];
|
|
||||||
foreach ($pdo->query('SELECT name, color FROM priorities ORDER BY sort_order')->fetchAll() as $pc) {
|
|
||||||
$prioColorMap[$pc['name']] = $pc['color'];
|
|
||||||
}
|
|
||||||
$jsChartLabels = json_encode($chartLabels);
|
|
||||||
$jsChartCreated = json_encode($chartCreated);
|
|
||||||
$jsChartClosed = json_encode($chartClosed);
|
|
||||||
$jsStatusLabels = json_encode(array_keys($byStatus));
|
|
||||||
$jsStatusData = json_encode(array_values($byStatus));
|
|
||||||
$jsPrioLabels = json_encode(array_keys($byPrio));
|
|
||||||
$jsPrioData = json_encode(array_values($byPrio));
|
|
||||||
$jsPrioColors = json_encode($prioColorMap);
|
|
||||||
?>
|
|
||||||
<script src="/assets/js/chart.min.js"></script>
|
|
||||||
<script>
|
|
||||||
(function initCharts() {
|
|
||||||
if (typeof Chart === 'undefined') {
|
|
||||||
setTimeout(initCharts, 50);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var primary = '#0f6f6a';
|
|
||||||
var muted = '#64748b';
|
|
||||||
var border = '#e2e8f0';
|
|
||||||
|
|
||||||
Chart.defaults.maintainAspectRatio = true;
|
|
||||||
var scaleOpts = {
|
var scaleOpts = {
|
||||||
x: { ticks: { color: muted, font: { size: 11 } }, grid: { color: border } },
|
x: { ticks: { color: muted, font: { size: 11 } }, grid: { color: border } },
|
||||||
y: { beginAtZero: true, ticks: { color: muted, precision: 0, font: { size: 11 } }, grid: { color: border } }
|
y: { beginAtZero: true, ticks: { color: muted, precision: 0, font: { size: 11 } }, grid: { color: border } }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Aktivitätsdiagramm
|
|
||||||
var ctxAct = document.getElementById('chart-activity');
|
var ctxAct = document.getElementById('chart-activity');
|
||||||
if (ctxAct) {
|
if (ctxAct) new Chart(ctxAct, {
|
||||||
new Chart(ctxAct, {
|
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: {
|
data: { labels: <?= $jsChartLabels ?>, datasets: [
|
||||||
labels: <?= $jsChartLabels ?>,
|
|
||||||
datasets: [
|
|
||||||
{ label: 'Erstellt', data: <?= $jsChartCreated ?>, borderColor: primary, backgroundColor: primary + '22', fill: true, tension: .35, pointRadius: 2 },
|
{ label: 'Erstellt', data: <?= $jsChartCreated ?>, borderColor: primary, backgroundColor: primary + '22', fill: true, tension: .35, pointRadius: 2 },
|
||||||
{ label: 'Geschlossen', data: <?= $jsChartClosed ?>, borderColor: '#22c55e', backgroundColor: '#22c55e22', fill: true, tension: .35, pointRadius: 2 }
|
{ label: 'Geschlossen', data: <?= $jsChartClosed ?>, borderColor: '#22c55e', backgroundColor: '#22c55e22', fill: true, tension: .35, pointRadius: 2 }
|
||||||
]
|
] },
|
||||||
},
|
options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { display: true, position: 'top', labels: { color: muted, boxWidth: 12, font: { size: 11 } } } }, scales: scaleOpts }
|
||||||
options: {
|
|
||||||
responsive: true,
|
|
||||||
maintainAspectRatio: false,
|
|
||||||
plugins: { legend: { display: true, position: 'top', labels: { color: muted, boxWidth: 12, font: { size: 11 } } } },
|
|
||||||
scales: scaleOpts
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
// Status-Balken
|
|
||||||
var ctxStatus = document.getElementById('chart-status');
|
var ctxStatus = document.getElementById('chart-status');
|
||||||
if (ctxStatus) {
|
if (ctxStatus) new Chart(ctxStatus, {
|
||||||
new Chart(ctxStatus, {
|
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {
|
data: { labels: <?= $jsStatusLabels ?>, datasets: [{ data: <?= $jsStatusData ?>, backgroundColor: ['#3b82f6','#f59e0b','#8b5cf6','#6b7280','#22c55e','#94a3b8'], borderRadius: 4 }] },
|
||||||
labels: <?= $jsStatusLabels ?>,
|
|
||||||
datasets: [{ data: <?= $jsStatusData ?>, backgroundColor: ['#3b82f6','#f59e0b','#8b5cf6','#6b7280','#22c55e','#94a3b8'], borderRadius: 4 }]
|
|
||||||
},
|
|
||||||
options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { display: false } }, scales: scaleOpts }
|
options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { display: false } }, scales: scaleOpts }
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
// Prioritäts-Doughnut
|
|
||||||
var ctxPrio = document.getElementById('chart-prio');
|
var ctxPrio = document.getElementById('chart-prio');
|
||||||
if (ctxPrio) {
|
if (ctxPrio) {
|
||||||
var prioHex = <?= $jsPrioColors ?>;
|
var prioHex = <?= $jsPrioColors ?>, prioLabels = <?= $jsPrioLabels ?>;
|
||||||
var prioLabels = <?= $jsPrioLabels ?>;
|
|
||||||
var pColors = prioLabels.map(function(l) { return prioHex[l] || '#64748b'; });
|
|
||||||
new Chart(ctxPrio, {
|
new Chart(ctxPrio, {
|
||||||
type: 'doughnut',
|
type: 'doughnut',
|
||||||
data: { labels: prioLabels, datasets: [{ data: <?= $jsPrioData ?>, backgroundColor: pColors, borderWidth: 2 }] },
|
data: { labels: prioLabels, datasets: [{ data: <?= $jsPrioData ?>, backgroundColor: prioLabels.map(function(l) { return prioHex[l] || '#64748b'; }), borderWidth: 2 }] },
|
||||||
options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { position: 'right', labels: { color: muted, boxWidth: 12, font: { size: 11 } } } } }
|
options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { position: 'right', labels: { color: muted, boxWidth: 12, font: { size: 11 } } } } }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
}
|
||||||
|
|
||||||
|
// Reiter der Seite
|
||||||
|
function showPageTab(name, fromClick) {
|
||||||
|
var found = false;
|
||||||
|
document.querySelectorAll('.page-tab').forEach(function(b) {
|
||||||
|
var on = b.dataset.tab === name;
|
||||||
|
if (on) found = true;
|
||||||
|
b.classList.toggle('active', on);
|
||||||
|
b.setAttribute('aria-selected', on ? 'true' : 'false');
|
||||||
|
});
|
||||||
|
if (!found) return;
|
||||||
|
document.querySelectorAll('.page-pane').forEach(function(p) { p.hidden = (p.id !== 'pane-' + name); });
|
||||||
|
var bar = document.getElementById('range-bar');
|
||||||
|
if (bar) bar.style.display = name === 'overview' ? 'none' : '';
|
||||||
|
var hid = document.getElementById('range-tab');
|
||||||
|
if (hid) hid.value = name;
|
||||||
|
if (name === 'activity') buildCharts();
|
||||||
|
if (fromClick && window.history && history.replaceState) {
|
||||||
|
var u = new URL(location.href);
|
||||||
|
if (name === 'overview') u.searchParams.delete('tab'); else u.searchParams.set('tab', name);
|
||||||
|
history.replaceState(null, '', u.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.querySelectorAll('.page-tab').forEach(function(b, i, all) {
|
||||||
|
b.addEventListener('click', function() { showPageTab(b.dataset.tab, true); });
|
||||||
|
b.addEventListener('keydown', function(ev) {
|
||||||
|
var d = ev.key === 'ArrowRight' ? 1 : ev.key === 'ArrowLeft' ? -1 : 0;
|
||||||
|
if (!d) return;
|
||||||
|
var n = all[(i + d + all.length) % all.length];
|
||||||
|
n.focus(); showPageTab(n.dataset.tab, true); ev.preventDefault();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
showPageTab(<?= json_encode($tab) ?>, false);
|
||||||
|
|
||||||
|
// Unterreiter der Auswertung
|
||||||
|
function showSubTab(name, btn) {
|
||||||
|
['dept','topic','agent'].forEach(function(t) {
|
||||||
|
var el = document.getElementById('tab-' + t);
|
||||||
|
if (el) el.style.display = (t === name) ? 'block' : 'none';
|
||||||
|
});
|
||||||
|
document.querySelectorAll('#pane-analysis .tab-btn').forEach(function(b) { b.classList.remove('active'); });
|
||||||
|
btn.classList.add('active');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.ov-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:18px; }
|
||||||
|
.ov-sec { font-size:.78rem; text-transform:uppercase; letter-spacing:.07em; color:var(--muted); margin:22px 0 10px; font-weight:700; }
|
||||||
|
.ov-label { font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
|
||||||
|
.ov-two { display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-bottom:20px; }
|
||||||
|
@media (max-width: 800px) { .ov-two { grid-template-columns:1fr; } }
|
||||||
|
.ov-update { background:linear-gradient(135deg,#0f6f6a,#0b5a56); color:#fff; border-radius:10px; padding:16px 20px; margin-bottom:20px; display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
|
||||||
|
.ov-update a { background:rgba(255,255,255,.2); color:#fff; border:1px solid rgba(255,255,255,.3); border-radius:8px; padding:8px 16px; font-size:.85rem; font-weight:600; text-decoration:none; white-space:nowrap; flex-shrink:0; }
|
||||||
|
.page-tabs { display:flex; gap:4px; margin:0 0 18px; border-bottom:1px solid var(--border,#e2e8f0); overflow-x:auto; overflow-y:hidden; }
|
||||||
|
.page-tab { background:none; border:0; border-bottom:3px solid transparent; padding:10px 18px; margin-bottom:-1px; cursor:pointer; font:inherit; font-weight:600; color:var(--muted,#64748b); border-radius:8px 8px 0 0; white-space:nowrap; display:inline-flex; align-items:center; gap:8px; }
|
||||||
|
.page-tab:hover { color:var(--text,#0f172a); background:var(--surface,#fff); }
|
||||||
|
.page-tab.active { color:var(--primary); border-bottom-color:var(--primary); background:var(--surface,#fff); }
|
||||||
|
.page-tab-badge { background:#ef4444; color:#fff; border-radius:10px; padding:0 7px; font-size:.72rem; line-height:18px; font-weight:700; }
|
||||||
|
.page-pane[hidden] { display:none; }
|
||||||
|
.ov-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px; }
|
||||||
|
.ov-grid-3 { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:16px; margin-bottom:16px; }
|
||||||
|
@media (max-width: 1100px) { .ov-grid-3 { grid-template-columns:1fr 1fr; } }
|
||||||
|
@media (max-width: 760px) { .ov-grid-2, .ov-grid-3 { grid-template-columns:1fr; } }
|
||||||
|
.ov-card { margin-bottom:0; min-width:0; }
|
||||||
|
.ov-card-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; }
|
||||||
|
.ov-card-head h3 { margin:0; font-size:1rem; display:flex; align-items:center; gap:8px; }
|
||||||
|
.ov-card-head a { font-size:.8rem; text-decoration:none; white-space:nowrap; }
|
||||||
|
.ov-count { background:var(--primary); color:#fff; border-radius:10px; padding:0 8px; font-size:.75rem; line-height:20px; font-weight:700; }
|
||||||
|
.ov-empty { color:var(--muted,#64748b); padding:18px 4px; text-align:center; font-size:.9rem; }
|
||||||
|
.ov-row { display:flex; align-items:center; gap:10px; padding:9px 6px; border-top:1px solid var(--border,#e3e9ee); text-decoration:none; color:inherit; border-radius:6px; }
|
||||||
|
.ov-row:first-of-type { border-top:0; }
|
||||||
|
.ov-row:hover { background:var(--surface-2, rgba(15,111,106,.06)); }
|
||||||
|
.ov-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
|
||||||
|
.ov-row-main { display:flex; flex-direction:column; min-width:0; flex:1; }
|
||||||
|
.ov-row-title { font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
||||||
|
.ov-row-meta { font-size:.78rem; color:var(--muted,#64748b); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
||||||
|
.ov-row-due { font-size:.78rem; color:var(--muted,#64748b); white-space:nowrap; }
|
||||||
|
.ov-row-due.over, .ov-task-meta.over { color:#dc2626; font-weight:600; }
|
||||||
|
.ov-today { display:flex; gap:28px; margin:4px 0 14px; }
|
||||||
|
.ov-today-num { font-size:2rem; font-weight:800; line-height:1.1; }
|
||||||
|
.ov-week { display:flex; gap:8px; align-items:flex-end; height:92px; }
|
||||||
|
.ov-week-col { flex:1; display:flex; flex-direction:column; align-items:center; height:100%; }
|
||||||
|
.ov-week-bars { flex:1; width:100%; display:flex; gap:3px; align-items:flex-end; }
|
||||||
|
.ov-week-bar { flex:1; border-radius:3px 3px 0 0; min-height:2px; }
|
||||||
|
.ov-week-bar.new { background:var(--primary); }
|
||||||
|
.ov-week-bar.done { background:#22c55e; }
|
||||||
|
.ov-week-lbl { font-size:.7rem; color:var(--muted,#64748b); margin-top:4px; }
|
||||||
|
.ov-legend { display:flex; gap:14px; font-size:.75rem; color:var(--muted,#64748b); margin-top:8px; }
|
||||||
|
.ov-legend i { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:5px; }
|
||||||
|
.ov-task { padding:8px 4px; border-top:1px solid var(--border,#e3e9ee); display:flex; flex-direction:column; gap:2px; }
|
||||||
|
.ov-task:first-of-type { border-top:0; }
|
||||||
|
.ov-task-title { font-weight:600; overflow-wrap:anywhere; }
|
||||||
|
.ov-task-meta { font-size:.78rem; color:var(--muted,#64748b); }
|
||||||
|
.ov-dept { display:grid; grid-template-columns:minmax(70px, 38%) 1fr auto; gap:10px; align-items:center; padding:5px 0; }
|
||||||
|
.ov-dept-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.88rem; }
|
||||||
|
.ov-dept-bar { background:var(--border,#e2e8f0); border-radius:6px; height:10px; overflow:hidden; }
|
||||||
|
.ov-dept-bar > div { height:100%; background:var(--primary); border-radius:6px; }
|
||||||
|
.ov-dept-n { font-weight:700; font-size:.88rem; min-width:24px; text-align:right; }
|
||||||
|
.ov-feed { display:flex; gap:14px; padding:7px 2px; border-top:1px solid var(--border,#e3e9ee); font-size:.88rem; }
|
||||||
|
.ov-feed:first-of-type { border-top:0; }
|
||||||
|
.ov-feed-time { color:var(--muted,#64748b); white-space:nowrap; font-size:.8rem; min-width:112px; }
|
||||||
|
.ov-feed-text { min-width:0; overflow-wrap:anywhere; }
|
||||||
|
.csat-kpis { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:14px; margin-bottom:16px; }
|
||||||
|
.csat-kpi { background:var(--surface,#fff); border:1px solid var(--border,#e3e9ee); border-radius:12px; padding:16px 18px; display:flex; flex-direction:column; gap:4px; box-shadow:0 1px 3px rgba(15,23,42,.05); }
|
||||||
|
.csat-big { font-size:2rem; font-weight:800; line-height:1.1; }
|
||||||
|
.csat-of { font-size:.95rem; font-weight:500; color:var(--muted,#64748b); }
|
||||||
|
.csat-meter { background:var(--border,#e2e8f0); border-radius:20px; height:8px; overflow:hidden; margin-top:6px; }
|
||||||
|
.csat-meter > div { height:100%; background:var(--primary); border-radius:20px; }
|
||||||
|
.csat-two { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:22px; }
|
||||||
|
.csat-two .card { margin-bottom:0; }
|
||||||
|
.csat-row { display:grid; grid-template-columns:minmax(80px, 30%) 1fr auto; align-items:center; gap:12px; padding:6px 0; }
|
||||||
|
.csat-stars { color:#f5b301; white-space:nowrap; font-size:.95rem; }
|
||||||
|
.csat-name { font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
||||||
|
.csat-bar { background:var(--border,#e2e8f0); border-radius:6px; height:12px; overflow:hidden; }
|
||||||
|
.csat-bar > div { height:100%; background:#f5b301; border-radius:6px; }
|
||||||
|
.csat-num { font-size:.85rem; white-space:nowrap; text-align:right; min-width:70px; }
|
||||||
|
.csat-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin:0 0 12px; }
|
||||||
|
.csat-filter { display:inline-flex; align-items:center; gap:6px; font-size:.85rem; color:var(--muted,#64748b); cursor:pointer; }
|
||||||
|
.csat-recent.only-comments .csat-box.no-comment { display:none; }
|
||||||
|
@media (max-width: 1000px) { .csat-kpis { grid-template-columns:repeat(2, minmax(0, 1fr)); } .csat-two { grid-template-columns:1fr; } }
|
||||||
|
@media (max-width: 480px) { .csat-kpis { grid-template-columns:1fr; } }
|
||||||
|
.csat-recent { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:14px; }
|
||||||
|
@media (max-width: 1000px) { .csat-recent { grid-template-columns:repeat(2, minmax(0, 1fr)); } }
|
||||||
|
@media (max-width: 640px) { .csat-recent { grid-template-columns:1fr; } }
|
||||||
|
.csat-box { background:var(--surface,#fff); border:1px solid var(--border,#e3e9ee); border-radius:10px; padding:14px 16px; display:flex; flex-direction:column; gap:6px; font-size:.88rem; }
|
||||||
|
.csat-ticket { font-weight:600; text-decoration:none; line-height:1.35; }
|
||||||
|
.csat-comment { color:var(--muted,#64748b); font-style:italic; border-top:1px solid var(--border,#e3e9ee); padding-top:8px; margin-top:2px; overflow-wrap:anywhere; }
|
||||||
.tabs { display:flex; gap:4px; margin-bottom:14px; border-bottom:1px solid #e2e8f0; }
|
.tabs { display:flex; gap:4px; margin-bottom:14px; border-bottom:1px solid #e2e8f0; }
|
||||||
.tab-btn { background:none; border:none; padding:8px 16px; cursor:pointer; font-size:.88rem; color:#64748b; border-bottom:2px solid transparent; }
|
.tab-btn { background:none; border:none; padding:8px 16px; cursor:pointer; font-size:.88rem; color:#64748b; border-bottom:2px solid transparent; }
|
||||||
.tab-btn.active { color:var(--primary); border-bottom-color:var(--primary); font-weight:600; }
|
.tab-btn.active { color:var(--primary); border-bottom-color:var(--primary); font-weight:600; }
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
function showTab(name) {
|
|
||||||
['dept','topic','agent'].forEach(t => {
|
|
||||||
document.getElementById('tab-' + t).style.display = (t === name) ? 'block' : 'none';
|
|
||||||
});
|
|
||||||
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
|
|
||||||
event.target.classList.add('active');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php require __DIR__ . '/_footer.php'; ?>
|
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$enabled = !empty($_POST['enabled']);
|
$enabled = !empty($_POST['enabled']);
|
||||||
if (!status_set_component_enabled($pdo, (int) ($_POST['id'] ?? 0), $enabled)) $errors[] = 'Dienst konnte nicht gefunden werden.';
|
if (!status_set_component_enabled($pdo, (int) ($_POST['id'] ?? 0), $enabled)) $errors[] = 'Dienst konnte nicht gefunden werden.';
|
||||||
else flash('success', $enabled ? 'Dienst aktiviert und wieder zur Prüfung freigegeben.' : 'Dienst deaktiviert, ausgeblendet und von Prüfungen ausgenommen.');
|
else flash('success', $enabled ? 'Dienst aktiviert und wieder zur Prüfung freigegeben.' : 'Dienst deaktiviert, ausgeblendet und von Prüfungen ausgenommen.');
|
||||||
|
} elseif ($action === 'component_internal') {
|
||||||
|
$internal = !empty($_POST['internal']);
|
||||||
|
if (!status_set_component_internal($pdo, (int) ($_POST['id'] ?? 0), $internal)) $errors[] = 'Nicht möglich: Bitte zuerst das Datenbank-Update einspielen (System-Update).';
|
||||||
|
else flash('success', $internal ? 'Dienst ist jetzt intern: nur Mitarbeiter sehen ihn, geprüft wird er weiter.' : 'Dienst ist jetzt öffentlich sichtbar.');
|
||||||
} elseif ($action === 'component_maintenance') {
|
} elseif ($action === 'component_maintenance') {
|
||||||
if (!status_toggle_component_maintenance($pdo, (int) ($_POST['id'] ?? 0))) $errors[] = 'Dienst konnte nicht gefunden werden.';
|
if (!status_toggle_component_maintenance($pdo, (int) ($_POST['id'] ?? 0))) $errors[] = 'Dienst konnte nicht gefunden werden.';
|
||||||
else flash('success', 'Wartungsstatus geändert.');
|
else flash('success', 'Wartungsstatus geändert.');
|
||||||
@@ -182,15 +186,16 @@ require __DIR__ . '/_header.php';
|
|||||||
$isMinecraftComponent = str_contains(mb_strtolower((string) $c['name']), 'minecraft');
|
$isMinecraftComponent = str_contains(mb_strtolower((string) $c['name']), 'minecraft');
|
||||||
$monitorTargetValue = trim((string) ($c['monitor_target'] ?? ''));
|
$monitorTargetValue = trim((string) ($c['monitor_target'] ?? ''));
|
||||||
if ($monitorTargetValue === '' && $checkInfo && $checkInfo['type'] === 'http') $monitorTargetValue = (string) $checkInfo['target'];
|
if ($monitorTargetValue === '' && $checkInfo && $checkInfo['type'] === 'http') $monitorTargetValue = (string) $checkInfo['target'];
|
||||||
$showsDetectedTargets = $checkInfo && in_array($checkInfo['type'], ['database', 'mail', 'fcm', 'android_app', 'windows_app'], true);
|
$showsDetectedTargets = $checkInfo && in_array($checkInfo['type'], ['database', 'mail', 'fcm', 'android_app', 'windows_app', 'plugin_site'], true);
|
||||||
$detectedTargets = $showsDetectedTargets ? status_component_detected_targets($pdo, $checkInfo) : [];
|
$detectedTargets = $showsDetectedTargets ? status_component_detected_targets($pdo, $checkInfo) : [];
|
||||||
?>
|
?>
|
||||||
<div style="flex:<?= str_contains(mb_strtolower((string) $c['name']), 'minecraft') ? '0 0 249px' : '1' ?>;min-width:180px"><strong><?= e($c['name']) ?></strong><?php if ($c['description']): ?><div class="muted" style="font-size:.8rem"><?= e($c['description']) ?></div><?php endif; ?><?php if (empty($c['is_enabled'])): ?><div class="muted" style="font-size:.75rem">Deaktiviert – nicht öffentlich sichtbar und wird nicht geprüft</div><?php endif; ?>
|
<div style="flex:<?= str_contains(mb_strtolower((string) $c['name']), 'minecraft') ? '0 0 249px' : '1' ?>;min-width:180px"><strong><?= e($c['name']) ?></strong><?php if ($c['description']): ?><div class="muted" style="font-size:.8rem"><?= e($c['description']) ?></div><?php endif; ?><?php if (empty($c['is_enabled'])): ?><div class="muted" style="font-size:.75rem">Deaktiviert – nicht öffentlich sichtbar und wird nicht geprüft</div><?php elseif (!empty($c['is_internal'])): ?><div class="muted" style="font-size:.75rem">Intern – nur für Mitarbeiter sichtbar, wird geprüft</div><?php endif; ?>
|
||||||
<div class="muted" style="font-size:.76rem;margin-top:3px"><?php if ($checkInfo): ?>Automatische Prüfung: <?= e($checkInfo['label']) ?> · <?= $c['last_checked_at'] ? 'zuletzt ' . e(format_dt((string) $c['last_checked_at'])) : 'wartet auf ersten Lauf' ?> · alle <?= max(1, (int) ($c['check_interval_minutes'] ?? 1)) ?> Min.<?php elseif (($c['monitor_type'] ?? 'auto') === 'manual'): ?>Manuell verwaltet<?php else: ?>Prüfziel fehlt – wartet auf Zuordnung<?php endif; ?><?php if (!empty($c['last_check_ms'])): ?> · <?= (int) $c['last_check_ms'] ?> ms<?php endif; ?></div>
|
<div class="muted" style="font-size:.76rem;margin-top:3px"><?php if ($checkInfo): ?>Automatische Prüfung: <?= e($checkInfo['label']) ?> · <?= $c['last_checked_at'] ? 'zuletzt ' . e(format_dt((string) $c['last_checked_at'])) : 'wartet auf ersten Lauf' ?> · alle <?= max(1, (int) ($c['check_interval_minutes'] ?? 1)) ?> Min.<?php elseif (($c['monitor_type'] ?? 'auto') === 'manual'): ?>Manuell verwaltet<?php else: ?>Prüfziel fehlt – wartet auf Zuordnung<?php endif; ?><?php if (!empty($c['last_check_ms'])): ?> · <?= (int) $c['last_check_ms'] ?> ms<?php endif; ?></div>
|
||||||
<?php if (!empty($c['last_check_error'])): ?><div style="color:#b91c1c;font-size:.76rem"><?= e((string) $c['last_check_error']) ?></div><?php endif; ?>
|
<?php if (!empty($c['last_check_error'])): ?><div style="color:#b91c1c;font-size:.76rem"><?= e((string) $c['last_check_error']) ?></div><?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<form method="post" style="display:flex;gap:5px;align-items:center"><?= csrf_field() ?><input type="hidden" name="action" value="component_category"><input type="hidden" name="id" value="<?= (int) $c['id'] ?>"><select name="category_id" aria-label="Kategorie für <?= e($c['name']) ?>" style="max-width:170px;padding:5px"><option value="">Ohne Kategorie</option><?php foreach ($categories as $category): ?><option value="<?= (int) $category['id'] ?>" <?= (int) ($c['category_id'] ?? 0) === (int) $category['id'] ? 'selected' : '' ?>><?= e($category['name']) ?></option><?php endforeach; ?></select><input type="number" name="sort_order" value="<?= (int) $c['sort_order'] ?>" title="Reihenfolge" aria-label="Reihenfolge für <?= e($c['name']) ?>" style="width:58px;padding:4px"><button class="btn secondary" type="submit" style="padding:4px 8px;font-size:.78rem">Speichern</button></form>
|
<form method="post" style="display:flex;gap:5px;align-items:center"><?= csrf_field() ?><input type="hidden" name="action" value="component_category"><input type="hidden" name="id" value="<?= (int) $c['id'] ?>"><select name="category_id" aria-label="Kategorie für <?= e($c['name']) ?>" style="max-width:170px;padding:5px"><option value="">Ohne Kategorie</option><?php foreach ($categories as $category): ?><option value="<?= (int) $category['id'] ?>" <?= (int) ($c['category_id'] ?? 0) === (int) $category['id'] ? 'selected' : '' ?>><?= e($category['name']) ?></option><?php endforeach; ?></select><input type="number" name="sort_order" value="<?= (int) $c['sort_order'] ?>" title="Reihenfolge" aria-label="Reihenfolge für <?= e($c['name']) ?>" style="width:58px;padding:4px"><button class="btn secondary" type="submit" style="padding:4px 8px;font-size:.78rem">Speichern</button></form>
|
||||||
<form method="post"><?= csrf_field() ?><input type="hidden" name="action" value="component_enabled"><input type="hidden" name="id" value="<?= (int) $c['id'] ?>"><input type="hidden" name="enabled" value="<?= empty($c['is_enabled']) ? '1' : '0' ?>"><button class="btn secondary" type="submit" style="padding:4px 8px;font-size:.78rem"><?= empty($c['is_enabled']) ? 'Aktivieren' : 'Deaktivieren' ?></button></form>
|
<form method="post"><?= csrf_field() ?><input type="hidden" name="action" value="component_enabled"><input type="hidden" name="id" value="<?= (int) $c['id'] ?>"><input type="hidden" name="enabled" value="<?= empty($c['is_enabled']) ? '1' : '0' ?>"><button class="btn secondary" type="submit" style="padding:4px 8px;font-size:.78rem"><?= empty($c['is_enabled']) ? 'Aktivieren' : 'Deaktivieren' ?></button></form>
|
||||||
|
<form method="post"><?= csrf_field() ?><input type="hidden" name="action" value="component_internal"><input type="hidden" name="id" value="<?= (int) $c['id'] ?>"><input type="hidden" name="internal" value="<?= empty($c['is_internal']) ? '1' : '0' ?>"><button class="btn secondary" type="submit" style="padding:4px 8px;font-size:.78rem" title="Intern: wird geprüft, steht aber nicht auf der öffentlichen Statusseite"><?= empty($c['is_internal']) ? 'Intern machen' : 'Öffentlich machen' ?></button></form>
|
||||||
<?php if ($checkInfo): ?>
|
<?php if ($checkInfo): ?>
|
||||||
<div style="display:flex;gap:8px;align-items:center;white-space:nowrap">
|
<div style="display:flex;gap:8px;align-items:center;white-space:nowrap">
|
||||||
<span style="color:<?= e($st[1]) ?>;font-weight:600"><?= e($st[0]) ?></span>
|
<span style="color:<?= e($st[1]) ?>;font-weight:600"><?= e($st[0]) ?></span>
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
if (!$errors) {
|
if (!$errors) {
|
||||||
// Sperre freigeben: die aktive Bearbeitung ist abgeschlossen, ein anderer
|
// Sperre freigeben: die aktive Bearbeitung ist abgeschlossen, ein anderer
|
||||||
// Mitarbeiter kann das Ticket sofort uebernehmen, ohne auf das Timeout zu warten.
|
// Mitarbeiter kann das Ticket sofort uebernehmen, ohne auf das Timeout zu warten.
|
||||||
$pdo->prepare('UPDATE tickets SET locked_by = NULL, locked_at = NULL WHERE id = ?')->execute([$ticket['id']]);
|
$pdo->prepare('UPDATE tickets SET locked_by = NULL, locked_at = NULL, updated_at = updated_at WHERE id = ?')->execute([$ticket['id']]);
|
||||||
finalize_work_session($pdo, (int) $ticket['id'], (int) $staff['id']);
|
finalize_work_session($pdo, (int) $ticket['id'], (int) $staff['id']);
|
||||||
webhook_dispatch($pdo, 'ticket.replied', (int) $ticket['id'], ['author' => 'staff', 'internal' => (bool) $isNote]);
|
webhook_dispatch($pdo, 'ticket.replied', (int) $ticket['id'], ['author' => 'staff', 'internal' => (bool) $isNote]);
|
||||||
flash('success', $isNote ? 'Notiz hinzugefügt.' : 'Antwort gesendet.');
|
flash('success', $isNote ? 'Notiz hinzugefügt.' : 'Antwort gesendet.');
|
||||||
@@ -415,7 +415,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($action === 'release_lock') {
|
if ($action === 'release_lock') {
|
||||||
$pdo->prepare('UPDATE tickets SET locked_by = NULL, locked_at = NULL WHERE id = ?')->execute([$ticket['id']]);
|
$pdo->prepare('UPDATE tickets SET locked_by = NULL, locked_at = NULL, updated_at = updated_at WHERE id = ?')->execute([$ticket['id']]);
|
||||||
finalize_work_session($pdo, (int) $ticket['id'], (int) $staff['id']);
|
finalize_work_session($pdo, (int) $ticket['id'], (int) $staff['id']);
|
||||||
log_activity($pdo, $ticket['id'], $staff['id'], 'Sperre manuell aufgehoben');
|
log_activity($pdo, $ticket['id'], $staff['id'], 'Sperre manuell aufgehoben');
|
||||||
flash('success', 'Sperre aufgehoben.');
|
flash('success', 'Sperre aufgehoben.');
|
||||||
@@ -432,7 +432,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
redirect('/staff/tickets.php');
|
redirect('/staff/tickets.php');
|
||||||
}
|
}
|
||||||
$unlockedFromName = $_POST['locked_by_name'] ?? 'einem anderen Mitarbeiter';
|
$unlockedFromName = $_POST['locked_by_name'] ?? 'einem anderen Mitarbeiter';
|
||||||
$pdo->prepare('UPDATE tickets SET locked_by = NULL, locked_at = NULL WHERE id = ?')->execute([$ticket['id']]);
|
$pdo->prepare('UPDATE tickets SET locked_by = NULL, locked_at = NULL, updated_at = updated_at WHERE id = ?')->execute([$ticket['id']]);
|
||||||
log_activity($pdo, $ticket['id'], $staff['id'], "Sperre von \"{$unlockedFromName}\" durch Admin aufgehoben");
|
log_activity($pdo, $ticket['id'], $staff['id'], "Sperre von \"{$unlockedFromName}\" durch Admin aufgehoben");
|
||||||
flash('success', "Sperre aufgehoben – Sie können das Ticket jetzt öffnen.");
|
flash('success', "Sperre aufgehoben – Sie können das Ticket jetzt öffnen.");
|
||||||
redirect('/staff/ticket_view.php?n=' . urlencode($number));
|
redirect('/staff/ticket_view.php?n=' . urlencode($number));
|
||||||
@@ -1049,14 +1049,15 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
<div class="thread-comments" style="border-top:1px solid var(--border-soft);background:var(--bg-soft)">
|
<div class="thread-comments" style="border-top:1px solid var(--border-soft);background:var(--bg-soft)">
|
||||||
<!-- Vorhandene Kommentare -->
|
<!-- Vorhandene Kommentare -->
|
||||||
<?php foreach ($threadComments as $co): ?>
|
<?php foreach ($threadComments as $co): ?>
|
||||||
<div style="display:flex;gap:8px;padding:8px 16px;border-bottom:1px solid var(--border-soft)">
|
<div style="display:flex;gap:12px;margin:12px 16px;padding:12px 16px;background:#eef2ff;border:1px solid #c7d2fe;border-left:4px solid #6366f1;border-radius:10px">
|
||||||
<div style="width:26px;height:26px;border-radius:50%;background:#6366f1;color:#fff;display:flex;align-items:center;justify-content:center;font-size:.72rem;font-weight:700;flex-shrink:0;margin-top:1px">
|
<div style="width:34px;height:34px;border-radius:50%;background:#6366f1;color:#fff;display:flex;align-items:center;justify-content:center;font-size:.85rem;font-weight:700;flex-shrink:0">
|
||||||
<?= mb_strtoupper(mb_substr($co['staff_name'], 0, 1)) ?>
|
<?= mb_strtoupper(mb_substr($co['staff_name'], 0, 1)) ?>
|
||||||
</div>
|
</div>
|
||||||
<div style="flex:1;min-width:0">
|
<div style="flex:1;min-width:0">
|
||||||
<div style="display:flex;align-items:baseline;gap:8px;margin-bottom:3px">
|
<div style="display:flex;align-items:center;gap:8px;margin-bottom:6px;flex-wrap:wrap">
|
||||||
<span style="font-size:.8rem;font-weight:600;color:var(--ink)"><?= e($co['staff_name']) ?></span>
|
<span style="font-size:.9rem;font-weight:700;color:#1e1b4b"><?= e($co['staff_name']) ?></span>
|
||||||
<span style="font-size:.72rem;color:var(--muted)"><?= format_dt($co['created_at']) ?></span>
|
<span style="font-size:.66rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#4338ca;background:#e0e7ff;border-radius:6px;padding:2px 7px">Kommentar</span>
|
||||||
|
<span style="font-size:.75rem;color:var(--muted)"><?= format_dt($co['created_at']) ?></span>
|
||||||
<?php if ($co['staff_id'] === $staff['id'] || $staff['role'] === 'admin'): ?>
|
<?php if ($co['staff_id'] === $staff['id'] || $staff['role'] === 'admin'): ?>
|
||||||
<form method="post" style="margin-left:auto">
|
<form method="post" style="margin-left:auto">
|
||||||
<?= csrf_field() ?>
|
<?= csrf_field() ?>
|
||||||
@@ -1066,13 +1067,13 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
</form>
|
</form>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size:.83rem;color:var(--ink-soft);line-height:1.5"><?= nl2br(e($co['message'])) ?></div>
|
<div style="font-size:.92rem;color:var(--ink);line-height:1.55"><?= nl2br(e($co['message'])) ?></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<!-- Kommentar hinzufügen -->
|
<!-- Kommentar hinzufügen -->
|
||||||
<div class="comment-input-wrap" id="comment-wrap-<?= $msg['id'] ?>" style="display:none;padding:8px 16px">
|
<div class="comment-input-wrap" id="comment-wrap-<?= $msg['id'] ?>" style="display:none;padding:8px 16px">
|
||||||
<form method="post" style="display:flex;gap:8px;align-items:flex-start">
|
<form method="post" style="display:flex;gap:8px;align-items:flex-start;flex:1 1 100%;width:100%;min-width:0">
|
||||||
<?= csrf_field() ?>
|
<?= csrf_field() ?>
|
||||||
<input type="hidden" name="action" value="add_comment">
|
<input type="hidden" name="action" value="add_comment">
|
||||||
<input type="hidden" name="thread_id" value="<?= $msg['id'] ?>">
|
<input type="hidden" name="thread_id" value="<?= $msg['id'] ?>">
|
||||||
@@ -1080,7 +1081,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
<?= mb_strtoupper(mb_substr($staff['name'], 0, 1)) ?>
|
<?= mb_strtoupper(mb_substr($staff['name'], 0, 1)) ?>
|
||||||
</div>
|
</div>
|
||||||
<textarea name="comment_message" placeholder="Interner Kommentar…" required
|
<textarea name="comment_message" placeholder="Interner Kommentar…" required
|
||||||
style="flex:1;min-height:60px;resize:vertical;font-size:.83rem;padding:6px 10px"
|
rows="3" style="flex:1 1 auto;width:100%;min-width:0;min-height:90px;resize:vertical;font-size:.88rem;padding:8px 10px"
|
||||||
onkeydown="if(event.ctrlKey&&event.key==='Enter'){this.closest('form').submit()}"></textarea>
|
onkeydown="if(event.ctrlKey&&event.key==='Enter'){this.closest('form').submit()}"></textarea>
|
||||||
<div style="display:flex;flex-direction:column;gap:4px">
|
<div style="display:flex;flex-direction:column;gap:4px">
|
||||||
<button type="submit" class="btn" style="font-size:.78rem;padding:5px 10px;white-space:nowrap">Senden</button>
|
<button type="submit" class="btn" style="font-size:.78rem;padding:5px 10px;white-space:nowrap">Senden</button>
|
||||||
@@ -1196,6 +1197,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
<option value="answered">Beantwortet</option>
|
<option value="answered">Beantwortet</option>
|
||||||
<option value="pending">Wartet auf Kunde</option>
|
<option value="pending">Wartet auf Kunde</option>
|
||||||
<option value="resolved">Gelöst</option>
|
<option value="resolved">Gelöst</option>
|
||||||
|
<option value="closed">Geschlossen</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1219,7 +1221,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<h3>Aktivität</h3>
|
<h3>Aktivität</h3>
|
||||||
<?php foreach ($activity as $log): ?>
|
<?php foreach ($activity as $log): ?>
|
||||||
<div class="muted" style="font-size:.82rem;padding:4px 0"><?= format_dt($log['created_at']) ?> — <?= e($log['staff_name'] ?? 'System') ?>: <?= e($log['action']) ?></div>
|
<div class="muted" style="font-size:.82rem;padding:4px 0"><?= format_dt($log['created_at']) ?> — <?= e($log['staff_name'] ?? 'System') ?>: <span><?= e($log['action']) ?></span></div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@@ -1227,9 +1229,15 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
|
|
||||||
|
|
||||||
<div style="margin-top:20px;display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px;align-items:start">
|
<div style="margin-top:20px;display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px;align-items:start">
|
||||||
|
<nav class="tv-tabs" id="tv-tabs" role="tablist" aria-label="Ticket-Details">
|
||||||
|
<button type="button" role="tab" class="tv-tab active" data-tab="details">Details</button>
|
||||||
|
<button type="button" role="tab" class="tv-tab" data-tab="manage">Organisation</button>
|
||||||
|
<button type="button" role="tab" class="tv-tab" data-tab="more">Mehr</button>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
<!-- Ticket-Eigenschaften als horizontale Leiste -->
|
<!-- Ticket-Eigenschaften als horizontale Leiste -->
|
||||||
<div class="card" style="padding:14px 20px">
|
<div class="card" data-ptab="details" style="padding:14px 20px">
|
||||||
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; padding-bottom:10px; border-bottom:1px solid var(--border-soft)">
|
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; padding-bottom:10px; border-bottom:1px solid var(--border-soft)">
|
||||||
<span style="font-size:.82rem; font-weight:700; color:var(--ink)">Eigenschaften</span>
|
<span style="font-size:.82rem; font-weight:700; color:var(--ink)">Eigenschaften</span>
|
||||||
<?php if (!$lockedByOther): ?>
|
<?php if (!$lockedByOther): ?>
|
||||||
@@ -1306,7 +1314,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card" style="padding:14px 20px">
|
<div class="card" data-ptab="manage" style="padding:14px 20px">
|
||||||
<div style="display:flex;justify-content:space-between;align-items:center;gap:8px"><span style="font-size:.71rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)">Zugehörige Probleme</span><?php if ($staff['role'] === 'admin'): ?><a class="btn secondary" style="padding:3px 8px;font-size:.75rem" href="/staff/problems.php">Verwalten</a><?php endif; ?></div>
|
<div style="display:flex;justify-content:space-between;align-items:center;gap:8px"><span style="font-size:.71rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)">Zugehörige Probleme</span><?php if ($staff['role'] === 'admin'): ?><a class="btn secondary" style="padding:3px 8px;font-size:.75rem" href="/staff/problems.php">Verwalten</a><?php endif; ?></div>
|
||||||
<?php if ($ticketProblems): foreach ($ticketProblems as $problemItem): ?>
|
<?php if ($ticketProblems): foreach ($ticketProblems as $problemItem): ?>
|
||||||
<div style="padding:8px 0;border-top:1px solid var(--border-soft);margin-top:8px"><a href="/staff/problems.php?id=<?= (int) $problemItem['id'] ?>"><strong><?= e(ticket_problem_number((int) $problemItem['id'])) ?> · <?= e($problemItem['title']) ?></strong></a><div class="muted" style="font-size:.78rem;margin-top:3px"><?= e(ticket_problem_statuses()[$problemItem['status']] ?? $problemItem['status']) ?></div><?php if (!empty($problemItem['workaround'])): ?><div style="font-size:.82rem;margin-top:5px"><strong>Workaround:</strong> <?= nl2br(e((string) $problemItem['workaround'])) ?></div><?php endif; ?><?php if ($staff['role'] === 'admin'): ?><form method="post" style="margin-top:6px"><?= csrf_field() ?><input type="hidden" name="action" value="problem_unlink"><input type="hidden" name="problem_id" value="<?= (int) $problemItem['id'] ?>"><button class="btn secondary" type="submit" style="padding:2px 8px;font-size:.75rem">Trennen</button></form><?php endif; ?></div>
|
<div style="padding:8px 0;border-top:1px solid var(--border-soft);margin-top:8px"><a href="/staff/problems.php?id=<?= (int) $problemItem['id'] ?>"><strong><?= e(ticket_problem_number((int) $problemItem['id'])) ?> · <?= e($problemItem['title']) ?></strong></a><div class="muted" style="font-size:.78rem;margin-top:3px"><?= e(ticket_problem_statuses()[$problemItem['status']] ?? $problemItem['status']) ?></div><?php if (!empty($problemItem['workaround'])): ?><div style="font-size:.82rem;margin-top:5px"><strong>Workaround:</strong> <?= nl2br(e((string) $problemItem['workaround'])) ?></div><?php endif; ?><?php if ($staff['role'] === 'admin'): ?><form method="post" style="margin-top:6px"><?= csrf_field() ?><input type="hidden" name="action" value="problem_unlink"><input type="hidden" name="problem_id" value="<?= (int) $problemItem['id'] ?>"><button class="btn secondary" type="submit" style="padding:2px 8px;font-size:.75rem">Trennen</button></form><?php endif; ?></div>
|
||||||
@@ -1315,7 +1323,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- SLA + Individuelle Felder -->
|
<!-- SLA + Individuelle Felder -->
|
||||||
<div class="card" style="padding:16px 20px">
|
<div class="card" data-ptab="details" style="padding:16px 20px">
|
||||||
<div style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:10px">SLA-Fristen</div>
|
<div style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:10px">SLA-Fristen</div>
|
||||||
<?php if ($slaPaused): ?><div style="padding:8px 10px;margin-bottom:12px;border-radius:7px;background:#f1f5f9;color:#475569;font-size:.82rem"><strong>SLA pausiert</strong> seit <?= e(format_dt((string) $ticket['sla_paused_at'])) ?> – die Fristen laufen bei „<?= e($statusLabel) ?>“ nicht weiter.</div><?php endif; ?>
|
<?php if ($slaPaused): ?><div style="padding:8px 10px;margin-bottom:12px;border-radius:7px;background:#f1f5f9;color:#475569;font-size:.82rem"><strong>SLA pausiert</strong> seit <?= e(format_dt((string) $ticket['sla_paused_at'])) ?> – die Fristen laufen bei „<?= e($statusLabel) ?>“ nicht weiter.</div><?php endif; ?>
|
||||||
<div style="display:grid; grid-template-columns:1fr 1fr; gap:12px">
|
<div style="display:grid; grid-template-columns:1fr 1fr; gap:12px">
|
||||||
@@ -1359,7 +1367,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
<?php $csatRow = null; try { $csatRow = csat_for_ticket($pdo, (int) $ticket['id']); } catch (Throwable $e) {} ?>
|
<?php $csatRow = null; try { $csatRow = csat_for_ticket($pdo, (int) $ticket['id']); } catch (Throwable $e) {} ?>
|
||||||
<?php if ($csatRow): ?>
|
<?php if ($csatRow): ?>
|
||||||
<!-- Zufriedenheit des Kunden -->
|
<!-- Zufriedenheit des Kunden -->
|
||||||
<div class="card" style="padding:14px 20px">
|
<div class="card" data-ptab="details" style="padding:14px 20px">
|
||||||
<span style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)">Kundenzufriedenheit</span>
|
<span style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)">Kundenzufriedenheit</span>
|
||||||
<?php if ($csatRow['rating'] !== null): ?>
|
<?php if ($csatRow['rating'] !== null): ?>
|
||||||
<div style="font-size:1.25rem;color:#f5b301;margin-top:4px"><?= e(csat_stars((int) $csatRow['rating'])) ?> <span style="font-size:.85rem;color:var(--muted)"><?= (int) $csatRow['rating'] ?> von 5</span></div>
|
<div style="font-size:1.25rem;color:#f5b301;margin-top:4px"><?= e(csat_stars((int) $csatRow['rating'])) ?> <span style="font-size:.85rem;color:var(--muted)"><?= (int) $csatRow['rating'] ?> von 5</span></div>
|
||||||
@@ -1372,7 +1380,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- Wiedervorlage und Beobachter -->
|
<!-- Wiedervorlage und Beobachter -->
|
||||||
<div class="card" style="padding:16px 20px">
|
<div class="card" data-ptab="manage" style="padding:16px 20px">
|
||||||
<span style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)">Wiedervorlage</span>
|
<span style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)">Wiedervorlage</span>
|
||||||
<?php if ($snoozedUntil): ?>
|
<?php if ($snoozedUntil): ?>
|
||||||
<p style="font-size:.84rem;margin:8px 0">💤 Bis <strong><?= e(date('d.m.Y H:i', (int) strtotime($snoozedUntil))) ?> Uhr</strong> ausgeblendet, dann kommt es zurück.</p>
|
<p style="font-size:.84rem;margin:8px 0">💤 Bis <strong><?= e(date('d.m.Y H:i', (int) strtotime($snoozedUntil))) ?> Uhr</strong> ausgeblendet, dann kommt es zurück.</p>
|
||||||
@@ -1402,7 +1410,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
|
|
||||||
<?php if ($similar['articles'] || $similar['tickets']): ?>
|
<?php if ($similar['articles'] || $similar['tickets']): ?>
|
||||||
<!-- Ähnliche Artikel und Tickets -->
|
<!-- Ähnliche Artikel und Tickets -->
|
||||||
<div class="card" style="padding:16px 20px">
|
<div class="card" data-ptab="more" style="padding:16px 20px">
|
||||||
<span style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)">Dazu passend</span>
|
<span style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)">Dazu passend</span>
|
||||||
<?php if ($similar['articles']): ?>
|
<?php if ($similar['articles']): ?>
|
||||||
<div style="font-size:.76rem;color:var(--muted);margin:8px 0 2px">Wissensdatenbank</div>
|
<div style="font-size:.76rem;color:var(--muted);margin:8px 0 2px">Wissensdatenbank</div>
|
||||||
@@ -1420,7 +1428,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- Kollaboratoren -->
|
<!-- Kollaboratoren -->
|
||||||
<div class="card" style="padding:16px 20px">
|
<div class="card" data-ptab="manage" style="padding:16px 20px">
|
||||||
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px">
|
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px">
|
||||||
<span style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)">Kollaboratoren</span>
|
<span style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted)">Kollaboratoren</span>
|
||||||
<button type="button" id="collab-toggle" onclick="var f=document.getElementById('collab-form');f.style.display=f.style.display==='none'?'':'none'" style="background:none;border:1px solid var(--border);border-radius:5px;padding:2px 8px;font-size:.73rem;cursor:pointer;color:var(--muted)">+ hinzufügen</button>
|
<button type="button" id="collab-toggle" onclick="var f=document.getElementById('collab-form');f.style.display=f.style.display==='none'?'':'none'" style="background:none;border:1px solid var(--border);border-radius:5px;padding:2px 8px;font-size:.73rem;cursor:pointer;color:var(--muted)">+ hinzufügen</button>
|
||||||
@@ -1453,7 +1461,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Selten: Zusammenführen + Löschen -->
|
<!-- Selten: Zusammenführen + Löschen -->
|
||||||
<details class="card" style="padding:0; overflow:hidden">
|
<details class="card" data-ptab="more" style="padding:0; overflow:hidden">
|
||||||
<summary style="padding:12px 16px; cursor:pointer; font-size:.79rem; font-weight:600; color:var(--muted); display:flex; align-items:center; justify-content:space-between; user-select:none; list-style:none">
|
<summary style="padding:12px 16px; cursor:pointer; font-size:.79rem; font-weight:600; color:var(--muted); display:flex; align-items:center; justify-content:space-between; user-select:none; list-style:none">
|
||||||
<span>Weitere Aktionen</span><span style="font-size:.68rem; transition:transform .2s">▾</span>
|
<span>Weitere Aktionen</span><span style="font-size:.68rem; transition:transform .2s">▾</span>
|
||||||
</summary>
|
</summary>
|
||||||
@@ -1508,7 +1516,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
<!-- Zeiterfassung -->
|
<!-- Zeiterfassung -->
|
||||||
<div class="card" style="padding:16px 20px">
|
<div class="card" data-ptab="manage" style="padding:16px 20px">
|
||||||
<div style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:10px">
|
<div style="font-size:.71rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:10px">
|
||||||
⏱ Zeiterfassung
|
⏱ Zeiterfassung
|
||||||
<?php if ($totalMinutes > 0): ?>
|
<?php if ($totalMinutes > 0): ?>
|
||||||
@@ -1560,9 +1568,9 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
$alreadyBanned = (bool)$bs->fetchColumn();
|
$alreadyBanned = (bool)$bs->fetchColumn();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?= plugin_filter('ticket.view.sidebar', '', ['ticketId' => (int) $ticket['id'], 'ticket' => $ticket, 'staff' => $staff]) /* Plugins liefern fertiges HTML (vertrauenswürdiger Code) */ ?>
|
<div data-ptab="more"><?= plugin_filter('ticket.view.sidebar', '', ['ticketId' => (int) $ticket['id'], 'ticket' => $ticket, 'staff' => $staff]) /* Plugins liefern fertiges HTML (vertrauenswürdiger Code) */ ?></div>
|
||||||
<?php if ($requesterEmail): ?>
|
<?php if ($requesterEmail): ?>
|
||||||
<div class="card" style="margin-top:16px;padding:14px 16px">
|
<div class="card" data-ptab="details" style="margin-top:16px;padding:14px 16px">
|
||||||
<div style="font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin-bottom:10px">Absender</div>
|
<div style="font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin-bottom:10px">Absender</div>
|
||||||
<div style="font-size:.83rem;margin-bottom:8px;word-break:break-all"><?= e($requesterEmail) ?></div>
|
<div style="font-size:.83rem;margin-bottom:8px;word-break:break-all"><?= e($requesterEmail) ?></div>
|
||||||
<?php if ($alreadyBanned): ?>
|
<?php if ($alreadyBanned): ?>
|
||||||
@@ -1591,7 +1599,7 @@ $sourceLabel = $sourceLabels[$ticket['source']] ?? $ticket['source'];
|
|||||||
|
|
||||||
<!-- Kundenbewertung -->
|
<!-- Kundenbewertung -->
|
||||||
<?php if (get_setting('ticket_ratings_enabled','1')==='1' && in_array($ticket['status'],['resolved','closed'])): ?>
|
<?php if (get_setting('ticket_ratings_enabled','1')==='1' && in_array($ticket['status'],['resolved','closed'])): ?>
|
||||||
<div class="card" style="margin-top:16px; padding:18px 20px">
|
<div class="card" data-ptab="details" style="margin-top:16px; padding:18px 20px">
|
||||||
<div style="font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:12px">Kundenbewertung</div>
|
<div style="font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:12px">Kundenbewertung</div>
|
||||||
<?php if ($ticketRating): ?>
|
<?php if ($ticketRating): ?>
|
||||||
<div style="display:flex; align-items:center; gap:10px; margin-bottom:8px">
|
<div style="display:flex; align-items:center; gap:10px; margin-bottom:8px">
|
||||||
@@ -1879,4 +1887,31 @@ function toggleRaw(id) {
|
|||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.tv-tabs { grid-column:1 / -1; display:flex; gap:2px; margin:0; border-bottom:1px solid var(--border,#e2e8f0); overflow-x:auto; overflow-y:hidden; }
|
||||||
|
.tv-tab { background:none; border:0; border-bottom:3px solid transparent; padding:9px 14px; margin-bottom:-1px; cursor:pointer; font:inherit; font-weight:600; color:var(--muted,#64748b); border-radius:8px 8px 0 0; white-space:nowrap; }
|
||||||
|
.tv-tab:hover { color:var(--text,#0f172a); background:var(--surface,#fff); }
|
||||||
|
.tv-tab.active { color:var(--primary); border-bottom-color:var(--primary); background:var(--surface,#fff); }
|
||||||
|
[data-ptab][hidden] { display:none !important; }
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
// Reiter unter dem Verlauf: zeigt nur die Karten der gewählten Gruppe. Die Wahl bleibt beim Neuladen (z. B. nach dem Speichern) erhalten.
|
||||||
|
(function () {
|
||||||
|
var bar = document.getElementById('tv-tabs');
|
||||||
|
if (!bar) return;
|
||||||
|
var tabs = bar.querySelectorAll('.tv-tab');
|
||||||
|
function show(name) {
|
||||||
|
var found = false;
|
||||||
|
tabs.forEach(function (b) { var on = b.dataset.tab === name; if (on) found = true; b.classList.toggle('active', on); b.setAttribute('aria-selected', on ? 'true' : 'false'); });
|
||||||
|
if (!found) return show('details');
|
||||||
|
document.querySelectorAll('[data-ptab]').forEach(function (el) { el.hidden = el.dataset.ptab !== name; });
|
||||||
|
try { sessionStorage.setItem('tv_tab', name); } catch (e) {}
|
||||||
|
}
|
||||||
|
tabs.forEach(function (b) { b.addEventListener('click', function () { show(b.dataset.tab); }); });
|
||||||
|
var saved = 'details';
|
||||||
|
try { saved = sessionStorage.getItem('tv_tab') || 'details'; } catch (e) {}
|
||||||
|
show(saved);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
<?php require __DIR__ . '/_footer.php'; ?>
|
<?php require __DIR__ . '/_footer.php'; ?>
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ $countStmt->execute($params);
|
|||||||
$totalCount = (int)$countStmt->fetchColumn();
|
$totalCount = (int)$countStmt->fetchColumn();
|
||||||
$totalPages = max(1, (int)ceil($totalCount / $perPage));
|
$totalPages = max(1, (int)ceil($totalCount / $perPage));
|
||||||
|
|
||||||
$sql .= ' ORDER BY t.created_at DESC LIMIT ' . $perPage . ' OFFSET ' . $offset;
|
$sql .= ' ORDER BY t.updated_at DESC, t.created_at DESC LIMIT ' . $perPage . ' OFFSET ' . $offset;
|
||||||
|
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
|
|||||||
Reference in New Issue
Block a user