diff --git a/index.html b/index.html
index c6a72e8..488a72c 100644
--- a/index.html
+++ b/index.html
@@ -218,8 +218,8 @@
Hallintaosoite |
Serial |
Sijainti |
- Funktio |
Tyyppi |
+ Funktio |
Malli |
Ping |
Toiminnot |
@@ -1065,12 +1065,35 @@
-
-
+
+
-
-
+
+
diff --git a/script.js b/script.js
index 90099b8..4679c20 100644
--- a/script.js
+++ b/script.js
@@ -2714,8 +2714,8 @@ function renderDevices() {
${esc(d.hallintaosoite || '-')} |
${esc(d.serial || '-')} |
${d.site_name ? esc(d.site_name) : '-'} |
- ${esc(d.funktio || '-')} |
${esc(d.tyyppi || '-')} |
+ ${esc(d.funktio || '-')} |
${esc(d.malli || '-')} |
${pingIcon} |
@@ -2728,6 +2728,19 @@ function renderDevices() {
document.getElementById('device-count').textContent = filtered.length + ' laitetta' + (query ? ` (${devicesData.length} yhteensä)` : '');
}
+function setSelectValue(selectId, val) {
+ const sel = document.getElementById(selectId);
+ if (!val) { sel.value = ''; return; }
+ const exists = Array.from(sel.options).some(o => o.value === val);
+ if (!exists) {
+ const opt = document.createElement('option');
+ opt.value = val;
+ opt.textContent = val;
+ sel.appendChild(opt);
+ }
+ sel.value = val;
+}
+
async function editDevice(id) {
const d = devicesData.find(x => x.id === id);
if (!d) return;
@@ -2735,8 +2748,8 @@ async function editDevice(id) {
document.getElementById('device-form-nimi').value = d.nimi || '';
document.getElementById('device-form-hallintaosoite').value = d.hallintaosoite || '';
document.getElementById('device-form-serial').value = d.serial || '';
- document.getElementById('device-form-funktio').value = d.funktio || '';
- document.getElementById('device-form-tyyppi').value = d.tyyppi || '';
+ setSelectValue('device-form-tyyppi', d.tyyppi || '');
+ setSelectValue('device-form-funktio', d.funktio || '');
document.getElementById('device-form-malli').value = d.malli || '';
document.getElementById('device-form-ping-check').checked = d.ping_check || false;
document.getElementById('device-form-lisatiedot').value = d.lisatiedot || '';
|