From 582b1a739aa10c84454dc7f862bc788a9ed2ded4 Mon Sep 17 00:00:00 2001 From: msquare Date: Tue, 12 Dec 2017 22:09:01 +0100 Subject: improve public dashboard --- includes/view/PublicDashboard_view.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/includes/view/PublicDashboard_view.php b/includes/view/PublicDashboard_view.php index b80ca515..1325d31a 100644 --- a/includes/view/PublicDashboard_view.php +++ b/includes/view/PublicDashboard_view.php @@ -5,9 +5,18 @@ */ function public_dashboard_view($stats, $free_shifts) { - $shift_panels = []; - foreach ($free_shifts as $shift) { - $shift_panels[] = public_dashborad_shift_render($shift); + $needed_angels = ''; + if (count($free_shifts) > 0) { + $shift_panels = []; + foreach ($free_shifts as $shift) { + $shift_panels[] = public_dashborad_shift_render($shift); + } + $needed_angels = div('container-fluid first', [ + div('col-xs-12', [ + heading(_('Needed angels:'), 1) + ]), + join($shift_panels) + ]); } return page([ div('first container-fluid', [ @@ -17,12 +26,7 @@ function public_dashboard_view($stats, $free_shifts) stats(_('Hours to be worked'), $stats['hours-to-work'], 'default'), '' ]), - div('container-fluid first', [ - div('col-xs-12', [ - heading(_('Needed angels:'), 1) - ]), - join($shift_panels) - ]) + $needed_angels ]); } -- cgit v1.2.3-54-g00ecf