Fixed backend pages, shifts table header

This commit is contained in:
Igor Scheller 2021-07-25 23:47:16 +02:00 committed by Michael Weimann
parent 91c7a19f11
commit d51edb6092
No known key found for this signature in database
GPG Key ID: 34F0524D4DA694A1
3 changed files with 21 additions and 11 deletions

View File

@ -105,9 +105,9 @@ function admin_free()
form([ form([
div('row', [ div('row', [
div('col-md-12 form-inline', [ div('col-md-12 form-inline', [
div('inline-form-spacing', [ div('row', [
form_text('search', __('Search'), $search), form_text('search', __('Search'), $search, null, null, null, 'col'),
form_select('angeltype', __('Angeltype'), $angel_types, $angelType), form_select('angeltype', __('Angeltype'), $angel_types, $angelType, '', 'col'),
form_submit('submit', __('Search')) form_submit('submit', __('Search'))
]), ]),
]), ]),

View File

@ -257,10 +257,11 @@ function form_submit($name, $label, $class = '', $wrapForm = true, $buttonType =
* @param bool $disabled * @param bool $disabled
* @param int|null $maxlength * @param int|null $maxlength
* @param string|null $autocomplete * @param string|null $autocomplete
* @param string|null $class
* *
* @return string * @return string
*/ */
function form_text($name, $label, $value, $disabled = false, $maxlength = null, $autocomplete = null) function form_text($name, $label, $value, $disabled = false, $maxlength = null, $autocomplete = null, $class = '')
{ {
$disabled = $disabled ? ' disabled="disabled"' : ''; $disabled = $disabled ? ' disabled="disabled"' : '';
$maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : ''; $maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : '';
@ -270,7 +271,8 @@ function form_text($name, $label, $value, $disabled = false, $maxlength = null,
$label, $label,
'<input class="form-control" id="form_' . $name . '" type="text" name="' . $name '<input class="form-control" id="form_' . $name . '" type="text" name="' . $name
. '" value="' . htmlspecialchars($value) . '"' . $maxlength . $disabled . $autocomplete . '/>', . '" value="' . htmlspecialchars($value) . '"' . $maxlength . $disabled . $autocomplete . '/>',
'form_' . $name 'form_' . $name,
$class
); );
} }
@ -404,14 +406,16 @@ function form_textarea($name, $label, $value, $disabled = false)
* @param string[] $values * @param string[] $values
* @param string $selected * @param string $selected
* @param string $selectText * @param string $selectText
* @param string $class
* @return string * @return string
*/ */
function form_select($name, $label, $values, $selected, $selectText = '') function form_select($name, $label, $values, $selected, $selectText = '', $class = '')
{ {
return form_element( return form_element(
$label, $label,
html_select_key('form_' . $name, $name, $values, $selected, $selectText), html_select_key('form_' . $name, $name, $values, $selected, $selectText),
'form_' . $name 'form_' . $name,
$class
); );
} }
@ -421,15 +425,21 @@ function form_select($name, $label, $values, $selected, $selectText = '')
* @param string $label * @param string $label
* @param string $input * @param string $input
* @param string $for * @param string $for
* @param string $class
* @return string * @return string
*/ */
function form_element($label, $input, $for = '') function form_element($label, $input, $for = '', $class = '')
{ {
$class = $class ? ' ' . $class : '';
if (empty($label)) { if (empty($label)) {
return '<div class="mb-3">' . $input . '</div>'; return '<div class="mb-3' . $class . '">' . $input . '</div>';
} }
return '<div class="mb-3">' . '<label class="form-label" for="' . $for . '">' . $label . '</label>' . $input . '</div>'; return '<div class="mb-3' . $class . '">'
. '<label class="form-label" for="' . $for . '">' . $label . '</label>'
. $input
. '</div>';
} }
/** /**

View File

@ -58,7 +58,7 @@ class ShiftsFilterRenderer
if ($dashboardFilter) { if ($dashboardFilter) {
$toolbar[] = sprintf( $toolbar[] = sprintf(
'<li role="presentation"><a href="%s">%s</a></li>', '<li role="presentation"><a class="nav-link" href="%s">%s</a></li>',
url('/public-dashboard', ['filtered' => true] + $dashboardFilter), url('/public-dashboard', ['filtered' => true] + $dashboardFilter),
icon('speedometer2') . __('Dashboard') icon('speedometer2') . __('Dashboard')
); );