feat: Refactor process dashboard UI
This commit is contained in:
parent
a141f60df0
commit
2a8ad6701c
@ -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
|
||||
|
||||
37
index.php
37
index.php
@ -150,31 +150,36 @@ $bni_groups = $stmt_bni_groups->fetchAll(PDO::FETCH_ASSOC);
|
||||
<?php foreach ($people as $person): ?>
|
||||
<tr>
|
||||
<td class="text-center align-middle"><input type="checkbox" class="person-checkbox" name="person_ids[]" value="<?= $person['id'] ?>"></td>
|
||||
<td>
|
||||
<td style="position: relative;">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<?= htmlspecialchars($person['firstName'] . ' ' . $person['lastName']) ?>
|
||||
|
||||
<div class="position-absolute top-0 end-0 p-1">
|
||||
<?php if ($person['role'] === 'member'): ?>
|
||||
<div class="d-inline-block ms-2">
|
||||
<i class="bi <?= !empty($person['gains_sheet_path']) ? 'bi-file-earmark-check text-success' : 'bi-file-earmark-x text-danger' ?>" title="GAINS Sheet"></i>
|
||||
<i class="bi <?= !empty($person['top_wanted_contacts_path']) ? 'bi-file-earmark-check text-success' : 'bi-file-earmark-x text-danger' ?>" title="Top Wanted Contacts"></i>
|
||||
<i class="bi <?= !empty($person['top_owned_contacts_path']) ? 'bi-file-earmark-check text-success' : 'bi-file-earmark-x text-danger' ?>" title="Top Owned Contacts"></i>
|
||||
</div>
|
||||
<span class="badge rounded-circle <?= !empty($person['gains_sheet_path']) ? 'bg-success' : 'bg-danger' ?>" style="width: 10px; height: 10px; display: inline-block;" title="GAINS Sheet"> </span>
|
||||
<span class="badge rounded-circle <?= !empty($person['top_wanted_contacts_path']) ? 'bg-success' : 'bg-danger' ?>" style="width: 10px; height: 10px; display: inline-block;" title="Top Wanted Contacts"> </span>
|
||||
<span class="badge rounded-circle <?= !empty($person['top_owned_contacts_path']) ? 'bg-success' : 'bg-danger' ?>" style="width: 10px; height: 10px; display: inline-block;" title="Top Owned Contacts"> </span>
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
<small class="text-muted"><?= htmlspecialchars($person['companyName']) ?></small>
|
||||
<br>
|
||||
<small class="text-info fw-bold"><?= htmlspecialchars(ucfirst($person['role'])) ?></small>
|
||||
</div>
|
||||
|
||||
<div style="font-size: 0.8rem;">
|
||||
<small class="text-muted d-block"><?= htmlspecialchars($person['companyName']) ?></small>
|
||||
<small class="text-muted d-block"><?= htmlspecialchars($person['industry'] ?? '') ?></small>
|
||||
<small class="text-info fw-bold d-inline"><?= htmlspecialchars(ucfirst($person['role'])) ?></small>
|
||||
<?php if ($person['role'] === 'member' && !empty($person['bni_group_name'])): ?>
|
||||
<br><small class="text-success fw-bold">Grupa: <?= htmlspecialchars($person['bni_group_name']) ?></small>
|
||||
<small class="text-success fw-bold d-inline">, Grupa: <?= htmlspecialchars($person['bni_group_name']) ?></small>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-sm btn-secondary edit-btn" data-bs-toggle="modal" data-bs-target="#editPersonModal"
|
||||
data-person-id="<?= $person['id'] ?>"
|
||||
data-person-name="<?= htmlspecialchars($person['firstName'] . ' ' . $person['lastName']) ?>">
|
||||
Edit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<?php // Spotkania Columns ?>
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user