highlight actual time in users shifts list
This commit is contained in:
parent
15a6ba1c52
commit
a35a3580e0
|
@ -327,7 +327,7 @@ function render_table($columns, $rows, $data = true)
|
|||
$html .= '</tr></thead>';
|
||||
$html .= '<tbody>';
|
||||
foreach ($rows as $row) {
|
||||
$html .= '<tr>';
|
||||
$html .= '<tr' . (isset($row['row-class']) ? ' class="' . $row['row-class'] . '"' : '') . '>';
|
||||
foreach ($columns as $key => $column) {
|
||||
$value = ' ';
|
||||
if (isset($row[$key])) {
|
||||
|
|
|
@ -316,6 +316,8 @@ function User_view_myshift(Shift $shift, $user_source, $its_me)
|
|||
'location' => location_name_render($shift->location),
|
||||
'shift_info' => $shift_info,
|
||||
'comment' => '',
|
||||
'start' => $shift->start,
|
||||
'end' => $shift->end,
|
||||
];
|
||||
|
||||
if ($its_me) {
|
||||
|
@ -402,6 +404,20 @@ function User_view_myshifts(
|
|||
|
||||
if (count($myshifts_table) > 0) {
|
||||
ksort($myshifts_table);
|
||||
$myshifts_table = array_values($myshifts_table);
|
||||
foreach ($myshifts_table as $i => &$shift) {
|
||||
$before = $myshifts_table[$i - 1] ?? null;
|
||||
$after = $myshifts_table[$i + 1] ?? null;
|
||||
if (Carbon::now() > $shift['start'] && Carbon::now() < $shift['end']) {
|
||||
$shift['row-class'] = 'border border-info border-2';
|
||||
} elseif ($after && Carbon::now() > $shift['end'] && Carbon::now() < $after['start']) {
|
||||
$shift['row-class'] = 'border-bottom border-info';
|
||||
} elseif (!$before && Carbon::now() < $shift['start']) {
|
||||
$shift['row-class'] = 'border-top-info';
|
||||
} elseif (!$after && Carbon::now() > $shift['end']) {
|
||||
$shift['row-class'] = 'border-bottom border-info';
|
||||
}
|
||||
}
|
||||
$myshifts_table[] = [
|
||||
'date' => '<b>' . __('Sum:') . '</b>',
|
||||
'duration' => '<b>' . sprintf('%.2f', round($timeSum / 3600, 2)) . ' h</b>',
|
||||
|
@ -461,6 +477,8 @@ function User_view_worklog(Worklog $worklog, $admin_user_worklog_privilege)
|
|||
$worklog->created_at->format(__('general.datetime'))
|
||||
),
|
||||
'actions' => $actions,
|
||||
'start' => $worklog->worked_at,
|
||||
'end' => $worklog->worked_at,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -121,6 +121,27 @@ table a > .icon-icon_angel {
|
|||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* making top border visible in tables */
|
||||
table .border-top {
|
||||
border-top-width: calc(var(--bs-border-width) * 2) !important;
|
||||
}
|
||||
|
||||
/* to only highlight the top row in info color */
|
||||
table .border-top-info {
|
||||
border-top-width: calc(var(--bs-border-width) * 2) !important;
|
||||
border-top-color: rgba(var(--bs-info-rgb)) !important;
|
||||
}
|
||||
|
||||
// equal top and bottom border if highlighted
|
||||
table .border-bottom {
|
||||
border-bottom-width: calc(var(--bs-border-width) * 2) !important;
|
||||
}
|
||||
|
||||
/* to be able to highlight table rows */
|
||||
.table-responsive {
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.stats {
|
||||
font-size: 20px;
|
||||
height: 150px;
|
||||
|
|
Loading…
Reference in New Issue