summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2019-08-21 22:22:05 +0200
committerGitHub <noreply@github.com>2019-08-21 22:22:05 +0200
commitce6419e3083c3bd60e5d80fe7f3a94c2166c0b94 (patch)
tree6483989ea6b3da2d6ba695c1ef5b06be09564591 /includes
parentf73b8e7a0eb08592985ee842b8b6d6c01b0f8e2f (diff)
parentb2a4225a6208ae3a13c97a636d41c99575f26a09 (diff)
Merge pull request #643 from MyIgel/show-angetypes
Shift page: show additional angeltypes if shift entries where found
Diffstat (limited to 'includes')
-rw-r--r--includes/view/Shifts_view.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php
index 4a4e4f0c..cbd0208d 100644
--- a/includes/view/Shifts_view.php
+++ b/includes/view/Shifts_view.php
@@ -2,6 +2,7 @@
use Engelsystem\Models\User\User;
use Engelsystem\ShiftSignupState;
+use Illuminate\Support\Collection;
/**
* Renders the basic shift view header.
@@ -115,10 +116,22 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt
}
$needed_angels = '';
- foreach ($shift['NeedAngels'] as $needed_angeltype) {
+ $neededAngels = new Collection($shift['NeedAngels']);
+ foreach ($neededAngels as $needed_angeltype) {
$needed_angels .= Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin);
}
+ foreach ($shift['ShiftEntry'] as $shiftEntry) {
+ if (!$neededAngels->where('TID', $shiftEntry['TID'])->first()) {
+ $needed_angels .= Shift_view_render_needed_angeltype([
+ 'TID' => $shiftEntry['TID'],
+ 'count' => 0,
+ 'restricted' => true,
+ 'taken' => true,
+ ], $angeltypes, $shift, $user_shift_admin);
+ }
+ }
+
$content = [msg()];
if ($shift_signup_state->getState() == ShiftSignupState::COLLIDES) {