Fixed api key toggle driver license config display and dashboard

This commit is contained in:
Igor Scheller 2021-07-24 20:31:40 +02:00 committed by Michael Weimann
parent 2509bd4a98
commit 7917e32f3e
No known key found for this signature in database
GPG Key ID: 34F0524D4DA694A1
6 changed files with 34 additions and 27 deletions

View File

@ -164,7 +164,7 @@ return [
], ],
3 => [ 3 => [
'name' => 'Engelsystem 32c3 (2015)', 'name' => 'Engelsystem 32c3 (2015)',
'type' => 'dark', 'type' => 'light',
'navbar_classes' => 'navbar-dark bg-black border-dark', 'navbar_classes' => 'navbar-dark bg-black border-dark',
], ],
2 => [ 2 => [

View File

@ -314,7 +314,9 @@ function ical_hint()
page_link_to('shifts_json_export', ['key' => $user->api_key]), page_link_to('shifts_json_export', ['key' => $user->api_key]),
page_link_to('user_myshifts', ['reset' => 1]) page_link_to('user_myshifts', ['reset' => 1])
) )
. ' <button class="btn btn-sm btn-danger" data-toggle="collapse" data-target="#collapseApiKey" aria-expanded="false" aria-controls="collapseApiKey"> . ' <button class="btn btn-sm btn-danger" type="button"
data-bs-toggle="collapse" data-bs-target="#collapseApiKey"
aria-expanded="false" aria-controls="collapseApiKey">
' . __('Show API Key') . ' ' . __('Show API Key') . '
</button>' </button>'
. '</p>' . '</p>'

View File

@ -18,7 +18,7 @@ function stats($label, $number, $style = null)
$style = 'success'; $style = 'success';
} }
} }
return div('stats stats-' . $style, [ return div('col stats stats-' . $style, [
$label, $label,
div('number', [ div('number', [
$number $number

View File

@ -34,8 +34,9 @@ function public_dashboard_view($stats, $free_shifts)
$isFiltered = request()->get('filtered'); $isFiltered = request()->get('filtered');
$filter = collect(session()->get('shifts-filter'))->only(['rooms', 'types'])->toArray(); $filter = collect(session()->get('shifts-filter'))->only(['rooms', 'types'])->toArray();
return page([ return page([
div('wrapper', [
div('public-dashboard', [ div('public-dashboard', [
div('first', [ div('first row', [
stats(__('Angels needed in the next 3 hrs'), $stats['needed-3-hours']), stats(__('Angels needed in the next 3 hrs'), $stats['needed-3-hours']),
stats(__('Angels needed for nightshifts'), $stats['needed-night']), stats(__('Angels needed for nightshifts'), $stats['needed-night']),
stats(__('Angels currently working'), $stats['angels-working'], 'default'), stats(__('Angels currently working'), $stats['angels-working'], 'default'),
@ -43,13 +44,14 @@ function public_dashboard_view($stats, $free_shifts)
'<script> '<script>
$(function() { $(function() {
setInterval(function() { setInterval(function() {
$(\'#public-dashboard\').load(window.location.href + \' #public-dashboard\'); $(\'#content .wrapper\').load(window.location.href + \' #public-dashboard\');
}, 60000); }, 60000);
}) })
</script>' </script>'
], 'statistics'), ], 'statistics'),
$needed_angels $needed_angels
], 'public-dashboard'), ], 'public-dashboard'),
]),
div('first col-md-12 text-center', [buttons([ div('first col-md-12 text-center', [buttons([
button_js( button_js(
' '
@ -91,9 +93,14 @@ function public_dashboard_shift_render($shift)
. '</span>'; . '</span>';
} }
return div('col-md-3', [ $type = 'bg-dark';
div('dashboard-panel panel panel-' . $shift['style'], [ if (theme_type() == 'light') {
div('panel-body', [ $type = 'bg-light';
}
return div('col-md-3 mb-3', [
div('dashboard-card card card-' . $shift['style'] . ' ' . $type, [
div('card-body', [
'<a class="panel-link" href="' . shift_link($shift) . '"></a>', '<a class="panel-link" href="' . shift_link($shift) . '"></a>',
$panel_body $panel_body
]) ])

View File

@ -20,8 +20,7 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
form([ form([
form_info(__('Privacy'), __('Your driving license information is only visible for supporters and admins.')), form_info(__('Privacy'), __('Your driving license information is only visible for supporters and admins.')),
form_checkbox('wants_to_drive', __('I am willing to drive a car for the event'), $wants_to_drive), form_checkbox('wants_to_drive', __('I am willing to drive a car for the event'), $wants_to_drive),
div('panel panel-default', [ div('m-3', [
div('panel-body', [
form_checkbox( form_checkbox(
'has_car', 'has_car',
__('I have my own car with me and am willing to use it for the event (You\'ll get reimbursed for fuel)'), __('I have my own car with me and am willing to use it for the event (You\'ll get reimbursed for fuel)'),
@ -49,7 +48,6 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
__('Forklift'), __('Forklift'),
$user_driver_license['has_license_forklift'] $user_driver_license['has_license_forklift']
) )
])
], 'driving_license'), ], 'driving_license'),
form_submit('submit', __('Save')) form_submit('submit', __('Save'))
]), ]),

View File

@ -42,8 +42,8 @@ class Globals extends TwigExtension implements GlobalsInterface
} }
$query = $this->request->query->get('theme'); $query = $this->request->query->get('theme');
if (!is_null($query) && isset($themes[$query])) { if (!is_null($query) && isset($themes[(int)$query])) {
$themeId = $query; $themeId = (int)$query;
} }
$theme = $themes[$themeId]; $theme = $themes[$themeId];