Webgui: filters and pagination
This commit is contained in:
+16
-2
@@ -25,6 +25,10 @@ switch ($submit = form_get_action()) {
|
||||
case 'edit': $action = ACT_EDIT; break;
|
||||
case 'del': $action = ACT_DELETE; break;
|
||||
|
||||
case 'filter':
|
||||
$action = ACT_DEFAULT;
|
||||
break;
|
||||
|
||||
case 'insert':
|
||||
$p[':invname'] = gpc_get_string($_POST, 'invname');
|
||||
$p[':number'] = gpc_get_int($_POST, 'number');
|
||||
@@ -47,6 +51,7 @@ switch ($submit = form_get_action()) {
|
||||
$p[':price'] = gpc_get_currency($_POST, 'price');
|
||||
$p[':purchdate'] = gpc_get_date($_POST, 'purchdate');
|
||||
$p[':invcond'] = gpc_get_string($_POST, 'invcond');
|
||||
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
|
||||
db_exec_update('inventory', $p, 'invid');
|
||||
$action = ACT_VIEW;
|
||||
break;
|
||||
@@ -80,6 +85,8 @@ require 'header.php';
|
||||
if ($action == ACT_DEFAULT):
|
||||
// ========== VARIANT: default behavior =======================================
|
||||
|
||||
$flt = db_get_filter($user->id, 201);
|
||||
|
||||
/*
|
||||
The only way to find out whether the inventory is on the current boat is to use
|
||||
the box assignment. But this is also intentional to allow easy rearrangement.
|
||||
@@ -161,7 +168,8 @@ form_create_select('boxid', _('Box'), $opt_box);
|
||||
elseif ($action == ACT_VIEW):
|
||||
// ========== VARIANT: view single record =====================================
|
||||
|
||||
$sql = "SELECT invname, boxtype, sid, boxid, number, weight, price, purchdate, invcond "
|
||||
$sql = "SELECT invname, boxtype, sid, boxid, number, weight, price, purchdate,"
|
||||
. " invcond,remarks "
|
||||
. "FROM inventory "
|
||||
. "WHERE invid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -210,6 +218,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>", $inventory->invcond, "</td></tr>\n";
|
||||
echo "<tr><th>", _('Remarks'), "</th><td>", $inventory->remarks, "</td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
form_view_buttons($g_scriptname, $id);
|
||||
@@ -217,7 +226,8 @@ form_view_buttons($g_scriptname, $id);
|
||||
elseif ($action == ACT_EDIT):
|
||||
// ========== VARIANT: edit single record =====================================
|
||||
|
||||
$sql = "SELECT invname, boxtype, sid, boxid, number, weight, price, purchdate, invcond "
|
||||
$sql = "SELECT invname, boxtype, sid, boxid, number, weight, price, purchdate, "
|
||||
. " invcond, remarks "
|
||||
. "FROM inventory "
|
||||
. "WHERE invid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -281,6 +291,10 @@ foreach ($cond as $k => $v) {
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=$inventory->remarks ?></textarea>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
Reference in New Issue
Block a user