diff --git a/_get_person_details.php b/_get_person_details.php index 026fa7b..dd9a0cd 100644 --- a/_get_person_details.php +++ b/_get_person_details.php @@ -11,7 +11,12 @@ if (isset($_GET['id'])) { $person = $stmt->fetch(PDO::FETCH_ASSOC); // Fetch all functions - $stmt = $pdo->query("SELECT id, name FROM functions ORDER BY display_order"); + $stmt = $pdo->query(" + SELECT f.id, f.name, bg.name as group_name + FROM functions f + LEFT JOIN bni_groups bg ON f.group_id = bg.id + ORDER BY f.display_order + "); $all_functions = $stmt->fetchAll(PDO::FETCH_ASSOC); // Fetch person's functions diff --git a/index.php b/index.php index 07323b7..cdc2ead 100644 --- a/index.php +++ b/index.php @@ -150,30 +150,35 @@ $bni_groups = $stmt_bni_groups->fetchAll(PDO::FETCH_ASSOC); - -
- - -
- - - + +
+
+ + +
+ +   +   +   +
- -
- -
- - -
Grupa: - -
-
- + +
+ + + + + , Grupa: + +
+
+
+ +
@@ -597,8 +602,12 @@ document.addEventListener('DOMContentLoaded', function () { data.all_functions.forEach(func => { const option = document.createElement('option'); option.value = func.id; - option.textContent = func.name; - if (data.person_functions.includes(func.id)) { + let textContent = func.name; + if (func.group_name) { + textContent += ' (' + func.group_name + ')'; + } + option.textContent = textContent; + if (data.person_functions.map(String).includes(String(func.id))) { option.selected = true; } functionsSelect.appendChild(option);