diff --git a/_get_person_details.php b/_get_person_details.php index dd9a0cd..f3bd925 100644 --- a/_get_person_details.php +++ b/_get_person_details.php @@ -2,36 +2,41 @@ require_once 'db/config.php'; if (isset($_GET['id'])) { - $person_id = $_GET['id']; - $pdo = db(); - - // Fetch person details - $stmt = $pdo->prepare("SELECT * FROM people WHERE id = ?"); - $stmt->execute([$person_id]); - $person = $stmt->fetch(PDO::FETCH_ASSOC); - - // Fetch all functions - $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 - $stmt = $pdo->prepare("SELECT function_id FROM user_functions WHERE user_id = ?"); - $stmt->execute([$person_id]); - $person_functions = $stmt->fetchAll(PDO::FETCH_COLUMN, 0); - - $response = [ - 'person' => $person, - 'all_functions' => $all_functions, - 'person_functions' => $person_functions - ]; - header('Content-Type: application/json'); - echo json_encode($response); + try { + $person_id = $_GET['id']; + $pdo = db(); + + // Fetch person details + $stmt = $pdo->prepare("SELECT * FROM people WHERE id = ?"); + $stmt->execute([$person_id]); + $person = $stmt->fetch(PDO::FETCH_ASSOC); + + // Fetch all functions + $stmt = $pdo->query(" + SELECT f.id, f.name, bg.name as group_name + FROM functions f + LEFT JOIN bni_groups bg ON f.bni_group_id = bg.id + ORDER BY bg.display_order, f.display_order + "); + $all_functions = $stmt->fetchAll(PDO::FETCH_ASSOC); + + // Fetch person's functions + $stmt = $pdo->prepare("SELECT function_id FROM user_functions WHERE user_id = ?"); + $stmt->execute([$person_id]); + $person_functions = $stmt->fetchAll(PDO::FETCH_COLUMN, 0); + + $response = [ + 'person' => $person, + 'all_functions' => $all_functions, + 'person_functions' => $person_functions + ]; + + echo json_encode($response); + } catch (PDOException $e) { + http_response_code(500); + echo json_encode(['error' => $e->getMessage()]); + } exit; } ?> \ No newline at end of file diff --git a/assets/css/custom.css b/assets/css/custom.css index 8e4355d..a5f4dda 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -1,4 +1,3 @@ - body { font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background-color: #f8f9fa; @@ -99,3 +98,45 @@ body { width: 95%; max-width: 1400px; } + +.status-dot { + height: 12px; + width: 12px; + border-radius: 50%; + display: inline-block; + margin-left: 4px; +} + +.person-cell { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0.5rem; +} + +.person-name { + font-weight: bold; +} + +.person-details { + font-size: 0.75rem; + color: #6c757d; +} + +.person-details .person-group { + font-weight: bold; + color: #198754; +} + +.person-actions { + display: flex; + flex-direction: column; + align-items: flex-end; + justify-content: space-between; +} + +.status-dots { + display: flex; + justify-content: flex-end; + margin-bottom: 0.25rem; +} diff --git a/index.php b/index.php index e14bf53..da75ee6 100644 --- a/index.php +++ b/index.php @@ -121,6 +121,16 @@ $bni_groups = $stmt_bni_groups->fetchAll(PDO::FETCH_ASSOC); $spotkania_cols = $stmt_meetings->fetchAll(PDO::FETCH_ASSOC); ?> +
+ + +
+
@@ -148,39 +158,33 @@ $bni_groups = $stmt_bni_groups->fetchAll(PDO::FETCH_ASSOC); - + - @@ -601,10 +605,7 @@ document.addEventListener('DOMContentLoaded', function () { const functionsSelect = document.getElementById('editRoles'); functionsSelect.innerHTML = ''; // Clear existing options - const functionsSelect = document.getElementById('editRoles'); - functionsSelect.innerHTML = ''; // Clear existing options - - // Group functions by group name + // Group functions by group_name const groupedFunctions = data.all_functions.reduce((acc, func) => { const groupName = func.group_name || 'Other'; if (!acc[groupName]) { @@ -614,11 +615,10 @@ document.addEventListener('DOMContentLoaded', function () { return acc; }, {}); - // Populate the select with optgroups + // Populate select with optgroups for (const groupName in groupedFunctions) { const optgroup = document.createElement('optgroup'); optgroup.label = groupName; - groupedFunctions[groupName].forEach(func => { const option = document.createElement('option'); option.value = func.id; @@ -628,7 +628,6 @@ document.addEventListener('DOMContentLoaded', function () { } optgroup.appendChild(option); }); - functionsSelect.appendChild(optgroup); } }); @@ -726,24 +725,7 @@ document.addEventListener('DOMContentLoaded', function () { editMemberOnlyFields.style.display = isMember ? 'block' : 'none'; }); - // Adjust edit modal population - if(editPersonModal) { - editPersonModal.addEventListener('show.bs.modal', function (event) { - // ... (existing code) ... - fetch('_get_person_details.php?id=' + personId) - .then(response => response.json()) - .then(data => { - // ... (existing population code) ... - document.getElementById('editRole').value = data.person.role; - document.getElementById('editBniGroup').value = data.person.bni_group_id || ''; - // Trigger change to show/hide group div - editRoleSelect.dispatchEvent(new Event('change')); - - // ... (rest of the population code) ... - }); - }); - } });
-
-
- - -
- -   -   -   - -
- -
- - - Tel: - Email: - - - , Grupa: - -
+
+
+
+
+ + + + + , Grupa: +
-
- +
+
+
+ + + + +
+