Webgui: ongoing development
This commit is contained in:
+16
-6
@@ -1,17 +1,20 @@
|
||||
<?php
|
||||
/******************************************************************************
|
||||
* YMS - Yacht Management Software
|
||||
* Copyright (C) 2024 Thomas Hooge
|
||||
* Copyright (C) 2024-2026 Thomas Hooge
|
||||
*
|
||||
* SPDX-License-Identifier: WTFPL
|
||||
******************************************************************************/
|
||||
|
||||
require 'globals.inc';
|
||||
require 'lib/gpc.inc';
|
||||
|
||||
$pagetitle = _('Maintenance');
|
||||
|
||||
$id = gpc_get_int($_REQUEST, 'id', 0);
|
||||
|
||||
$opt_equipment = db_get_opt_equip($user->vid, [0 => _('*** unassigned ***')]);
|
||||
$opt_state = db_load_enum('maintenance', 'maintstate', true, true);
|
||||
|
||||
// ========== ACTIONS START ===================================================
|
||||
|
||||
@@ -50,6 +53,8 @@ switch ($submit = form_get_action()) {
|
||||
$p[':eid'] = gpc_get_int($_POST, 'eid');
|
||||
$p[':activities'] = gpc_get_string($_POST, 'activities', 80);
|
||||
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
|
||||
$p[':series'] = gpc_get_int($_POST, 'series');
|
||||
$p[':maintstate'] = gpc_get_string($_POST, 'maintstate');
|
||||
db_exec_update('maintenance', $p, 'maintid');
|
||||
$action = ACT_VIEW;
|
||||
break;
|
||||
@@ -87,7 +92,7 @@ $opt_special = array(
|
||||
<div class="card-header"><i class="bi bi-funnel me-2"></i>Filter</div>
|
||||
<div class="card-body d-flex flex-wrap gap-3">
|
||||
<div class="d-flex flex-nowrap gap-2">
|
||||
<label for="flt_equip">Equipment</label>
|
||||
<label for="flt_equip"><?=_('Equipment')?></label>
|
||||
<select id="flt_equip" name="flt_equip">
|
||||
<?php
|
||||
foreach ($opt_special + $opt_equipment as $k => $v) {
|
||||
@@ -222,7 +227,7 @@ elseif ($action == ACT_VIEW):
|
||||
|
||||
echo '<h2>', _('View Maintenance'), "</h2>\n";
|
||||
|
||||
$sql = "SELECT m.activities, m.eid, m.remarks, e.ename "
|
||||
$sql = "SELECT m.activities, m.eid, m.remarks, m.series, m.maintstate, e.ename "
|
||||
. "FROM maintenance AS m LEFT OUTER JOIN equipment AS e USING (eid) "
|
||||
. "WHERE m.maintid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -255,6 +260,8 @@ if (isset($maint->eid) and $maint->eid>0) {
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
echo '<tr><th>', _('Remarks'),"</th><td>", $maint->remarks, "</td></tr>\n";
|
||||
echo '<tr><th>', _('Series'),"</th><td>", $maint->series, "</td></tr>\n";
|
||||
echo '<tr><th scope="row">', _('State'),"</th><td>", get_enum($maint->maintstate), "</td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo '</div>'; // Column break
|
||||
@@ -301,12 +308,10 @@ echo '<a href="note.php?f=add&t=maint&id=', $id, '" class="btn btn-primary" role
|
||||
echo _('Add note'), "</a>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
||||
|
||||
elseif ($action == ACT_EDIT):
|
||||
// ========== VARIANT: edit single record =====================================
|
||||
|
||||
$sql = "SELECT activities, eid, remarks "
|
||||
$sql = "SELECT activities, eid, remarks, series, maintstate "
|
||||
. "FROM maintenance "
|
||||
. "WHERE maintid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -327,7 +332,12 @@ echo '<h2>', _('Edit Maintenance'), "</h2>\n";
|
||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=$maint->remarks ?></textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="series" class="form-label"><?=_('Series')?></label>
|
||||
<input type="text" class="form-control" id="series" name="series" maxlength="4" value="<?=$maint->series ?>">
|
||||
</div>
|
||||
<?php
|
||||
form_create_select('maintstate', _('Status'), $opt_state, $maint->maintstate);
|
||||
|
||||
form_edit_buttons($g_scriptname, $id);
|
||||
echo "</form>\n";
|
||||
|
||||
Reference in New Issue
Block a user