Stan przed edycją interfejsu procesów
This commit is contained in:
parent
cdd041c172
commit
47c0b35493
@ -2,6 +2,8 @@
|
||||
require_once 'db/config.php';
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
header('Content-Type: application/json');
|
||||
try {
|
||||
$person_id = $_GET['id'];
|
||||
$pdo = db();
|
||||
|
||||
@ -14,8 +16,8 @@ if (isset($_GET['id'])) {
|
||||
$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
|
||||
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);
|
||||
|
||||
@ -30,8 +32,11 @@ if (isset($_GET['id'])) {
|
||||
'person_functions' => $person_functions
|
||||
];
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($response);
|
||||
} catch (PDOException $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => $e->getMessage()]);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@ -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;
|
||||
}
|
||||
|
||||
76
index.php
76
index.php
@ -121,6 +121,16 @@ $bni_groups = $stmt_bni_groups->fetchAll(PDO::FETCH_ASSOC);
|
||||
$spotkania_cols = $stmt_meetings->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="groupFilter" class="form-label">Filter by Group</label>
|
||||
<select class="form-select" id="groupFilter">
|
||||
<option value="">All Groups</option>
|
||||
<?php foreach ($bni_groups as $group): ?>
|
||||
<option value="<?= $group['id'] ?>"><?= htmlspecialchars($group['name']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-sm">
|
||||
<thead class="table-light">
|
||||
@ -148,40 +158,34 @@ $bni_groups = $stmt_bni_groups->fetchAll(PDO::FETCH_ASSOC);
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($people as $person): ?>
|
||||
<tr>
|
||||
<tr data-group-id="<?= $person['bni_group_id'] ?>">
|
||||
<td class="text-center align-middle"><input type="checkbox" class="person-checkbox" name="person_ids[]" value="<?= $person['id'] ?>"></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'): ?>
|
||||
<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; ?>
|
||||
</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-muted d-block">Tel: <?= htmlspecialchars($person['phone'] ?? '') ?></small>
|
||||
<small class="text-muted d-block">Email: <?= htmlspecialchars($person['email'] ?? '') ?></small>
|
||||
<small class="text-info fw-bold d-inline"><?= htmlspecialchars(ucfirst($person['role'])) ?></small>
|
||||
<td class="person-cell">
|
||||
<div class="person-main">
|
||||
<div class="person-name"><?= htmlspecialchars($person['firstName'] . ' ' . $person['lastName']) ?></div>
|
||||
<div class="person-details">
|
||||
<span class="d-block"><?= htmlspecialchars($person['companyName']) ?></span>
|
||||
<span class="d-block"><?= htmlspecialchars($person['industry'] ?? '') ?></span>
|
||||
<span><?= htmlspecialchars(ucfirst($person['role'])) ?></span>
|
||||
<?php if ($person['role'] === 'member' && !empty($person['bni_group_name'])): ?>
|
||||
<small class="text-success fw-bold d-inline">, Grupa: <?= htmlspecialchars($person['bni_group_name']) ?></small>
|
||||
<span class="person-group">, Grupa: <?= htmlspecialchars($person['bni_group_name']) ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="person-actions">
|
||||
<div class="status-dots">
|
||||
<?php if ($person['role'] === 'member'): ?>
|
||||
<span class="status-dot <?= !empty($person['gains_sheet_path']) ? 'bg-success' : 'bg-danger' ?>" title="GAINS Sheet"></span>
|
||||
<span class="status-dot <?= !empty($person['top_wanted_contacts_path']) ? 'bg-success' : 'bg-danger' ?>" title="Top Wanted Contacts"></span>
|
||||
<span class="status-dot <?= !empty($person['top_owned_contacts_path']) ? 'bg-success' : 'bg-danger' ?>" title="Top Owned Contacts"></span>
|
||||
<?php endif; ?>
|
||||
</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 ?>
|
||||
@ -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) ...
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user