fix input radio id and default to multi on shift creation

This commit is contained in:
Thomas Rupprecht 2022-12-21 23:53:47 +01:00 committed by GitHub
parent 559517e017
commit fdddd63aae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -29,7 +29,7 @@ function admin_shifts()
$session = session();
$start = Carbon::createTimestampFromDatetime(date('Y-m-d') . 'T00:00');
$end = $start;
$mode = '';
$mode = 'multi';
$angelmode = 'manually';
$length = '';
$change_hours = [];

View File

@ -140,10 +140,13 @@ function form_checkbox($name, $label, $selected, $value = 'checked', $html_id =
*/
function form_radio($name, $label, $selected, $value)
{
$value = htmlspecialchars((string)$value);
$id = preg_replace('/\s/', '-', $name . '_' . $value);
return '<div class="form-check">'
. '<input class="form-check-input" type="radio" id="' . $name . '" name="' . $name . '" value="' . htmlspecialchars((string)$value) . '" '
. '<input class="form-check-input" type="radio" id="' . $id . '" name="' . $name . '" value="' . $value . '" '
. ($selected ? ' checked="checked"' : '') . ' />'
. '<label class="form-check-label" for="' . $name . '">'
. '<label class="form-check-label" for="' . $id . '">'
. $label
. '</label></div>';
}