From 4f271a8560b26a550bba02daa6fd34c54edd0f6c Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Tue, 13 Jan 2026 00:05:49 +0100 Subject: [PATCH] update --- .../accountsetup/accountsetup_config.php | 1 + .../landingpage/accountsetup/settings.php | 44 +-------------- partials/landingpage/accountsetup/users.php | 56 +++++++++++++++++++ partials/structure/header.php | 2 + public/admin/users.php | 3 + public/assets/js/bridge-setup-page.js | 8 --- public/assets/js/ui-user.js | 31 ++++++++++ 7 files changed, 94 insertions(+), 51 deletions(-) create mode 100644 partials/landingpage/accountsetup/users.php create mode 100644 public/admin/users.php diff --git a/partials/landingpage/accountsetup/accountsetup_config.php b/partials/landingpage/accountsetup/accountsetup_config.php index 8144499..89eeaa3 100644 --- a/partials/landingpage/accountsetup/accountsetup_config.php +++ b/partials/landingpage/accountsetup/accountsetup_config.php @@ -4,6 +4,7 @@ $appBaseUrl = $GLOBALS['app_base_url'] ?? ''; $defaultNavLinks = [ ['id' => 'dashboard', 'label' => 'Dashboard', 'href' => $appBaseUrl . '/admin/dashboard.php'], ['id' => 'settings', 'label' => 'API & Tabellen', 'href' => $appBaseUrl . '/admin/settings.php'], + ['id' => 'users', 'label' => 'Userverwaltung', 'href' => $appBaseUrl . '/admin/users.php'], ['id' => 'profile', 'label' => 'Mein Konto', 'href' => $appBaseUrl . '/admin/profile.php'], ]; diff --git a/partials/landingpage/accountsetup/settings.php b/partials/landingpage/accountsetup/settings.php index cd3591f..e9cd584 100644 --- a/partials/landingpage/accountsetup/settings.php +++ b/partials/landingpage/accountsetup/settings.php @@ -6,48 +6,6 @@ require __DIR__ . '/accountsetup_config.php'; require dirname(__DIR__) . '/../structure/layout_start.php'; ?>
-
-
-

Team

- -
-
- - - - - -
NameE-MailRolleStatusAktionen
-
- -
-

Absender für Testmails

@@ -152,7 +110,7 @@ require dirname(__DIR__) . '/../structure/layout_start.php';
- +

Bridge-Setup

diff --git a/partials/landingpage/accountsetup/users.php b/partials/landingpage/accountsetup/users.php new file mode 100644 index 0000000..34275e0 --- /dev/null +++ b/partials/landingpage/accountsetup/users.php @@ -0,0 +1,56 @@ + +
+
+
+

Team

+ +
+
+ + + + + +
NameE-MailRolleStatusAktionen
+
+ +
+
+ +
+ 'dashboard', 'label' => 'Dashboard', 'href' => $appBaseUrl . '/admin/dashboard.php'], ['id' => 'settings', 'label' => 'API & Tabellen', 'href' => $appBaseUrl . '/admin/settings.php'], + ['id' => 'users', 'label' => 'Userverwaltung', 'href' => $appBaseUrl . '/admin/users.php'], ['id' => 'profile', 'label' => 'Mein Konto', 'href' => $appBaseUrl . '/admin/profile.php'], ]; @@ -48,6 +49,7 @@ $showNavLinks = !$hasHeaderTabs && !empty($navLinks); Profil Dashboard API & Tabellen + Userverwaltung
diff --git a/public/admin/users.php b/public/admin/users.php new file mode 100644 index 0000000..fb62bde --- /dev/null +++ b/public/admin/users.php @@ -0,0 +1,3 @@ + { if (bridgeSetupDialog?.open) bridgeSetupDialog.close(); }); - adminLoadBridgeBtn?.addEventListener('click', (ev) => { - if (bridgeSetupDialog?.showModal && !bridgeSetupDialog.open) { - bridgeSetupDialog.showModal(); - } - loadTablesFromBridge(ev, { preserveSelection: state.selectedTables.length > 0 }); - }); modeInputs.forEach(input => { input.addEventListener('change', () => applyModeVisibility(input.value)); }); diff --git a/public/assets/js/ui-user.js b/public/assets/js/ui-user.js index 06b2a76..29f1f94 100644 --- a/public/assets/js/ui-user.js +++ b/public/assets/js/ui-user.js @@ -40,6 +40,7 @@ let adminTablesAllSelect; let adminTablesSelectedSelect; let adminTablesAddBtn; let adminTablesRemoveBtn; +let adminLoadBridgeBtn; ensureConsoleCapture(); @@ -69,6 +70,7 @@ export function initAccountPage() { adminTablesSelectedSelect = document.getElementById('adminBridgeTablesSelected'); adminTablesAddBtn = document.getElementById('adminBridgeTablesAdd'); adminTablesRemoveBtn = document.getElementById('adminBridgeTablesRemove'); + adminLoadBridgeBtn = document.getElementById('btn-admin-load-bridge'); document.getElementById('btn-user-add')?.addEventListener('click', () => openUserForm()); document.getElementById('userFormCancel')?.addEventListener('click', () => closeUserForm()); @@ -112,6 +114,9 @@ export function initAccountPage() { adminTablesRemoveBtn?.addEventListener('click', () => { removeAdminTables(getSelectedOptions(adminTablesSelectedSelect)); }); + adminLoadBridgeBtn?.addEventListener('click', () => { + refreshBridgeTablesFromEndpoint(); + }); window.addEventListener('bridge-setup-updated', (ev) => { const setup = ev?.detail || {}; @@ -413,6 +418,32 @@ function addAdminTables(list) { updateAdminTableSelects(whitelist, merged); } +async function refreshBridgeTablesFromEndpoint() { + if (state.loading) return; + state.loading = true; + try { + const res = await apiAction('account.bridge.test', { method: 'POST', data: {} }); + if (!res?.ok) throw new Error(res?.error || 'Bridge konnte nicht abgefragt werden'); + const fetched = normalizeTableList(res.tables || []); + if (!fetched.length) { + toast('Keine Tabellen vom Bridge-Endpunkt erhalten', false); + return; + } + const selected = normalizeTableList(state.settings.bridge_tables || []); + const selectedSet = new Set(selected); + const nextSelected = fetched.filter(name => selectedSet.has(name)); + state.settings.bridge_setup = state.settings.bridge_setup || {}; + state.settings.bridge_setup.tables = fetched; + state.settings.bridge_tables = nextSelected; + updateAdminTableSelects(fetched, nextSelected); + toast('Tabellen aktualisiert', true); + } catch (err) { + toast(err.message || 'Bridge konnte nicht geprüft werden', false); + } finally { + state.loading = false; + } +} + function removeAdminTables(list) { const whitelist = normalizeTableList(state.settings.bridge_setup?.tables || []); if (!whitelist.length) return;