From 272be5eab28de785fc504626e244d03a7d185d74 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 11 May 2020 22:41:18 +0200 Subject: [PATCH] Shifts overview: Show all rooms and only own angel types --- includes/pages/user_shifts.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index d8990c58..a5fd36b3 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -182,13 +182,14 @@ function view_user_shifts() $days = load_days(); $rooms = load_rooms(); $types = load_types(); + $ownTypes = []; + foreach (UserAngelTypes_by_User($user->id) as $type) { + $ownTypes[] = (int)$type['angeltype_id']; + } if (!$session->has('shifts-filter')) { - $room_ids = [ - $rooms[0]['id'] - ]; - $type_ids = array_map('get_ids_from_array', $types); - $shiftsFilter = new ShiftsFilter(auth()->can('user_shifts_admin'), $room_ids, $type_ids); + $room_ids = collect($rooms)->pluck('id')->toArray(); + $shiftsFilter = new ShiftsFilter(auth()->can('user_shifts_admin'), $room_ids, $ownTypes); $session->set('shifts-filter', $shiftsFilter->sessionExport()); } @@ -222,11 +223,6 @@ function view_user_shifts() info(render_user_arrived_hint()); } - $ownTypes = []; - foreach (UserAngelTypes_by_User($user->id) as $type) { - $ownTypes[] = (int)$type['angeltype_id']; - } - return page([ div('col-md-12', [ msg(),