diff --git a/includes/sys_template.php b/includes/sys_template.php index 56df96e2..3adbffce 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -327,7 +327,7 @@ function render_table($columns, $rows, $data = true) $html .= ''; $html .= ''; foreach ($rows as $row) { - $html .= ''; + $html .= ''; foreach ($columns as $key => $column) { $value = ' '; if (isset($row[$key])) { diff --git a/includes/view/User_view.php b/includes/view/User_view.php index d83b25b1..bab365f6 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -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' => '' . __('Sum:') . '', 'duration' => '' . sprintf('%.2f', round($timeSum / 3600, 2)) . ' h', @@ -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, ]; } diff --git a/resources/assets/themes/base.scss b/resources/assets/themes/base.scss index 8d30b4fe..5abf23ed 100644 --- a/resources/assets/themes/base.scss +++ b/resources/assets/themes/base.scss @@ -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;