Webgui: filter and pagination working

This commit is contained in:
2026-07-15 19:42:55 +02:00
parent 2177834b39
commit a183a4725f
33 changed files with 2088 additions and 750 deletions
+7 -8
View File
@@ -14,8 +14,8 @@ $pagetitle = _('Equipment');
$id = gpc_get_int($_REQUEST, 'id', 0);
$opt_supplier = db_get_opt_supp(array(-1 => _('--- unknown ---')));
$opt_manufacturer = db_get_opt_manuf(array(-1 => _('--- unknown ---')));
$opt_supplier = db_get_opt_supp($g_opt_unknown);
$opt_manufacturer = db_get_opt_manuf($g_opt_unknown);
$opt_ecat = db_get_options(4); // Equipment categories
$opt_unit = db_get_options(8);
@@ -232,7 +232,7 @@ if ($action == ACT_DEFAULT):
page_caption_search($pagetitle);
$flt = db_get_filter($user->id, 200);
$flt = db_get_filter($user->id, 200, ['cat','manuf','supp','txt','flags']);
$sort = array(
1 => 'ename',
2 => 'ename DESC'
@@ -288,10 +288,9 @@ try {
$g_error->PrintOut();
}
$numrows = $sth->fetchColumn();
$lastpage = ceil($numrows/$g_rows_pp);
$page = gpc_get_int($_REQUEST, 'p', 1);
// TODO check against allowed values for rows per page
$rows_pp = gpc_get_int($_REQUEST, 'n', $g_rows_pp);
$rows_pp = gpc_get_int($_REQUEST, 'n', $user->rows_pp);
$lastpage = ceil($numrows/$rows_pp);
$sql = "SELECT eid, ename, manufacturer, model, serial, remarks, flags,"
. " TIMESTAMPDIFF(MONTH, purchdate, NOW()) AS age_mon "
@@ -464,7 +463,7 @@ echo "</table>\n";
echo '</div>'; // Column break
echo '<div class="col">', "\n";
echo '<div class="card">', "\n";
echo '<div class="card mb-2">', "\n";
echo '<div class="card-header">', _('Images and documents'), "</div>\n";
echo '<div class="card-body d-flex flex-wrap gap-3">', "\n";
@@ -669,7 +668,7 @@ $equipment = $sth->fetch(PDO::FETCH_OBJ);
</div>
<?php
form_create_select('supplier', _('Supplier'), $opt_supplier, $equipment->supplier);
form_create_select('category', _('Category'), [-1 => _('--- unknown ---')] + $opt_ecat, $equipment->ecat);
form_create_select('category', _('Category'), $g_opt_unknown + $opt_ecat, $equipment->ecat);
?>
<div class="mb-3">
<label for="remarks" class="form-label"><?=_('Remarks')?></label>