$_POST['name'] ?? '', 'response_hours' => $_POST['response_hours'] ?? 0, 'resolution_hours' => $_POST['resolution_hours'] ?? 0, 'is_active' => ($_POST['status'] ?? 'active') === 'active', 'notes' => $_POST['notes'] ?? '', ]); audit_log($staff['id'], ($action === 'create' ? 'SLA-Plan erstellt: ' : 'SLA-Plan aktualisiert: ') . trim($_POST['name'] ?? '')); flash('success', $action === 'create' ? 'SLA-Plan erstellt.' : 'Änderungen gespeichert. Sie gelten für neue Tickets und bei Prioritätsänderung.'); redirect('/staff/sla_plans.php'); } catch (AdminModelException $e) { $errors[] = $e->getMessage(); } } if ($action === 'delete') { $deleted = sla_plan_delete($pdo, (int) $_POST['id']); audit_log($staff['id'], "SLA-Plan gelöscht: {$deleted}"); flash('success', 'SLA-Plan gelöscht. Betroffene Abteilungen und Themen nutzen wieder die Zeiten der Priorität.'); redirect('/staff/sla_plans.php'); } } $isNew = isset($_GET['new']); $editId = (int) ($_GET['edit'] ?? 0); $showForm = $isNew || $editId || ($errors && in_array($_POST['action'] ?? '', ['create', 'update'], true)); $plans = $pdo->query( 'SELECT p.*, (SELECT COUNT(*) FROM departments d WHERE d.sla_plan_id = p.id) AS dept_count, (SELECT COUNT(*) FROM help_topics h WHERE h.sla_plan_id = p.id) AS topic_count FROM sla_plans p ORDER BY p.name' )->fetchAll(); $editPlan = null; if ($editId) { $stmt = $pdo->prepare('SELECT * FROM sla_plans WHERE id = ?'); $stmt->execute([$editId]); $editPlan = $stmt->fetch() ?: null; } $hours = fn(int $h) => $h >= 24 && $h % 24 === 0 ? ($h / 24) . ' Tag' . ($h / 24 === 1 ? '' : 'e') : $h . ' Std'; $pageTitle = 'SLA-Pläne'; $activePage = 'sla_plans'; require __DIR__ . '/_header.php'; ?>
Benannte Reaktions- und Lösungszeiten, die du Abteilungen und Hilfethemen zuordnest. Ohne Zuordnung gelten die Zeiten der Priorität.
| Name | Status | Reaktion | Lösung | Abteilungen | Hilfethemen | Zuletzt aktualisiert | |
|---|---|---|---|---|---|---|---|
| = e($p['name']) ?> | = $p['is_active'] ? 'Aktiv' : 'Deaktiviert' ?> | = e($hours((int) $p['response_hours'])) ?> | = e($hours((int) $p['resolution_hours'])) ?> | = (int) $p['dept_count'] ?> | = (int) $p['topic_count'] ?> | = e(ui_date($p['updated_at'] ?? null)) ?> | Bearbeiten · |
| Noch keine SLA-Pläne angelegt. | |||||||