fix #345 by adding a badge to shift view wich contains number of missing angels

This commit is contained in:
msquare 2019-11-03 12:08:46 +01:00
parent dc3de33a4b
commit 613d258c87
1 changed files with 7 additions and 2 deletions

View File

@ -44,7 +44,7 @@ class ShiftCalendarShiftRenderer
div( div(
'shift panel panel-' . $class, 'shift panel panel-' . $class,
[ [
$this->renderShiftHead($shift, $class), $this->renderShiftHead($shift, $class, $shift_signup_state->getFreeEntries()),
div('panel-body', [ div('panel-body', [
$info_text, $info_text,
Room_name_render([ Room_name_render([
@ -254,7 +254,7 @@ class ShiftCalendarShiftRenderer
* @param string $class The shift state class * @param string $class The shift state class
* @return string * @return string
*/ */
private function renderShiftHead($shift, $class) private function renderShiftHead($shift, $class, $needed_angeltypes_count)
{ {
$header_buttons = ''; $header_buttons = '';
if (auth()->can('admin_shifts')) { if (auth()->can('admin_shifts')) {
@ -274,6 +274,11 @@ class ShiftCalendarShiftRenderer
$shift_heading = date('H:i', $shift['start']) . ' ‐ ' $shift_heading = date('H:i', $shift['start']) . ' ‐ '
. date('H:i', $shift['end']) . ' — ' . date('H:i', $shift['end']) . ' — '
. $shift['name']; . $shift['name'];
if($needed_angeltypes_count > 0) {
$shift_heading = '<span class="badge">' . $needed_angeltypes_count . '</span> ' . $shift_heading;
}
return div('panel-heading', [ return div('panel-heading', [
'<a href="' . shift_link($shift) . '">' . $shift_heading . '</a>', '<a href="' . shift_link($shift) . '">' . $shift_heading . '</a>',
$header_buttons $header_buttons