Shifts overview: Show all rooms and only own angel types

This commit is contained in:
Igor Scheller 2020-05-11 22:41:18 +02:00 committed by msquare
parent f99e0a229f
commit 272be5eab2
1 changed files with 6 additions and 10 deletions

View File

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