From 35a2b66038264b4364a36efdf2d4b6c4535cd9f0 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Wed, 29 Apr 2026 17:40:15 -0400 Subject: [PATCH] refactor: migrate P1/P2 SLA banner to lt-sla-p1/lt-sla-p2 component Replaces the lt-alert workaround with the new purpose-built SLA banner component now in base.css: - lt-sla-p1 (pulsing red) / lt-sla-p2 (static amber) wrapper classes - Structured subcomponents: lt-sla-icon, lt-sla-info, lt-sla-title, lt-sla-bar + lt-sla-fill (gradient fill), lt-sla-meta, lt-sla-dismiss - Dismiss now uses banner.hidden + sessionStorage key lt_sla_dismissed_ (aligns with web_template pattern; previous code used classList 'dismissed') - Elapsed/remaining/breach state driven by same tick() interval, now updating lt-sla-fill width instead of a separate lt-progress bar inside lt-alert-msg Co-Authored-By: Claude Sonnet 4.6 --- views/TicketView.php | 98 +++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 56 deletions(-) diff --git a/views/TicketView.php b/views/TicketView.php index 00fd051..c87570e 100644 --- a/views/TicketView.php +++ b/views/TicketView.php @@ -215,56 +215,58 @@ include __DIR__ . '/layout_header.php'; 1 => 8, 2 => 24, default => 72 }; $elapsedSeconds = time() - strtotime($ticket['created_at']); - $elapsedHours = round($elapsedSeconds / 3600, 1); $slaPct = min(100, round(($elapsedSeconds / ($slaTargetHours * 3600)) * 100)); $slaBreached = $elapsedSeconds >= ($slaTargetHours * 3600); - $alertClass = $priorityNum === 1 ? 'lt-alert--error' : 'lt-alert--warning'; - $alertIcon = $priorityNum === 1 ? '[ ! ]' : '[ ~ ]'; - $alertLabel = $priorityNum === 1 ? 'CRITICAL — P1 Ticket' : 'HIGH PRIORITY — P2 Ticket'; - $progressClass = $slaBreached ? 'lt-progress--red' : ($slaPct >= 75 ? 'lt-progress--red' : 'lt-progress--green'); + $slaClass = $priorityNum === 1 ? 'lt-sla-p1' : 'lt-sla-p2'; + $slaIcon = $priorityNum === 1 ? '[ ! ]' : '[ ~ ]'; + $slaLabel = $priorityNum === 1 ? 'P1 Critical' : 'P2 High'; + $slaId = 'sla-' . htmlspecialchars($ticket['ticket_id'], ENT_QUOTES, 'UTF-8'); ?> - -