Webgui programming

This commit is contained in:
2025-05-09 10:22:08 +02:00
parent c293ca1caa
commit fb93c83388
11 changed files with 340 additions and 85 deletions
+20 -3
View File
@@ -43,6 +43,7 @@ switch ($submit = form_get_action()) {
$p[':compname'] = gpc_get_string($_POST, 'compname');
$p[':shortname'] = gpc_get_string($_POST, 'shortname', 20);
$p[':comptype'] = gpc_get_int($_POST, 'comptype');
$p[':comptype2'] = gpc_get_int($_POST, 'comptype2');
$p[':street'] = gpc_get_string($_POST, 'street', 30);
$p[':zip'] = gpc_get_string($_POST, 'zip', 10);
$p[':city'] = gpc_get_string($_POST, 'city', 30);
@@ -228,8 +229,8 @@ echo '<h2>', _('Add Company'), "</h2>\n";
elseif ($action == ACT_VIEW):
// ========== VARIANT: view single record =====================================
$sql = "SELECT compname, comptype, shortname, street, zip, city, country,"
. " contact, phone, email, web, customerno, contractno, remarks "
$sql = "SELECT compname, comptype, comptype2, shortname, street, zip, city,"
. " country, contact, phone, email, web, customerno, contractno, remarks "
. "FROM company "
. "WHERE compid=?";
$sth = $pdo->prepare($sql);
@@ -242,6 +243,7 @@ echo '<table class="table">', "\n";
echo '<tr><th scope="row" style="width:20%">', _('Name'),"</th><td>", $company->compname, "</td></tr>\n";
echo '<tr><th scope="row">', _('Short name'),"</th><td>", $company->shortname, "</td></tr>\n";
echo '<tr><th scope="row">', _('Type'),"</th><td>", $opt_comptype[$company->comptype], "</td></tr>\n";
echo '<tr><th scope="row">', _('Secondary type'),"</th><td>", $company->comptype2 ? $opt_comptype[$company->comptype2] : '-', "</td></tr>\n";
echo '<tr><th scope="row">', _('Street'),"</th><td>", $company->street, "</td></tr>\n";
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";
@@ -299,7 +301,7 @@ elseif ($action == ACT_EDIT):
echo '<h2>', _('Edit Company'), "</h2>\n";
$sql = "SELECT compname, comptype, street, zip, city, country,"
$sql = "SELECT compname, comptype, comptype2, street, zip, city, country,"
. " contact, phone, email, web, customerno, contractno, remarks "
. "FROM company "
. "WHERE compid=?";
@@ -332,6 +334,21 @@ foreach ($opt_comptype as $k => $v) {
?>
</select>
</div>
<div class="mb-3">
<label for="comptype2" class="form-label"><?=_('Secondary company type')?></label>
<select name="comptype2" class="form-control">
<?php
echo '<option value="">--- kein ---', "</option>\n";
foreach ($opt_comptype as $k => $v) {
echo '<option value="', $k ,'"';
if ($company->comptype2 == $k) {
echo ' selected';
}
echo '>', $v, "</option>\n";
}
?>
</select>
</div>
<div class="mb-3">
<label for="street" class="form-label"><?=_('Street')?></label>
<input type="text" class="form-control" id="street" name="street" value="<?=$company->street ?>">