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(),