From b3895068d2d6dd3e865397d69256153e3e649dc7 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Wed, 12 Nov 2025 21:34:24 +0000 Subject: [PATCH] final 2 --- header.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/header.php b/header.php index 0096fe6..26ee6dd 100644 --- a/header.php +++ b/header.php @@ -179,8 +179,22 @@ } $order_by_column = ($sort_column === 'timeframes') ? 'last_updated' : $sort_column; + $direction = ($sort_order === 'asc' ? 'ASC' : 'DESC'); - $order_clause = "ORDER BY " . $order_by_column . " " . ($sort_order === 'asc' ? 'ASC' : 'DESC'); + if ($order_by_column === 'status') { + $order_clause = "ORDER BY CASE status + WHEN 'Pending Submission' THEN 1 + WHEN '1st Step' THEN 2 + WHEN '1st Step Pending' THEN 3 + WHEN '2nd Step' THEN 4 + WHEN '2nd Step Pending' THEN 5 + WHEN 'Settled' THEN 6 + WHEN 'Withdrawn' THEN 7 + ELSE 8 + END " . $direction; + } else { + $order_clause = "ORDER BY " . $order_by_column . " " . $direction; + } try { $stmt = $pdo->prepare("SELECT * FROM grievances WHERE category = ? $order_clause");