Add roadmap management feature with database schema and user management

- Implemented roadmap.php for displaying and managing roadmap items with filters for quarter and status.
- Created schema.sql to define the database structure for users, invites, daily plans, tasks, brainstorm sessions, brainstorm cards, roadmap items, and integrations.
- Developed users.php for admin panel to manage team members and invitations, including functionality to create and revoke invites.
This commit is contained in:
2026-09-08 12:47:11 +02:00
commit 9da056b480
25 changed files with 3737 additions and 0 deletions
+93
View File
@@ -0,0 +1,93 @@
<?php
/**
* AJAX API voor Roadmap Beheer
*/
require_once __DIR__ . '/../includes/auth.php';
$user = require_auth();
$db = get_db_connection();
header('Content-Type: application/json');
$action = $_GET['action'] ?? ($_POST['action'] ?? '');
try {
// 1. Roadmap item toevoegen
if ($action === 'add_item') {
$data = json_decode(file_get_contents('php://input'), true);
$title = trim($data['title'] ?? '');
$description = trim($data['description'] ?? '');
$quarter = $data['quarter'] ?? 'Q3';
$type = $data['type'] ?? 'FEATURE';
$priority = $data['priority'] ?? 'MEDIUM';
$dueDate = !empty($data['due_date']) ? $data['due_date'] : null;
$jiraKey = !empty($data['jira_key']) ? trim($data['jira_key']) : null;
if (empty($title)) {
echo json_encode(['error' => 'Titel is verplicht']);
exit;
}
$stmt = $db->prepare("
INSERT INTO roadmap_items (title, description, quarter, type, priority, status, progress, due_date, jira_issue_key, created_by_id)
VALUES (?, ?, ?, ?, ?, 'PLANNED', 0, ?, ?, ?)
");
$stmt->execute([$title, $description, $quarter, $type, $priority, $dueDate, $jiraKey, $user['id']]);
echo json_encode(['success' => true]);
exit;
}
// 2. Status of voortgang bijwerken
if ($action === 'update_item') {
$data = json_decode(file_get_contents('php://input'), true);
$id = (int)($data['id'] ?? 0);
$status = $data['status'] ?? null;
$progress = isset($data['progress']) ? (int)$data['progress'] : null;
$jiraKey = isset($data['jira_key']) ? trim($data['jira_key']) : null;
$fields = [];
$params = [];
if ($status !== null) {
$fields[] = "status = ?";
$params[] = $status;
}
if ($progress !== null) {
$fields[] = "progress = ?";
$params[] = max(0, min(100, $progress));
}
if ($jiraKey !== null) {
$fields[] = "jira_issue_key = ?";
$params[] = $jiraKey;
}
if (!empty($fields)) {
$params[] = $id;
$sql = "UPDATE roadmap_items SET " . implode(", ", $fields) . " WHERE id = ?";
$stmt = $db->prepare($sql);
$stmt->execute($params);
}
echo json_encode(['success' => true]);
exit;
}
// 3. Item verwijderen
if ($action === 'delete_item') {
$data = json_decode(file_get_contents('php://input'), true);
$id = (int)($data['id'] ?? 0);
$stmt = $db->prepare("DELETE FROM roadmap_items WHERE id = ?");
$stmt->execute([$id]);
echo json_encode(['success' => true]);
exit;
}
echo json_encode(['error' => 'Onbekende actie']);
} catch (Exception $e) {
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
}