Shifts overview: Show all rooms and only own angel types

main
Igor Scheller 5 years ago committed by msquare
parent f99e0a229f
commit 272be5eab2

@ -182,13 +182,14 @@ function view_user_shifts()
$days = load_days(); $days = load_days();
$rooms = load_rooms(); $rooms = load_rooms();
$types = load_types(); $types = load_types();
$ownTypes = [];
foreach (UserAngelTypes_by_User($user->id) as $type) {
$ownTypes[] = (int)$type['angeltype_id'];
}
if (!$session->has('shifts-filter')) { if (!$session->has('shifts-filter')) {
$room_ids = [ $room_ids = collect($rooms)->pluck('id')->toArray();
$rooms[0]['id'] $shiftsFilter = new ShiftsFilter(auth()->can('user_shifts_admin'), $room_ids, $ownTypes);
];
$type_ids = array_map('get_ids_from_array', $types);
$shiftsFilter = new ShiftsFilter(auth()->can('user_shifts_admin'), $room_ids, $type_ids);
$session->set('shifts-filter', $shiftsFilter->sessionExport()); $session->set('shifts-filter', $shiftsFilter->sessionExport());
} }
@ -222,11 +223,6 @@ function view_user_shifts()
info(render_user_arrived_hint()); info(render_user_arrived_hint());
} }
$ownTypes = [];
foreach (UserAngelTypes_by_User($user->id) as $type) {
$ownTypes[] = (int)$type['angeltype_id'];
}
return page([ return page([
div('col-md-12', [ div('col-md-12', [
msg(), msg(),

Loading…
Cancel
Save