Administrator Views verbessert

This commit is contained in:
concierge committed 2026-10-25 11:11:37 +01:00
1 parent ffdb399f9e
commit 0a2070fcf5
12 files changed
+247 -12

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
const tenantCode = window.location.pathname.split('/')[1];
async function loadBrokerStatus() {
try {
const response = await fetch(`/${tenantCode}/admin/api/broker/status`);
if (!response.ok) {
throw new Error('Failed to load status');
}
const data = await response.json();
const body = document.getElementById('brokerStatusBody');
body.innerHTML = '';
if (!data.connections || data.connections.length === 0) {
const row = document.createElement('tr');
const cell = document.createElement('td');
cell.colSpan = 4;
cell.textContent = 'Keine aktiven Verbindungen';
row.appendChild(cell);
body.appendChild(row);
return;
}
for (const conn of data.connections) {
const row = document.createElement('tr');
const tdId = document.createElement('td');
tdId.textContent = conn.account_id;
const tdName = document.createElement('td');
tdName.textContent = conn.account_name;
const tdRole = document.createElement('td');
tdRole.textContent = conn.role;
const tdGroup = document.createElement('td');
if (conn.group_alias) {
tdGroup.textContent = `Gruppe ${conn.group_id}: ${conn.group_alias}`;
} else if (conn.role === 'Gruppe') {
tdGroup.textContent = `Gruppe ${conn.group_id || '-'}`;
} else {
tdGroup.textContent = '-';
}
row.append(tdId, tdName, tdRole, tdGroup);
body.appendChild(row);
}
} catch (error) {
console.error(error);
const body = document.getElementById('brokerStatusBody');
body.innerHTML = '<tr><td colspan="4">Fehler beim Laden</td></tr>';
}
}
loadBrokerStatus();
setInterval(loadBrokerStatus, 5000);
+45
View File
@@ -170,6 +170,51 @@ function revertStreet(histId) {
});
}
function normalizeForFilter(text) {
if (!text) return '';
let s = String(text).toLowerCase();
s = s.replace(/ä/g, 'ae')
.replace(/ö/g, 'oe')
.replace(/ü/g, 'ue')
.replace(/ß/g, 'ss');
s = s.replace(/[-_]/g, ' ');
s = s.replace(/\s+/g, ' ').trim();
return s;
}
function applyStreetFilters() {
const nameInput = document.getElementById('streetNameFilter');
const stateInput = document.getElementById('streetStateFilter');
const groupInput = document.getElementById('streetGroupFilter');
const nameQuery = normalizeForFilter(nameInput ? nameInput.value : '');
const stateQuery = stateInput ? stateInput.value : '';
const groupQuery = groupInput ? groupInput.value : '';
document.querySelectorAll('#strassenTable tbody tr').forEach(row => {
if (!row.dataset.id) return;
const nameCell = row.cells[1];
const nameText = normalizeForFilter(nameCell ? nameCell.innerText : '');
const stateSelect = row.cells[2] ? row.cells[2].querySelector('select') : null;
const groupSelect = row.cells[3] ? row.cells[3].querySelector('select') : null;
const stateVal = stateSelect ? stateSelect.value : '';
const groupVal = groupSelect ? groupSelect.value : '';
let visible = true;
if (nameQuery && nameText.indexOf(nameQuery) === -1) {
visible = false;
}
if (visible && stateQuery && stateVal !== stateQuery) {
visible = false;
}
if (visible && groupQuery && groupVal !== groupQuery) {
visible = false;
}
row.style.display = visible ? '' : 'none';
});
}
document.addEventListener('DOMContentLoaded', applyStreetFilters);
function closeStreetHistoryModal() {
document.getElementById('streetHistoryModal').close();
}