Webgui improve filter functions

This commit is contained in:
thooge committed 2026-10-24 10:47:44 +02:00
1 parent b3825cb1b3
commit 9d09b1e120
17 files changed
+435 -458

No files matched your search

+6 -43
View File
@@ -334,58 +334,21 @@ $sth->execute($p);
$res = $sth->fetchAll();
// Filter
$opt_special = array(
'all' => _('― all ―'),
);
?>
<form method="post" action="<?=$g_scriptname?>">
<form id="filterform" method="post" action="<?=$g_scriptname?>">
<div id="filter" class="card">
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
<div class="card-body d-flex flex-wrap gap-3">
<div class="d-flex flex-nowrap gap-2">
<label for="flt_doctype">Type</label>
<select class="form-select" id="flt_doctype" name="flt_doctype">
<?php
foreach ($opt_special + $opt_doctype as $k => $v) {
echo '<option value="', $k,'"';
if ($k == $flt->doctype) {
echo ' selected';
}
echo '>', $v, '</option>';
}
filter_create_select('flt_doctype', _('Type'), $g_opt_all + $opt_doctype, $flt->doctype);
filter_create_select('flt_reftype', _('Reference'), $g_opt_none + $opt_reftype, $flt->reftype);
filter_create_text('flt_txt', _('Text'), $flt->txt, 15, 30);
?>
</select>
</div>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_reftype"><?=_('Reference')?></label>
<select class="form-select" id="flt_reftype" name="flt_reftype">
<?php
$opt_special['none'] = _('&horbar; none &horbar;');
foreach ($opt_special + $opt_reftype as $k => $v) {
echo '<option value="', $k,'"';
if ($k == $flt->reftype) {
echo ' selected';
}
echo '>', $v, '</option>';
}
?>
</select>
</div>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_txt">Text</label>
<input type="text" class="form-control" name="flt_txt" size="15" maxlength="30" value="<?=$flt->txt ?>">
</div>
</div>
<div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
<button name="submit[freset]" class="btn btn-sm btn-secondary float-end" title="<?=_('Reset filter to defaults')?>"><?=_('Clear')?></button>
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>
<button name="submit[freset]" class="btn btn-sm btn-secondary float-end" title="<?=_('Reset filter to defaults')?>"><?=_('Clear')?></button>
</div>
</div>
</form>