some beauty for the my shifts table

This commit is contained in:
msquare 2017-12-27 12:45:48 +01:00
parent 1e8f0c4845
commit 02b775684d
9 changed files with 36 additions and 9 deletions

View File

@ -351,9 +351,10 @@ function User_view_myshift($shift, $user_source, $its_me)
} }
$myshift = [ $myshift = [
'date' => date('Y-m-d', $shift['start']), 'date' => glyph('calendar') . date('Y-m-d', $shift['start']) . '<br>'
'time' => date('H:i', $shift['start']) . ' - ' . date('H:i', $shift['end']), . glyph('time') . date('H:i', $shift['start']) . ' - ' . date('H:i', $shift['end']),
'room' => $shift['Name'], 'duration' => round(($shift['end'] - $shift['start']) / 3600, 2) . ' h',
'room' => Room_name_render($shift),
'shift_info' => $shift_info, 'shift_info' => $shift_info,
'comment' => '' 'comment' => ''
]; ];
@ -363,11 +364,12 @@ function User_view_myshift($shift, $user_source, $its_me)
} }
if ($shift['freeloaded']) { if ($shift['freeloaded']) {
$myshift['duration'] = '<p class="text-danger">' . round(-($shift['end'] - $shift['start']) / 3600 * 2, 2) . ' h' . '</p>';
if (in_array('user_shifts_admin', $privileges)) { if (in_array('user_shifts_admin', $privileges)) {
$myshift['comment'] .= '<br />' $myshift['comment'] .= '<br />'
. '<p class="error">' . _('Freeloaded') . ': ' . $shift['freeload_comment'] . '</p>'; . '<p class="text-danger">' . _('Freeloaded') . ': ' . $shift['freeload_comment'] . '</p>';
} else { } else {
$myshift['comment'] .= '<br /><p class="error">' . _('Freeloaded') . '</p>'; $myshift['comment'] .= '<br /><p class="text-danger">' . _('Freeloaded') . '</p>';
} }
} }
@ -416,7 +418,7 @@ function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshi
if (count($myshifts_table) > 0) { if (count($myshifts_table) > 0) {
$myshifts_table[] = [ $myshifts_table[] = [
'date' => '<b>' . _('Sum:') . '</b>', 'date' => '<b>' . _('Sum:') . '</b>',
'time' => '<b>' . round($timesum / 3600, 2) . ' h</b>', 'duration' => '<b>' . round($timesum / 3600, 2) . ' h</b>',
'room' => '', 'room' => '',
'shift_info' => '', 'shift_info' => '',
'comment' => '', 'comment' => '',
@ -425,7 +427,7 @@ function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshi
if($its_me || $tshirt_admin) { if($its_me || $tshirt_admin) {
$myshifts_table[] = [ $myshifts_table[] = [
'date' => '<b>' . _('Your t-shirt score') . '&trade;:</b>', 'date' => '<b>' . _('Your t-shirt score') . '&trade;:</b>',
'time' => '<b>' . round($tshirt_score, 2) . ' h</b>', 'duration' => '<b>' . round($tshirt_score, 2) . ' h</b>',
'room' => '', 'room' => '',
'shift_info' => '', 'shift_info' => '',
'comment' => '', 'comment' => '',
@ -512,8 +514,8 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
]), ]),
($its_me || $admin_user_privilege) ? '<h2>' . _('Shifts') . '</h2>' : '', ($its_me || $admin_user_privilege) ? '<h2>' . _('Shifts') . '</h2>' : '',
($its_me || $admin_user_privilege) ? table([ ($its_me || $admin_user_privilege) ? table([
'date' => _('Day'), 'date' => _('Day &amp; time'),
'time' => _('Time'), 'duration' => _('Duration'),
'room' => _('Location'), 'room' => _('Location'),
'shift_info' => _('Name &amp; workmates'), 'shift_info' => _('Name &amp; workmates'),
'comment' => _('Comment'), 'comment' => _('Comment'),

View File

@ -6866,6 +6866,9 @@ body {
.space-top { .space-top {
margin-top: 15px; margin-top: 15px;
} }
.column_duration {
text-align: right;
}
.messages:focus { .messages:focus {
outline: none; outline: none;
} }

View File

@ -6889,6 +6889,9 @@ body {
.space-top { .space-top {
margin-top: 15px; margin-top: 15px;
} }
.column_duration {
text-align: right;
}
.messages:focus { .messages:focus {
outline: none; outline: none;
} }

View File

@ -6866,6 +6866,9 @@ body {
.space-top { .space-top {
margin-top: 15px; margin-top: 15px;
} }
.column_duration {
text-align: right;
}
.messages:focus { .messages:focus {
outline: none; outline: none;
} }

View File

@ -6875,6 +6875,9 @@ body {
.space-top { .space-top {
margin-top: 15px; margin-top: 15px;
} }
.column_duration {
text-align: right;
}
.messages:focus { .messages:focus {
outline: none; outline: none;
} }

View File

@ -6889,6 +6889,9 @@ body {
.space-top { .space-top {
margin-top: 15px; margin-top: 15px;
} }
.column_duration {
text-align: right;
}
.messages:focus { .messages:focus {
outline: none; outline: none;
} }

View File

@ -6869,6 +6869,9 @@ body {
.space-top { .space-top {
margin-top: 15px; margin-top: 15px;
} }
.column_duration {
text-align: right;
}
.messages:focus { .messages:focus {
outline: none; outline: none;
} }

View File

@ -6893,6 +6893,9 @@ body {
.space-top { .space-top {
margin-top: 15px; margin-top: 15px;
} }
.column_duration {
text-align: right;
}
.messages:focus { .messages:focus {
outline: none; outline: none;
} }

View File

@ -157,6 +157,10 @@ body {
margin-top: 15px; margin-top: 15px;
} }
.column_duration {
text-align: right;
}
.messages { .messages {
&:focus { &:focus {
outline: none; outline: none;