prepare(" SELECT * FROM projects WHERE id = ? AND client_id = ? "); $stmt->execute([$project_id, $_SESSION['client_id']]); $project = $stmt->fetch(); if (!$project) { header('Location: projects-list.php'); exit; } // Fetch selections for this project try { $stmt = $pdo->prepare(" SELECT ps.*, COUNT(DISTINCT sm.user_id) as actual_selected, c.company_name as created_by_name FROM project_selections ps LEFT JOIN selection_members sm ON ps.id = sm.selection_id LEFT JOIN clients c ON ps.created_by = c.id WHERE ps.project_id = ? AND ps.client_id = ? GROUP BY ps.id ORDER BY ps.created_at DESC "); $stmt->execute([$project_id, $_SESSION['client_id']]); $selections = $stmt->fetchAll(); } catch (Exception $e) { error_log("Selections fetch error: " . $e->getMessage()); $selections = []; } $page_title = 'View Project'; $is_live = $project['status'] === 'Live'; // Status colors $status_colors = [ 'Created' => '#0066cc', 'Targeted' => '#ffc107', 'Live' => '#28a745', 'On hold' => '#dc2626', 'Closed' => '#666' ]; $status_color = $status_colors[$project['status']] ?? '#666'; // Define redirect statuses $redirect_statuses = [ 'complete' => ['name' => 'Complete', 'color' => '#28a745'], 'partial' => ['name' => 'Partial Complete', 'color' => '#0066cc'], 'earlyscreenout' => ['name' => 'Early Screen Out', 'color' => '#dc2626'], 'latescreenout' => ['name' => 'Late Screen Out', 'color' => '#ffc107'], 'timeout' => ['name' => 'Timed Out', 'color' => '#666'], 'quotafull' => ['name' => 'Quota Full', 'color' => '#ff6b6b'] ]; $base_url = 'https://relevantreflex.com/r/'; include 'client-portal-header.php'; ?>
Status
Project ID
Country
Created

🔗 Redirect URLs

$info): ?>

👥 Panel Member Selections ()

➕ Create Selection
📋
No Selections Created Yet
Create your first selection to start recruiting panel members for this project.
➕ Create Your First Selection
Selection ID Name Status Required Selected Incidence Created Actions
%
View Edit Edit Delete

📊 Survey URLs

+ Add URLs
prepare(" SELECT batch_number, total_urls, sent_count, upload_type, created_at FROM survey_url_batches WHERE project_id = ? ORDER BY batch_number DESC "); $stmt->execute([$project['project_id']]); $url_batches = $stmt->fetchAll(PDO::FETCH_ASSOC); // Query 2: Get status counts per batch in one query $batch_status_counts = []; if (!empty($url_batches)) { $stmt = $pdo->prepare(" SELECT batch_number, status, COUNT(*) as cnt FROM survey_urls WHERE project_id = ? GROUP BY batch_number, status "); $stmt->execute([$project['project_id']]); $status_rows = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($status_rows as $row) { $bn = $row['batch_number']; $st = $row['status']; if (!isset($batch_status_counts[$bn])) { $batch_status_counts[$bn] = []; } $batch_status_counts[$bn][$st] = (int)$row['cnt']; } } } catch (Exception $e) { $url_batches = []; $batch_status_counts = []; error_log("Error fetching URL batches: " . $e->getMessage()); } ?>
🔗
No Survey URLs Yet
Add survey URLs to track panel member responses and manage redirects.
+ Add Your First Batch
Batch # Type Total Status Breakdown Created Actions
Batch # ['label' => 'Available', 'class' => 'pill-available'], 'sent' => ['label' => 'Sent', 'class' => 'pill-sent'], 'clicked' => ['label' => 'Clicked', 'class' => 'pill-clicked'], 'complete' => ['label' => 'Complete', 'class' => 'pill-complete'], 'partial' => ['label' => 'Partial', 'class' => 'pill-partial'], 'earlyscreenout' => ['label' => 'Early SO', 'class' => 'pill-earlyscreenout'], 'latescreenout' => ['label' => 'Late SO', 'class' => 'pill-latescreenout'], 'timeout' => ['label' => 'Timeout', 'class' => 'pill-timeout'], 'quotafull' => ['label' => 'Quota Full', 'class' => 'pill-quotafull'], ]; ?>
$status_info): ?> 0): ?> : No activity yet

📝 Note: URLs that remain without a result for over 2 hours are automatically marked as Timeout.