This commit is contained in:
2026-01-21 23:19:13 +01:00
parent d7108a9701
commit 40714e8ec6
3 changed files with 15 additions and 2 deletions

View File

@@ -234,9 +234,15 @@ export async function loadList(section) {
return;
}
selectEl.disabled = false;
items.forEach(item => {
const sorted = items.slice().sort((a, b) => {
const aActive = Number(a.is_active) === 1 ? 1 : 0;
const bActive = Number(b.is_active) === 1 ? 1 : 0;
if (aActive !== bActive) return bActive - aActive;
return Number(b.id || 0) - Number(a.id || 0);
});
sorted.forEach(item => {
const opt = document.createElement('option');
const label = `#${item.version_no} ${formatVersionDate(item.created_at)}` + (Number(item.is_active) === 1 ? ' (aktiv)' : '');
const label = `${Number(item.is_active) === 1 ? '✓ ' : ''}#${item.version_no} ${formatVersionDate(item.created_at)}` + (Number(item.is_active) === 1 ? ' (aktiv)' : '');
opt.value = String(item.id);
opt.textContent = label;
selectEl.appendChild(opt);