Work on webgui and add flags to equipment

This commit is contained in:
2025-07-01 10:48:39 +02:00
parent 1f2af40943
commit d5d754d596
6 changed files with 58 additions and 17 deletions
+10 -6
View File
@@ -1,7 +1,7 @@
<?php
/******************************************************************************
* YMS - Yacht Management Software
* Copyright (C) 2024 Thomas Hooge
* Copyright (C) 2024, 2025 Thomas Hooge
*
* SPDX-License-Identifier: WTFPL
******************************************************************************/
@@ -195,19 +195,23 @@ $sort = array(
$w = array('vid=:vid');
$p = array(':vid' => $user->vid);
if ($flt->cat == -1) {
$w[] = 'ecat IS NULL';
} elseif ($flt->cat > 0) {
if ($flt->cat > 0) {
$w[] = 'ecat=:ecat';
$p[':ecat'] = $flt->cat;
} elseif ($flt->cat == -1) {
$w[] = 'ecat IS NULL';
}
if ($flt->manuf > 0) {
$w[] = 'manufacturer=:manuf';
$p[':manuf'] = $flt->manuf;
} elseif ($flt->manuf == -1) {
$w[] = 'manufacturer IS NULL';
}
if ($flt->supp > 0) {
$w[] = 'supplier=:supp';
$p[':supp'] = $flt->supp;
} elseif ($flt->supp == -1) {
$w[] = 'supplier IS NULL';
}
if (strlen($flt->txt) > 1) {
$w[] = '(ename LIKE :txt OR model LIKE :txt OR remarks LIKE :txt)';
@@ -216,7 +220,7 @@ if (strlen($flt->txt) > 1) {
$where = join(' AND ', $w);
$order = ' ORDER BY ename';
// get total recond count for pagination and limit
// get total record count for pagination and limit
$sth = $pdo->prepare("SELECT COUNT(*) FROM equipment WHERE " . $where);
try {
$sth->execute($p);
@@ -379,7 +383,7 @@ echo '<div class="col">';
<?php
$sql = "SELECT d.docid, d.doctype, d.title "
. "FROM docref AS r INNER JOIN document AS d using (docid) "
. "WHERE r.refid=? "
. "WHERE r.reftype='equipment' AND r.refid=? "
. "ORDER BY d.doctype";
$sth = $pdo->prepare($sql);
$sth->execute([$id]);