UI: User Avatar pills for Assigned tickets, updated Icons for Ticket Mine and Unusassigned tickets

This commit is contained in:
johnnyq
2026-09-29 18:02:05 -04:00
parent b15ef69bf4
commit 1666305a1c
11 changed files with 44 additions and 77 deletions

View File

@@ -225,6 +225,34 @@ function formatAddress($address, $city, $state, $zip, $country = '', $separator
}
/**
* The agent a ticket is assigned to, as a pill: their avatar (or their initials
* on a grey circle) then their name. Unassigned keeps the same shape with a
* user-slash circle - red while the ticket still needs someone, muted once it
* doesn't. Takes the RAW user columns and escapes them itself.
* Bootstrap 5.3 utilities and Font Awesome only - no custom CSS.
*/
function formatAssignee($user_id, $user_name, $user_avatar, $highlight_unassigned = true) {
$pill = "badge rounded-pill d-inline-flex align-items-center align-middle gap-1 p-1 pe-2";
$user_id = intval($user_id);
if (!$user_id) {
$tone = $highlight_unassigned ? 'danger' : 'secondary';
$colors = $highlight_unassigned ? 'text-danger-emphasis bg-danger-subtle' : 'text-body-secondary bg-body-secondary';
return "<span class='$pill $colors'><span class='position-relative d-inline-flex' aria-hidden='true'><i class='fas fa-circle fs-5 text-$tone'></i><i class='fas fa-user-slash position-absolute top-50 start-50 translate-middle small text-white'></i></span>Unassigned</span>";
}
$user_avatar = escapeHtml($user_avatar);
if ($user_avatar) {
$avatar = "<img src='/uploads/users/$user_id/$user_avatar' alt='' width='20' height='20' class='rounded-circle object-fit-cover'>";
} else {
$avatar = "<span class='position-relative d-inline-flex' aria-hidden='true'><i class='fas fa-circle fs-5 text-secondary'></i><span class='position-absolute top-50 start-50 translate-middle small text-white'><small>" . escapeHtml(initials($user_name)) . "</small></span></span>";
}
return "<span class='$pill text-body-emphasis bg-body-secondary'>$avatar" . escapeHtml($user_name) . "</span>";
}
function timeAgo($datetime) {
if (is_null($datetime)) {
return "-";