QoL 54: booking lengths, dispatch board lengths and cron run times written 1h 30m like logged time, decimal hours written 12.5 h including project hours, and the client export minutes in the same form

This commit is contained in:
johnnyq
2026-11-21 01:15:09 -05:00
parent 8b332846b4
commit 14990ac931
6 changed files with 12 additions and 11 deletions

View File

@@ -224,6 +224,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u
- Capitals: page and window titles, menu items and buttons are in Title Case - New Ticket, Mark Reviewed, Back Up Now, Turn Off Portal Access - and field labels, section headings, tabs and help are in sentence case - Postal code, Tax rate, Physical location - in the agent pages, Admin and the client portal alike. The settings pages in the menu are now Company Details, Invoices and Billing, Purchase Orders, Client Portal and Single Sign-on.
- Lists: the first click on a column you aren't sorting by sorts names A-Z and dates, money and counts newest or largest first, and a second click flips it. It used to go the opposite way to the column you were on, so the first click could go either way.
- Badges and blanks: every badge is a rounded pill, the menu counts included, and an empty value shows as a grey dash everywhere. A request that can't be done - credit over the balance, say - shows in red like every other error, and the client portal's search boxes read Search ... like the agent pages'.
- Lengths of time: booking lengths, the dispatch board and how long a cron job ran are written 1h 30m like time logged everywhere else - they read 1 hour 30 min and 2 min 5 s - and hours as a number are 12.5 h, project hours included.
### Bug Fixes

View File

@@ -189,16 +189,16 @@ $took = function ($seconds) {
return 'under 0.1 s';
}
if ($seconds < 10) {
return rtrim(rtrim(number_format($seconds, 1), '0'), '.') . ' s';
return rtrim(rtrim(number_format($seconds, 1), '0'), '.') . 's';
}
if ($seconds < 60) {
return round($seconds) . ' s';
return round($seconds) . 's';
}
$minutes = intdiv(intval(round($seconds)), 60);
if ($minutes < 60) {
return $minutes . ' min ' . (intval(round($seconds)) % 60) . ' s';
return $minutes . 'm ' . (intval(round($seconds)) % 60) . 's';
}
return intdiv($minutes, 60) . ' h ' . ($minutes % 60) . ' min';
return intdiv($minutes, 60) . 'h ' . ($minutes % 60) . 'm';
};
// Job names in a sentence - "Mail Queue", "Mail Queue and Backup", "Mail Queue, Backup and Nightly Tasks" - each a link to its row
$job_names = function ($list) {

View File

@@ -82,7 +82,7 @@
function lengthText(minutes) {
const h = Math.floor(minutes / 60);
const m = minutes % 60;
return ((h ? h + (h > 1 ? ' hours' : ' hour') : '') + (m ? ' ' + m + ' min' : '')).trim();
return ((h ? h + 'h' : '') + (m ? ' ' + m + 'm' : '')).trim();
}
function minutesBetween(start, end) {
const a = parseDateTime(start);
@@ -886,7 +886,7 @@
function bar(minutes, capacity) {
const pct = capacity ? Math.min(100, Math.round(minutes / capacity * 100)) : 0;
const tone = capacity && minutes > capacity ? 'bg-danger' : (pct >= 85 ? 'bg-warning' : 'bg-primary');
return '<div class="small text-nowrap">' + esc(lengthText(minutes) || '0 min') + (capacity ? ' <span class="text-body-secondary">of ' + esc(lengthText(capacity)) + '</span>' : '') + '</div>'
return '<div class="small text-nowrap">' + esc(lengthText(minutes) || '0m') + (capacity ? ' <span class="text-body-secondary">of ' + esc(lengthText(capacity)) + '</span>' : '') + '</div>'
+ '<div class="progress itflow-dispatch-bar" role="progressbar" aria-valuenow="' + pct + '" aria-valuemin="0" aria-valuemax="100"><div class="progress-bar ' + tone + '" style="width: ' + pct + '%"></div></div>';
}

View File

@@ -1232,7 +1232,7 @@ function clientExportPdf($client_id, $options) {
$chapter('Service levels', 'Targets run in business hours.', 1);
$minutes = function ($m) {
$m = intval($m);
return $m >= 60 ? round($m / 60, 1) . ' h' : $m . ' min';
return $m >= 60 ? round($m / 60, 1) . ' h' : $m . 'm';
};
$write(clientExportPdfTable(['Priority' => 20, 'SLA' => 40, 'First reply within' => 20, 'Resolved within' => 20], array_map(function ($s) use ($e, $minutes) {
return [$e($s['priority']), $e($s['sla']), $e($minutes($s['response_minutes'])), $e($minutes($s['resolution_minutes']))];

View File

@@ -211,13 +211,13 @@ function projectDuePill($row) {
return '';
}
/** Hours for people: "45m", "3h", "12.5h". */
/** Hours for people: "45m", "3 h", "12.5 h". */
function projectHoursText($seconds) {
$seconds = max(0, intval($seconds));
if ($seconds < 3600) {
return round($seconds / 60) . 'm';
}
return rtrim(rtrim(number_format($seconds / 3600, 1, '.', ''), '0'), '.') . 'h';
return rtrim(rtrim(number_format($seconds / 3600, 1, '.', ''), '0'), '.') . ' h';
}
/** A budget in hours as posted - a positive number up to 999999, or null for none. */

View File

@@ -2477,12 +2477,12 @@ function ticketScheduleLengths($keep = 0) {
return $lengths;
}
/** "1 hour 30 min", "45 min". */
/** "1h 30m", "45m" - how every length of time is written. */
function ticketScheduleLengthText($minutes) {
$minutes = intval($minutes);
$hours = intdiv($minutes, 60);
$rest = $minutes % 60;
return trim(($hours ? $hours . ' hour' . ($hours > 1 ? 's' : '') : '') . ($rest ? " $rest min" : ''));
return trim(($hours ? "{$hours}h" : '') . ($rest ? " {$rest}m" : ''));
}
/** "Tuesday, October 20, 2026, 1:00pm - 3:00pm" - both dates in full when it runs past midnight. */