Webgui: filter and pagination working
This commit is contained in:
+11
-10
@@ -13,7 +13,7 @@ $pagetitle = _('Storage');
|
||||
|
||||
$id = gpc_get_int($_REQUEST, 'id', 0);
|
||||
|
||||
$stype = db_get_options(3);
|
||||
$opt_stype = db_get_options(3);
|
||||
|
||||
// ========== ACTIONS START ===================================================
|
||||
|
||||
@@ -37,6 +37,7 @@ switch ($submit = form_get_action()) {
|
||||
case 'update':
|
||||
$p[':sid'] = $id;
|
||||
$p[':sname'] = gpc_get_string($_POST, 'sname');
|
||||
$p[':stype'] = gpc_get_string($_POST, 'stype');
|
||||
$p[':x'] = gpc_get_int($_POST, 'x');
|
||||
$p[':y'] = gpc_get_int($_POST, 'y');
|
||||
$p[':z'] = gpc_get_int($_POST, 'z');
|
||||
@@ -73,9 +74,12 @@ switch ($submit = form_get_action()) {
|
||||
$action = ACT_VIEW;
|
||||
break;
|
||||
}
|
||||
$sth = $pdo->prepare("SELECT sname FROM storage WHERE sid=?");
|
||||
$sth->execute([$id]);
|
||||
$storagename = $sth->fetchcolumn();
|
||||
$sth = $pdo->prepare("DELETE FROM storage WHERE sid=?");
|
||||
$sth->execute([$id]);
|
||||
$g_message->Add(sprintf(_('Deleted storage no. %d'), $id));
|
||||
$g_message->Add(sprintf(_('Deleted storage no. %d (%s)'), $id, $storagename));
|
||||
$action = ACT_DEFAULT;
|
||||
break;
|
||||
|
||||
@@ -194,15 +198,9 @@ echo '<h2>', _('Add Storage'), "</h2>\n";
|
||||
<label for="sname" class="form-label"><?=_('Name')?></label>
|
||||
<input type="text" class="form-control" id="sname" name="sname">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<select name="stype" class="form-control">
|
||||
<?php
|
||||
foreach ($stype as $k => $v) {
|
||||
echo '<option value="', $k ,'">', $v, "</option>\n";
|
||||
}
|
||||
form_create_select('stype', _('Type'), $opt_stype);
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
|
||||
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
|
||||
</form>
|
||||
@@ -223,7 +221,7 @@ $storage = $sth->fetch(PDO::FETCH_OBJ);
|
||||
echo '<h2>', $storage->sname, "</h2>\n";
|
||||
|
||||
echo '<table class="table">', "\n";
|
||||
echo '<tr><th style="width:33%">', _('Typ'),"</th><td>", $stype[$storage->stype], "</td></tr>\n";
|
||||
echo '<tr><th style="width:33%">', _('Typ'),"</th><td>", $opt_stype[$storage->stype], "</td></tr>\n";
|
||||
echo '<tr><th>', _('Capacity'),"</th><td>", $storage->capacity, ' ', $storage->capaunit, "</td></tr>\n";
|
||||
echo '<tr><th>', _('Location (x, y, z)'),"</th><td>(", $storage->x, ', ', $storage->y, ', ', $storage->z, ")</td></tr>\n";
|
||||
echo '<tr><th>', _('Width (wx, wy, wz)'),"</th><td>(", $storage->wx, ', ', $storage->wy, ', ', $storage->wz, ")</td></tr>\n";
|
||||
@@ -294,6 +292,9 @@ $storage = $sth->fetch(PDO::FETCH_OBJ);
|
||||
<label for="sname" class="form-label"><?=_('Name')?></label>
|
||||
<input type="text" class="form-control" id="sname" name="sname" value="<?=$storage->sname ?>">
|
||||
</div>
|
||||
<?php
|
||||
form_create_select('stype', _('Type'), $opt_stype, $storage->stype);
|
||||
?>
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?=_('Position (x, y, z) in mm')?></label>
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user