Upload via GUI (360 Dateien)
This commit is contained in:
+429
-428
@@ -1,429 +1,430 @@
|
|||||||
<?php
|
<?php
|
||||||
/** @var array $staff (current_staff(), wird von der aufrufenden Seite gesetzt) */
|
/** @var array $staff (current_staff(), wird von der aufrufenden Seite gesetzt) */
|
||||||
$staff = current_staff();
|
$staff = current_staff();
|
||||||
$activePage = $activePage ?? '';
|
$activePage = $activePage ?? '';
|
||||||
header('Content-Type: text/html; charset=UTF-8');
|
header('Content-Type: text/html; charset=UTF-8');
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title><?= e($pageTitle ?? 'DeskHub – Mitarbeiterbereich') ?></title>
|
<title><?= e($pageTitle ?? 'DeskHub – Mitarbeiterbereich') ?></title>
|
||||||
<meta name="csrf" content="<?= csrf_token() ?>">
|
<meta name="csrf" content="<?= csrf_token() ?>">
|
||||||
<?php
|
<?php
|
||||||
// VAPID Public Key – aus Config oder automatisch aus DB
|
// VAPID Public Key – aus Config oder automatisch aus DB
|
||||||
if (file_exists(__DIR__ . '/../includes/push.php')) {
|
if (file_exists(__DIR__ . '/../includes/push.php')) {
|
||||||
require_once __DIR__ . '/../includes/push.php';
|
require_once __DIR__ . '/../includes/push.php';
|
||||||
$__vapidKeys = get_or_create_vapid_keys();
|
$__vapidKeys = get_or_create_vapid_keys();
|
||||||
$pushKey = $__vapidKeys['public_key'] ?? '';
|
$pushKey = $__vapidKeys['public_key'] ?? '';
|
||||||
} else {
|
} else {
|
||||||
$pushKey = config()['push']['public_key'] ?? '';
|
$pushKey = config()['push']['public_key'] ?? '';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php if ($pushKey): ?>
|
<?php if ($pushKey): ?>
|
||||||
<meta name="push-key" content="<?= e($pushKey) ?>">
|
<meta name="push-key" content="<?= e($pushKey) ?>">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<link rel="stylesheet" href="/assets/css/style.css?v=<?= @filemtime(__DIR__ . "/../assets/css/style.css") ?: time() ?>">
|
<link rel="stylesheet" href="/assets/css/style.css?v=<?= @filemtime(__DIR__ . "/../assets/css/style.css") ?: time() ?>">
|
||||||
<?= site_icon_links() ?>
|
<?= site_icon_links() ?>
|
||||||
<link rel="manifest" href="/manifest-staff.php">
|
<link rel="manifest" href="/manifest-staff.php">
|
||||||
<meta name="theme-color" content="#0f6f6a">
|
<meta name="theme-color" content="#0f6f6a">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<script>
|
<script>
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
navigator.serviceWorker.register('/staff/sw-staff.js', {scope: '/staff/'}).catch(function(){});
|
navigator.serviceWorker.register('/staff/sw-staff.js', {scope: '/staff/'}).catch(function(){});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<script>try { if (localStorage.getItem('deskhub_sidebar') === 'closed') document.documentElement.classList.add('sidebar-closed'); } catch (e) {}</script>
|
<script>try { if (localStorage.getItem('deskhub_sidebar') === 'closed') document.documentElement.classList.add('sidebar-closed'); } catch (e) {}</script>
|
||||||
<button type="button" id="sidebar-open" class="sidebar-toggle sidebar-toggle-open" aria-label="Seitenleiste einblenden" title="Seitenleiste einblenden" onclick="document.getElementById('sidebar-toggle').click()">☰</button>
|
<button type="button" id="sidebar-open" class="sidebar-toggle sidebar-toggle-open" aria-label="Seitenleiste einblenden" title="Seitenleiste einblenden" onclick="document.getElementById('sidebar-toggle').click()">☰</button>
|
||||||
<div class="app-shell">
|
<div class="app-shell">
|
||||||
<aside class="sidebar" id="sidebar">
|
<aside class="sidebar" id="sidebar">
|
||||||
<button type="button" id="sidebar-toggle" class="sidebar-toggle sidebar-toggle-close" aria-label="Seitenleiste einklappen" title="Seitenleiste einklappen">«</button>
|
<button type="button" id="sidebar-toggle" class="sidebar-toggle sidebar-toggle-close" aria-label="Seitenleiste einklappen" title="Seitenleiste einklappen">«</button>
|
||||||
<div class="brand">
|
<div class="brand">
|
||||||
<?php $logo = get_setting('logo_path'); ?>
|
<?php $logo = get_setting('logo_path'); ?>
|
||||||
<?php if ($logo): ?>
|
<?php if ($logo): ?>
|
||||||
<img src="<?= e($logo) ?>" alt="<?= e(get_setting('display_name', 'DeskHub')) ?>" style="max-height:34px; max-width:180px; display:block">
|
<img src="<?= e($logo) ?>" alt="<?= e(get_setting('display_name', 'DeskHub')) ?>" style="max-height:34px; max-width:180px; display:block">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
Desk<span>Hub</span>
|
Desk<span>Hub</span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<nav>
|
<nav>
|
||||||
<?php // Übersicht + ehemals separates "Berichte" wurden zu einer Seite zusammengelegt
|
<?php // Übersicht + ehemals separates "Berichte" wurden zu einer Seite zusammengelegt
|
||||||
// (siehe staff/reports.php) – der Login landete ohnehin schon immer dort. ?>
|
// (siehe staff/reports.php) – der Login landete ohnehin schon immer dort. ?>
|
||||||
<a href="/staff/reports.php" class="<?= $activePage==='reports'?'active':'' ?>">Übersicht</a>
|
<a href="/staff/reports.php" class="<?= $activePage==='reports'?'active':'' ?>">Übersicht</a>
|
||||||
<a href="/staff/report_builder.php" class="<?= $activePage==='report_builder'?'active':'' ?>">Bericht-Baukasten</a>
|
<a href="/staff/report_builder.php" class="<?= $activePage==='report_builder'?'active':'' ?>">Bericht-Baukasten</a>
|
||||||
<a href="/staff/tickets.php" class="<?= $activePage==='tickets'?'active':'' ?>">Tickets</a>
|
<a href="/staff/tickets.php" class="<?= $activePage==='tickets'?'active':'' ?>">Tickets</a>
|
||||||
<a href="/staff/tasks.php" class="<?= $activePage==='tasks'?'active':'' ?>">Aufgaben</a>
|
<a href="/staff/tasks.php" class="<?= $activePage==='tasks'?'active':'' ?>">Aufgaben</a>
|
||||||
<a href="/staff/banlist.php" class="<?= $activePage==='banlist'?'active':'' ?>">Sperrliste</a>
|
<a href="/staff/banlist.php" class="<?= $activePage==='banlist'?'active':'' ?>">Sperrliste</a>
|
||||||
<a href="/staff/apps.php" class="<?= $activePage==='apps'?'active':'' ?>">Apps</a>
|
<a href="/staff/apps.php" class="<?= $activePage==='apps'?'active':'' ?>">Apps</a>
|
||||||
<?php foreach (plugin_menu_items($staff ?? null) as $__pm): ?>
|
<?php foreach (plugin_menu_items($staff ?? null) as $__pm): ?>
|
||||||
<a href="<?= e($__pm['url']) ?>" class="<?= ($activePage ?? '') === 'plugin_' . $__pm['plugin'] ? 'active' : '' ?>"><?= e($__pm['label']) ?></a>
|
<a href="<?= e($__pm['url']) ?>" class="<?= ($activePage ?? '') === 'plugin_' . $__pm['plugin'] ? 'active' : '' ?>"><?= e($__pm['label']) ?></a>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if (get_setting('live_chat_enabled', '0') === '1' && $staff): ?>
|
<?php if (get_setting('live_chat_enabled', '0') === '1' && $staff): ?>
|
||||||
<?php
|
<?php
|
||||||
// Badge = Anzahl Live-Chats, deren letzte Nachricht vom Kunden kam (also unbeantwortet),
|
// Badge = Anzahl Live-Chats, deren letzte Nachricht vom Kunden kam (also unbeantwortet),
|
||||||
// auf die eigenen Abteilungen begrenzt (wie die Ticketliste selbst).
|
// auf die eigenen Abteilungen begrenzt (wie die Ticketliste selbst).
|
||||||
[$__lcDeptSql, $__lcDeptParams] = dept_filter_sql(staff_department_ids($staff), 't.department_id');
|
[$__lcDeptSql, $__lcDeptParams] = dept_filter_sql(staff_department_ids($staff), 't.department_id');
|
||||||
$__lcSql = "SELECT COUNT(*) FROM tickets t WHERE t.source = 'chat' AND t.status != 'closed'
|
$__lcSql = "SELECT COUNT(*) FROM tickets t WHERE t.source = 'chat' AND t.status != 'closed'
|
||||||
AND (SELECT tt.author_type FROM ticket_threads tt WHERE tt.ticket_id = t.id ORDER BY tt.created_at DESC, tt.id DESC LIMIT 1) = 'customer'"
|
AND (SELECT tt.author_type FROM ticket_threads tt WHERE tt.ticket_id = t.id ORDER BY tt.created_at DESC, tt.id DESC LIMIT 1) = 'customer'"
|
||||||
. $__lcDeptSql; // enthält bereits das führende " AND " (dept_filter_sql)
|
. $__lcDeptSql; // enthält bereits das führende " AND " (dept_filter_sql)
|
||||||
$__lcStmt = get_db()->prepare($__lcSql);
|
$__lcStmt = get_db()->prepare($__lcSql);
|
||||||
$__lcStmt->execute($__lcDeptParams);
|
$__lcStmt->execute($__lcDeptParams);
|
||||||
$__lcPending = (int) $__lcStmt->fetchColumn();
|
$__lcPending = (int) $__lcStmt->fetchColumn();
|
||||||
?>
|
?>
|
||||||
<a href="/staff/live_chat.php" class="<?= $activePage==='live_chat'?'active':'' ?>">
|
<a href="/staff/live_chat.php" class="<?= $activePage==='live_chat'?'active':'' ?>">
|
||||||
Live-Chat<?php if ($__lcPending): ?> <span class="nav-badge" style="background:var(--danger, #dc2626); color:#fff; border-radius:10px; min-width:18px; height:18px; font-size:.68rem; font-weight:700; display:inline-flex; align-items:center; justify-content:center; padding:0 5px; margin-left:4px; vertical-align:middle"><?= $__lcPending > 9 ? '9+' : $__lcPending ?></span><?php endif; ?>
|
Live-Chat<?php if ($__lcPending): ?> <span class="nav-badge" style="background:var(--danger, #dc2626); color:#fff; border-radius:10px; min-width:18px; height:18px; font-size:.68rem; font-weight:700; display:inline-flex; align-items:center; justify-content:center; padding:0 5px; margin-left:4px; vertical-align:middle"><?= $__lcPending > 9 ? '9+' : $__lcPending ?></span><?php endif; ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Adminportal auch für "Co-Admins" zeigen: Agenten, denen per benutzerdefinierter Rolle
|
// Adminportal auch für "Co-Admins" zeigen: Agenten, denen per benutzerdefinierter Rolle
|
||||||
// gezielt einzelne Adminportal-Rechte zugewiesen wurden (admin_section_permissions()).
|
// gezielt einzelne Adminportal-Rechte zugewiesen wurden (admin_section_permissions()).
|
||||||
// has_permission() liefert für echte Admins ohnehin immer true, daher genügt die reine
|
// has_permission() liefert für echte Admins ohnehin immer true, daher genügt die reine
|
||||||
// Rechteprüfung je Link – kein zusätzliches role==='admin' nötig.
|
// Rechteprüfung je Link – kein zusätzliches role==='admin' nötig.
|
||||||
$hasAnyAdminAccess = false;
|
$hasAnyAdminAccess = false;
|
||||||
if ($staff) {
|
if ($staff) {
|
||||||
foreach (array_keys(admin_section_permissions()) as $__perm) {
|
foreach (array_keys(admin_section_permissions()) as $__perm) {
|
||||||
if (has_permission($staff, $__perm)) { $hasAnyAdminAccess = true; break; }
|
if (has_permission($staff, $__perm)) { $hasAnyAdminAccess = true; break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php if ($hasAnyAdminAccess): ?>
|
<?php if ($hasAnyAdminAccess): ?>
|
||||||
<div class="nav-section-label" id="admin-toggle" role="button" tabindex="0">
|
<div class="nav-section-label" id="admin-toggle" role="button" tabindex="0">
|
||||||
Adminportal <span class="nav-toggle-chevron">▾</span>
|
Adminportal <span class="nav-toggle-chevron">▾</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-admin-block" id="admin-block">
|
<div class="nav-admin-block" id="admin-block">
|
||||||
<span class="nav-group-label">Verwalten</span>
|
<span class="nav-group-label">Verwalten</span>
|
||||||
<?php if (has_permission($staff, 'manage_departments')): ?><a href="/staff/departments.php" class="<?= $activePage==='departments'?'active':'' ?>">Abteilungen</a><?php endif; ?>
|
<?php if (has_permission($staff, 'manage_departments')): ?><a href="/staff/departments.php" class="<?= $activePage==='departments'?'active':'' ?>">Abteilungen</a><?php endif; ?>
|
||||||
<?php if (has_permission($staff, 'manage_priorities')): ?><a href="/staff/priorities.php" class="<?= $activePage==='priorities'?'active':'' ?>">Prioritäten / SLA</a><a href="/staff/sla_plans.php" class="<?= $activePage==='sla_plans'?'active':'' ?>">SLA-Pläne</a><?php endif; ?>
|
<?php if (has_permission($staff, 'manage_priorities')): ?><a href="/staff/priorities.php" class="<?= $activePage==='priorities'?'active':'' ?>">Prioritäten / SLA</a><a href="/staff/sla_plans.php" class="<?= $activePage==='sla_plans'?'active':'' ?>">SLA-Pläne</a><?php endif; ?>
|
||||||
<?php if (has_permission($staff, 'manage_help_topics')): ?><a href="/staff/help_topics.php" class="<?= $activePage==='help_topics'?'active':'' ?>">Hilfethemen</a><?php endif; ?>
|
<?php if (has_permission($staff, 'manage_help_topics')): ?><a href="/staff/help_topics.php" class="<?= $activePage==='help_topics'?'active':'' ?>">Hilfethemen</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/custom_fields.php" class="<?= $activePage==='custom_fields'?'active':'' ?>">Ticket-Felder</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/custom_fields.php" class="<?= $activePage==='custom_fields'?'active':'' ?>">Ticket-Felder</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/api_keys.php" class="<?= $activePage==='api_keys'?'active':'' ?>">API-Schlüssel</a><a href="/staff/webhooks.php" class="<?= $activePage==='webhooks'?'active':'' ?>">Webhooks</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/api_keys.php" class="<?= $activePage==='api_keys'?'active':'' ?>">API-Schlüssel</a><a href="/staff/webhooks.php" class="<?= $activePage==='webhooks'?'active':'' ?>">Webhooks</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/custom_lists.php" class="<?= $activePage==='custom_lists'?'active':'' ?>">Benutzerdefinierte Listen</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/custom_lists.php" class="<?= $activePage==='custom_lists'?'active':'' ?>">Benutzerdefinierte Listen</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/canned_responses.php" class="<?= $activePage==='canned'?'active':'' ?>">Vorlagen</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/canned_responses.php" class="<?= $activePage==='canned'?'active':'' ?>">Vorlagen</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/site_pages.php" class="<?= $activePage==='site_pages'?'active':'' ?>">Seiten</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/site_pages.php" class="<?= $activePage==='site_pages'?'active':'' ?>">Seiten</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/languages.php" class="<?= $activePage==='languages'?'active':'' ?>">Sprachen</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/languages.php" class="<?= $activePage==='languages'?'active':'' ?>">Sprachen</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/ticket_templates.php" class="<?= $activePage==='ticket_templates'?'active':'' ?>">Ticket-Vorlagen</a><a href="/staff/status_page.php" class="<?= $activePage==='status_page'?'active':'' ?>">Statusseite</a><a href="/staff/problems.php" class="<?= $activePage==='problems'?'active':'' ?>">Problemmanagement</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/ticket_templates.php" class="<?= $activePage==='ticket_templates'?'active':'' ?>">Ticket-Vorlagen</a><a href="/staff/status_page.php" class="<?= $activePage==='status_page'?'active':'' ?>">Statusseite</a><a href="/staff/problems.php" class="<?= $activePage==='problems'?'active':'' ?>">Problemmanagement</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/mail_queue.php" class="<?= $activePage==='mail_queue'?'active':'' ?>">Mail-Warteschlange</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/mail_queue.php" class="<?= $activePage==='mail_queue'?'active':'' ?>">Mail-Warteschlange</a><?php endif; ?>
|
||||||
<?php if (has_permission($staff, 'manage_email_addresses')): ?><a href="/staff/email_addresses.php" class="<?= $activePage==='email_addresses'?'active':'' ?>">E-Mail-Adressen</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/login_log.php" class="<?= $activePage==='login_log'?'active':'' ?>">Anmelde-Wächter</a><?php endif; ?>
|
||||||
<?php if (has_permission($staff, 'manage_email_templates')): ?><a href="/staff/email_templates.php" class="<?= $activePage==='email_templates'?'active':'' ?>">E-Mail-Vorlagen</a><?php endif; ?>
|
<?php if (has_permission($staff, 'manage_email_addresses')): ?><a href="/staff/email_addresses.php" class="<?= $activePage==='email_addresses'?'active':'' ?>">E-Mail-Adressen</a><?php endif; ?>
|
||||||
<?php if (has_permission($staff, 'manage_kb')): ?><a href="/staff/kb_manage.php" class="<?= $activePage==='kb'?'active':'' ?>">Wissensdatenbank</a><?php endif; ?>
|
<?php if (has_permission($staff, 'manage_email_templates')): ?><a href="/staff/email_templates.php" class="<?= $activePage==='email_templates'?'active':'' ?>">E-Mail-Vorlagen</a><?php endif; ?>
|
||||||
<?php if (has_permission($staff, 'manage_assistant')): ?><a href="/staff/assistant.php" class="<?= $activePage==='assistant'?'active':'' ?>">Digitaler Assistent</a><?php endif; ?>
|
<?php if (has_permission($staff, 'manage_kb')): ?><a href="/staff/kb_manage.php" class="<?= $activePage==='kb'?'active':'' ?>">Wissensdatenbank</a><?php endif; ?>
|
||||||
|
<?php if (has_permission($staff, 'manage_assistant')): ?><a href="/staff/assistant.php" class="<?= $activePage==='assistant'?'active':'' ?>">Digitaler Assistent</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/plugins.php" class="<?= $activePage==='plugins'?'active':'' ?>">Plugins</a><?php endif; ?>
|
|
||||||
<?php foreach (plugin_admin_menu_items($staff) as $__pm): ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/plugins.php" class="<?= $activePage==='plugins'?'active':'' ?>">Plugins</a><?php endif; ?>
|
||||||
<a href="<?= e($__pm['url']) ?>" class="<?= ($activePage ?? '') === 'plugin_' . $__pm['plugin'] ? 'active' : '' ?>"><?= e($__pm['label']) ?></a>
|
<?php foreach (plugin_admin_menu_items($staff) as $__pm): ?>
|
||||||
<?php endforeach; ?>
|
<a href="<?= e($__pm['url']) ?>" class="<?= ($activePage ?? '') === 'plugin_' . $__pm['plugin'] ? 'active' : '' ?>"><?= e($__pm['label']) ?></a>
|
||||||
<span class="nav-group-label">Kunden</span>
|
<?php endforeach; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/customers.php" class="<?= $activePage==='customers'?'active':'' ?>">Kundenverzeichnis</a><?php endif; ?>
|
<span class="nav-group-label">Kunden</span>
|
||||||
<?php if (has_permission($staff, 'manage_organizations')): ?><a href="/staff/organizations.php" class="<?= $activePage==='organizations'?'active':'' ?>">Organisationen</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/customers.php" class="<?= $activePage==='customers'?'active':'' ?>">Kundenverzeichnis</a><?php endif; ?>
|
||||||
|
<?php if (has_permission($staff, 'manage_organizations')): ?><a href="/staff/organizations.php" class="<?= $activePage==='organizations'?'active':'' ?>">Organisationen</a><?php endif; ?>
|
||||||
<span class="nav-group-label">Agenten</span>
|
|
||||||
<?php if (has_permission($staff, 'manage_staff')): ?><a href="/staff/staff_manage.php" class="<?= $activePage==='staff'?'active':'' ?>">Mitarbeiter</a><?php endif; ?>
|
<span class="nav-group-label">Agenten</span>
|
||||||
<?php if (has_permission($staff, 'manage_teams')): ?><a href="/staff/teams.php" class="<?= $activePage==='teams'?'active':'' ?>">Teams</a><?php endif; ?>
|
<?php if (has_permission($staff, 'manage_staff')): ?><a href="/staff/staff_manage.php" class="<?= $activePage==='staff'?'active':'' ?>">Mitarbeiter</a><?php endif; ?>
|
||||||
<?php if (has_permission($staff, 'manage_roles')): ?><a href="/staff/roles.php" class="<?= $activePage==='roles'?'active':'' ?>">Rollen</a><?php endif; ?>
|
<?php if (has_permission($staff, 'manage_teams')): ?><a href="/staff/teams.php" class="<?= $activePage==='teams'?'active':'' ?>">Teams</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/availability.php" class="<?= $activePage==='availability'?'active':'' ?>">Status & Schichten</a><?php endif; ?>
|
<?php if (has_permission($staff, 'manage_roles')): ?><a href="/staff/roles.php" class="<?= $activePage==='roles'?'active':'' ?>">Rollen</a><?php endif; ?>
|
||||||
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/availability.php" class="<?= $activePage==='availability'?'active':'' ?>">Status & Schichten</a><?php endif; ?>
|
||||||
<span class="nav-group-label">System</span>
|
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/security_check.php" class="<?= $activePage==='security_check'?'active':'' ?>">Sicherheitsprüfung</a><?php endif; ?>
|
<span class="nav-group-label">System</span>
|
||||||
<?php if (has_permission($staff, 'view_audit_log')): ?><a href="/staff/audit_log.php" class="<?= $activePage==='audit_log'?'active':'' ?>">Admin-Protokoll</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/security_check.php" class="<?= $activePage==='security_check'?'active':'' ?>">Sicherheitsprüfung</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/ticket_rules.php" class="<?= $activePage==='ticket_rules'?'active':'' ?>">Ticket-Regeln</a><?php endif; ?>
|
<?php if (has_permission($staff, 'view_audit_log')): ?><a href="/staff/audit_log.php" class="<?= $activePage==='audit_log'?'active':'' ?>">Admin-Protokoll</a><?php endif; ?>
|
||||||
<?php if (has_permission($staff, 'manage_escalations')): ?><a href="/staff/escalation_rules.php" class="<?= $activePage==='escalation_rules'?'active':'' ?>">Eskalationsregeln</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/ticket_rules.php" class="<?= $activePage==='ticket_rules'?'active':'' ?>">Ticket-Regeln</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/recurring_tickets.php" class="<?= $activePage==='recurring'?'active':'' ?>">Wiederkehrende Tickets</a><?php endif; ?>
|
<?php if (has_permission($staff, 'manage_escalations')): ?><a href="/staff/escalation_rules.php" class="<?= $activePage==='escalation_rules'?'active':'' ?>">Eskalationsregeln</a><?php endif; ?>
|
||||||
<?php if (has_permission($staff, 'view_time_entries')): ?><a href="/staff/time_entries.php" class="<?= $activePage==='time_entries'?'active':'' ?>">Zeiterfassung</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/recurring_tickets.php" class="<?= $activePage==='recurring'?'active':'' ?>">Wiederkehrende Tickets</a><?php endif; ?>
|
||||||
<?php if (has_permission($staff, 'manage_business_hours')): ?><a href="/staff/business_hours.php" class="<?= $activePage==='business_hours'?'active':'' ?>">Geschäftszeiten</a><?php endif; ?>
|
<?php if (has_permission($staff, 'view_time_entries')): ?><a href="/staff/time_entries.php" class="<?= $activePage==='time_entries'?'active':'' ?>">Zeiterfassung</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/settings.php" class="<?= $activePage==='settings'?'active':'' ?>">Einstellungen</a><?php endif; ?>
|
<?php if (has_permission($staff, 'manage_business_hours')): ?><a href="/staff/business_hours.php" class="<?= $activePage==='business_hours'?'active':'' ?>">Geschäftszeiten</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/backup.php" class="<?= $activePage==='backup'?'active':'' ?>">Backup</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/settings.php" class="<?= $activePage==='settings'?'active':'' ?>">Einstellungen</a><?php endif; ?>
|
||||||
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/update.php" class="<?= $activePage==='update'?'active':'' ?>">System-Update</a><?php endif; ?>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/backup.php" class="<?= $activePage==='backup'?'active':'' ?>">Backup</a><?php endif; ?>
|
||||||
</div>
|
<?php if ($staff['role'] === 'admin'): ?><a href="/staff/update.php" class="<?= $activePage==='update'?'active':'' ?>">System-Update</a><?php endif; ?>
|
||||||
<script>
|
</div>
|
||||||
(function () {
|
<script>
|
||||||
var toggle = document.getElementById('admin-toggle');
|
(function () {
|
||||||
var block = document.getElementById('admin-block');
|
var toggle = document.getElementById('admin-toggle');
|
||||||
var KEY = 'deskhub_admin_nav_collapsed';
|
var block = document.getElementById('admin-block');
|
||||||
// In diesen Adminportal-Unterseiten immer ausgeklappt zeigen, damit die aktive Seite sichtbar bleibt
|
var KEY = 'deskhub_admin_nav_collapsed';
|
||||||
var forceOpen = block.querySelector('a.active') !== null;
|
// In diesen Adminportal-Unterseiten immer ausgeklappt zeigen, damit die aktive Seite sichtbar bleibt
|
||||||
function apply(collapsed) {
|
var forceOpen = block.querySelector('a.active') !== null;
|
||||||
block.style.display = collapsed ? 'none' : '';
|
function apply(collapsed) {
|
||||||
toggle.querySelector('.nav-toggle-chevron').textContent = collapsed ? '▸' : '▾';
|
block.style.display = collapsed ? 'none' : '';
|
||||||
}
|
toggle.querySelector('.nav-toggle-chevron').textContent = collapsed ? '▸' : '▾';
|
||||||
var stored = localStorage.getItem(KEY);
|
}
|
||||||
apply(!forceOpen && stored === '1');
|
var stored = localStorage.getItem(KEY);
|
||||||
toggle.addEventListener('click', function () {
|
apply(!forceOpen && stored === '1');
|
||||||
var collapsed = block.style.display !== 'none';
|
toggle.addEventListener('click', function () {
|
||||||
apply(collapsed);
|
var collapsed = block.style.display !== 'none';
|
||||||
localStorage.setItem(KEY, collapsed ? '1' : '0');
|
apply(collapsed);
|
||||||
});
|
localStorage.setItem(KEY, collapsed ? '1' : '0');
|
||||||
toggle.addEventListener('keydown', function (e) {
|
});
|
||||||
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggle.click(); }
|
toggle.addEventListener('keydown', function (e) {
|
||||||
});
|
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggle.click(); }
|
||||||
})();
|
});
|
||||||
</script>
|
})();
|
||||||
<?php endif; ?>
|
</script>
|
||||||
</nav>
|
<?php endif; ?>
|
||||||
<div class="sidebar-footer">
|
</nav>
|
||||||
<?php if ($staff): ?>
|
<div class="sidebar-footer">
|
||||||
<div style="display:flex; align-items:center; gap:10px; margin-bottom:8px">
|
<?php if ($staff): ?>
|
||||||
<?php if (!empty($staff['avatar_path'])): ?>
|
<div style="display:flex; align-items:center; gap:10px; margin-bottom:8px">
|
||||||
<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 if (!empty($staff['avatar_path'])): ?>
|
||||||
<?php else: ?>
|
<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">
|
||||||
<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">
|
<?php else: ?>
|
||||||
<?= mb_strtoupper(mb_substr($staff['name'], 0, 1)) ?>
|
<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">
|
||||||
</div>
|
<?= mb_strtoupper(mb_substr($staff['name'], 0, 1)) ?>
|
||||||
<?php endif; ?>
|
</div>
|
||||||
<div style="min-width:0">
|
<?php endif; ?>
|
||||||
<div style="font-size:.82rem; font-weight:600; color:#fff; overflow:hidden; text-overflow:ellipsis; white-space:nowrap"><?= e($staff['name']) ?></div>
|
<div style="min-width:0">
|
||||||
<div style="font-size:.72rem; color:#4e6278"><?= $staff['role']==='admin'?'Administrator':'Mitarbeiter' ?></div>
|
<div style="font-size:.82rem; font-weight:600; color:#fff; overflow:hidden; text-overflow:ellipsis; white-space:nowrap"><?= e($staff['name']) ?></div>
|
||||||
<?php if (!empty($staff['is_on_vacation'])): ?>
|
<div style="font-size:.72rem; color:#4e6278"><?= $staff['role']==='admin'?'Administrator':'Mitarbeiter' ?></div>
|
||||||
<div style="font-size:.7rem; color:var(--accent)">🌴 Im Urlaub</div>
|
<?php if (!empty($staff['is_on_vacation'])): ?>
|
||||||
<?php endif; ?>
|
<div style="font-size:.7rem; color:var(--accent)">🌴 Im Urlaub</div>
|
||||||
</div>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="lang-row" style="margin-bottom:10px"><?= i18n_switcher_html('dark') ?></div>
|
</div>
|
||||||
<div style="display:flex; gap:14px; align-items:center">
|
<div class="lang-row" style="margin-bottom:10px"><?= i18n_switcher_html('dark') ?></div>
|
||||||
|
<div style="display:flex; gap:14px; align-items:center">
|
||||||
<?php
|
|
||||||
$__unreadMentions = 0;
|
<?php
|
||||||
$__unreadChat = 0;
|
$__unreadMentions = 0;
|
||||||
if ($staff) {
|
$__unreadChat = 0;
|
||||||
$__ms = get_db()->prepare('SELECT COUNT(*) FROM staff_mentions WHERE mentioned_staff_id=? AND is_read=0');
|
if ($staff) {
|
||||||
$__ms->execute([$staff['id']]);
|
$__ms = get_db()->prepare('SELECT COUNT(*) FROM staff_mentions WHERE mentioned_staff_id=? AND is_read=0');
|
||||||
$__unreadMentions = (int)$__ms->fetchColumn();
|
$__ms->execute([$staff['id']]);
|
||||||
$__cs = get_db()->prepare('SELECT COUNT(*) FROM staff_chat_messages WHERE to_staff_id=? AND is_read=0');
|
$__unreadMentions = (int)$__ms->fetchColumn();
|
||||||
$__cs->execute([$staff['id']]);
|
$__cs = get_db()->prepare('SELECT COUNT(*) FROM staff_chat_messages WHERE to_staff_id=? AND is_read=0');
|
||||||
$__unreadChat = (int)$__cs->fetchColumn();
|
$__cs->execute([$staff['id']]);
|
||||||
}
|
$__unreadChat = (int)$__cs->fetchColumn();
|
||||||
?>
|
}
|
||||||
<a href="/staff/chat.php" title="Interner Chat" style="position:relative; color:#8b97a3; font-size:.78rem; text-decoration:none">
|
?>
|
||||||
💬<?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; ?>
|
<a href="/staff/chat.php" title="Interner Chat" style="position:relative; color:#8b97a3; font-size:.78rem; text-decoration:none">
|
||||||
</a>
|
💬<?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; ?>
|
||||||
<a href="/staff/mentions.php" title="Erwähnungen" style="position:relative; color:#8b97a3; font-size:.78rem; text-decoration:none">
|
</a>
|
||||||
🔔<?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; ?>
|
<a href="/staff/mentions.php" title="Erwähnungen" style="position:relative; color:#8b97a3; font-size:.78rem; text-decoration:none">
|
||||||
</a>
|
🔔<?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; ?>
|
||||||
<a href="/staff/profile.php" style="color:#8b97a3; font-size:.78rem">Profil</a>
|
</a>
|
||||||
<a href="/staff/logout.php" style="color:#8b97a3; font-size:.78rem">Abmelden</a>
|
<a href="/staff/profile.php" style="color:#8b97a3; font-size:.78rem">Profil</a>
|
||||||
</div>
|
<a href="/staff/logout.php" style="color:#8b97a3; font-size:.78rem">Abmelden</a>
|
||||||
<?php endif; ?>
|
</div>
|
||||||
</div>
|
<?php endif; ?>
|
||||||
</aside>
|
</div>
|
||||||
|
</aside>
|
||||||
<?php
|
|
||||||
// Timeout in JS übergeben
|
<?php
|
||||||
$_jsTimeout = (int)(get_setting('staff_session_timeout', '30') ?: 30);
|
// Timeout in JS übergeben
|
||||||
$_jsLastAct = $_SESSION['staff_last_activity'] ?? time();
|
$_jsTimeout = (int)(get_setting('staff_session_timeout', '30') ?: 30);
|
||||||
if (!isset($_SESSION['staff_last_activity'])) {
|
$_jsLastAct = $_SESSION['staff_last_activity'] ?? time();
|
||||||
$_SESSION['staff_last_activity'] = time();
|
if (!isset($_SESSION['staff_last_activity'])) {
|
||||||
$_jsLastAct = time();
|
$_SESSION['staff_last_activity'] = time();
|
||||||
}
|
$_jsLastAct = time();
|
||||||
$_jsRemaining = max(10, ($_jsLastAct + $_jsTimeout * 60) - time());
|
}
|
||||||
?>
|
$_jsRemaining = max(10, ($_jsLastAct + $_jsTimeout * 60) - time());
|
||||||
<script>
|
?>
|
||||||
window.sessionTimerRemaining = <?= (int)$_jsRemaining ?>;
|
<script>
|
||||||
window.sessionTimerTimeout = <?= (int)$_jsTimeout ?>;
|
window.sessionTimerRemaining = <?= (int)$_jsRemaining ?>;
|
||||||
</script>
|
window.sessionTimerTimeout = <?= (int)$_jsTimeout ?>;
|
||||||
<script>
|
</script>
|
||||||
(function() {
|
<script>
|
||||||
var remaining = window.sessionTimerRemaining || 0;
|
(function() {
|
||||||
var timeoutMin = window.sessionTimerTimeout || 30;
|
var remaining = window.sessionTimerRemaining || 0;
|
||||||
|
var timeoutMin = window.sessionTimerTimeout || 30;
|
||||||
function init() {
|
|
||||||
var el = document.getElementById('session-timer');
|
function init() {
|
||||||
var bar = document.getElementById('session-timer-bar');
|
var el = document.getElementById('session-timer');
|
||||||
if (!el || !bar || remaining <= 0) return;
|
var bar = document.getElementById('session-timer-bar');
|
||||||
|
if (!el || !bar || remaining <= 0) return;
|
||||||
function fmt(s) {
|
|
||||||
var m = Math.floor(s / 60);
|
function fmt(s) {
|
||||||
var sec = s % 60;
|
var m = Math.floor(s / 60);
|
||||||
return m + ':' + (sec < 10 ? '0' : '') + sec;
|
var sec = s % 60;
|
||||||
}
|
return m + ':' + (sec < 10 ? '0' : '') + sec;
|
||||||
|
}
|
||||||
function tick() {
|
|
||||||
if (remaining <= 0) {
|
function tick() {
|
||||||
window.location.href = '/staff/login.php';
|
if (remaining <= 0) {
|
||||||
return;
|
window.location.href = '/staff/login.php';
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
el.textContent = fmt(remaining);
|
|
||||||
|
el.textContent = fmt(remaining);
|
||||||
// Immer sichtbar
|
|
||||||
bar.style.opacity = '1';
|
// Immer sichtbar
|
||||||
bar.style.pointerEvents = 'auto';
|
bar.style.opacity = '1';
|
||||||
|
bar.style.pointerEvents = 'auto';
|
||||||
// Farbe nach Dringlichkeit
|
|
||||||
if (remaining <= 60) {
|
// Farbe nach Dringlichkeit
|
||||||
bar.style.background = 'rgba(239,68,68,.9)';
|
if (remaining <= 60) {
|
||||||
bar.style.borderColor = 'rgba(239,68,68,.5)';
|
bar.style.background = 'rgba(239,68,68,.9)';
|
||||||
el.style.color = '#fff';
|
bar.style.borderColor = 'rgba(239,68,68,.5)';
|
||||||
} else if (remaining <= 300) {
|
el.style.color = '#fff';
|
||||||
bar.style.background = 'rgba(245,158,11,.9)';
|
} else if (remaining <= 300) {
|
||||||
bar.style.borderColor = 'rgba(245,158,11,.5)';
|
bar.style.background = 'rgba(245,158,11,.9)';
|
||||||
el.style.color = '#fff';
|
bar.style.borderColor = 'rgba(245,158,11,.5)';
|
||||||
} else {
|
el.style.color = '#fff';
|
||||||
bar.style.background = 'rgba(15,23,42,.72)';
|
} else {
|
||||||
bar.style.borderColor = 'rgba(255,255,255,.1)';
|
bar.style.background = 'rgba(15,23,42,.72)';
|
||||||
el.style.color = '#cbd5e1';
|
bar.style.borderColor = 'rgba(255,255,255,.1)';
|
||||||
}
|
el.style.color = '#cbd5e1';
|
||||||
|
}
|
||||||
remaining--;
|
|
||||||
setTimeout(tick, 1000);
|
remaining--;
|
||||||
}
|
setTimeout(tick, 1000);
|
||||||
|
}
|
||||||
tick();
|
|
||||||
|
tick();
|
||||||
// Bei jeder Nutzeraktion (Klick, Tastatur) Timer via fetch zurücksetzen
|
|
||||||
var resetDebounce;
|
// Bei jeder Nutzeraktion (Klick, Tastatur) Timer via fetch zurücksetzen
|
||||||
function resetTimer() {
|
var resetDebounce;
|
||||||
clearTimeout(resetDebounce);
|
function resetTimer() {
|
||||||
resetDebounce = setTimeout(function() {
|
clearTimeout(resetDebounce);
|
||||||
fetch('/staff/session_ping.php', { method:'POST',
|
resetDebounce = setTimeout(function() {
|
||||||
headers:{'X-CSRF-Token': document.querySelector('meta[name=csrf]')?.content || ''},
|
fetch('/staff/session_ping.php', { method:'POST',
|
||||||
credentials:'same-origin' })
|
headers:{'X-CSRF-Token': document.querySelector('meta[name=csrf]')?.content || ''},
|
||||||
.then(function(r){ return r.json(); })
|
credentials:'same-origin' })
|
||||||
.then(function(d){ if (d.remaining) remaining = d.remaining; })
|
.then(function(r){ return r.json(); })
|
||||||
.catch(function(){});
|
.then(function(d){ if (d.remaining) remaining = d.remaining; })
|
||||||
}, 2000); // max. alle 2 Sek. ein Ping
|
.catch(function(){});
|
||||||
}
|
}, 2000); // max. alle 2 Sek. ein Ping
|
||||||
|
}
|
||||||
['click','keydown','mousemove','scroll','touchstart'].forEach(function(ev) {
|
|
||||||
document.addEventListener(ev, resetTimer, { passive: true });
|
['click','keydown','mousemove','scroll','touchstart'].forEach(function(ev) {
|
||||||
});
|
document.addEventListener(ev, resetTimer, { passive: true });
|
||||||
|
});
|
||||||
// Restzeit regelmäßig beim Server erfragen (verlängert nichts): Aktivität in einem anderen Tab verlängert die Zeit hier mit,
|
|
||||||
// und ist die Sitzung wirklich abgelaufen, geht es sofort zur Anmeldung
|
// Restzeit regelmäßig beim Server erfragen (verlängert nichts): Aktivität in einem anderen Tab verlängert die Zeit hier mit,
|
||||||
function syncTimer() {
|
// und ist die Sitzung wirklich abgelaufen, geht es sofort zur Anmeldung
|
||||||
fetch('/staff/session_ping.php?check=1', { credentials:'same-origin', cache:'no-store' })
|
function syncTimer() {
|
||||||
.then(function(r){ if (r.status === 401) { window.location.href = '/staff/login.php'; return null; } return r.json(); })
|
fetch('/staff/session_ping.php?check=1', { credentials:'same-origin', cache:'no-store' })
|
||||||
.then(function(d){ if (d && typeof d.remaining === 'number') remaining = d.remaining; })
|
.then(function(r){ if (r.status === 401) { window.location.href = '/staff/login.php'; return null; } return r.json(); })
|
||||||
.catch(function(){});
|
.then(function(d){ if (d && typeof d.remaining === 'number') remaining = d.remaining; })
|
||||||
}
|
.catch(function(){});
|
||||||
setInterval(syncTimer, 30000);
|
}
|
||||||
} // end init
|
setInterval(syncTimer, 30000);
|
||||||
|
} // end init
|
||||||
if (document.readyState === 'loading') {
|
|
||||||
document.addEventListener('DOMContentLoaded', init);
|
if (document.readyState === 'loading') {
|
||||||
} else {
|
document.addEventListener('DOMContentLoaded', init);
|
||||||
init();
|
} else {
|
||||||
}
|
init();
|
||||||
})();
|
}
|
||||||
</script>
|
})();
|
||||||
|
</script>
|
||||||
<script>
|
|
||||||
// ── Browser Push Notifications ───────────────────────────────────────────
|
<script>
|
||||||
(function() {
|
// ── Browser Push Notifications ───────────────────────────────────────────
|
||||||
var pushKey = document.querySelector('meta[name=push-key]')?.content || document.getElementById('push-vapid-key')?.value;
|
(function() {
|
||||||
if (!pushKey || !('serviceWorker' in navigator) || !('PushManager' in window)) return;
|
var pushKey = document.querySelector('meta[name=push-key]')?.content || document.getElementById('push-vapid-key')?.value;
|
||||||
var btn = document.getElementById('push-toggle-btn');
|
if (!pushKey || !('serviceWorker' in navigator) || !('PushManager' in window)) return;
|
||||||
|
var btn = document.getElementById('push-toggle-btn');
|
||||||
function urlB64ToUint8(b64) {
|
|
||||||
var pad = '='.repeat((4 - b64.length % 4) % 4);
|
function urlB64ToUint8(b64) {
|
||||||
var raw = atob(b64.replace(/-/g,'+').replace(/_/g,'/') + pad);
|
var pad = '='.repeat((4 - b64.length % 4) % 4);
|
||||||
return Uint8Array.from([...raw].map(function(ch){ return ch.charCodeAt(0); }));
|
var raw = atob(b64.replace(/-/g,'+').replace(/_/g,'/') + pad);
|
||||||
}
|
return Uint8Array.from([...raw].map(function(ch){ return ch.charCodeAt(0); }));
|
||||||
|
}
|
||||||
function setBtn(active) {
|
|
||||||
if (!btn) return;
|
function setBtn(active) {
|
||||||
btn.textContent = active ? '🔔' : '🔕';
|
if (!btn) return;
|
||||||
btn.style.color = active ? '#22c55e' : '#8b97a3';
|
btn.textContent = active ? '🔔' : '🔕';
|
||||||
btn.title = active ? 'Push aktiv – klicken zum Deaktivieren' : 'Push-Benachrichtigungen aktivieren';
|
btn.style.color = active ? '#22c55e' : '#8b97a3';
|
||||||
}
|
btn.title = active ? 'Push aktiv – klicken zum Deaktivieren' : 'Push-Benachrichtigungen aktivieren';
|
||||||
|
}
|
||||||
navigator.serviceWorker.ready.then(function(reg) {
|
|
||||||
reg.pushManager.getSubscription().then(function(s) {
|
navigator.serviceWorker.ready.then(function(reg) {
|
||||||
setBtn(!!(s && Notification.permission === 'granted'));
|
reg.pushManager.getSubscription().then(function(s) {
|
||||||
});
|
setBtn(!!(s && Notification.permission === 'granted'));
|
||||||
});
|
});
|
||||||
|
});
|
||||||
window.togglePushNotifications = function() {
|
|
||||||
navigator.serviceWorker.ready.then(function(reg) {
|
window.togglePushNotifications = function() {
|
||||||
reg.pushManager.getSubscription().then(function(sub) {
|
navigator.serviceWorker.ready.then(function(reg) {
|
||||||
if (sub) {
|
reg.pushManager.getSubscription().then(function(sub) {
|
||||||
sub.unsubscribe().then(function() {
|
if (sub) {
|
||||||
fetch('/staff/push_subscribe.php', { method:'POST', credentials:'same-origin',
|
sub.unsubscribe().then(function() {
|
||||||
headers:{'Content-Type':'application/json'},
|
fetch('/staff/push_subscribe.php', { method:'POST', credentials:'same-origin',
|
||||||
body: JSON.stringify({action:'unsubscribe', endpoint: sub.endpoint}) });
|
headers:{'Content-Type':'application/json'},
|
||||||
setBtn(false);
|
body: JSON.stringify({action:'unsubscribe', endpoint: sub.endpoint}) });
|
||||||
});
|
setBtn(false);
|
||||||
} else {
|
});
|
||||||
Notification.requestPermission().then(function(perm) {
|
} else {
|
||||||
if (perm !== 'granted') { alert('Bitte Benachrichtigungen im Browser erlauben.'); return; }
|
Notification.requestPermission().then(function(perm) {
|
||||||
reg.pushManager.subscribe({ userVisibleOnly:true, applicationServerKey: urlB64ToUint8(pushKey) })
|
if (perm !== 'granted') { alert('Bitte Benachrichtigungen im Browser erlauben.'); return; }
|
||||||
.then(function(ns) {
|
reg.pushManager.subscribe({ userVisibleOnly:true, applicationServerKey: urlB64ToUint8(pushKey) })
|
||||||
var j = ns.toJSON();
|
.then(function(ns) {
|
||||||
fetch('/staff/push_subscribe.php', { method:'POST', credentials:'same-origin',
|
var j = ns.toJSON();
|
||||||
headers:{'Content-Type':'application/json'},
|
fetch('/staff/push_subscribe.php', { method:'POST', credentials:'same-origin',
|
||||||
body: JSON.stringify({action:'subscribe', endpoint:j.endpoint, keys:j.keys}) })
|
headers:{'Content-Type':'application/json'},
|
||||||
.then(function() { setBtn(true); });
|
body: JSON.stringify({action:'subscribe', endpoint:j.endpoint, keys:j.keys}) })
|
||||||
}).catch(function(err) { alert('Push fehlgeschlagen: ' + err.message); });
|
.then(function() { setBtn(true); });
|
||||||
});
|
}).catch(function(err) { alert('Push fehlgeschlagen: ' + err.message); });
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
})();
|
};
|
||||||
</script>
|
})();
|
||||||
<script src="/assets/js/sidebar.js?v=<?= @filemtime(__DIR__ . "/../assets/js/sidebar.js") ?: time() ?>"></script>
|
</script>
|
||||||
<main class="main">
|
<script src="/assets/js/sidebar.js?v=<?= @filemtime(__DIR__ . "/../assets/js/sidebar.js") ?: time() ?>"></script>
|
||||||
<!-- Session-Timer: kompakte Pille oben rechts -->
|
<main class="main">
|
||||||
<div id="session-timer-bar" style="position:fixed;top:12px;right:16px;z-index:9999;display:flex;align-items:center;gap:6px;background:rgba(15,23,42,.75);backdrop-filter:blur(6px);border:1px solid rgba(255,255,255,.1);border-radius:20px;padding:4px 12px 4px 8px;pointer-events:none;opacity:0;transition:opacity .3s">
|
<!-- Session-Timer: kompakte Pille oben rechts -->
|
||||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="#94a3b8" stroke-width="2.5"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
|
<div id="session-timer-bar" style="position:fixed;top:12px;right:16px;z-index:9999;display:flex;align-items:center;gap:6px;background:rgba(15,23,42,.75);backdrop-filter:blur(6px);border:1px solid rgba(255,255,255,.1);border-radius:20px;padding:4px 12px 4px 8px;pointer-events:none;opacity:0;transition:opacity .3s">
|
||||||
<span id="session-timer" style="font-size:.72rem;font-weight:700;color:#cbd5e1;font-variant-numeric:tabular-nums;letter-spacing:.02em"></span>
|
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="#94a3b8" stroke-width="2.5"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
|
||||||
</div>
|
<span id="session-timer" style="font-size:.72rem;font-weight:700;color:#cbd5e1;font-variant-numeric:tabular-nums;letter-spacing:.02em"></span>
|
||||||
<?= plugin_filter('staff.page.top', '', ['staff' => $staff ?? null, 'activePage' => $activePage ?? '']) /* Hinweise von Plugins oben auf jeder Seite (fertiges HTML aus vertrauenswürdigem Plugin-Code) */ ?>
|
</div>
|
||||||
<?php foreach (get_flashes() as $f): ?>
|
<?= plugin_filter('staff.page.top', '', ['staff' => $staff ?? null, 'activePage' => $activePage ?? '']) /* Hinweise von Plugins oben auf jeder Seite (fertiges HTML aus vertrauenswürdigem Plugin-Code) */ ?>
|
||||||
<div class="flash <?= e($f['type']) ?>"><?= e($f['message']) ?></div>
|
<?php foreach (get_flashes() as $f): ?>
|
||||||
<?php endforeach; ?>
|
<div class="flash <?= e($f['type']) ?>"><?= e($f['message']) ?></div>
|
||||||
<?php
|
<?php endforeach; ?>
|
||||||
if (isset($staff) && has_permission($staff, 'manage_email_addresses')) {
|
<?php
|
||||||
foreach (system_health(get_db()) as $__issue): ?>
|
if (isset($staff) && has_permission($staff, 'manage_email_addresses')) {
|
||||||
<div class="flash <?= $__issue['level'] === 'error' ? 'error' : 'warning' ?>" style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
foreach (system_health(get_db()) as $__issue): ?>
|
||||||
<strong><?= $__issue['level'] === 'error' ? 'Störung:' : 'Hinweis:' ?></strong> <?= e($__issue['message']) ?>
|
<div class="flash <?= $__issue['level'] === 'error' ? 'error' : 'warning' ?>" style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
||||||
<a href="/staff/email_addresses.php" style="margin-left:auto">E-Mail-Adressen öffnen</a>
|
<strong><?= $__issue['level'] === 'error' ? 'Störung:' : 'Hinweis:' ?></strong> <?= e($__issue['message']) ?>
|
||||||
</div>
|
<a href="/staff/email_addresses.php" style="margin-left:auto">E-Mail-Adressen öffnen</a>
|
||||||
<?php endforeach; } ?>
|
</div>
|
||||||
<?php
|
<?php endforeach; } ?>
|
||||||
if (isset($staff) && ($staff['role'] ?? '') === 'admin' && ($activePage ?? '') !== 'update') {
|
<?php
|
||||||
require_once __DIR__ . '/../database/migrate.php';
|
if (isset($staff) && ($staff['role'] ?? '') === 'admin' && ($activePage ?? '') !== 'update') {
|
||||||
$__pending = migrations_pending(get_db());
|
require_once __DIR__ . '/../database/migrate.php';
|
||||||
if ($__pending): ?>
|
$__pending = migrations_pending(get_db());
|
||||||
<div class="flash warning" style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
if ($__pending): ?>
|
||||||
<strong>Datenbank veraltet:</strong> <?= count($__pending) ?> ausstehende Änderung(en) – der Code ist neuer als die Datenbank.
|
<div class="flash warning" style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
||||||
<a href="/staff/update.php" style="margin-left:auto">Jetzt aktualisieren</a>
|
<strong>Datenbank veraltet:</strong> <?= count($__pending) ?> ausstehende Änderung(en) – der Code ist neuer als die Datenbank.
|
||||||
</div>
|
<a href="/staff/update.php" style="margin-left:auto">Jetzt aktualisieren</a>
|
||||||
<?php endif; } ?>
|
</div>
|
||||||
<?php
|
<?php endif; } ?>
|
||||||
if (isset($staff) && ($staff['role'] ?? '') === 'admin' && ($activePage ?? '') !== 'plugins' && plugin_official_configured()) {
|
<?php
|
||||||
$__upd = plugin_updates_available(get_db());
|
if (isset($staff) && ($staff['role'] ?? '') === 'admin' && ($activePage ?? '') !== 'plugins' && plugin_official_configured()) {
|
||||||
if ($__upd): ?>
|
$__upd = plugin_updates_available(get_db());
|
||||||
<div class="flash warning" style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
if ($__upd): ?>
|
||||||
<strong>Plugin-Updates verfügbar:</strong> <?= e(implode(', ', array_map(fn($u) => $u['name'] . ' ' . $u['available'], $__upd))) ?>
|
<div class="flash warning" style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
||||||
<a href="/staff/plugins.php" style="margin-left:auto">Zu den Plugins</a>
|
<strong>Plugin-Updates verfügbar:</strong> <?= e(implode(', ', array_map(fn($u) => $u['name'] . ' ' . $u['available'], $__upd))) ?>
|
||||||
</div>
|
<a href="/staff/plugins.php" style="margin-left:auto">Zu den Plugins</a>
|
||||||
<?php endif; } ?>
|
</div>
|
||||||
<?php $lockedOverride = get_locked_ticket_override(); ?>
|
<?php endif; } ?>
|
||||||
<?php if ($lockedOverride && isset($staff) && $staff['role'] === 'admin'): ?>
|
<?php $lockedOverride = get_locked_ticket_override(); ?>
|
||||||
<div class="flash warning" style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
<?php if ($lockedOverride && isset($staff) && $staff['role'] === 'admin'): ?>
|
||||||
🔓 Als Admin können Sie die Sperre von „<?= e($lockedOverride['name']) ?>“ auf Ticket #<?= e($lockedOverride['number']) ?> sofort aufheben, statt auf den automatischen Timeout zu warten.
|
<div class="flash warning" style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
||||||
<form method="post" action="/staff/ticket_view.php?n=<?= urlencode($lockedOverride['number']) ?>" style="margin:0">
|
🔓 Als Admin können Sie die Sperre von „<?= e($lockedOverride['name']) ?>“ auf Ticket #<?= e($lockedOverride['number']) ?> sofort aufheben, statt auf den automatischen Timeout zu warten.
|
||||||
<?= csrf_field() ?>
|
<form method="post" action="/staff/ticket_view.php?n=<?= urlencode($lockedOverride['number']) ?>" style="margin:0">
|
||||||
<input type="hidden" name="action" value="admin_force_unlock">
|
<?= csrf_field() ?>
|
||||||
<input type="hidden" name="locked_by_name" value="<?= e($lockedOverride['name']) ?>">
|
<input type="hidden" name="action" value="admin_force_unlock">
|
||||||
<button type="submit" class="btn btn-sm" style="padding:4px 10px;font-size:.78rem">Sperre jetzt aufheben</button>
|
<input type="hidden" name="locked_by_name" value="<?= e($lockedOverride['name']) ?>">
|
||||||
</form>
|
<button type="submit" class="btn btn-sm" style="padding:4px 10px;font-size:.78rem">Sperre jetzt aufheben</button>
|
||||||
</div>
|
</form>
|
||||||
<?php endif; ?>
|
</div>
|
||||||
<?php if (isset($staff) && $staff['role'] === 'admin' && (config()['db']['driver'] ?? 'sqlite') === 'sqlite'): ?>
|
<?php endif; ?>
|
||||||
<div class="flash warning" style="display:flex;align-items:center;gap:10px">
|
<?php if (isset($staff) && $staff['role'] === 'admin' && (config()['db']['driver'] ?? 'sqlite') === 'sqlite'): ?>
|
||||||
⚠️ <strong>SQLite-Modus aktiv:</strong> Nicht für den Produktivbetrieb geeignet.
|
<div class="flash warning" style="display:flex;align-items:center;gap:10px">
|
||||||
Bitte in <code>config/config.php</code> auf <code>driver = 'mysql'</code> umstellen und MySQL-Zugangsdaten eintragen.
|
⚠️ <strong>SQLite-Modus aktiv:</strong> Nicht für den Produktivbetrieb geeignet.
|
||||||
</div>
|
Bitte in <code>config/config.php</code> auf <code>driver = 'mysql'</code> umstellen und MySQL-Zugangsdaten eintragen.
|
||||||
<?php endif; ?>
|
</div>
|
||||||
<?php if (isset($staff) && $staff['role'] === 'admin' && empty(config()['app_key']) && !get_setting('app_key')): ?>
|
<?php endif; ?>
|
||||||
<div class="flash warning" style="display:flex;align-items:center;gap:10px">
|
<?php if (isset($staff) && $staff['role'] === 'admin' && empty(config()['app_key']) && !get_setting('app_key')): ?>
|
||||||
🔑 <strong>Kein App-Key gesetzt:</strong> Passwörter werden nur schwach verschlüsselt.
|
<div class="flash warning" style="display:flex;align-items:center;gap:10px">
|
||||||
Bitte in <code>config/config.php</code> den Wert <code>app_key</code> setzen.
|
🔑 <strong>Kein App-Key gesetzt:</strong> Passwörter werden nur schwach verschlüsselt.
|
||||||
Generieren: <code>php -r "echo bin2hex(random_bytes(32));"</code>
|
Bitte in <code>config/config.php</code> den Wert <code>app_key</code> setzen.
|
||||||
</div>
|
Generieren: <code>php -r "echo bin2hex(random_bytes(32));"</code>
|
||||||
<?php endif; ?>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|||||||
@@ -108,10 +108,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
if ($action === 'save_settings') {
|
if ($action === 'save_settings') {
|
||||||
$onVacation = !empty($_POST['is_on_vacation']) ? 1 : 0;
|
$onVacation = !empty($_POST['is_on_vacation']) ? 1 : 0;
|
||||||
$substituteId = ($_POST['vacation_substitute_id'] ?? '') !== '' ? (int)$_POST['vacation_substitute_id'] : null;
|
$substituteId = ($_POST['vacation_substitute_id'] ?? '') !== '' ? (int)$_POST['vacation_substitute_id'] : null;
|
||||||
|
$beforeRow = $pdo->prepare('SELECT is_on_vacation, vacation_substitute_id FROM staff WHERE id = ?');
|
||||||
|
$beforeRow->execute([$staff['id']]);
|
||||||
|
$beforeRow = $beforeRow->fetch() ?: ['is_on_vacation' => 0, 'vacation_substitute_id' => null];
|
||||||
$pdo->prepare('UPDATE staff SET is_on_vacation=?, vacation_substitute_id=? WHERE id=?')
|
$pdo->prepare('UPDATE staff SET is_on_vacation=?, vacation_substitute_id=? WHERE id=?')
|
||||||
->execute([$onVacation, $substituteId, $staff['id']]);
|
->execute([$onVacation, $substituteId, $staff['id']]);
|
||||||
audit_log($staff['id'], $onVacation ? 'Abwesenheit aktiviert' : 'Abwesenheit deaktiviert');
|
audit_log($staff['id'], $onVacation ? 'Abwesenheit aktiviert' : 'Abwesenheit deaktiviert');
|
||||||
flash('success', 'Einstellungen gespeichert.');
|
// Offene Tickets an die Vertretung weitergeben bzw. nach dem Urlaub zurückholen
|
||||||
|
[$handed, $back] = vacation_apply_change($pdo, (int) $staff['id'], [$beforeRow['is_on_vacation'], $beforeRow['vacation_substitute_id']], [$onVacation, $substituteId], !empty($_POST['hand_over']));
|
||||||
|
flash('success', 'Einstellungen gespeichert.' . ($handed ? ' ' . $handed . ' offene Tickets wurden an die Vertretung weitergegeben.' : '') . ($back ? ' ' . $back . ' Tickets sind wieder bei Ihnen.' : ''));
|
||||||
redirect('/staff/profile.php?tab=settings');
|
redirect('/staff/profile.php?tab=settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,6 +134,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
redirect('/staff/profile.php?tab=account');
|
redirect('/staff/profile.php?tab=account');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Gemerktes Gerät entfernen (Anmelde-Wächter) ────────────────
|
||||||
|
if ($action === 'forget_device') {
|
||||||
|
$pdo->prepare('DELETE FROM login_devices WHERE id = ? AND staff_id = ?')->execute([(int) ($_POST['device_id'] ?? 0), $staff['id']]);
|
||||||
|
flash('success', 'Gerät entfernt.');
|
||||||
|
redirect('/staff/profile.php?tab=security');
|
||||||
|
}
|
||||||
|
|
||||||
// ── 2FA aktivieren ─────────────────────────────────────────────
|
// ── 2FA aktivieren ─────────────────────────────────────────────
|
||||||
if ($action === 'enable_2fa') {
|
if ($action === 'enable_2fa') {
|
||||||
$code = trim($_POST['totp_code'] ?? '');
|
$code = trim($_POST['totp_code'] ?? '');
|
||||||
@@ -352,7 +364,7 @@ require __DIR__ . '/_header.php';
|
|||||||
<input type="checkbox" name="is_on_vacation" value="1" style="width:auto; margin-top:3px; flex-shrink:0" <?= $me['is_on_vacation'] ? 'checked' : '' ?>>
|
<input type="checkbox" name="is_on_vacation" value="1" style="width:auto; margin-top:3px; flex-shrink:0" <?= $me['is_on_vacation'] ? 'checked' : '' ?>>
|
||||||
<span>
|
<span>
|
||||||
<strong>Urlaubsmodus aktiv</strong><br>
|
<strong>Urlaubsmodus aktiv</strong><br>
|
||||||
<span class="muted" style="font-size:.84rem">Neue Tickets werden nicht automatisch diesem Konto zugewiesen, während der Urlaubsmodus aktiv ist. Bereits zugewiesene Tickets bleiben unverändert.</span>
|
<span class="muted" style="font-size:.84rem">Neue Tickets werden nicht automatisch diesem Konto zugewiesen, während der Urlaubsmodus aktiv ist.</span>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<label style="margin-top:14px">Vertretung (optional)</label>
|
<label style="margin-top:14px">Vertretung (optional)</label>
|
||||||
@@ -362,7 +374,11 @@ require __DIR__ . '/_header.php';
|
|||||||
<option value="<?= $a['id'] ?>" <?= ($me['vacation_substitute_id'] ?? '') == $a['id'] ? 'selected' : '' ?>><?= e($a['name']) ?></option>
|
<option value="<?= $a['id'] ?>" <?= ($me['vacation_substitute_id'] ?? '') == $a['id'] ? 'selected' : '' ?>><?= e($a['name']) ?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
<p class="muted" style="font-size:.8rem">Neue Tickets werden während Ihrer Abwesenheit automatisch dieser Person zugewiesen.</p>
|
<p class="muted" style="font-size:.8rem">Neue Tickets werden während Ihrer Abwesenheit automatisch dieser Person zugewiesen. Sie sieht dafür auch Ihre Abteilungen.</p>
|
||||||
|
<label style="display:flex; align-items:flex-start; gap:12px; cursor:pointer; font-weight:400; margin-top:10px">
|
||||||
|
<input type="checkbox" name="hand_over" value="1" style="width:auto; margin-top:3px; flex-shrink:0" checked>
|
||||||
|
<span><strong>Meine offenen Tickets an die Vertretung weitergeben</strong><br><span class="muted" style="font-size:.84rem">Beim Speichern gehen Ihre offenen Tickets an die Vertretung. Wenn Sie den Urlaubsmodus beenden, kommen die Tickets zurück, die dann noch offen bei ihr liegen. Ohne Vertretung passiert nichts.</span></span>
|
||||||
|
</label>
|
||||||
<?php if ($me['is_on_vacation']): ?>
|
<?php if ($me['is_on_vacation']): ?>
|
||||||
<div class="flash info" style="margin-top:8px">Urlaubsmodus ist aktuell <strong>aktiv</strong>. Sie erhalten keine automatischen Ticket-Zuweisungen.</div>
|
<div class="flash info" style="margin-top:8px">Urlaubsmodus ist aktuell <strong>aktiv</strong>. Sie erhalten keine automatischen Ticket-Zuweisungen.</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@@ -480,6 +496,44 @@ $setupSecret = $_SESSION['totp_setup_secret'] ?? '';
|
|||||||
</form>
|
</form>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
|
$myDevices = $pdo->prepare('SELECT * FROM login_devices WHERE staff_id = ? ORDER BY last_seen DESC');
|
||||||
|
$myDevices->execute([$staff['id']]);
|
||||||
|
$myDevices = $myDevices->fetchAll();
|
||||||
|
$myEvents = $pdo->prepare('SELECT * FROM login_events WHERE staff_id = ? ORDER BY id DESC LIMIT 10');
|
||||||
|
$myEvents->execute([$staff['id']]);
|
||||||
|
$myEvents = $myEvents->fetchAll();
|
||||||
|
$eventLabels = login_guard_event_labels();
|
||||||
|
?>
|
||||||
|
<div class="card" style="margin-top:20px">
|
||||||
|
<h3>🛡️ Meine Geräte und Anmeldungen</h3>
|
||||||
|
<p class="muted" style="font-size:.88rem">Von diesen Geräten haben Sie sich schon angemeldet. Meldet sich jemand von einem neuen Gerät oder Ort an, bekommen Sie eine Mail. Ein Gerät, das Sie nicht kennen, können Sie hier entfernen; ändern Sie dann auch Ihr Passwort.</p>
|
||||||
|
<?php if (!$myDevices): ?><p class="muted">Noch keine Geräte gemerkt.</p><?php else: ?>
|
||||||
|
<div style="overflow-x:auto"><table>
|
||||||
|
<thead><tr><th>Gerät</th><th>Letzter Ort</th><th>Zuletzt gesehen</th><th></th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($myDevices as $d): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= e($d['label']) ?><div class="muted" style="font-size:.76rem"><?= $d['channel'] === 'app' ? 'App' : 'Browser' ?>, seit <span><?= e(date('d.m.Y', strtotime((string) $d['first_seen']))) ?></span></div></td>
|
||||||
|
<td><?= e($d['place']) ?><div class="muted" style="font-size:.76rem"><?= e($d['last_ip']) ?></div></td>
|
||||||
|
<td><?= e(date('d.m.Y H:i', strtotime((string) $d['last_seen']))) ?></td>
|
||||||
|
<td><form method="post" onsubmit="return confirm('Dieses Gerät entfernen? Die nächste Anmeldung davon löst wieder eine Warnung aus.')"><?= csrf_field() ?><input type="hidden" name="action" value="forget_device"><input type="hidden" name="device_id" value="<?= (int) $d['id'] ?>"><button class="btn secondary" type="submit" style="padding:3px 8px;font-size:.78rem">Entfernen</button></form></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($myEvents): ?>
|
||||||
|
<h4 style="margin:18px 0 6px">Letzte Anmeldungen</h4>
|
||||||
|
<div style="overflow-x:auto"><table>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($myEvents as $ev): ?>
|
||||||
|
<tr><td style="white-space:nowrap"><?= e(date('d.m.Y H:i', strtotime((string) $ev['created_at']))) ?></td><td><?= e($eventLabels[$ev['event']] ?? $ev['event']) ?></td><td><?= e($ev['device']) ?></td><td><?= e($ev['place']) ?> <span class="muted">(<?= e($ev['ip']) ?>)</span></td></tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user