From 6bb56f7c511c7d4d022b4541f85c072fd14fcada Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 13 Sep 2024 13:31:18 -0400 Subject: [PATCH] UI Improvement to Domains, Certificates and Licenses listing: Updated Expire to show TimeAgo as well and to highlight table rows red if expiring within 14 Days, yellow for 90 days and gray if expired also updated side badges to refelect the badge color as well --- client_certificates.php | 26 ++++++++++++++++++-- client_domains.php | 25 +++++++++++++++++-- client_side_nav.php | 4 ++-- client_software.php | 21 +++++++++++++++- inc_all_client.php | 53 +++++++++++++++++++++++++++++++++++------ 5 files changed, 115 insertions(+), 14 deletions(-) diff --git a/client_certificates.php b/client_certificates.php index 4e116abc..86eef3fe 100644 --- a/client_certificates.php +++ b/client_certificates.php @@ -102,8 +102,27 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $certificate_expire = nullable_htmlentities($row['certificate_expire']); $certificate_created_at = nullable_htmlentities($row['certificate_created_at']); + $certificate_expire_ago = timeAgo($certificate_expire); + // Convert the expiry date to a timestamp + $certificate_expire_timestamp = strtotime($row['certificate_expire']); + $current_timestamp = time(); // Get current timestamp + + // Calculate the difference in days + $days_until_expiry = ($certificate_expire_timestamp - $current_timestamp) / (60 * 60 * 24); + + // Determine the class based on the number of days until expiry + if ($days_until_expiry <= 0) { + $tr_class = "table-secondary"; + } elseif ($days_until_expiry <= 14) { + $tr_class = "table-danger"; + } elseif ($days_until_expiry <= 90) { + $tr_class = "table-warning"; + } else { + $tr_class = ''; + } + ?> - +
@@ -125,7 +144,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - + +
+
+