More improvements e.g. flags and provision target
This commit is contained in:
+18
-1
@@ -74,6 +74,8 @@ switch ($submit = form_get_action()) {
|
||||
$p[':ecat'] = gpc_get_int($_POST, 'category');
|
||||
if ($p[':ecat'] <= 0) $p[':ecat'] = NULL;
|
||||
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
|
||||
$allowed = db_load_enum('equipment', 'flags');
|
||||
$p[':flags'] = gpc_get_set($_POST, 'flags', $allowed, true, NULL);
|
||||
db_exec_update('equipment', $p, 'eid');
|
||||
$action = ACT_VIEW;
|
||||
break;
|
||||
@@ -374,6 +376,17 @@ foreach ($res as $row) {
|
||||
echo "<tr>\n";
|
||||
echo "<td>", $i;
|
||||
echo '<a class="text-nowrap" title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['eid'], '"><i class="bi bi-eye ms-2"></i></a>', "\n";
|
||||
// icons for some flags
|
||||
$flags = explode(',', $row['flags']);
|
||||
if (in_array('ordered', $flags)) {
|
||||
echo '<i class="bi bi-cart3" title="', _('Ordered'), '"></i>';
|
||||
}
|
||||
if (in_array('deleted', $flags)) {
|
||||
echo '<i class="bi bi-recycle" title="', _('Deleted'), '"></i>';
|
||||
}
|
||||
if (in_array('removed', $flags)) {
|
||||
echo '<i class="bi bi-x-square" title="', _('Removed'), '"></i>';
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<td>", $row['ename'], "</td>\n";
|
||||
echo "<td>", ($opt_manufacturer[$row['manufacturer']] ?? ''), "</td>\n";
|
||||
@@ -624,7 +637,7 @@ foreach ($sth->fetchAll() as $row) {
|
||||
}
|
||||
|
||||
$sql = "SELECT eid, ename, model, serial, weight, price, purchdate,"
|
||||
. " supplier, manufacturer, ecat, shortname, remarks "
|
||||
. " supplier, manufacturer, ecat, shortname, remarks, flags "
|
||||
. "FROM equipment "
|
||||
. "WHERE eid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -671,6 +684,10 @@ form_create_select('category', _('Category'), $g_opt_unknown + $opt_ecat, $equip
|
||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=$equipment->remarks ?></textarea>
|
||||
</div>
|
||||
<?php
|
||||
$opt_flags = db_load_enum('equipment', 'flags', true, true, false);
|
||||
form_create_checks('flags', _('Flags'), $opt_flags, explode(',', $equipment->flags));
|
||||
?>
|
||||
<button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button>
|
||||
<a href="<?=$g_scriptname?>?f=view&id=<?=$id?>" class="btn btn-secondary"><?=_('Back')?></a>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user