Webgui code improvements and fixes
This commit is contained in:
1 parent
dacf32b401
commit
5fe9a52f15
14 files changed
+202
-308
No files matched your search
+1
-1
@@ -180,7 +180,7 @@ $sth = $pdo->prepare($sql);
|
|||||||
$sth->execute([$id]);
|
$sth->execute([$id]);
|
||||||
$box = $sth->fetch(PDO::FETCH_OBJ);
|
$box = $sth->fetch(PDO::FETCH_OBJ);
|
||||||
|
|
||||||
echo '<h2>', $box->label, "</h2>\n";
|
echo '<h2>', sprintf(_('Box: %s'), h($box->label)), "</h2>\n";
|
||||||
|
|
||||||
// Bootstrap grid
|
// Bootstrap grid
|
||||||
echo '<div class="container">';
|
echo '<div class="container">';
|
||||||
|
|||||||
+13
-54
@@ -194,26 +194,13 @@ echo '<h2>', _('Add Cable'), "</h2>\n";
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="tagname" class="form-label"><?=_('Name')?></label>
|
|
||||||
<input type="text" class="form-control" id="cablename" name="cablename" required autofocus>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="note" class="form-label"><?=_('Length, m')?></label>
|
|
||||||
<input type="text" class="form-control" id="length" name="length">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('cablename', _('Name'), 80, NULL, TRUE, TRUE);
|
||||||
|
form_create_numeric('length', _('Length, m'), step: 0.01);
|
||||||
form_create_select('cabletype', _('Type'), $g_opt_none + $opt_cabletype);
|
form_create_select('cabletype', _('Type'), $g_opt_none + $opt_cabletype);
|
||||||
?>
|
form_create_numeric('number', _('Number of conductors'), NULL, 1, 99, 1);
|
||||||
<div class="mb-3">
|
form_create_numeric('xsection', _('Cross section, mm²'), NULL, 0, 999, 0.1);
|
||||||
<label for="note" class="form-label"><?=_('Number of conductors')?></label>
|
|
||||||
<input type="number" class="form-control" id="conductors" name="conductors">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="note" class="form-label"><?=_('Cross section, mm²')?></label>
|
|
||||||
<input type="text" class="form-control" id="xsection" name="xsection">
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
form_new_buttons($g_scriptname);
|
form_new_buttons($g_scriptname);
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
|
|
||||||
@@ -261,46 +248,18 @@ echo '<h2>', _('Edit cable'), "</h2>\n";
|
|||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<input type="hidden" name="id" value="<?=$id?>">
|
<input type="hidden" name="id" value="<?=$id?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="mname" class="form-label"><?=_('Name')?></label>
|
|
||||||
<input type="text" class="form-control" id="cablename" name="cablename" value="<?=h($cable->cablename)?>">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('cablename', _('Name'), 80, $cable->cablename, TRUE, TRUE);
|
||||||
form_create_select('cabletype', _('Type'), $g_opt_none + $opt_cabletype, $cable->cabletype);
|
form_create_select('cabletype', _('Type'), $g_opt_none + $opt_cabletype, $cable->cabletype);
|
||||||
form_create_select('techname', _('Techname'), $g_opt_none + $opt_techname, $cable->techname);
|
form_create_select('techname', _('Techname'), $g_opt_none + $opt_techname, $cable->techname);
|
||||||
?>
|
form_create_numeric('length', _('Length, m'), format_float($cable->length, 1), 0, 9999, 0.01);
|
||||||
<div class="mb-3">
|
form_create_numeric('number', _('Number of conductors'), $cable->conductors, 1, 99, 1);
|
||||||
<label for="note" class="form-label"><?=_('Length, m')?></label>
|
form_create_numeric('diameter', ('Diameter, mm'), format_float($cable->diameter, 1), 0, 999, 0.1);
|
||||||
<input type="text" class="form-control" id="length" name="length" value="<?=format_float($cable->length, 1);?>">
|
form_create_numeric('xsection', _('Cross section, mm²'), format_float($cable->xsection, 1), 0, 999, 0.1);
|
||||||
</div>
|
form_create_numeric('weight', _('Weight, kg/m'), format_float($cable->weight, 2), 0, 9999, 0.01);
|
||||||
<div class="mb-3">
|
form_create_color('color', _('Color'), $cable->color);
|
||||||
<label for="note" class="form-label"><?=_('Number of conductors')?></label>
|
|
||||||
<input type="number" class="form-control" id="conductors" name="conductors" value="<?=$cable->conductors;?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="note" class="form-label"><?=_('Diameter, mm')?></label>
|
|
||||||
<input type="text" class="form-control" id="diameter" name="diameter" value="<?=format_float($cable->diameter, 1);?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="note" class="form-label"><?=_('Cross section, mm²')?></label>
|
|
||||||
<input type="text" class="form-control" id="xsection" name="xsection" value="<?=format_float($cable->xsection, 1);?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="note" class="form-label"><?=_('Weight, kg/m')?></label>
|
|
||||||
<input type="text" class="form-control" id="weight" name="weight" value="<?=$cable->weight;?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="color" class="form-label"><?=_('Color')?></label>
|
|
||||||
<input type="color" name="color" id="color" class="form-control" value="#<?=$cable->color;?>">
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
form_create_select('cablecond', _('Condition'), $opt_cablecond, $cable->cablecond);
|
form_create_select('cablecond', _('Condition'), $opt_cablecond, $cable->cablecond);
|
||||||
?>
|
form_create_textarea('remarks', _('Remarks'), 3, 150, $cable->remarks);
|
||||||
<div class="mb-3">
|
|
||||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
|
||||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($cable->remarks)?></textarea>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
form_edit_buttons($g_scriptname, $id);
|
form_edit_buttons($g_scriptname, $id);
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
|
|||||||
@@ -113,11 +113,8 @@ elseif ($action == ACT_ADD):
|
|||||||
echo '<h2>', _('Add Checklist'), "</h2>\n";
|
echo '<h2>', _('Add Checklist'), "</h2>\n";
|
||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="title" class="form-label"><?=_('Title')?></label>
|
|
||||||
<input type="text" class="form-control" id="title" name="title">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('title', _('Title'), 30);
|
||||||
form_new_buttons($g_scriptname);
|
form_new_buttons($g_scriptname);
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
|
|
||||||
@@ -158,11 +155,8 @@ echo '<h2>', _('Edit checklist'), "</h2>\n";
|
|||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<input type="hidden" name="id" value="<?=$id?>">
|
<input type="hidden" name="id" value="<?=$id?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="provname" class="form-label"><?=_('Name')?></label>
|
|
||||||
<input type="text" class="form-control" id="title" name="title" value="<?=$checklist->title ?>">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('title', _('Title'), 30, $checklist->title);
|
||||||
form_create_select('clstate', _('State'), $opt_clstate, $checklist->clstate);
|
form_create_select('clstate', _('State'), $opt_clstate, $checklist->clstate);
|
||||||
|
|
||||||
form_edit_buttons($g_scriptname, $id);
|
form_edit_buttons($g_scriptname, $id);
|
||||||
|
|||||||
+18
-73
@@ -253,11 +253,10 @@ elseif ($action == ACT_ADD):
|
|||||||
echo '<h2>', _('Add Company'), "</h2>\n";
|
echo '<h2>', _('Add Company'), "</h2>\n";
|
||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<div class="mb-3">
|
<?php
|
||||||
<label for="compname" class="form-label"><?=_('Name')?></label>
|
form_create_text('compname', _('Name'), 60);
|
||||||
<input type="text" class="form-control" id="compname" name="compname">
|
form_create_select('comptype', _('Company type'), $opt_comptype);
|
||||||
</div>
|
?>
|
||||||
<?php form_create_select('comptype', _('Company type'), $opt_comptype); ?>
|
|
||||||
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
|
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
|
||||||
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
|
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
|
||||||
</form>
|
</form>
|
||||||
@@ -357,76 +356,22 @@ $company = $sth->fetch(PDO::FETCH_OBJ);
|
|||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<input type="hidden" name="id" value="<?=$id?>">
|
<input type="hidden" name="id" value="<?=$id?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="compname" class="form-label"><?=_('Name')?></label>
|
|
||||||
<input type="text" class="form-control" id="compname" name="compname" value="<?=h($company->compname)?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="shortname" class="form-label"><?=_('Short name')?></label>
|
|
||||||
<input type="text" class="form-control" id="shortname" name="shortname" value="<?=h($company->shortname)?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="comptype" class="form-label"><?=_('Company type')?></label>
|
|
||||||
<select name="comptype" class="form-control">
|
|
||||||
<?php
|
|
||||||
foreach ($opt_comptype as $k => $v) {
|
|
||||||
echo '<option value="', $k ,'"';
|
|
||||||
if ($company->comptype == $k) {
|
|
||||||
echo ' selected';
|
|
||||||
}
|
|
||||||
echo '>', $v, "</option>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('compname', _('Name'), 60, $company->compname);
|
||||||
|
form_create_text('shortname', _('Short name'), 20, $company->shortname);
|
||||||
|
form_create_select('comptype', _('Company type'), $opt_comptype, $company->comptype);
|
||||||
form_create_select('comptype2', _('Secondary company type'), $g_opt_none + $opt_comptype, $company->comptype2);
|
form_create_select('comptype2', _('Secondary company type'), $g_opt_none + $opt_comptype, $company->comptype2);
|
||||||
?>
|
form_create_text('street', _('Street'), 40, $company->street);
|
||||||
<div class="mb-3">
|
form_create_text('zip', _('Zip'), 10, $company->zip);
|
||||||
<label for="street" class="form-label"><?=_('Street')?></label>
|
form_create_text('city', _('City'), 30, $company->city);
|
||||||
<input type="text" class="form-control" id="street" name="street" value="<?=h($company->street)?>">
|
form_create_text('country', _('Country'), 30, $company->country);
|
||||||
</div>
|
form_create_text('contact', _('Contact'), 30, $company->contact);
|
||||||
<div class="mb-3">
|
form_create_text('phone', _('Phone'), 30, $company->phone);
|
||||||
<label for="zip" class="form-label"><?=_('Zip')?></label>
|
form_create_text('email', _('Email'), 50, $company->email);
|
||||||
<input type="text" class="form-control" id="zip" name="zip" value="<?=h($company->zip)?>">
|
form_create_text('web', _('Web'), 40, $company->web);
|
||||||
</div>
|
form_create_text('customerno', _('Customer no.'), 20, $company->customerno);
|
||||||
<div class="mb-3">
|
form_create_text('contractno', _('Contract no.'), 20, $company->contracno);
|
||||||
<label for="city" class="form-label"><?=_('City')?></label>
|
form_create_textarea('remarks', _('Remarks'), 3, 150, $company->remarks);
|
||||||
<input type="text" class="form-control" id="city" name="city" value="<?=h($company->city)?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="country" class="form-label"><?=_('Country')?></label>
|
|
||||||
<input type="text" class="form-control" id="country" name="country" value="<?=h($company->country)?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="contact" class="form-label"><?=_('Contact')?></label>
|
|
||||||
<input type="text" class="form-control" id="contact" name="contact" value="<?=h($company->contact)?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="phone" class="form-label"><?=_('Phone')?></label>
|
|
||||||
<input type="text" class="form-control" id="phone" name="phone" value="<?=h($company->phone)?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="email" class="form-label"><?=_('Email')?></label>
|
|
||||||
<input type="text" class="form-control" id="email" name="email" value="<?=h($company->email)?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="web" class="form-label"><?=_('Web')?></label>
|
|
||||||
<input type="text" class="form-control" id="web" name="web" value="<?=h($company->web)?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="customerno" class="form-label"><?=_('Customer no.')?></label>
|
|
||||||
<input type="text" class="form-control" id="customerno" name="customerno" value="<?=h($company->customerno)?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="contractno" class="form-label"><?=_('Contract no.')?></label>
|
|
||||||
<input type="text" class="form-control" id="contractno" name="contractno" value="<?=h($company->contractno)?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
|
||||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($company->remarks)?></textarea>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
$opt_flags = db_load_enum('company', 'flags', true, true, false);
|
$opt_flags = db_load_enum('company', 'flags', true, true, false);
|
||||||
form_create_checks('flags', _('Flags'), $opt_flags, explode(',', $company->flags));
|
form_create_checks('flags', _('Flags'), $opt_flags, explode(',', $company->flags));
|
||||||
?>
|
?>
|
||||||
|
|||||||
+27
-23
@@ -321,7 +321,7 @@ $page = gpc_get_int($_REQUEST, 'p', 1);
|
|||||||
$rows_pp = gpc_get_int($_REQUEST, 'n', $user->rows_pp);
|
$rows_pp = gpc_get_int($_REQUEST, 'n', $user->rows_pp);
|
||||||
$lastpage = ceil($numrows/$rows_pp);
|
$lastpage = ceil($numrows/$rows_pp);
|
||||||
|
|
||||||
$sql = "SELECT d.docid, d.doctype, d.filename, d.title, COUNT(r.drid) AS refcount "
|
$sql = "SELECT d.docid, d.doctype, d.mimetype, d.filename, d.title, COUNT(r.drid) AS refcount "
|
||||||
. "FROM document AS d LEFT OUTER JOIN docref AS r USING (docid)";
|
. "FROM document AS d LEFT OUTER JOIN docref AS r USING (docid)";
|
||||||
if ($where) $sql .= ' WHERE ' . $where;
|
if ($where) $sql .= ' WHERE ' . $where;
|
||||||
$sql .= " GROUP BY d.docid, d.doctype, d.filename, d.title";
|
$sql .= " GROUP BY d.docid, d.doctype, d.filename, d.title";
|
||||||
@@ -379,7 +379,17 @@ foreach ($res as $row) {
|
|||||||
echo "<td>", $i;
|
echo "<td>", $i;
|
||||||
echo '<a title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['docid'], '"><i class="bi-eye ms-2"></i></a>', "\n";
|
echo '<a title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['docid'], '"><i class="bi-eye ms-2"></i></a>', "\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td>", $opt_doctype[$row['doctype']], "</td>\n";
|
echo "<td>";
|
||||||
|
if ($row['mimetype'] == 'application/pdf') {
|
||||||
|
echo '<i class="bi bi-file-earmark-pdf"></i>';
|
||||||
|
} else if ($row['mimetype'] == 'image/svg+xml') {
|
||||||
|
echo '<i class="bi bi-file-earmark-easel"></i>';
|
||||||
|
} else if ($row['mimetype'] == 'image/jpeg' or $row['mimetype'] == 'image/png') {
|
||||||
|
echo '<i class="bi bi-file-earmark-image"></i>';
|
||||||
|
} else {
|
||||||
|
echo '<i class="bi bi-file-earmark"></i>';
|
||||||
|
}
|
||||||
|
echo ' ', $opt_doctype[$row['doctype']], "</td>\n";
|
||||||
echo "<td>", $row['filename'], "</td>\n";
|
echo "<td>", $row['filename'], "</td>\n";
|
||||||
echo "<td>", $row['title'], "</td>\n";
|
echo "<td>", $row['title'], "</td>\n";
|
||||||
echo "<td>", $row['refcount'], "</td>\n";
|
echo "<td>", $row['refcount'], "</td>\n";
|
||||||
@@ -403,14 +413,10 @@ elseif ($action == ACT_ADD):
|
|||||||
echo '<h2>', _('Add Document'), "</h2>\n";
|
echo '<h2>', _('Add Document'), "</h2>\n";
|
||||||
?>
|
?>
|
||||||
<form method="post" enctype="multipart/form-data" action="<?=$g_scriptname?>">
|
<form method="post" enctype="multipart/form-data" action="<?=$g_scriptname?>">
|
||||||
<div class="mb-3">
|
<?php
|
||||||
<label for="title" class="form-label"><?=_('Title')?></label>
|
form_create_text('title', _('Title'), 40);
|
||||||
<input type="text" class="form-control" id="title" name="title" value="<?=$title ?? ''?>">
|
form_create_textarea('remarks', _('Remarks'), 3, 150, $storage->remarks);
|
||||||
</div>
|
?>
|
||||||
<div class="mb-3">
|
|
||||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
|
||||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=$remarks ?? ''?></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="files" class="form-label"><?=_('Document')?></label>
|
<label for="files" class="form-label"><?=_('Document')?></label>
|
||||||
<input class="form-control" type="file" id="files" name="files" onchange="preview()">
|
<input class="form-control" type="file" id="files" name="files" onchange="preview()">
|
||||||
@@ -519,6 +525,7 @@ echo '<tr><th scope="row">', _('Filename'),"</th><td>", h($document->filename),
|
|||||||
echo '<tr><th scope="row">', _('File size'),"</th><td>", format_filesize($document->docsize), "</td></tr>\n";
|
echo '<tr><th scope="row">', _('File size'),"</th><td>", format_filesize($document->docsize), "</td></tr>\n";
|
||||||
echo '<tr><th scope="row">', _('Upload date'),"</th><td>", $document->doctime, "</td></tr>\n";
|
echo '<tr><th scope="row">', _('Upload date'),"</th><td>", $document->doctime, "</td></tr>\n";
|
||||||
echo '<tr><th scope="row">', _('Title'),"</th><td>", h($document->title), "</td></tr>\n";
|
echo '<tr><th scope="row">', _('Title'),"</th><td>", h($document->title), "</td></tr>\n";
|
||||||
|
echo '<tr><th scope="row">', _('Access'),"</th><td>", get_enum($document->roleaccess), "</td></tr>\n";
|
||||||
echo '<tr><th scope="row">', _('Remarks'),"</th><td>", h($document->remarks, br:true), "</td></tr>\n";
|
echo '<tr><th scope="row">', _('Remarks'),"</th><td>", h($document->remarks, br:true), "</td></tr>\n";
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
|
|
||||||
@@ -722,13 +729,15 @@ elseif ($action == ACT_EDIT):
|
|||||||
|
|
||||||
echo '<h2>', _('Edit Document'), "</h2>\n";
|
echo '<h2>', _('Edit Document'), "</h2>\n";
|
||||||
|
|
||||||
$sql = "SELECT docid, doctype, mimetype, filename, extension, hash, title, remarks "
|
$sql = "SELECT docid, doctype, mimetype, filename, extension, hash, title, roleaccess, remarks "
|
||||||
. "FROM document "
|
. "FROM document "
|
||||||
. "WHERE docid=?";
|
. "WHERE docid=?";
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute([$id]);
|
$sth->execute([$id]);
|
||||||
$document = $sth->fetch(PDO::FETCH_OBJ);
|
$document = $sth->fetch(PDO::FETCH_OBJ);
|
||||||
|
|
||||||
|
// TODO check roleaccess!
|
||||||
|
|
||||||
if ($document->doctype == 'picture') {
|
if ($document->doctype == 'picture') {
|
||||||
echo '<img width="', $g_thumb_size, '" src="dl.php?id=', $document->docid, '">';
|
echo '<img width="', $g_thumb_size, '" src="dl.php?id=', $document->docid, '">';
|
||||||
}
|
}
|
||||||
@@ -736,15 +745,10 @@ if ($document->doctype == 'picture') {
|
|||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<input type="hidden" name="id" value="<?=$id?>">
|
<input type="hidden" name="id" value="<?=$id?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="title" class="form-label"><?=_('Filename')?></label>
|
|
||||||
<input type="text" class="form-control" id="filename" name="filename" value="<?=$document->filename ?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="title" class="form-label"><?=_('Title')?></label>
|
|
||||||
<input type="text" class="form-control" id="title" name="title" value="<?=$document->title ?>">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('filename', _('Filename'), 200, $document->filename);
|
||||||
|
form_create_text('title', _('Title'), 40, $document->title);
|
||||||
|
|
||||||
if ($document->mimetype == 'application/pdf') {
|
if ($document->mimetype == 'application/pdf') {
|
||||||
echo '<div class="mb-3">', "\n";
|
echo '<div class="mb-3">', "\n";
|
||||||
$opt_doctype = array(
|
$opt_doctype = array(
|
||||||
@@ -757,13 +761,13 @@ if ($document->mimetype == 'application/pdf') {
|
|||||||
} else {
|
} else {
|
||||||
echo '<input type="hidden" name="doctype" value="', $document->doctype, '">', "\n";
|
echo '<input type="hidden" name="doctype" value="', $document->doctype, '">', "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form_create_textarea('remarks', _('Remarks'), 3, 150, $document->remarks);
|
||||||
?>
|
?>
|
||||||
<div class="mb-3">
|
<div class="container-fluid px-0 my-3">
|
||||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
|
||||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($document->remarks)?></textarea>
|
|
||||||
</div>
|
|
||||||
<button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button>
|
<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>
|
<a href="<?=$g_scriptname?>?f=view&id=<?=$id?>" class="btn btn-secondary"><?=_('Back')?></a>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|||||||
+3
-12
@@ -417,22 +417,13 @@ $flt = db_get_filter($user->id, 200);
|
|||||||
?>
|
?>
|
||||||
<h2><?=_('Add Equipment')?></h2>
|
<h2><?=_('Add Equipment')?></h2>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="ename" class="form-label"><?=_('Name')?></label>
|
|
||||||
<input type="text" class="form-control" id="ename" name="ename">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('ename', _('name'), 80);
|
||||||
form_create_select('category', _('Category'), $g_opt_none + $opt_ecat, $flt->cat);
|
form_create_select('category', _('Category'), $g_opt_none + $opt_ecat, $flt->cat);
|
||||||
form_create_select('manufacturer', _('Manufacturer'), $opt_manufacturer, $flt->manuf);
|
form_create_select('manufacturer', _('Manufacturer'), $opt_manufacturer, $flt->manuf);
|
||||||
|
form_create_text('model', _('Model'), 40);
|
||||||
|
form_create_textarea('remarks', _('Remarks'), 3, 150);
|
||||||
?>
|
?>
|
||||||
<div class="mb-3">
|
|
||||||
<label for="model" class="form-label"><?=_('Model')?></label>
|
|
||||||
<input type="text" class="form-control" id="model" name="model">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
|
||||||
<textarea class="form-control" id="remarks" name="remarks" rows="3" maxlength="150"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="container-fluid px-0 my-3">
|
<div class="container-fluid px-0 my-3">
|
||||||
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
|
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
|
||||||
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
|
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
|
||||||
|
|||||||
+5
-24
@@ -270,35 +270,16 @@ echo '<h2>', _('Edit fuse'), "</h2>\n";
|
|||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<input type="hidden" name="id" value="<?=$id?>">
|
<input type="hidden" name="id" value="<?=$id?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="fnumber" class="form-label"><?=_('Fuse number')?></label>
|
|
||||||
<input type="number" class="form-control" id="fnumber" name="fnumber" value="<?=$fuse->fnumber ?>">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_numeric('fnumber', _('Fuse number'), $fuse->fnumber, 1, 9999, 1, TRUE, TRUE);
|
||||||
form_create_select('ftype', _('Type'), $g_opt_none + $opt_ftype, $fuse->ftype);
|
form_create_select('ftype', _('Type'), $g_opt_none + $opt_ftype, $fuse->ftype);
|
||||||
?>
|
form_create_text('description', _('Description'), 60, $fuse->description);
|
||||||
<div class="mb-3">
|
form_create_numeric('current', _('Current, A'), format_float($fuse->current), 1, 999, 1);
|
||||||
<label for="note" class="form-label"><?=_('Description')?></label>
|
form_create_color('color', _('Color'), $fuse->color);
|
||||||
<input type="text" class="form-control" id="description" name="description" value="<?=h($fuse->description)?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="current" class="form-label"><?=_('Current')?></label>
|
|
||||||
<input type="text" class="form-control" id="current" name="current" value="<?=format_float($fuse->current) ?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="color" class="form-label"><?=_('Color')?></label>
|
|
||||||
<input type="color" name="color" id="color" class="form-control" value="#<?=$fuse->color;?>">
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
form_create_select('location', _('Location'), $g_opt_none + $opt_location, $fuse->location);
|
form_create_select('location', _('Location'), $g_opt_none + $opt_location, $fuse->location);
|
||||||
form_create_select('cableid', _('Cable'), $g_opt_none + $opt_cable, $fuse->cableid);
|
form_create_select('cableid', _('Cable'), $g_opt_none + $opt_cable, $fuse->cableid);
|
||||||
form_create_select('eid', _('Equipment'), $g_opt_none + $opt_equipment, $fuse->eid);
|
form_create_select('eid', _('Equipment'), $g_opt_none + $opt_equipment, $fuse->eid);
|
||||||
?>
|
form_create_textarea('remarks', _('Remarks'), 3, 150, $fuse->remarks);
|
||||||
<div class="mb-3">
|
|
||||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
|
||||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($fuse->remarks)?></textarea>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
form_edit_buttons($g_scriptname, $id);
|
form_edit_buttons($g_scriptname, $id);
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
|
|||||||
+10
-1
@@ -15,6 +15,7 @@ $pagetitle=_('Inventory');
|
|||||||
|
|
||||||
$id = gpc_get_int($_REQUEST, 'id', 0);
|
$id = gpc_get_int($_REQUEST, 'id', 0);
|
||||||
|
|
||||||
|
$opt_conttype = db_load_enum('inventory', 'conttype', true, true);
|
||||||
$opt_storage = db_get_opt_storage($user->vid);
|
$opt_storage = db_get_opt_storage($user->vid);
|
||||||
$opt_box = db_get_opt_box($user->vid);
|
$opt_box = db_get_opt_box($user->vid);
|
||||||
$opt_invcond = db_load_enum('inventory', 'invcond', true, true);
|
$opt_invcond = db_load_enum('inventory', 'invcond', true, true);
|
||||||
@@ -288,6 +289,10 @@ elseif ($action == ACT_ADD):
|
|||||||
echo '<h2>', _('Add Inventory'), "</h2>\n";
|
echo '<h2>', _('Add Inventory'), "</h2>\n";
|
||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
|
<?php
|
||||||
|
form_create_text('invname', _('Name'), 80, NULL, TRUE, TRUE);
|
||||||
|
form_create_numeric('number', _('Number'), 0, 9999, 1);
|
||||||
|
/*
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="invname" class="form-label"><?=_('Name')?></label>
|
<label for="invname" class="form-label"><?=_('Name')?></label>
|
||||||
<input type="text" class="form-control" id="invname" name="invname" autofocus>
|
<input type="text" class="form-control" id="invname" name="invname" autofocus>
|
||||||
@@ -303,7 +308,9 @@ echo '<h2>', _('Add Inventory'), "</h2>\n";
|
|||||||
<option value="box"><?=_('Box')?></option>
|
<option value="box"><?=_('Box')?></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
*/
|
||||||
|
form_create_select('conttype', _('Container type'), $opt_conttype, 'storage');
|
||||||
|
|
||||||
// load current filter setting for storage default setting
|
// load current filter setting for storage default setting
|
||||||
$flt = db_get_filter($user->id, 201, ['stor','cond','txt']);
|
$flt = db_get_filter($user->id, 201, ['stor','cond','txt']);
|
||||||
form_create_select('sid', _('Storage'), $g_opt_none + $opt_storage, $flt->stor);
|
form_create_select('sid', _('Storage'), $g_opt_none + $opt_storage, $flt->stor);
|
||||||
@@ -430,6 +437,8 @@ $opt_conttype = db_load_enum('inventory', 'conttype', true, true);
|
|||||||
form_create_select('conttype', _('Container type'), $opt_conttype, $inventory->conttype);
|
form_create_select('conttype', _('Container type'), $opt_conttype, $inventory->conttype);
|
||||||
form_create_select('sid', _('Storage'), $g_opt_none + $opt_storage, $inventory->sid);
|
form_create_select('sid', _('Storage'), $g_opt_none + $opt_storage, $inventory->sid);
|
||||||
form_create_select('boxid', _('Box'), $g_opt_none + $opt_box, $inventory->boxid);
|
form_create_select('boxid', _('Box'), $g_opt_none + $opt_box, $inventory->boxid);
|
||||||
|
|
||||||
|
// form_create_numeric
|
||||||
?>
|
?>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="price" class="form-label"><?=sprintf(_('Price, %s'), $g_lconv['currency_symbol']); ?></label>
|
<label for="price" class="form-label"><?=sprintf(_('Price, %s'), $g_lconv['currency_symbol']); ?></label>
|
||||||
|
|||||||
+55
-9
@@ -6,6 +6,10 @@
|
|||||||
* SPDX-License-Identifier: WTFPL
|
* SPDX-License-Identifier: WTFPL
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
|
|
||||||
|
TODO implement datalist
|
||||||
|
tel and/or email?
|
||||||
|
autocomplete?
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ========== FORM FUNCTIONS ==================================================
|
// ========== FORM FUNCTIONS ==================================================
|
||||||
@@ -49,20 +53,39 @@ function form_tag_assignment($script, $id, $tags) {
|
|||||||
|
|
||||||
// ========== FORM FIELDS =====================================================
|
// ========== FORM FIELDS =====================================================
|
||||||
|
|
||||||
function form_create_numeric($fieldname, $label, $min=NULL, $max=NULL, $step=NULL, $value=NULL) {
|
function form_create_numeric($fieldname, $label, $value=NULL, $min=NULL, $max=NULL, $step=NULL, $required=FALSE, $autofocus=FALSE) {
|
||||||
// TODO WIP
|
// step = 'any'-> any float
|
||||||
// step = any float
|
// step = 0.01 -> float with limited decimal places
|
||||||
// step = 0.01 float
|
// step = 1 -> integer
|
||||||
// step = 1 integer
|
|
||||||
echo '<div class="mb-3">', "\n";
|
echo '<div class="mb-3">', "\n";
|
||||||
echo '<input type="number"';
|
echo '<label for="', $fieldname, '" class="form-label">', $label, "</label>\n";
|
||||||
|
echo '<input type="number" class="form-control" id="', $fieldname, '" name = "', $fieldname, '"';
|
||||||
|
if ($value !== NULL) {
|
||||||
|
echo ' value="', h($value), '"';
|
||||||
|
}
|
||||||
|
if ($min !== NULL) {
|
||||||
|
echo ' min="', $min, '"';
|
||||||
|
}
|
||||||
|
if ($max !== NULL) {
|
||||||
|
echo ' max="', $max, '"';
|
||||||
|
}
|
||||||
|
if ($step !== NULL) {
|
||||||
|
echo ' step="', $step, '"';
|
||||||
|
}
|
||||||
|
if ($required === TRUE) {
|
||||||
|
echo ' required';
|
||||||
|
}
|
||||||
|
if ($autofocus === TRUE) {
|
||||||
|
echo ' autofocus';
|
||||||
|
}
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_create_text($fieldname, $label, $maxlen=NULL, $value=NULL) {
|
function form_create_text($fieldname, $label, $maxlen=NULL, $value=NULL, $required=FALSE, $autofocus=FALSE) {
|
||||||
// create generic text entry with assigned label
|
// create generic text entry with assigned label
|
||||||
// TODO required, errortext
|
// TODO errortext
|
||||||
|
// perhaps support inputmode="numeric", pattern="[0-9]{1,3}"
|
||||||
echo '<div class="mb-3">', "\n";
|
echo '<div class="mb-3">', "\n";
|
||||||
echo '<label for="', $fieldname, '" class="form-label">', $label, "</label>\n";
|
echo '<label for="', $fieldname, '" class="form-label">', $label, "</label>\n";
|
||||||
echo '<input type="text" class="form-control" id="', $fieldname, '" name="', $fieldname, '"';
|
echo '<input type="text" class="form-control" id="', $fieldname, '" name="', $fieldname, '"';
|
||||||
@@ -72,6 +95,12 @@ function form_create_text($fieldname, $label, $maxlen=NULL, $value=NULL) {
|
|||||||
if ($value !== NULL) {
|
if ($value !== NULL) {
|
||||||
echo ' value="', h($value), '"';
|
echo ' value="', h($value), '"';
|
||||||
}
|
}
|
||||||
|
if ($required === TRUE) {
|
||||||
|
echo ' required';
|
||||||
|
}
|
||||||
|
if ($autofocus === TRUE) {
|
||||||
|
echo ' autofocus';
|
||||||
|
}
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
}
|
}
|
||||||
@@ -92,11 +121,28 @@ function form_create_textarea($fieldname, $label, $rows=3, $maxlen=NULL, $value=
|
|||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function form_create_date($fieldname, $label, $value=NULL, $mindate=NULL, $maxdate=NULL) {
|
||||||
|
echo '<div class="mb-3">', "\n";
|
||||||
|
echo '<label for="', $fieldname, '" class="form-label">', $label, "</label>\n";
|
||||||
|
echo '<input type="date" class="form-control" id="', $fieldname, '" name="', $fieldname, '"';
|
||||||
|
if ($min !== NULL) {
|
||||||
|
echo ' min="', $mindate, '"';
|
||||||
|
}
|
||||||
|
if ($max !== NULL) {
|
||||||
|
echo ' max="', $maxdate, '"';
|
||||||
|
}
|
||||||
|
if ($value !== NULL) {
|
||||||
|
echo ' value="', h($value), '"';
|
||||||
|
}
|
||||||
|
echo ">\n";
|
||||||
|
echo "</div>\n";
|
||||||
|
}
|
||||||
|
|
||||||
function form_create_color($fieldname, $label, $value=NULL) {
|
function form_create_color($fieldname, $label, $value=NULL) {
|
||||||
// value has to be 6char hex
|
// value has to be 6char hex
|
||||||
echo '<div class="mb-3">', "\n";
|
echo '<div class="mb-3">', "\n";
|
||||||
echo '<label for="', $fieldname, '" class="form-label">', $label, "</label>\n";
|
echo '<label for="', $fieldname, '" class="form-label">', $label, "</label>\n";
|
||||||
echo '<input type="color" class="form-control" id="', $fieldname, '" name="', $fieldname, '"';
|
echo '<input type="color" class="form-control form-control-color" id="', $fieldname, '" name="', $fieldname, '"';
|
||||||
if ($value !== NULL) {
|
if ($value !== NULL) {
|
||||||
echo ' value="#', $value, '"';
|
echo ' value="#', $value, '"';
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-12
@@ -292,18 +292,16 @@ elseif ($action == ACT_ADD):
|
|||||||
echo '<h2>', _('Add Maintenance'), "</h2>\n";
|
echo '<h2>', _('Add Maintenance'), "</h2>\n";
|
||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="activities" class="form-label"><?=_('Activities')?></label>
|
|
||||||
<input type="text" class="form-control" id="activities" name="activities">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('activities', _('Activities'), 40, NULL, TRUE, TRUE);
|
||||||
// TODO
|
// TODO
|
||||||
// Add link to equipment, perhaps later with modal dialog?
|
// Add link to equipment, perhaps later with modal dialog?
|
||||||
?>
|
form_create_select('eid', _('Equipment'), $opt_equipment, $id);
|
||||||
<div class="mb-3">
|
|
||||||
|
/* <div class="mb-3">
|
||||||
<label for="eid" class="form-label"><?=_('Equipment')?></label>
|
<label for="eid" class="form-label"><?=_('Equipment')?></label>
|
||||||
<select name="eid" id="eid" class="form-select">
|
<select name="eid" id="eid" class="form-select">
|
||||||
<?php
|
|
||||||
foreach ($opt_equipment as $k => $v) {
|
foreach ($opt_equipment as $k => $v) {
|
||||||
echo '<option value="', $k, '"';
|
echo '<option value="', $k, '"';
|
||||||
if ($k == $id) {
|
if ($k == $id) {
|
||||||
@@ -311,8 +309,10 @@ foreach ($opt_equipment as $k => $v) {
|
|||||||
}
|
}
|
||||||
echo '>', $v, "</option>\n";
|
echo '>', $v, "</option>\n";
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
</select>
|
</select>
|
||||||
|
*/
|
||||||
|
?>
|
||||||
<div class="container-fluid px-0 my-3">
|
<div class="container-fluid px-0 my-3">
|
||||||
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
|
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
|
||||||
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
|
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
|
||||||
@@ -446,11 +446,8 @@ echo '<h2>', _('Edit Maintenance'), "</h2>\n";
|
|||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<input type="hidden" name="id" value="<?=$id?>">
|
<input type="hidden" name="id" value="<?=$id?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="activities" class="form-label"><?=_('Activities')?></label>
|
|
||||||
<input type="text" class="form-control" id="activities" name="activities" value="<?=h($maint->activities)?>">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('activities', _('Activities'), 40, $maint->activities);
|
||||||
form_create_select('eid', _('Equipment'), $opt_equipment, $maint->eid);
|
form_create_select('eid', _('Equipment'), $opt_equipment, $maint->eid);
|
||||||
form_create_select('series', _('Series'), $g_opt_none + $g_opt_new + $opt_series, $maint->series);
|
form_create_select('series', _('Series'), $g_opt_none + $g_opt_new + $opt_series, $maint->series);
|
||||||
?>
|
?>
|
||||||
|
|||||||
+10
-44
@@ -272,30 +272,13 @@ echo '<h2>', _('Add measurement'), "</h2>\n";
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="mname" class="form-label"><?=_('Name')?></label>
|
|
||||||
<input type="text" class="form-control" id="mname" name="mname" required autofocus>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="note" class="form-label"><?=_('Note')?></label>
|
|
||||||
<input type="text" class="form-control" id="note" name="note">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('mname', _('Name'), 80, TRUE, TRUE);
|
||||||
|
form_create_text('note', _('Note'), 80);
|
||||||
form_create_select('nval', _('Dimensions'), $opt_dimensions);
|
form_create_select('nval', _('Dimensions'), $opt_dimensions);
|
||||||
?>
|
form_create_numeric('val1', _('Value 1'));
|
||||||
<div class="mb-3">
|
form_create_numeric('val2', _('Value 2'));
|
||||||
<label for="val1" class="form-label"><?=_('Value 1')?></label>
|
form_create_numeric('val3', _('Value 3'));
|
||||||
<input type="text" class="form-control" id="val1" name="val1">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="val2" class="form-label"><?=_('Value 2')?></label>
|
|
||||||
<input type="text" class="form-control" id="val1" name="val2">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="val3" class="form-label"><?=_('Value 3')?></label>
|
|
||||||
<input type="text" class="form-control" id="val3" name="val3">
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
form_create_select('unit', _('Unit'), $opt_unit);
|
form_create_select('unit', _('Unit'), $opt_unit);
|
||||||
form_create_select('accuracy', _('Accuracy'), $opt_accuracy);
|
form_create_select('accuracy', _('Accuracy'), $opt_accuracy);
|
||||||
form_create_select('eid', _('Equipment'), $opt_equipment, $id);
|
form_create_select('eid', _('Equipment'), $opt_equipment, $id);
|
||||||
@@ -350,30 +333,13 @@ echo '<h2>', _('Edit measurement'), "</h2>\n";
|
|||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<input type="hidden" name="id" value="<?=$id?>">
|
<input type="hidden" name="id" value="<?=$id?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="mname" class="form-label"><?=_('Name')?></label>
|
|
||||||
<input type="text" class="form-control" id="name" name="mname" value="<?=$measurement->mname ?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="note" class="form-label"><?=_('Note')?></label>
|
|
||||||
<input type="text" class="form-control" id="note" name="note" value="<?=$measurement->note ?>">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('mname', _('Name'), 80, $measurement->mname, TRUE, TRUE);
|
||||||
|
form_create_text('note', _('Note'), 80, $measurement->note);
|
||||||
form_create_select('nval', _('Dimensions'), $opt_dimensions, $measurement->nval);
|
form_create_select('nval', _('Dimensions'), $opt_dimensions, $measurement->nval);
|
||||||
?>
|
form_create_numeric('val2', _('Value 2'), $measurement->val1);
|
||||||
<div class="mb-3">
|
form_create_numeric('val2', _('Value 2'), $measurement->val2);
|
||||||
<label for="val1"><?=_('Value 1')?></label>
|
form_create_numeric('val2', _('Value 2'), $measurement->val3);
|
||||||
<input type="number" min="0" class="form-control" id="val1" name="val1" value="<?=$measurement->val1 ?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="val2"><?=_('Value 2')?></label>
|
|
||||||
<input type="number" min="0" class="form-control" id="val2" name="val2" value="<?=$measurement->val2 ?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="val3"><?=_('Value 3')?></label>
|
|
||||||
<input type="number" min="0" class="form-control" id="val3" name="val3" value="<?=$measurement->val3 ?>">
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
form_create_select('unit', _('Unit'), $opt_unit, $measurement->unit);
|
form_create_select('unit', _('Unit'), $opt_unit, $measurement->unit);
|
||||||
form_create_select('accuracy', _('Accuracy'), $opt_accuracy, $measurement->accuracy);
|
form_create_select('accuracy', _('Accuracy'), $opt_accuracy, $measurement->accuracy);
|
||||||
form_create_select('mcat', _('Category'), $g_opt_none + $opt_category, $measurement->mcat);
|
form_create_select('mcat', _('Category'), $g_opt_none + $opt_category, $measurement->mcat);
|
||||||
|
|||||||
+1
-4
@@ -390,11 +390,8 @@ $project = $sth->fetch(PDO::FETCH_OBJ);
|
|||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<input type="hidden" name="id" value="<?=$id?>">
|
<input type="hidden" name="id" value="<?=$id?>">
|
||||||
<div class="mb-3">
|
|
||||||
<label for="projname" class="form-label"><?=_('Name')?></label>
|
|
||||||
<input type="text" class="form-control" id="projname" name="projname" value="<?=$project->projname ?>">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('projname', _('Name'), 40, $project->projname, TRUE, TRUE);
|
||||||
form_create_select('responsible', _('Responsible'), $opt_user, $project->responsible);
|
form_create_select('responsible', _('Responsible'), $opt_user, $project->responsible);
|
||||||
?>
|
?>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
|||||||
+18
-13
@@ -112,10 +112,6 @@ if ($res = $sth->fetch(PDO::FETCH_NUM)) {
|
|||||||
$sth->execute([$user->id, $rowspp]);
|
$sth->execute([$user->id, $rowspp]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$currsym = $pdo->query("SELECT valstr FROM settings WHERE userid=0 AND sno=4")->fetchColumn();
|
|
||||||
$maximgx = $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=20")->fetchColumn();
|
|
||||||
$maximgy = $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=21")->fetchColumn();
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<h2><?=_('for current user')?></h2>
|
<h2><?=_('for current user')?></h2>
|
||||||
@@ -133,16 +129,22 @@ for ($i = 1; $i <= 6; $i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
form_create_select('datefmt', _('Date format'), $opt_datefmt, $datefmt);
|
form_create_select('datefmt', _('Date format'), $opt_datefmt, $datefmt);
|
||||||
?>
|
form_create_numeric('rowspp', _('Number of rows per page'), $rowspp, 5, 100, 1);
|
||||||
<div class="mb-3">
|
|
||||||
|
/* <div class="mb-3">
|
||||||
<label for="rowspp" class="form-label"><?=_('Number of rows per page')?></label>
|
<label for="rowspp" class="form-label"><?=_('Number of rows per page')?></label>
|
||||||
<input type="text" class="form-control" id="rowspp" name="rowspp" maxlength="3" value=<?=$rowspp?>>
|
<input type="text" class="form-control" id="rowspp" name="rowspp" maxlength="3" value=<?=$rowspp?>>
|
||||||
</div>
|
</div> */
|
||||||
<?php
|
|
||||||
// limit global settings for captain only
|
// limit global settings for captain only
|
||||||
if ($user->role == 'captain'):
|
if ($user->role == 'captain') {
|
||||||
?>
|
echo '<h2>', _('global for all users'), "</h2>\n";
|
||||||
<h2><?=_('global for all users')?></h2>
|
|
||||||
|
$currsym = $pdo->query("SELECT valstr FROM settings WHERE userid=0 AND sno=4")->fetchColumn();
|
||||||
|
$maximgx = $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=20")->fetchColumn();
|
||||||
|
$maximgy = $pdo->query("SELECT valint FROM settings WHERE userid=0 AND sno=21")->fetchColumn();
|
||||||
|
|
||||||
|
/*
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="currsym" class="form-label"><?=_('Currency symbol')?></label>
|
<label for="currsym" class="form-label"><?=_('Currency symbol')?></label>
|
||||||
<input type="text" class="form-control" id="currsym" name="currsym" maxlength="3" value=<?=$currsym?>>
|
<input type="text" class="form-control" id="currsym" name="currsym" maxlength="3" value=<?=$currsym?>>
|
||||||
@@ -155,8 +157,11 @@ if ($user->role == 'captain'):
|
|||||||
<label for="maximgy" class="form-label"><?=_('Maximal image height')?></label>
|
<label for="maximgy" class="form-label"><?=_('Maximal image height')?></label>
|
||||||
<input type="text" class="form-control" id="maximgy" name="maximgy" maxlength="4" value=<?=$maximgy?>>
|
<input type="text" class="form-control" id="maximgy" name="maximgy" maxlength="4" value=<?=$maximgy?>>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
*/
|
||||||
endif;
|
form_create_text('currsym', _('Currency symbol'), 3, $currsym);
|
||||||
|
form_create_numeric('maximgx', _('Maximal image width'), $maximgy, 200, 4096, 1);
|
||||||
|
form_create_numeric('maximgy', _('Maximal image height'), $maximgy, 200, 4096, 1);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="container-fluid px-0 my-3">
|
<div class="container-fluid px-0 my-3">
|
||||||
<button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button>
|
<button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button>
|
||||||
|
|||||||
+30
-30
@@ -206,16 +206,13 @@ echo '<h2>', _('Add Storage'), "</h2>\n";
|
|||||||
?>
|
?>
|
||||||
<form method="post" action="<?=$g_scriptname?>">
|
<form method="post" action="<?=$g_scriptname?>">
|
||||||
<?php
|
<?php
|
||||||
/*
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="sname" class="form-label"><?=_('Name')?></label>
|
|
||||||
<input type="text" class="form-control" id="sname" name="sname">
|
|
||||||
</div> */
|
|
||||||
form_create_text('sname', _('Name'), 40);
|
form_create_text('sname', _('Name'), 40);
|
||||||
form_create_select('stype', _('Type'), $opt_stype);
|
form_create_select('stype', _('Type'), $opt_stype);
|
||||||
?>
|
?>
|
||||||
|
<div class="container-fluid px-0 my-3">
|
||||||
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
|
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
|
||||||
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
|
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@@ -230,7 +227,7 @@ $sql = "SELECT sid, sname, stype, capacity, capaunit, x, y, z, wx, wy, wz, angle
|
|||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute([$id]);
|
$sth->execute([$id]);
|
||||||
$storage = $sth->fetch(PDO::FETCH_OBJ);
|
$storage = $sth->fetch(PDO::FETCH_OBJ);
|
||||||
echo '<h1>', _('Storage'), ': ', $storage->sname, "</h1>\n";
|
echo '<h1>', sprintf(_('Storage: %s'), h($storage->sname)), "</h1>\n";
|
||||||
|
|
||||||
echo '<table class="table">', "\n";
|
echo '<table class="table">', "\n";
|
||||||
echo '<tr><th style="width:33%">', _('Typ'),"</th><td>", $opt_stype[$storage->stype], "</td></tr>\n";
|
echo '<tr><th style="width:33%">', _('Typ'),"</th><td>", $opt_stype[$storage->stype], "</td></tr>\n";
|
||||||
@@ -238,7 +235,7 @@ echo '<tr><th>', _('Capacity'),"</th><td>", $storage->capacity, ' ', $storage->c
|
|||||||
echo '<tr><th>', _('Location (x, y, z)'),"</th><td>(", $storage->x, ', ', $storage->y, ', ', $storage->z, ")</td></tr>\n";
|
echo '<tr><th>', _('Location (x, y, z)'),"</th><td>(", $storage->x, ', ', $storage->y, ', ', $storage->z, ")</td></tr>\n";
|
||||||
echo '<tr><th>', _('Width (wx, wy, wz)'),"</th><td>(", $storage->wx, ', ', $storage->wy, ', ', $storage->wz, ")</td></tr>\n";
|
echo '<tr><th>', _('Width (wx, wy, wz)'),"</th><td>(", $storage->wx, ', ', $storage->wy, ', ', $storage->wz, ")</td></tr>\n";
|
||||||
echo '<tr><th>', _('Angle'),"</th><td>", $storage->angle, "°</td></tr>\n";
|
echo '<tr><th>', _('Angle'),"</th><td>", $storage->angle, "°</td></tr>\n";
|
||||||
echo '<tr><th>', _('Color'),"</th><td>", $storage->color, "</td></tr>\n";
|
echo '<tr><th>', _('Color'),"</th><td>", format_color($storage->color), "</td></tr>\n";
|
||||||
echo '<tr><th>', _('Remarks'),"</th><td>", h($storage->remarks), "</td></tr>\n";
|
echo '<tr><th>', _('Remarks'),"</th><td>", h($storage->remarks), "</td></tr>\n";
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
|
|
||||||
@@ -311,7 +308,8 @@ elseif ($action == ACT_EDIT):
|
|||||||
|
|
||||||
echo '<h2>', _('Edit Storage'), "</h2>\n";
|
echo '<h2>', _('Edit Storage'), "</h2>\n";
|
||||||
|
|
||||||
$sql = "SELECT sid, sname, stype, x, y, z, wx, wy, wz, angle, capacity, capaunit, remarks "
|
$sql = "SELECT sid, sname, stype, x, y, z, wx, wy, wz, angle, capacity, "
|
||||||
|
. "color, capaunit, remarks "
|
||||||
. "FROM storage "
|
. "FROM storage "
|
||||||
. "WHERE sid=?";
|
. "WHERE sid=?";
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
@@ -326,19 +324,20 @@ $storage = $sth->fetch(PDO::FETCH_OBJ);
|
|||||||
<input type="text" class="form-control" id="sname" name="sname" value="<?=h($storage->sname)?>">
|
<input type="text" class="form-control" id="sname" name="sname" value="<?=h($storage->sname)?>">
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
form_create_text('sname', _('Name'), $storage->name, 40);
|
||||||
form_create_select('stype', _('Type'), $opt_stype, $storage->stype);
|
form_create_select('stype', _('Type'), $opt_stype, $storage->stype);
|
||||||
?>
|
?>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label"><?=_('Position (x, y, z) in mm')?></label>
|
<label class="form-label"><?=_('Position (x, y, z) in mm')?></label>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type="number" class="form-control" id="x" name="x" min="0" value="<?=$storage->x ?>">
|
<input type="number" class="form-control" id="x" name="x" min="0" max="65535" value="<?=$storage->x ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type="number" class="form-control" id="y" name="y" value="<?=$storage->y ?>">
|
<input type="number" class="form-control" id="y" name="y" min="-32768" max="32767" value="<?=$storage->y ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type="number" class="form-control" id="z" name="z" value="<?=$storage->z ?>">
|
<input type="number" class="form-control" id="z" name="z" min="-32768" max="32767" value="<?=$storage->z ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -346,40 +345,41 @@ form_create_select('stype', _('Type'), $opt_stype, $storage->stype);
|
|||||||
<label class="form-label"><?=_('Width (x, y, z) in mm')?></label>
|
<label class="form-label"><?=_('Width (x, y, z) in mm')?></label>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type="number" class="form-control" id="wx" name="wx" min="0" value="<?=$storage->wx ?>">
|
<input type="number" class="form-control" id="wx" name="wx" min="0" max="65535" value="<?=$storage->wx ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type="number" class="form-control" id="wy" name="wy" min="0" value="<?=$storage->wy ?>">
|
<input type="number" class="form-control" id="wy" name="wy" min="0" max="65535" value="<?=$storage->wy ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type="number" class="form-control" id="wz" name="wz" min="0" value="<?=$storage->wz ?>">
|
<input type="number" class="form-control" id="wz" name="wz" min="0" max="65535" value="<?=$storage->wz ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
|
||||||
<label for="angle" class="form-label"><?=_('Angle, deg.')?></label>
|
|
||||||
<input type="number" class="form-control" id="angle" name="angle" value="<?=$storage->angle ?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="capacity" class="form-label"><?=_('Capacity')?></label>
|
|
||||||
<input type="number" class="form-control" id="capacity" name="capacity" value="<?=$storage->capacity ?>">
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
|
form_create_numeric('angle', _('Anglem deg.'), $storage->angle, 0, 359, 1);
|
||||||
|
form_create_numeric('capacity', _('Capacity'), $storage->capacity, 0, 32767);
|
||||||
form_create_select('capaunit', _('Capacity Unit'), $opt_capaunit, $storage->capaunit);
|
form_create_select('capaunit', _('Capacity Unit'), $opt_capaunit, $storage->capaunit);
|
||||||
/* <div class="mb-3">
|
|
||||||
<label for="color"><?=_('Color')?></label>
|
|
||||||
<input type="color" class="form-control" id="color" name="color" value="#<?=$storage->color ?>">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
|
||||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=h($storage->remarks)?></textarea>
|
|
||||||
</div> */
|
|
||||||
form_create_color('color', _('Color'), $storage->color);
|
form_create_color('color', _('Color'), $storage->color);
|
||||||
form_create_textarea('remarks', _('Remarks'), 3, 150, $storage->remarks);
|
form_create_textarea('remarks', _('Remarks'), 3, 150, $storage->remarks);
|
||||||
?>
|
?>
|
||||||
<button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button>
|
<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>
|
<a href="<?=$g_scriptname?>?f=view&id=<?=$id?>" class="btn btn-secondary"><?=_('Back')?></a>
|
||||||
</form>
|
</form>
|
||||||
|
<script>
|
||||||
|
document.getElementById('capaunit').addEventListener('change', function () {
|
||||||
|
const capacity = document.getElementById('capacity');
|
||||||
|
if (this.value === 'pcs') {
|
||||||
|
capacity.step = 1;
|
||||||
|
decpl = 0;
|
||||||
|
} else {
|
||||||
|
capacity.step = 0.01;
|
||||||
|
decpl = 2;
|
||||||
|
}
|
||||||
|
if (capacity.value !== '' && Number.isFinite(Number(capacity.value))) {
|
||||||
|
capacity.value = Number(capacity.value).toFixed(decpl);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
elseif ($action == ACT_DELETE):
|
elseif ($action == ACT_DELETE):
|
||||||
|
|||||||
Reference in new issue
Block a user