fix: Admin-Inventarliste zeigt GUID wenn kein Name gesetzt

This commit is contained in:
Jens Reinemann 2026-05-17 18:47:28 +02:00
parent 117d5c7af0
commit 66a5a7d7a5
3 changed files with 9 additions and 4 deletions

View file

@ -36,6 +36,7 @@ internal data class UpdatePasswordRequest(val password: String)
@Serializable @Serializable
internal data class InventoryWithUsersDto( internal data class InventoryWithUsersDto(
val inventoryId: String, val inventoryId: String,
val inventoryName: String,
val users: List<UserDto> val users: List<UserDto>
) )

View file

@ -130,7 +130,7 @@ internal class InventoryRepository {
inventoryId = invId inventoryId = invId
) )
} }
InventoryWithUsersDto(inventoryId = invId, users = users) InventoryWithUsersDto(inventoryId = invId, inventoryName = invRow[Inventories.name], users = users)
} }
} }

View file

@ -480,15 +480,19 @@
} else { } else {
page.forEach(inv => { page.forEach(inv => {
const tr = document.createElement('tr'); const tr = document.createElement('tr');
const name = inv.inventoryName ? inv.inventoryName : '—'; const hasName = inv.inventoryName && inv.inventoryName.trim();
const lastUpdFmt = inv.lastUpdated ? new Date(inv.lastUpdated).toLocaleDateString('de-DE') : ''; const lastUpdFmt = inv.lastUpdated ? new Date(inv.lastUpdated).toLocaleDateString('de-DE') : '';
const tdName = document.createElement('td'); const tdName = document.createElement('td');
tdName.textContent = name; if (hasName) {
if (inv.inventoryName) { tdName.textContent = inv.inventoryName;
const badge = document.createElement('span'); badge.className = 'inv-badge'; badge.title = inv.inventoryId; const badge = document.createElement('span'); badge.className = 'inv-badge'; badge.title = inv.inventoryId;
badge.textContent = inv.inventoryId.slice(0, 8) + '…'; badge.style.marginLeft = '6px'; badge.textContent = inv.inventoryId.slice(0, 8) + '…'; badge.style.marginLeft = '6px';
tdName.appendChild(badge); tdName.appendChild(badge);
} else {
const badge = document.createElement('span'); badge.className = 'inv-badge'; badge.title = inv.inventoryId;
badge.textContent = inv.inventoryId;
tdName.appendChild(badge);
} }
const tds = [tdName]; const tds = [tdName];