Webgui code improvements for dropdown handling
This commit is contained in:
+10
-3
@@ -14,7 +14,7 @@ $pagetitle = _('Storage');
|
||||
|
||||
$id = gpc_get_int($_REQUEST, 'id', 0);
|
||||
|
||||
$opt_stype = db_get_options(3);
|
||||
$opt_stype = db_get_options(SS_STORAGE_TYPE);
|
||||
$opt_capaunit = $g_opt_empty + db_load_enum('storage', 'capaunit', true, true);
|
||||
|
||||
// ========== ACTIONS START ===================================================
|
||||
@@ -50,6 +50,7 @@ switch ($submit = form_get_action()) {
|
||||
$p[':capacity'] = gpc_get_int($_POST, 'capacity');
|
||||
if ($p[':capacity'] == 0) $p[':capacity'] = NULL;
|
||||
$p[':capaunit'] = gpc_get_string($_POST, 'capaunit');
|
||||
$p[':color'] = gpc_get_color($_POST, 'color');
|
||||
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
|
||||
db_exec_update('storage', $p, 'sid');
|
||||
$action = ACT_VIEW;
|
||||
@@ -107,7 +108,7 @@ page_caption_search($pagetitle);
|
||||
|
||||
// Storage
|
||||
// stype from dropdown
|
||||
$sql = "SELECT sid, sname, x, y, z, angle, remarks "
|
||||
$sql = "SELECT sid, sname, color, x, y, z, angle, remarks "
|
||||
. "FROM storage "
|
||||
. "WHERE vid=? "
|
||||
. "ORDER BY sid";
|
||||
@@ -119,6 +120,7 @@ echo "<thead>\n";
|
||||
echo "<tr>";
|
||||
echo '<th>#</th>';
|
||||
echo "<th>", _('Name'), "</th>";
|
||||
echo "<th>", _('Color'), "</th>";
|
||||
echo "<th>", _('Position'), "</th>";
|
||||
echo "<th>", _('Remarks'), "</th>";
|
||||
echo "<th> </th>";
|
||||
@@ -132,6 +134,7 @@ foreach ($res as $row) {
|
||||
echo '<a class="text-nowrap" title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['sid'], '"><i class="bi bi-eye ms-2"></i></a>', "\n";
|
||||
echo "</td>\n";
|
||||
echo "<td>", $row['sname'], "</td>\n";
|
||||
echo '<td>', format_color(strtoupper($row['color'])), "</td>\n";
|
||||
if ($row['angle'] != 0) {
|
||||
$angle = " (" . $row['angle'] . "°)";
|
||||
} else {
|
||||
@@ -216,7 +219,7 @@ form_create_select('stype', _('Type'), $opt_stype);
|
||||
elseif ($action == ACT_VIEW):
|
||||
// ========== VARIANT: view single record =====================================
|
||||
|
||||
$opt_unit = db_get_options(6);
|
||||
$opt_unit = db_get_options(DD_PROVISION_UNIT);
|
||||
$sql = "SELECT sid, sname, stype, capacity, capaunit, x, y, z, wx, wy, wz, angle, color, remarks "
|
||||
. "FROM storage "
|
||||
. "WHERE sid=?";
|
||||
@@ -358,6 +361,10 @@ form_create_select('stype', _('Type'), $opt_stype, $storage->stype);
|
||||
<input type="number" class="form-control" id="capacity" name="capacity" value="<?=$storage->capacity ?>">
|
||||
</div>
|
||||
<?php form_create_select('capaunit', _('Capacity Unit'), $opt_capaunit, $storage->capaunit); ?>
|
||||
<div class="mb-3">
|
||||
<label for="color"><?=_('Color')?></label>
|
||||
<input type="color" class="form-control" id="color" name="color" value="#<?=$storage->color ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($storage->remarks)?></textarea>
|
||||
|
||||
Reference in New Issue
Block a user