Webgui code improvements and fixes

This commit is contained in:
thooge committed 2026-10-30 11:40:59 +01:00
1 parent dacf32b401
commit 5fe9a52f15
14 files changed
+205 -311

No files matched your search

+18 -73
View File
@@ -253,11 +253,10 @@ elseif ($action == ACT_ADD):
echo '<h2>', _('Add Company'), "</h2>\n";
?>
<form method="post" action="<?=$g_scriptname?>">
<div class="mb-3">
<label for="compname" class="form-label"><?=_('Name')?></label>
<input type="text" class="form-control" id="compname" name="compname">
</div>
<?php form_create_select('comptype', _('Company type'), $opt_comptype); ?>
<?php
form_create_text('compname', _('Name'), 60);
form_create_select('comptype', _('Company type'), $opt_comptype);
?>
<button type="submit" name="submit[insert]" class="btn btn-primary"><?=_('Save')?></button>
<a href="<?=$g_scriptname?>" class="btn btn-secondary"><?=_('Back')?></a>
</form>
@@ -357,76 +356,22 @@ $company = $sth->fetch(PDO::FETCH_OBJ);
?>
<form method="post" action="<?=$g_scriptname?>">
<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
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);
?>
<div class="mb-3">
<label for="street" class="form-label"><?=_('Street')?></label>
<input type="text" class="form-control" id="street" name="street" value="<?=h($company->street)?>">
</div>
<div class="mb-3">
<label for="zip" class="form-label"><?=_('Zip')?></label>
<input type="text" class="form-control" id="zip" name="zip" value="<?=h($company->zip)?>">
</div>
<div class="mb-3">
<label for="city" class="form-label"><?=_('City')?></label>
<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
form_create_text('street', _('Street'), 40, $company->street);
form_create_text('zip', _('Zip'), 10, $company->zip);
form_create_text('city', _('City'), 30, $company->city);
form_create_text('country', _('Country'), 30, $company->country);
form_create_text('contact', _('Contact'), 30, $company->contact);
form_create_text('phone', _('Phone'), 30, $company->phone);
form_create_text('email', _('Email'), 50, $company->email);
form_create_text('web', _('Web'), 40, $company->web);
form_create_text('customerno', _('Customer no.'), 20, $company->customerno);
form_create_text('contractno', _('Contract no.'), 20, $company->contracno);
form_create_textarea('remarks', _('Remarks'), 3, 150, $company->remarks);
$opt_flags = db_load_enum('company', 'flags', true, true, false);
form_create_checks('flags', _('Flags'), $opt_flags, explode(',', $company->flags));
?>