Settings page finished, filter gui improved

This commit is contained in:
2026-07-07 11:23:16 +02:00
parent 42df35f1a0
commit 2177834b39
12 changed files with 241 additions and 51 deletions
+21 -8
View File
@@ -185,7 +185,7 @@ form_view_buttons($g_scriptname, $id);
// Inventory in box
// WIP
$sql = "SELECT invid, invname, weight FROM inventory WHERE conttype='box' AND boxid=?";
$sql = "SELECT invid, invname, weight, number FROM inventory WHERE conttype='box' AND boxid=?";
$sth = $pdo->prepare($sql);
$sth->execute([$id]);
$res = $sth->fetchAll();
@@ -195,21 +195,34 @@ $weight_total = 0.0;
if ($res) {
echo '<table class="table table-striped">', "\n";
echo "<thead>\n";
echo "<tr>";
echo '<tr>';
echo '<th>#</th>';
echo '<th>', _('Inventory'), "</th>";
echo '<th>', _('Number'), "</th>";
echo '<th>', _('Weight'), "</th>";
echo "<td></td>";
echo "</thead>\n";
echo "</tr>\n";
$i = 1;
foreach ($res as $row) {
echo "<tr>\n";
echo "<td>", $row['invname'], "</td>\n";
echo "<td>", format_float($row['weight'], 2, 'kg'), "</td>\n";
form_action_buttons('inventory.php', $row['invid']);
echo '<td>', $i++, ' ';
echo '<a class="text-nowrap" title="', _('View'), '" href="inventory.php?f=view&id=', $row['invid'], '"><i class="bi bi-eye ms-2"></i></a>';
echo "</td>\n";
echo '<td>', $row['invname'], "</td>\n";
echo '<td>', $row['number'], "</td>\n";
echo '<td>';
$weight_item = $row['weight'] * $row['number'];
if ($weight_item > 0) {
$weight_total += $weight_item;
echo format_float($weight_item, 2, 'kg');
} else {
echo '-';
}
echo "</td>\n";
echo "</tr>\n";
$weight_total += $row['weight'];
}
echo "<tfoot>";
echo '<tr><td></td><td>', format_float($weight_total, 2, 'kg'), '</td>', "\n";
echo '<tr><td colspan="3"></td><td>', format_float($weight_total, 2, 'kg'), '</td>', "\n";
echo "</tfoot>\n";
echo "</table>\n";
} else {
+13 -6
View File
@@ -264,9 +264,17 @@ echo '<tr><th scope="row">', _('Street'),"</th><td>", $company->street, "</td></
echo '<tr><th scope="row">', _('Zip, City'),"</th><td>", $company->zip, ' ', $company->city, "</td></tr>\n";
echo '<tr><th scope="row">', _('Country'),"</th><td>", $company->country, "</td></tr>\n";
echo '<tr><th scope="row">', _('Contact'),"</th><td>", $company->contact, "</td></tr>\n";
echo '<tr><th scope="row">', _('Phone'),"</th><td>", $company->phone, "</td></tr>\n";
echo '<tr><th scope="row">', _('Email'),"</th><td>", $company->email, "</td></tr>\n";
echo '<tr><th scope="row">', _('Web'),"</th><td>", $company->web, "</td></tr>\n";
echo '<tr><th scope="row">', _('Phone'),"</th><td>";
echo make_phonelink($company->phone),' ', $company->phone, "</td></tr>\n";
echo '<tr><th scope="row">', _('Email'),"</th><td>";
echo make_maillink($company->email),' ', $company->email, "</td></tr>\n";
echo '<tr><th scope="row">', _('Web'),"</th><td>";
// echo '<a title="', _('Go to website'), '" href="',
echo make_weblink($company->web), ' ', $company->web, "</td></tr>\n";
echo '<tr><th scope="row">', _('Customer no.'),"</th><td>", $company->customerno, "</td></tr>\n";
echo '<tr><th scope="row">', _('Contract no.'),"</th><td>", $company->contractno, "</td></tr>\n";
echo '<tr><th scope="row">', _('Remarks'),"</th><td>", $company->remarks, "</td></tr>\n";
@@ -292,14 +300,13 @@ if ($sth->rowCount() > 0) {
}
// show referenced invoices
$sql = "SELECT docid, refid, filename, title "
. "FROM docref AS r JOIN document AS d USING (docid) "
. "WHERE reftype='company' AND refid=?";
. "WHERE r.reftype='company' AND r.refid=? AND d.doctype='invoice'";
$sth = $pdo->prepare($sql);
$sth->execute([$id]);
if ($sth->rowCount() > 0) {
echo "<p>Invoices:</p>\n";
echo "<p>", _('Invoices'), ":</p>\n";
echo "<ul>\n";
foreach ($sth->fetchAll() as $row) {
echo "<li>";
+19 -5
View File
@@ -313,9 +313,11 @@ $opt_special = array(
<form method="post" action="<?=$g_scriptname?>">
<div id="filter" class="card">
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
<div class="card-body">
<div class="card-body d-flex flex-wrap gap-3">
<div class="d-flex flex-nowrap gap-2">
<label for="flt_doctype">Type</label>
<select id="flt_doctype" name="flt_doctype">
<select class="form-select" id="flt_doctype" name="flt_doctype">
<?php
foreach ($opt_special + $opt_doctype as $k => $v) {
echo '<option value="', $k,'"';
@@ -326,8 +328,11 @@ foreach ($opt_special + $opt_doctype as $k => $v) {
}
?>
</select>
<label for="flt_reftype"><?=_('Ref.-Type')?></label>
<select id="flt_reftype" name="flt_reftype">
</div>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_reftype"><?=_('Reference')?></label>
<select class="form-select" id="flt_reftype" name="flt_reftype">
<?php
$opt_special['none'] = _('&horbar; none &horbar;');
foreach ($opt_special + $opt_reftype as $k => $v) {
@@ -339,11 +344,20 @@ foreach ($opt_special + $opt_reftype as $k => $v) {
}
?>
</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?>">
<input type="text" class="form-control" 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>
+51 -15
View File
@@ -36,6 +36,8 @@ switch ($submit = form_get_action()) {
$flt['manuf'] = gpc_get_int($_POST, 'flt_manuf');
$flt['supp'] = gpc_get_int($_POST, 'flt_supp');
$flt['txt'] = gpc_get_string($_POST, 'flt_txt');
$allowed = db_load_enum('equipment', 'flags');
$flt['flags'] = gpc_get_set($_POST, 'flt_flags', $allowed);
db_save_filter($flt, 200);
$action = ACT_DEFAULT;
break;
@@ -144,10 +146,10 @@ switch ($submit = form_get_action()) {
if ($factor < 1) {
$width = (int)($width * $factor);
$height = (int)($height * $factor);
$g_message->add(sprintf(_('Image sacled down to %dx%d'), $width, $height));
$g_message->add(sprintf(_('Image scaled down to %dx%d'), $width, $height));
if ($file_mimetype == 'image/jpeg') {
$orig = imagecreatefromjpeg($file_tmp);
$scaled = imagescale($orig, (int)($width * $factor), (int)($height * $factor), IMG_BICUBIC);
$scaled = imagescale($orig, $width, $height, IMG_BICUBIC);
imagejpeg($scaled, $file_tmp, 85);
} else if ($file_mimetype == 'image/png') {
$orig = imagecreatefrompng($file_tmp);
@@ -155,7 +157,7 @@ switch ($submit = form_get_action()) {
$g_error->Add("imagecreatefrompng failed");
break;
}
$scaled = imagescale($orig, (int)($width * $factor), (int)($height * $factor), IMG_BICUBIC);
$scaled = imagescale($orig, $width, $height, IMG_BICUBIC);
if (!$scaled) {
$g_error->Add("imagescale failed");
break;
@@ -231,7 +233,6 @@ if ($action == ACT_DEFAULT):
page_caption_search($pagetitle);
$flt = db_get_filter($user->id, 200);
$sort = array(
1 => 'ename',
2 => 'ename DESC'
@@ -261,12 +262,21 @@ if (strlen($flt->txt) > 1) {
$w[] = '(ename LIKE :txt OR model LIKE :txt OR remarks LIKE :txt)';
$p[':txt'] = '%'.$flt->txt.'%';
}
// TODO flags (ordered, removed, deleted)
// if (strlen($flt->flags) > 0) {
// }
// condition for multiple flags is OR
$parts = ["flags=''", 'flags IS NULL'];
foreach ($flt->flags as $f) {
$parts[] = "FIND_IN_SET('$f', flags)";
}
if (!empty($parts)) {
if (count($parts) > 1) {
$w[] = '(' . join(' OR ', $parts) . ')';
} else {
$w[] = $parts[0];
}
}
$where = join(' AND ', $w);
$order = ' ORDER BY ename';
// get total record count for pagination and limit
$sth = $pdo->prepare("SELECT COUNT(*) FROM equipment WHERE " . $where);
try {
@@ -314,12 +324,13 @@ filter_create_select('flt_supp', _('Supplier'), $g_opt_all + $opt_none_male + $o
?>
<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 ?>">
<input type="text" class="form-control" name="flt_txt" maxlength="30" value="<?=$flt->txt ?>">
</div>
<div class="d-flex flex-nowrap gap-2">
<?php
$enum_data = db_load_enum('equipment', 'flags', true, true, false);
form_create_checks('flags', _('Flags'), $enum_data, []);
$opt_flags = db_load_enum('equipment', 'flags', true, true, false);
filter_create_checks('flt_flags', _('Flags'), $opt_flags, $flt->flags ?? []);
?>
</div>
</div>
@@ -455,7 +466,7 @@ echo '<div class="col">', "\n";
echo '<div class="card">', "\n";
echo '<div class="card-header">', _('Images and documents'), "</div>\n";
echo '<div class="card-body">', "\n";
echo '<div class="card-body d-flex flex-wrap gap-3">', "\n";
$sql = "SELECT d.docid, d.doctype, d.title "
. "FROM docref AS r INNER JOIN document AS d using (docid) "
@@ -468,13 +479,19 @@ $res = $sth->fetchAll();
$doccount = 0;
foreach ($res as $row) {
$doccount += 1;
echo '<div class="border rounded p-2 d-flex flex-column" style="width: 150px;">';
if ($row['doctype'] == 'picture') {
echo '<a href="dl.php?id=', $row['docid'], '">';
// echo '<img width="120" src="doc/pic-', $row['hash'], '.', $row['extension'],'">';
echo '<img width="120" src="dl.php?id=', $row['docid'], '" alt="', $row['title'], '">';
echo '<img class="img-fluid rounded mb-2" width="120" src="dl.php?id=', $row['docid'], '" alt="', $row['title'], '">';
echo "</a>\n";
// additionally direct download and go to document details page
echo '<div class="d-flex justify-content-between mt-auto">';
echo '<a href="documents.php?f=view&id=', $row['docid'], '" title="Download image"> <i class="bi bi-eye"></i></a>';
echo '<a href="dl.php?id=', $row['docid'], '" title="View document"><i class="bi bi-download"></i></a>';
echo '</div>';
} elseif ($row['doctype'] == 'drawing') {
echo "<p>Drawing: ", $row['title'], "<br>";
echo "<p>Drawing:<br>", $row['title'], "<br>";
echo '<a href="dl.php?id=', $row['docid'], '">';
echo '<img width="180" src="dl.php?id=', $row['docid'], '">';
echo "</a>";
@@ -485,7 +502,7 @@ foreach ($res as $row) {
// echo $row['title'];
echo "</a>\n";
} elseif ($row['doctype'] == 'manual') {
echo "<p>Manual: ";
echo "<p>Manual:<br>";
echo '<a href="documents.php?f=view&id=', $row['docid'], '">';
echo $row['title'];
echo "</a></p>\n";
@@ -493,6 +510,7 @@ foreach ($res as $row) {
// unknown document type
echo "<span>Unknown document type:", $row['doctype'], "</span>\n";
}
echo "</div>\n";
}
if ($doccount == 0) {
echo _('No referenced documents'), "\n";
@@ -581,6 +599,24 @@ if ($sth->rowCount() > 0) {
echo '<p>', _('No spare parts found.'), "<p>\n";
}
// Document preview
?>
<div class="modal fade" id="imageModal" tabindex="-1" aria-labelledby="imageModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered custom-image-modal">
<div class="modal-content">
<div class="modal-header">
TITLE
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
IMAGE
</div>
</div>
</div>
</div>
<?php
elseif ($action == ACT_EDIT):
// ========== VARIANT: edit single record =====================================
+101 -4
View File
@@ -364,11 +364,28 @@ function db_exec_insert($table, $params) {
}
function db_exec_update($table, $params, $pk) {
// TODO primary key with multiple fields: $pk is an array
// primary key can be a single field name or multiple fields: $pk is an array
global $pdo;
global $g_error;
$fields = join(',', array_map(function($s) { return ltrim($s, ':') . '=' . $s; }, array_keys($params)));
$sql = "UPDATE $table SET $fields WHERE $pk=:$pk";
// remove primary key fields from list of fields to update
if (is_array($pk)) {
if (count($pk) == 1) {
$pk = $pk[0];
$fields = $params;
unset($fields[':'.$pk]);
$where = "$pk=:$pk";
} else {
$pkparams = array_map(fn($value) => ':' . $value, $pk);
$fields = array_diff_key($params, array_flip($pkparams));
$where = join(' AND ', array_map(fn($s) => "$s=:$s", $pk));
}
} else {
$fields = $params;
unset($fields[':'.$pk]);
$where = "$pk=:$pk";
}
$fieldlist = join(',', array_map(fn($s) => ltrim($s, ':') . '=' . $s, array_keys($fields)));
$sql = "UPDATE $table SET $fieldlist WHERE $where";
$sth = $pdo->prepare($sql);
try {
$sth->execute($params);
@@ -503,6 +520,7 @@ function db_load_enum($table, $column, $lookup=false, $as_dict=false, $check_nul
// if lookup is true the name lookup and translaton is applied
// if as_dict is true the enum value is returned as the array key
// if check_null is true the nullable-check is applied and returned
// works also for set datatype
global $pdo;
$sql = "SELECT TRIM(TRAILING ')' FROM SUBSTRING(column_type,6)), is_nullable "
. "FROM information_schema.columns "
@@ -903,6 +921,7 @@ function form_create_checks($fieldname, $label, $optlist, $selected) {
echo "</div>\n";
}
// TODO DEPRECATED for touch multiple adjacent buttuns are not well suited.
function form_action_buttons($script, $id) {
echo "<td>";
echo '<a title="', _('View'), '" href="', $script, '?f=view&id=', $id, '"><i class="bi-eye"></i></a>', "\n";
@@ -980,7 +999,7 @@ function filter_create_select($fieldname, $label, $optlist, $selval=NULL, $multi
} */
echo '<div class="d-flex flex-nowrap gap-2">', "\n";
echo '<label for="', $fieldname,'">', $label,'</label>', "\n";
echo '<select id="', $fieldname, '" name="', $fieldname, '"', $multiple ? ' multiple' : '', ">\n";
echo '<select class="form-select" id="', $fieldname, '" name="', $fieldname, '"', $multiple ? ' multiple' : '', ">\n";
foreach ($optlist as $k => $v) {
echo '<option value="', $k, '"';
if ($k == $selval) {
@@ -992,6 +1011,24 @@ function filter_create_select($fieldname, $label, $optlist, $selval=NULL, $multi
echo "</div>";
}
function filter_create_checks($fieldname, $label, $optlist, $selected = []) {
// TODO WIP
echo '<fieldset class="mb-3">';
echo '<legend class="fs-6 mb-1 border-bottom pb-1">', $label, "</legend>\n";
echo '<div class="d-flex flex-wrap gap-3">';
foreach ($optlist as $k => $v) {
echo '<div class="form-check">';
$checked = in_array($k, $selected, true) ? ' checked' : '';
echo '<label class="form-check-label">';
echo '<input type="checkbox" class="form-check-input" name="', $fieldname, '[', $k, ']"', $checked, '>';
echo $v;
echo '</label>';
echo '</div>';
}
echo '</div>';
echo '</fieldset>';
}
// ========== FORMAT FUNCTIONS ================================================
function format_float($val, $decimals = 2, $suffix = '') {
@@ -1202,6 +1239,66 @@ function pdf_get_preview($docid) {
}
function make_weblink($dest) {
$dest = trim($dest);
if ($dest === '') {
return '';
}
$scheme = strtolower((string) parse_url($dest, PHP_URL_SCHEME));
if ($scheme === '') {
$dest = 'https://' . $dest;
} elseif (!in_array($scheme, ['http', 'https'], true)) {
return '';
}
return '<a href="' . $dest . '"><i class="bi-globe"></i></a>';
}
function make_maillink($dest) {
$dest = trim($dest);
if ($dest === '') {
return '';
}
$scheme = strtolower((string) parse_url($dest, PHP_URL_SCHEME));
if ($scheme === '') {
$dest = 'mailto:' . $dest;
} elseif ($scheme !== 'mailto') {
return '';
}
return '<a href="' . $dest . '"><i class="bi-envelope"></i></a>';
}
function make_phonelink($dest) {
$dest = normalize_phone_e164($dest);
if ($dest === '') {
return '';
}
$scheme = strtolower((string) parse_url($dest, PHP_URL_SCHEME));
if ($scheme === '') {
$dest = 'tel:' . $dest;
} elseif ($scheme !== 'tel') {
return '';
}
return '<a href="' . $dest . '"><i class="bi-telephone"></i></a>';
}
function normalize_phone_e164($phone) {
$phone = trim($phone);
if ($phone === '') {
return '';
}
$phone = preg_replace('/[^\d+]/', '', $phone);
if (str_starts_with($phone, '+')) {
return $phone;
}
if (str_starts_with($phone, '00')) {
return '+' . substr($phone, 2);
}
if (str_starts_with($phone, '0')) {
$phone = substr($phone, 1);
}
return '+49' . $phone;
}
// ========== MENU FUNCTIONS ==================================================
$g_menu = Array (
+3 -3
View File
@@ -188,7 +188,7 @@ $opt_special = array(
?>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_stor"><?=_('Storage')?></label>
<select id="flt_stor" name="flt_stor">
<select class="form-select" id="flt_stor" name="flt_stor">
<?php
foreach ($opt_special + $opt_storage as $k => $v) {
echo '<option value="', $k,'"';
@@ -202,7 +202,7 @@ foreach ($opt_special + $opt_storage as $k => $v) {
</div>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_cond"><?=_('Condition')?></label>
<select id="flt_cond" name="flt_cond">
<select class="form-select" id="flt_cond" name="flt_cond">
<?php
$opt_special = array(
-2 => _('&horbar; all &horbar;'),
@@ -219,7 +219,7 @@ foreach ($opt_special + $opt_invcond as $k => $v) {
</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 ?>">
<input type="text" class="form-control" name="flt_txt" size="15" maxlength="30" value="<?=$flt->txt ?>">
</div>
</div>
<div class="card-footer">
+12
View File
@@ -110,3 +110,15 @@ function gpc_get_enum(&$GPC, $varname, $values, $default = NULL) {
}
return $GPC[$varname];
}
function gpc_get_set(&$GPC, $varname, $allowed, $as_string = false, $default = []) {
if (!isset($GPC[$varname])) {
return $default;
}
$selected = array_intersect($allowed, array_keys($GPC[$varname]));
if ($as_string) {
return implode(',', $selected);
} else {
return array_values($selected);
}
}
+2 -2
View File
@@ -93,7 +93,7 @@ $opt_special = array(
<div class="card-body d-flex flex-wrap gap-3">
<div class="d-flex flex-nowrap gap-2">
<label for="flt_equip"><?=_('Equipment')?></label>
<select id="flt_equip" name="flt_equip">
<select class="form-select" id="flt_equip" name="flt_equip">
<?php
foreach ($opt_special + $opt_equipment as $k => $v) {
echo '<option value="', $k,'"';
@@ -107,7 +107,7 @@ foreach ($opt_special + $opt_equipment as $k => $v) {
</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 ?? ''?>">
<input type="text" class="form-control" name="flt_txt" maxlength="30" value="<?=$flt->txt ?? ''?>">
</div>
</div>
<div class="card-footer">
+1 -1
View File
@@ -104,7 +104,7 @@ Auswahl an anderen Stellen im Programm benötigt.</p>
<h3>Dokumente</h3>
<p>Ein Dokument kann mehrfach zugeordnet werden. Z.B. einem
Ausrüstungsgegenstand und gleichzeitig einem Projekt oder einer Aufgabe.</p>
Ausrüstungsgegenstand und gleichzeitig einer Firma, einem Projekt oder einer Aufgabe.</p>
<p>Es stehen verschiedene Dokumentarten zur Verfügung:</p>
<ul>
<li>Fotos bzw. Bilder als png- oder jpg-Dateien</li>
+15 -4
View File
@@ -15,6 +15,7 @@ $id = gpc_get_int($_REQUEST, 'id', 0);
$opt_mtype = db_load_enum('measurement', 'mtype', true, false);
$opt_unit = db_get_options(8);
// TODO use enum function
$opt_accuracy = array(
'unknown' => _('Unknown'),
'precise' => _('Precise'),
@@ -55,6 +56,7 @@ switch ($submit = form_get_action()) {
case 'insert':
$p[':mname'] = gpc_get_string($_POST, 'mname');
$p[':mtype'] = gpc_get_string($_POST, 'mtype');
$p[':note'] = gpc_get_string($_POST, 'note');
$p[':nval'] = gpc_get_int($_POST, 'nval'); // 1 to 3 dimensions
$p[':val1'] = gpc_get_int($_POST, 'val1');
@@ -79,6 +81,7 @@ switch ($submit = form_get_action()) {
case 'update':
$p[':mid'] = $id;
$p[':mname'] = gpc_get_string($_POST, 'mname');
$p[':mtype'] = gpc_get_string($_POST, 'mtype');
$p[':nval'] = gpc_get_int($_POST, 'nval'); // 1 to 3 dimensions
$p[':val1'] = gpc_get_int($_POST, 'val1');
$p[':val2'] = NULL;
@@ -171,6 +174,7 @@ $res = $sth->fetchAll();
echo '<table class="table table-striped">', "\n";
echo "<thead>\n";
echo "<tr>\n";
echo '<th>#</th>';
echo '<th>', _('Measurement'), "</th>";
echo '<th>', _('Note'), "</th>";
echo '<th class="text-end">', _('Measured'), "</th>";
@@ -179,16 +183,20 @@ echo '<th>', _('Accuracy'), "</th>";
echo "<th></th>";
echo "</tr>\n";
echo "</thead>\n";
$i = 0;
foreach ($res as $row) {
$i++;
echo "<tr>\n";
echo '<td>', $i;
echo '<a class="text-nowrap" title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['mid'], '"><i class="bi bi-eye ms-2"></i></a>';
echo "</td>\n";
echo "<td>", $row['mname'], "</td>\n";
echo "<td>", $row['note'], "</td>\n";
echo '<td class="text-end">', format_vals($row['nval'], $row['val1'], $row['val2'], $row['val3']), "</td>\n";
echo "<td>", $opt_unit[$row['unit']], "</td>\n";
echo "<td>", $opt_accuracy[$row['accuracy']], "</td>\n";
echo "<td>";
// Action buttons
form_action_buttons($g_scriptname, $row['mid']);
echo '<a class="text-nowrap" title="', _('Edit'), '" href="', $g_scriptname, '?f=edit&id=', $row['mid'], '"><i class="bi bi-pencil ms-2"></i></a>';
echo "</td>\n";
echo "</tr>\n";
}
@@ -216,6 +224,7 @@ echo '<h2>', _('Add measurement'), "</h2>\n";
<input type="text" class="form-control" id="note" name="note">
</div>
<?php
form_create_select('mtype', _('Type'), $opt_mtype);
form_create_select('nval', _('Dimensions'), $opt_dimensions);
?>
<div class="mb-3">
@@ -245,7 +254,7 @@ form_create_select('eid', _('Equipment'), $opt_equipment, $id);
elseif ($action == ACT_VIEW):
// ========== VARIANT: view single record =====================================
$sql = "SELECT mname, unit, nval, val1, val2, val3, accuracy, mdate, note, eid "
$sql = "SELECT mname, mtype, unit, nval, val1, val2, val3, accuracy, mdate, note, eid "
. "FROM measurement "
. "WHERE mid=?";
$sth = $pdo->prepare($sql);
@@ -256,6 +265,7 @@ echo '<h2>', _('Measurement'), "</h2>\n";
echo '<table class="table">', "\n";
echo '<tr><th style="width:20%">', _('Name'),"</th><td>", $measurement->mname, "</td></tr>\n";
echo '<tr><th>', _('Type'),"</th><td>", $opt_mtype[$measurement->mtype], "</td></tr>\n";
echo '<tr><th>', _('Unit'),"</th><td>", $opt_unit[$measurement->unit], "</td></tr>\n";
echo '<tr><th>', _('Values'),"</th><td>$measurement->nval</td></tr>\n";
echo '<tr><th>', _('Value 1'),"</th><td>$measurement->val1</td></tr>\n";
@@ -273,7 +283,7 @@ form_view_buttons($g_scriptname, $id);
elseif ($action == ACT_EDIT):
// ========== VARIANT: edit single record =====================================
$sql = "SELECT mname, nval, val1, val2, val3, unit, accuracy, note, eid "
$sql = "SELECT mname, mtype, nval, val1, val2, val3, unit, accuracy, note, eid "
. "FROM measurement "
. "WHERE mid=?";
$sth = $pdo->prepare($sql);
@@ -293,6 +303,7 @@ echo '<h2>', _('Edit measurement'), "</h2>\n";
<input type="text" class="form-control" id="note" name="note" value="<?=$measurement->note ?>">
</div>
<?php
form_create_select('mtype', _('Type'), $opt_mtype, $measurement->mtype);
form_create_select('nval', _('Dimensions'), $opt_dimensions, $measurement->nval);
?>
<div class="mb-3">
+2 -2
View File
@@ -159,14 +159,14 @@ $res = $sth->fetchAll();
<div class="card-body d-flex flex-wrap gap-3">
<div class="d-flex flex-nowrap gap-2">
<label for="flt_name">Name</label>
<input type="text" name="flt_name" size="15" maxlength="30" value="<?=$flt->name;?>">
<input type="text" class="form-control" name="flt_name" size="15" maxlength="30" value="<?=$flt->name;?>">
</div>
<?php
filter_create_select('flt_state[]', _('State'), $g_opt_all + $opt_state, $flt->state, FALSE);
?>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_remarks">Text</label>
<input type="text" name="flt_remarks" size="15" maxlength="30" value="<?=$flt->remarks ?>">
<input type="text" class="form-control" name="flt_remarks" size="15" maxlength="30" value="<?=$flt->remarks ?>">
</div>
</div>
<div class="card-footer">
+1 -1
View File
@@ -157,7 +157,7 @@ filter_create_select('flt_cat', _('Category'), $g_opt_all + $g_opt_none + $opt_c
?>
<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;?>">
<input type="text" class="form-control" name="flt_txt" maxlength="30" value="<?=$flt->txt;?>">
</div>
</div>
<div class="card-footer">