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);
|
$person = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
// Fetch all functions
|
// 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);
|
$all_functions = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
// Fetch person's functions
|
// 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): ?>
|
<?php foreach ($people as $person): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center align-middle"><input type="checkbox" class="person-checkbox" name="person_ids[]" value="<?= $person['id'] ?>"></td>
|
<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>
|
<div>
|
||||||
<?= htmlspecialchars($person['firstName'] . ' ' . $person['lastName']) ?>
|
<?= htmlspecialchars($person['firstName'] . ' ' . $person['lastName']) ?>
|
||||||
|
|
||||||
|
<div class="position-absolute top-0 end-0 p-1">
|
||||||
<?php if ($person['role'] === 'member'): ?>
|
<?php if ($person['role'] === 'member'): ?>
|
||||||
<div class="d-inline-block ms-2">
|
<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>
|
||||||
<i class="bi <?= !empty($person['gains_sheet_path']) ? 'bi-file-earmark-check text-success' : 'bi-file-earmark-x text-danger' ?>" title="GAINS Sheet"></i>
|
<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>
|
||||||
<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>
|
<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>
|
||||||
<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>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<br>
|
</div>
|
||||||
<small class="text-muted"><?= htmlspecialchars($person['companyName']) ?></small>
|
|
||||||
<br>
|
<div style="font-size: 0.8rem;">
|
||||||
<small class="text-info fw-bold"><?= htmlspecialchars(ucfirst($person['role'])) ?></small>
|
<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'])): ?>
|
<?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; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-1">
|
</div>
|
||||||
|
<div>
|
||||||
<button class="btn btn-sm btn-secondary edit-btn" data-bs-toggle="modal" data-bs-target="#editPersonModal"
|
<button class="btn btn-sm btn-secondary edit-btn" data-bs-toggle="modal" data-bs-target="#editPersonModal"
|
||||||
data-person-id="<?= $person['id'] ?>"
|
data-person-id="<?= $person['id'] ?>"
|
||||||
data-person-name="<?= htmlspecialchars($person['firstName'] . ' ' . $person['lastName']) ?>">
|
data-person-name="<?= htmlspecialchars($person['firstName'] . ' ' . $person['lastName']) ?>">
|
||||||
Edit
|
Edit
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<?php // Spotkania Columns ?>
|
<?php // Spotkania Columns ?>
|
||||||
@ -597,8 +602,12 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
data.all_functions.forEach(func => {
|
data.all_functions.forEach(func => {
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = func.id;
|
option.value = func.id;
|
||||||
option.textContent = func.name;
|
let textContent = func.name;
|
||||||
if (data.person_functions.includes(func.id)) {
|
if (func.group_name) {
|
||||||
|
textContent += ' (' + func.group_name + ')';
|
||||||
|
}
|
||||||
|
option.textContent = textContent;
|
||||||
|
if (data.person_functions.map(String).includes(String(func.id))) {
|
||||||
option.selected = true;
|
option.selected = true;
|
||||||
}
|
}
|
||||||
functionsSelect.appendChild(option);
|
functionsSelect.appendChild(option);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user