Webgui: More mobile friendly touch and much more improvements
This commit is contained in:
+46
-23
@@ -138,15 +138,17 @@ try {
|
||||
$g_error->Add($e->getMessage());
|
||||
$g_error->Add($sql);
|
||||
$g_error->Add(print_r($p, true));
|
||||
$g_error->PrintOut();
|
||||
}
|
||||
$numrows = $sth->fetchColumn();
|
||||
$lastpage = ceil($numrows/$g_rows_pp);
|
||||
$page = gpc_get_int($_REQUEST, 'p', 1);
|
||||
$rows_pp = gpc_get_int($_REQUEST, 'n', $g_rows_pp);
|
||||
$lastpage = ceil($numrows/$rows_pp);
|
||||
|
||||
$sql = "SELECT i.invid, i.invname, i.number, i.invcond, s.sname AS container "
|
||||
$sql = "SELECT i.invid, i.invname, i.number, i.invcond, i.eid, s.sname AS container "
|
||||
. "FROM inventory AS i JOIN storage AS s ON (i.conttype='storage' AND i.sid=s.sid)";
|
||||
$sql .= ' WHERE ' . $where;
|
||||
$sql .= " UNION SELECT i.invid, i.invname, i.number, i.invcond, b.label AS container "
|
||||
$sql .= " UNION SELECT i.invid, i.invname, i.number, i.invcond, i.eid, b.label AS container "
|
||||
. "FROM inventory AS i JOIN box AS b ON (i.conttype='box' AND i.boxid=b.boxid) "
|
||||
. " JOIN storage AS s ON (b.sid=s.sid) ";
|
||||
$sql .= ' WHERE ' . $where;
|
||||
@@ -162,6 +164,7 @@ try {
|
||||
$g_error->Add($e->getMessage());
|
||||
$g_error->Add($sql);
|
||||
$g_error->Add(print_r($p, true));
|
||||
$g_error->PrintOut();
|
||||
}
|
||||
$res = $sth->fetchAll();
|
||||
|
||||
@@ -173,16 +176,17 @@ $opt_special = array(
|
||||
?>
|
||||
<form method="post" action="<?=$g_scriptname?>">
|
||||
<div id="filter" class="card">
|
||||
<div class="card-header">Filter</div>
|
||||
<div class="card-body">
|
||||
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
|
||||
<div class="card-body d-flex flex-wrap gap-3">
|
||||
<?php
|
||||
// page specific filter start
|
||||
// - selection for storage
|
||||
// - selection for box
|
||||
// page specific filter end
|
||||
?>
|
||||
<label for="flt_stor"><?=_('Storage')?></label>
|
||||
<select id="flt_stor" name="flt_stor">
|
||||
<div class="d-flex flex-nowrap gap-2">
|
||||
<label for="flt_stor"><?=_('Storage')?></label>
|
||||
<select id="flt_stor" name="flt_stor">
|
||||
<?php
|
||||
foreach ($opt_special + $opt_storage as $k => $v) {
|
||||
echo '<option value="', $k,'"';
|
||||
@@ -192,9 +196,11 @@ foreach ($opt_special + $opt_storage as $k => $v) {
|
||||
echo '>', $v, '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<label for="flt_cond"><?=_('Condition')?></label>
|
||||
<select id="flt_cond" name="flt_cond">
|
||||
</select>
|
||||
</div>
|
||||
<div class="d-flex flex-nowrap gap-2">
|
||||
<label for="flt_cond"><?=_('Condition')?></label>
|
||||
<select id="flt_cond" name="flt_cond">
|
||||
<?php
|
||||
$opt_special = array(
|
||||
-2 => _('― all ―'),
|
||||
@@ -207,12 +213,17 @@ foreach ($opt_special + $opt_invcond as $k => $v) {
|
||||
echo '>', $v, '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<label for="flt_txt">Text</label>
|
||||
<input type="text" name="flt_txt" size="15" maxlength="30" value="<?=$flt->txt?>">
|
||||
<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>
|
||||
</select>
|
||||
</div>
|
||||
<div class="d-flex flex-nowrap gap-2">
|
||||
<label for="flt_txt">Text</label>
|
||||
<input type="text" 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>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -224,6 +235,7 @@ echo $pagination;
|
||||
echo '<table class="table table-striped">', "\n";
|
||||
echo "<thead>\n";
|
||||
echo "<tr>\n";
|
||||
echo '<th>#</th>';
|
||||
echo "<th>", _('Name'), "</th>\n";
|
||||
echo "<th>", _('Container'), "</th>\n";
|
||||
echo "<th>", _('Number'), "</th>\n";
|
||||
@@ -232,19 +244,30 @@ echo "<th>", _('Tags'), "</th>\n";
|
||||
echo "<td></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</thead>\n";
|
||||
$i = ($page - 1) * $rows_pp;
|
||||
$i0 = $i + 1;
|
||||
foreach ($res as $row) {
|
||||
$i++; // record number
|
||||
echo "<tr>\n";
|
||||
echo '<td>', $row['invname'], "</td>\n";
|
||||
echo '<td>', $i;
|
||||
echo '<a class="text-nowrap" title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['invid'], '"><i class="bi bi-eye ms-2"></i></a>', "\n";
|
||||
echo "</td>\n";
|
||||
// alternative symbols: wrench, wrench-adjustable, tools
|
||||
echo '<td>', $row['invname'];
|
||||
echo isset($row['eid']) && $row['eid'] > 0 ? ' <i class="bi bi-wrench"></i>' : '', "</td>\n";
|
||||
echo "<td>", $row['container'], "</td>\n";
|
||||
echo "<td>", $row['number'], "</td>\n";
|
||||
echo "<td>", ($opt_invcond[$row['invcond']] ?? ''), "</td>\n";
|
||||
echo "<td>", _('No tags assigned'), "</td>\n";
|
||||
form_action_buttons($g_scriptname, $row['invid']);
|
||||
// Edit current record button
|
||||
echo "<td>";
|
||||
echo '<a title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['invid'], '"><i class="bi-pencil"></i></a>', "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
// Table summary
|
||||
echo "<tfoot>\n";
|
||||
echo '<tr><td colspan="5">', sprintf(_('%d records'), count($res)), '</td></tr>', "\n";
|
||||
echo '<tr><td colspan="7">', sprintf(_('Records %d to %d of %d'), $i0, $i, $numrows), '</td></tr>', "\n";
|
||||
echo "</tfoot>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
@@ -274,8 +297,8 @@ echo '<h2>', _('Add Inventory'), "</h2>\n";
|
||||
</select>
|
||||
</div>
|
||||
<?php
|
||||
form_create_select('sid', _('Storage'), $opt_storage);
|
||||
form_create_select('boxid', _('Box'), $opt_box);
|
||||
form_create_select('sid', _('Storage'), $g_opt_none + $opt_storage);
|
||||
form_create_select('boxid', _('Box'), $g_opt_none + $opt_box);
|
||||
?>
|
||||
<div class="container-fluid px-0 my-3">
|
||||
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
|
||||
@@ -337,7 +360,7 @@ echo "<tr><th>", _('Weight'), "</th><td>", format_float($inventory->weight, 2, '
|
||||
echo "<tr><th>", _('Price'), "</th><td>", format_currency($inventory->price), "</td></tr>\n";
|
||||
echo "<tr><th>", _('Purchase date'), "</th><td>", $inventory->purchdate, "</td></tr>\n";
|
||||
echo "<tr><th>", _('Condition'), "</th><td>", $opt_invcond[$inventory->invcond], "</td></tr>\n";
|
||||
echo "<tr><th>", _('Remarks'), "</th><td>", $inventory->remarks, "</td></tr>\n";
|
||||
echo "<tr><th>", _('Remarks'), "</th><td>", nl2br($inventory->remarks), "</td></tr>\n";
|
||||
|
||||
$tags = db_load_taglist('inv', $id);
|
||||
form_tag_assignment($g_scriptname, $id, $tags);
|
||||
@@ -377,7 +400,7 @@ $inventory = $sth->fetch(PDO::FETCH_OBJ);
|
||||
$opt_conttype = db_load_enum('inventory', 'conttype', true, true);
|
||||
form_create_select('conttype', _('Container type'), $opt_conttype, $inventory->conttype);
|
||||
form_create_select('sid', _('Storage'), $opt_storage, $inventory->sid);
|
||||
form_create_select('boxid', _('Box'), $opt_box, $inventory->boxid);
|
||||
form_create_select('boxid', _('Box'), $g_opt_none + $opt_box, $inventory->boxid);
|
||||
?>
|
||||
<div class="mb-3">
|
||||
<label for="price" class="form-label"><?=sprintf(_('Price, %s'), $g_lconv['currency_symbol']); ?></label>
|
||||
|
||||
Reference in New Issue
Block a user