room view & angeltype view: show all shifts (#1067)

This commit is contained in:
xuwhite 2023-01-17 20:01:29 +01:00 committed by GitHub
parent 64be48c646
commit 89f9b423b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View File

@ -196,6 +196,9 @@ function angeltype_controller()
$days = angeltype_controller_shiftsFilterDays($angeltype);
$shiftsFilter = angeltype_controller_shiftsFilter($angeltype, $days);
if (request()->input('showFilledShifts')) {
$shiftsFilter->setFilled([ShiftsFilter::FILLED_FREE, ShiftsFilter::FILLED_FILLED]);
}
$shiftsFilterRenderer = new ShiftsFilterRenderer($shiftsFilter);
$shiftsFilterRenderer->enableDaySelection($days);
@ -204,7 +207,7 @@ function angeltype_controller()
$request = request();
$tab = 0;
if ($request->has('shifts_filter_day')) {
if ($request->has('shifts_filter_day') || $request->has('showShiftsTab')) {
$tab = 1;
}
@ -266,7 +269,7 @@ function angeltype_controller_shiftsFilter(AngelType $angeltype, $days)
if (!empty($days) && !in_array($selected_day, $days)) {
$selected_day = $days[0];
}
if ($request->has('shifts_filter_day')) {
if ($request->input('shifts_filter_day')) {
$selected_day = $request->input('shifts_filter_day');
}
$shiftsFilter->setStartTime(parse_date('Y-m-d H:i', $selected_day . ' 00:00'));

View File

@ -41,7 +41,7 @@ function room_controller(): array
if (!empty($days) && !in_array($selected_day, $days)) {
$selected_day = $days[0];
}
if ($request->has('shifts_filter_day')) {
if ($request->input('shifts_filter_day')) {
$selected_day = $request->input('shifts_filter_day');
}
$shiftsFilter->setStartTime(parse_date('Y-m-d H:i', $selected_day . ' 00:00'));

View File

@ -63,6 +63,13 @@ class ShiftsFilterRenderer
icon('speedometer2') . __('Dashboard')
);
}
if (!request('showFilledShifts') && !auth()->can('user_shifts_admin')) {
$toolbar[] = sprintf(
'<li role="presentation"><a class="nav-link" href="%s">%s</a></li>',
$page_link . '&showFilledShifts=1&showShiftsTab=1&shifts_filter_day=' . request('shifts_filter_day', $selected_day),
icon('eye') . __('All')
);
}
}
return div('mb-3', [
toolbar_pills($toolbar)