Webgui: improve box, maintenance and date handling
This commit is contained in:
+29
-4
@@ -55,6 +55,8 @@ switch ($submit = form_get_action()) {
|
||||
$p[':activities'] = gpc_get_string($_POST, 'activities', 80);
|
||||
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
|
||||
$p[':series'] = gpc_get_int($_POST, 'series');
|
||||
$p[':plan_date'] = gpc_get_date($_POST, 'plan_date');
|
||||
$p[':completion_date'] = gpc_get_date($_POST, 'completion_date');
|
||||
$p[':maintstate'] = gpc_get_string($_POST, 'maintstate');
|
||||
db_exec_update('maintenance', $p, 'maintid');
|
||||
$action = ACT_VIEW;
|
||||
@@ -247,7 +249,8 @@ elseif ($action == ACT_VIEW):
|
||||
echo '<h2>', _('View Maintenance'), "</h2>\n";
|
||||
|
||||
// load maintenance record
|
||||
$sql = "SELECT m.activities, m.eid, m.remarks, m.series, m.maintstate, e.ename "
|
||||
$sql = "SELECT m.activities, m.eid, m.remarks, m.series, m.maintstate, e.ename, "
|
||||
. "m.plan_date, m.completion_date, m.interval_hours, m.last_hours "
|
||||
. "FROM maintenance AS m LEFT OUTER JOIN equipment AS e USING (eid) "
|
||||
. "WHERE m.maintid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -282,6 +285,10 @@ if (isset($maint->eid) and $maint->eid>0) {
|
||||
echo "</td></tr>\n";
|
||||
echo '<tr><th>', _('Remarks'),"</th><td>", h($maint->remarks), "</td></tr>\n";
|
||||
echo '<tr><th>', _('Series'),"</th><td>", $maint->series, "</td></tr>\n";
|
||||
echo '<tr><th>', _('Interval'),"</th><td>", $maint->interval_hours, " h</td></tr>\n";
|
||||
echo '<tr><th>', _('Last'),"</th><td>", $maint->last_hours, "</td></tr>\n";
|
||||
echo '<tr><th>', _('Plan date'),"</th><td>", format_date($maint->plan_date), "</td></tr>\n";
|
||||
echo '<tr><th>', _('Completion date'),"</th><td>", format_date($maint->completion_date), "</td></tr>\n";
|
||||
echo '<tr><th scope="row">', _('State'),"</th><td>", get_enum($maint->maintstate), "</td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
@@ -293,7 +300,9 @@ echo '<h4>Documents for ', h($maint->ename), "</h4>\n";
|
||||
if (isset($docs)) {
|
||||
echo '<ul>', "\n";
|
||||
foreach ($docs as $d) {
|
||||
echo '<li>', $d['title'] ?? $d['filename'], ' (', $d['docid'], ")</li>\n";
|
||||
echo '<li>', $d['title'] ?? $d['filename'], ' (', $d['docid'], ')';
|
||||
echo ' <a href="documents.php?f=view&id=', $d['docid'], '"><i class="bi-eye"></i></a>';
|
||||
echo "</li>\n";
|
||||
}
|
||||
echo "</ul>\n";
|
||||
} else {
|
||||
@@ -332,7 +341,7 @@ echo "</div>\n";
|
||||
elseif ($action == ACT_EDIT):
|
||||
// ========== VARIANT: edit single record =====================================
|
||||
|
||||
$sql = "SELECT activities, eid, remarks, series, maintstate "
|
||||
$sql = "SELECT activities, eid, remarks, series, plan_date, completion_date, maintstate "
|
||||
. "FROM maintenance "
|
||||
. "WHERE maintid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -351,12 +360,28 @@ echo '<h2>', _('Edit Maintenance'), "</h2>\n";
|
||||
<?php form_create_select('eid', _('Equipment'), $opt_equipment, $maint->eid); ?>
|
||||
<div class="mb-3">
|
||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($maint->remarks, br:true)?></textarea>
|
||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($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>
|
||||
<div class="mb-3">
|
||||
<label for="interval_hours" class="form-label"><?=_('Interval hours')?></label>
|
||||
<input type="number" class="form-control" id="interval_hours" name="interval_hours" inputmode="numeric" maxlength="6" value="<?=$maint->interval_hours ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="last_hours" class="form-label"><?=_('Last hours')?></label>
|
||||
<input type="number" class="form-control" id="last_hours" name="last_hours" inputmode="numeric" maxlength="6" value="<?=$maint->last_hours ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="plan_date"><?=_('Plan date')?></label>
|
||||
<input type="date" class="form-control" id="plan_date" name="plan_date" value="<?=$maint->plan_date ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="completion_date"><?=_('Completion date')?></label>
|
||||
<input type="date" class="form-control" id="completion_date" name="completion_date" value="<?=$maint->completion_date ?>">
|
||||
</div>
|
||||
<?php
|
||||
form_create_select('maintstate', _('Status'), $opt_state, $maint->maintstate);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user