Download index.html from dataquantals/quantals-collect-version-2: direct link, hf CLI and curl.
- Browser
- Download file 46.5 kB
-
https://huggingface.co/spaces/dataquantals/quantals-collect-version-2/resolve/main/index.html
- Command line
-
hf download hf://spaces/dataquantals/quantals-collect-version-2/index.html
-
curl -L -o index.html https://huggingface.co/spaces/dataquantals/quantals-collect-version-2/resolve/main/index.html
46.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Participants - Quantals Collect</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/ag-grid-community/dist/ag-grid-community.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ag-grid-community/styles/ag-grid.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ag-grid-community/styles/ag-theme-alpine.css">
<style>
/* Custom styles */
.participant-card {
transition: transform 0.2s ease-in-out;
min-width: 300px;
}
.participant-card:hover {
transform: translateY(-2px);
}
.status-badge {
padding: 0.25rem 0.75rem;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 500;
}
.status-consented {
background-color: #dcfce7;
color: #166534;
}
.status-withdrawn {
background-color: #fee2e2;
color: #991b1b;
}
.status-pending {
background-color: #fef3c7;
color: #92400e;
}
.tag {
padding: 0.25rem 0.5rem;
border-radius: 0.375rem;
font-size: 0.75rem;
background-color: #e5e7eb;
color: #374151;
}
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 50;
}
.modal.active {
display: flex;
}
.timeline-item {
position: relative;
padding-left: 2rem;
}
.timeline-item::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 2px;
background: #e5e7eb;
}
.timeline-dot {
position: absolute;
left: -4px;
top: 0;
width: 8px;
height: 8px;
border-radius: 50%;
background: #3b82f6;
}
@keyframes slideUp {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
.slide-up {
animation: slideUp 0.3s ease-out;
}
@keyframes statusPulse {
0% { transform: scale(1); }
50% { transform: scale(1.1); }
100% { transform: scale(1); }
}
.status-pulse {
animation: statusPulse 0.3s ease-out 3;
}
.consent-preview {
transition: transform 0.2s ease-out;
}
.consent-preview:hover {
transform: scale(1.05);
}
/* New Action Button Styles */
:root {
--bg-primary: #ffffff;
--border-color: #e5e7eb;
--button-hover: #f3f4f6;
--button-active: #e5e7eb;
--button-text: #374151;
--button-icon: #6b7280;
}
.participant-actions {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(90px, 100%), 1fr));
gap: 0.5rem;
padding: 0.75rem;
background: var(--bg-primary);
position: sticky;
bottom: 0;
border-top: 1px solid var(--border-color);
min-height: 44px;
align-items: center;
}
.action-button {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 0.5rem;
border-radius: 0.375rem;
background: transparent;
color: var(--button-text);
border: 1px solid var(--border-color);
min-height: 44px;
transition: all 0.15s ease-in-out;
cursor: pointer;
}
.action-button:hover {
background: var(--button-hover);
}
.action-button:active {
background: var(--button-active);
}
.action-button:focus {
outline: 2px solid #3b82f6;
outline-offset: 2px;
}
.action-button svg {
width: 1.25rem;
height: 1.25rem;
color: var(--button-icon);
}
/* Container Queries */
@container (min-width: 600px) {
.action-button {
flex-direction: row;
}
}
@container (max-width: 599px) {
.action-button {
flex-direction: column;
width: 100%;
}
.action-button span {
display: none;
}
}
/* High Contrast Mode */
@media (forced-colors: active) {
.action-button {
border: 2px solid CanvasText;
}
.action-button:focus {
outline: 2px solid CanvasText;
}
}
/* Tooltip Styles */
.tooltip {
position: relative;
}
.tooltip::after {
content: attr(data-tooltip);
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
padding: 0.25rem 0.5rem;
background: #1f2937;
color: white;
border-radius: 0.25rem;
font-size: 0.75rem;
white-space: nowrap;
opacity: 0;
pointer-events: none;
transition: opacity 0.15s ease-in-out;
}
.tooltip:hover::after {
opacity: 1;
}
/* Edit Modal Styles */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 50;
}
.modal.active {
display: flex;
}
/* Focus styles */
.focus-visible:focus-visible {
outline: 2px solid #3b82f6;
outline-offset: 2px;
}
/* Toast styles */
.toast {
position: fixed;
bottom: 1rem;
right: 1rem;
padding: 0.75rem 1rem;
border-radius: 0.375rem;
background-color: white;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
z-index: 50;
}
.toast-success {
background-color: #dcfce7;
color: #166534;
}
.toast-error {
background-color: #fee2e2;
color: #991b1b;
}
.toast-info {
background-color: #e0f2fe;
color: #075985;
}
</style>
</head>
<body class="bg-gray-50 font-sans">
<div class="flex h-screen overflow-hidden">
<!-- Sidebar -->
<div class="sidebar bg-indigo-800 text-white w-64 flex flex-col">
<div class="p-4 flex items-center space-x-3 border-b border-indigo-700">
<div class="bg-white p-2 rounded-lg">
<i class="fas fa-microscope text-indigo-800 text-xl"></i>
</div>
<h1 class="text-xl font-bold">Quantals Collect</h1>
</div>
<nav class="flex-1 p-4 space-y-2">
<a href="index.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<i class="fas fa-home"></i>
<span>Dashboard</span>
</a>
<a href="projects.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<i class="fas fa-project-diagram"></i>
<span>Projects</span>
</a>
<a href="participants.html" class="flex items-center space-x-3 p-2 rounded-lg bg-indigo-700 text-white">
<i class="fas fa-users"></i>
<span>Participants</span>
</a>
<a href="interviews.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<i class="fas fa-microphone"></i>
<span>Interviews</span>
</a>
<a href="notes.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<i class="fas fa-sticky-note"></i>
<span>Notes</span>
</a>
<a href="analysis.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<i class="fas fa-chart-pie"></i>
<span>Analysis</span>
</a>
<a href="ai-assist.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<i class="fas fa-robot"></i>
<span>AI Assist</span>
</a>
<a href="transcriber.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<i class="fas fa-keyboard"></i>
<span>Transcriber</span>
</a>
</nav>
<div class="p-4 border-t border-indigo-700">
<a href="settings.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<i class="fas fa-cog"></i>
<span>Settings</span>
</a>
</div>
</div>
<!-- Main Content -->
<div class="flex-1 flex flex-col overflow-hidden">
<!-- Header -->
<header class="bg-white shadow-sm p-4 flex justify-between items-center">
<div class="flex items-center space-x-4">
<h2 class="text-xl font-semibold text-gray-800">Participants</h2>
<div class="offline-indicator hidden px-3 py-1 bg-yellow-100 text-yellow-800 rounded-full text-sm">
<i class="fas fa-wifi-slash mr-1"></i> Offline
</div>
</div>
<div class="flex items-center space-x-4">
<button class="p-2 rounded-full hover:bg-gray-100 relative">
<i class="fas fa-bell text-gray-600"></i>
<span class="absolute top-0 right-0 w-2 h-2 bg-red-500 rounded-full"></span>
</button>
<div class="flex items-center space-x-2">
<div class="w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center">
<span class="text-xs font-medium text-indigo-800">RS</span>
</div>
<span class="text-sm">Research Team</span>
</div>
</div>
</header>
<!-- Main Content Area -->
<main class="flex-1 overflow-y-auto p-6">
<div class="max-w-7xl mx-auto">
<!-- Sticky Toolbar -->
<div class="sticky top-0 bg-white p-4 rounded-lg shadow-sm mb-6 z-10">
<div class="flex justify-between items-center">
<div class="flex space-x-4 flex-1">
<div class="relative flex-1 max-w-md">
<input type="text" placeholder="Search participants..." class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
<button class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors flex items-center space-x-2" onclick="openNewParticipantModal()">
<i class="fas fa-user-plus"></i>
<span>Add Participant</span>
</button>
</div>
<div class="flex space-x-2">
<button class="p-2 rounded-lg hover:bg-gray-100" onclick="toggleView()" title="Toggle View">
<i class="fas fa-th-large text-gray-600"></i>
</button>
<button class="px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center space-x-2">
<i class="fas fa-download"></i>
<span>Export CSV</span>
</button>
</div>
</div>
</div>
<!-- Card View -->
<div id="cardView" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Participant Card Template -->
<div class="participant-card bg-white rounded-lg shadow-sm p-6 slide-up">
<div class="flex justify-between items-start mb-4">
<div class="flex items-center space-x-3">
<div class="w-12 h-12 rounded-full bg-indigo-100 flex items-center justify-center">
<span class="text-lg font-medium text-indigo-800">P-12</span>
</div>
<div>
<h3 class="text-lg font-semibold text-gray-800">Participant #12</h3>
<p class="text-sm text-gray-500">Enrolled: Jan 15, 2024</p>
</div>
</div>
<span class="status-badge status-consented">Consented</span>
</div>
<div class="space-y-4">
<div>
<h4 class="text-sm font-medium text-gray-700 mb-2">Demographics</h4>
<div class="grid grid-cols-2 gap-2 text-sm">
<div>
<span class="text-gray-500">Age:</span>
<span class="text-gray-800">32</span>
</div>
<div>
<span class="text-gray-500">Gender:</span>
<span class="text-gray-800">Female</span>
</div>
<div>
<span class="text-gray-500">Language:</span>
<span class="text-gray-800">English (Native)</span>
</div>
</div>
</div>
<div>
<h4 class="text-sm font-medium text-gray-700 mb-2">Activity</h4>
<div class="flex items-center space-x-4 text-sm">
<div>
<span class="text-gray-500">Interviews:</span>
<span class="text-gray-800">3</span>
</div>
<div>
<span class="text-gray-500">Last Session:</span>
<span class="text-gray-800">Feb 1, 2024</span>
</div>
</div>
</div>
<div>
<h4 class="text-sm font-medium text-gray-700 mb-2">Tags</h4>
<div class="flex flex-wrap gap-2">
<span class="tag">High-frequency user</span>
<span class="tag">Urban</span>
<span class="tag">Tech-savvy</span>
</div>
</div>
</div>
<div class="participant-actions">
<button
class="action-button tooltip"
onclick="handleEdit('P-12')"
data-tooltip="Edit participant"
aria-label="Edit participant">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
</svg>
<span>Edit</span>
</button>
<button
class="action-button tooltip"
onclick="handleNewSession('P-12')"
data-tooltip="Create new session"
aria-label="Create new session">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 5v14M5 12h14"></path>
</svg>
<span>New Session</span>
</button>
<button
class="action-button tooltip"
onclick="handleConsent('P-12')"
data-tooltip="Manage consent forms"
aria-label="Manage consent forms">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
<path d="M14 2v6h6"></path>
<path d="M16 13H8"></path>
<path d="M16 17H8"></path>
<path d="M10 9H8"></path>
</svg>
<span>Consent</span>
</button>
</div>
</div>
</div>
<!-- Table View (Hidden by default) -->
<div id="tableView" class="hidden">
<div id="participantsGrid" class="ag-theme-alpine" style="height: 600px;"></div>
</div>
</div>
</main>
</div>
</div>
<!-- New Participant Modal -->
<div id="newParticipantModal" class="modal">
<div class="bg-white rounded-lg shadow-xl max-w-2xl w-full mx-auto my-8">
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-semibold text-gray-800">Add New Participant</h3>
<button onclick="closeNewParticipantModal()" class="text-gray-400 hover:text-gray-600">
<i class="fas fa-times"></i>
</button>
</div>
<form class="space-y-4">
<!-- Identity Management -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Participant ID</label>
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" value="P-13" readonly>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Contact Information (Optional)</label>
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="Encrypted storage">
</div>
<!-- Demographics -->
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Age</label>
<input type="number" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Gender</label>
<select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
<option>Prefer not to say</option>
<option>Male</option>
<option>Female</option>
<option>Other</option>
</select>
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Language Preference</label>
<select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
<option>English</option>
<option>Bemba</option>
<option>Nyanja</option>
<option>Tonga</option>
<option>Lozi</option>
</select>
</div>
<!-- Ethical Compliance -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Consent Status</label>
<div class="flex items-center space-x-4">
<label class="inline-flex items-center">
<input type="checkbox" class="form-checkbox text-indigo-600">
<span class="ml-2">Consent Obtained</span>
</label>
<button type="button" class="text-indigo-600 hover:text-indigo-700 text-sm">
<i class="fas fa-upload mr-1"></i>
Upload Consent Form
</button>
</div>
</div>
<!-- Custom Fields -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Custom Tags</label>
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="Add tags separated by commas">
</div>
<!-- Researcher Notes -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Researcher Notes (Private)</label>
<textarea class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" rows="3"></textarea>
</div>
<div class="flex justify-end space-x-3">
<button type="button" onclick="closeNewParticipantModal()" class="px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50">Cancel</button>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">Add Participant</button>
</div>
</form>
</div>
</div>
</div>
<!-- Add Edit Modal Template -->
<div id="editParticipantModal" class="modal" role="dialog" aria-labelledby="edit-participant-title">
<div class="bg-white rounded-lg shadow-xl max-w-2xl w-full mx-auto my-8">
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h2 id="edit-participant-title" class="text-xl font-semibold text-gray-800">Edit Participant</h2>
<button onclick="closeEditModal()" class="text-gray-400 hover:text-gray-600" aria-label="Close modal">
<i class="fas fa-times"></i>
</button>
</div>
<!-- Live Region for Screen Readers -->
<div aria-live="polite" class="sr-only">
Editing participant, tab to navigate fields
</div>
<form id="editParticipantForm" class="space-y-6" onsubmit="handleEditSubmit(event)">
<!-- Core Metadata Section -->
<div class="space-y-4">
<h3 class="text-lg font-medium text-gray-900">Core Metadata</h3>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700">Participant ID</label>
<input type="text" id="participantId" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm bg-gray-50" disabled>
</div>
<div>
<label class="block text-sm font-medium text-gray-700">Status</label>
<select id="participantStatus" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500" required>
<option value="ACTIVE">Active</option>
<option value="PENDING">Pending</option>
<option value="WITHDRAWN">Withdrawn</option>
<option value="ARCHIVED">Archived</option>
</select>
</div>
</div>
</div>
<!-- Demographics Section -->
<div class="space-y-4">
<h3 class="text-lg font-medium text-gray-900">Demographics</h3>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700">Age</label>
<input type="number" id="participantAge" min="18" max="120" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500" required>
</div>
<div>
<label class="block text-sm font-medium text-gray-700">Language</label>
<select id="participantLanguage" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500" required>
<option value="en">English</option>
<option value="bem">Bemba</option>
<option value="nya">Nyanja</option>
<option value="ton">Tonga</option>
<option value="loz">Lozi</option>
</select>
</div>
</div>
</div>
<!-- Contact Section -->
<div class="space-y-4">
<h3 class="text-lg font-medium text-gray-900">Contact Information</h3>
<div class="flex items-center space-x-2">
<input type="checkbox" id="showContact" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
<label for="showContact" class="text-sm text-gray-700">Show contact information</label>
</div>
<div id="contactFields" class="hidden space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700">Email</label>
<input type="email" id="participantEmail" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500">
</div>
</div>
</div>
<!-- Custom Fields Section -->
<div class="space-y-4">
<h3 class="text-lg font-medium text-gray-900">Custom Fields</h3>
<div id="customFields" class="space-y-4">
<!-- Custom fields will be dynamically inserted here -->
</div>
</div>
<!-- Form Actions -->
<div class="flex justify-end space-x-3">
<button type="button" onclick="closeEditModal()" class="px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
Cancel
</button>
<button type="submit" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
Save Changes
</button>
</div>
</form>
</div>
</div>
</div>
<script>
// View Toggle
function toggleView() {
const cardView = document.getElementById('cardView');
const tableView = document.getElementById('tableView');
const toggleButton = document.querySelector('[title="Toggle View"] i');
if (cardView.classList.contains('hidden')) {
cardView.classList.remove('hidden');
tableView.classList.add('hidden');
toggleButton.classList.remove('fa-list');
toggleButton.classList.add('fa-th-large');
} else {
cardView.classList.add('hidden');
tableView.classList.remove('hidden');
toggleButton.classList.remove('fa-th-large');
toggleButton.classList.add('fa-list');
initGrid();
}
}
// AG Grid Initialization
function initGrid() {
const gridDiv = document.querySelector('#participantsGrid');
const gridOptions = {
columnDefs: [
{ field: 'id', headerName: 'ID', width: 100 },
{ field: 'status', headerName: 'Status', width: 120 },
{ field: 'enrollmentDate', headerName: 'Enrolled', width: 120 },
{ field: 'age', headerName: 'Age', width: 80 },
{ field: 'gender', headerName: 'Gender', width: 120 },
{ field: 'language', headerName: 'Language', width: 150 },
{ field: 'interviews', headerName: 'Interviews', width: 100 },
{ field: 'lastSession', headerName: 'Last Session', width: 120 },
{ field: 'tags', headerName: 'Tags', width: 200 }
],
defaultColDef: {
sortable: true,
filter: true,
resizable: true
},
rowData: [
{
id: 'P-12',
status: 'Consented',
enrollmentDate: 'Jan 15, 2024',
age: 32,
gender: 'Female',
language: 'English (Native)',
interviews: 3,
lastSession: 'Feb 1, 2024',
tags: 'High-frequency user, Urban, Tech-savvy'
}
// Add more row data as needed
]
};
new agGrid.Grid(gridDiv, gridOptions);
}
// Modal Functions
function openNewParticipantModal() {
document.getElementById('newParticipantModal').classList.add('active');
}
function closeNewParticipantModal() {
document.getElementById('newParticipantModal').classList.remove('active');
}
// Close modal when clicking outside
window.onclick = function(event) {
const modal = document.getElementById('newParticipantModal');
if (event.target === modal) {
closeNewParticipantModal();
}
}
// Status Change Animation
function animateStatusChange(element) {
element.classList.add('status-pulse');
setTimeout(() => {
element.classList.remove('status-pulse');
}, 1000);
}
// Add new button handler functions
function handleEdit(participantId) {
openEditModal(participantId);
}
function handleNewSession(participantId) {
// Check consent status first
const participant = fetchParticipant(participantId);
if (!participant.hasValidConsent) {
showError('Participant withdrew consent (Code: ETH-403)');
return;
}
// Check for incomplete sessions
const incompleteSessions = getIncompleteSessions(participantId);
if (incompleteSessions.length >= 3) {
if (!confirm('Participant has 3+ incomplete sessions. Continue?')) {
return;
}
}
navigate(`/sessions/new?participant=${participantId}`, {
state: {
preset: getParticipantPreferences(participantId)
}
});
}
function handleConsent(participantId) {
openWizard({
steps: [
{
title: "Verify Identity",
component: IdentityVerification
},
{
title: "Consent Form",
component: ConsentManager,
props: {
versions: fetchConsentForms(participantId),
eSign: supportsDigitalSignature()
}
}
]
});
}
// Utility functions
function fetchParticipant(id) {
// Implementation for fetching participant data
return {
id,
hasValidConsent: true,
// ... other participant data
};
}
function getIncompleteSessions(participantId) {
// Implementation for getting incomplete sessions
return [];
}
function getParticipantPreferences(participantId) {
// Implementation for getting participant preferences
return {
language: 'en',
// ... other preferences
};
}
function supportsDigitalSignature() {
// Implementation for checking digital signature support
return true;
}
function showError(message) {
// Implementation for showing error messages
alert(message);
}
// Container query setup
document.querySelectorAll('.participant-card').forEach(card => {
const container = document.createElement('div');
container.style.containerType = 'inline-size';
card.parentNode.insertBefore(container, card);
container.appendChild(card);
});
// Edit Modal Functions
let originalData = null;
let editModal = null;
function openEditModal(participantId) {
const participant = fetchParticipant(participantId);
// Check if participant is archived
if (participant.status === 'ARCHIVED') {
showToast('Archived participants cannot be edited');
return;
}
// Store original data for diff comparison
originalData = { ...participant };
// Populate form fields
document.getElementById('participantId').value = participant.id;
document.getElementById('participantStatus').value = participant.status;
document.getElementById('participantAge').value = participant.age;
document.getElementById('participantLanguage').value = participant.language;
// Handle contact information visibility
const showContact = document.getElementById('showContact');
const contactFields = document.getElementById('contactFields');
if (hasPermission('VIEW_PII')) {
showContact.checked = true;
contactFields.classList.remove('hidden');
document.getElementById('participantEmail').value = decrypt(participant.encryptedEmail);
}
// Populate custom fields
populateCustomFields(participant.customFields);
// Show modal
editModal = document.getElementById('editParticipantModal');
editModal.classList.add('active');
// Focus trap
focusTrap(editModal);
}
function closeEditModal() {
if (editModal) {
editModal.classList.remove('active');
// Return focus to edit button
document.querySelector(`[data-participant-id="${originalData.id}"]`).focus();
}
}
async function handleEditSubmit(event) {
event.preventDefault();
const formData = new FormData(event.target);
const editedData = Object.fromEntries(formData.entries());
// Check for changes
const changes = deepDiff(originalData, editedData);
if (Object.keys(changes).length === 0) {
closeEditModal();
return;
}
// Ethical compliance check
if (changes.status === 'WITHDRAWN') {
const approved = await requireEthicalApproval('WITHDRAWAL');
if (!approved) return;
}
try {
// Save changes
const response = await saveParticipantChanges(originalData.id, changes);
// Update UI
updateParticipantCard(response.data);
showSuccessToast(`Participant ${originalData.id} updated`);
// Log audit trail
logAuditEvent('PARTICIPANT_EDIT', {
id: originalData.id,
changes: maskPII(changes)
});
closeEditModal();
} catch (error) {
handleEditError(error);
}
}
// Utility Functions
function deepDiff(original, edited) {
const changes = {};
for (const key in edited) {
if (JSON.stringify(original[key]) !== JSON.stringify(edited[key])) {
changes[key] = edited[key];
}
}
return changes;
}
function focusTrap(modal) {
const focusableElements = modal.querySelectorAll(
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
);
const firstFocusable = focusableElements[0];
const lastFocusable = focusableElements[focusableElements.length - 1];
modal.addEventListener('keydown', (e) => {
if (e.key === 'Tab') {
if (e.shiftKey) {
if (document.activeElement === firstFocusable) {
lastFocusable.focus();
e.preventDefault();
}
} else {
if (document.activeElement === lastFocusable) {
firstFocusable.focus();
e.preventDefault();
}
}
}
});
firstFocusable.focus();
}
function showToast(message, type = 'info') {
// Implementation for showing toast messages
console.log(`${type.toUpperCase()}: ${message}`);
}
function showSuccessToast(message) {
showToast(message, 'success');
}
function hasPermission(permission) {
// Implementation for permission checking
return true; // Placeholder
}
function decrypt(encrypted) {
// Implementation for decryption
return encrypted; // Placeholder
}
function maskPII(data) {
// Implementation for masking PII in audit logs
return data; // Placeholder
}
async function requireEthicalApproval(action) {
// Implementation for ethical approval workflow
return true; // Placeholder
}
async function saveParticipantChanges(id, changes) {
// Implementation for saving changes
return { data: { ...originalData, ...changes } }; // Placeholder
}
function updateParticipantCard(data) {
// Implementation for updating the participant card in the UI
console.log('Updating card with:', data);
}
function logAuditEvent(action, data) {
// Implementation for audit logging
console.log('Audit:', action, data);
}
function handleEditError(error) {
if (error.status === 403) {
showToast('Permission denied', 'error');
} else if (error.status === 409) {
showVersionConflictUI(error);
} else if (isOffline()) {
queueForSync(error.data);
showToast('Changes queued for sync', 'info');
} else {
showToast('An error occurred', 'error');
}
}
function populateCustomFields(fields) {
const container = document.getElementById('customFields');
container.innerHTML = ''; // Clear existing fields
fields.forEach(field => {
const fieldElement = createCustomFieldElement(field);
container.appendChild(fieldElement);
});
}
function createCustomFieldElement(field) {
const div = document.createElement('div');
div.className = 'space-y-1';
const label = document.createElement('label');
label.className = 'block text-sm font-medium text-gray-700';
label.textContent = field.label;
const input = document.createElement('input');
input.type = field.type || 'text';
input.name = field.name;
input.value = field.value;
input.className = 'mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500';
if (field.required) input.required = true;
if (field.pattern) input.pattern = field.pattern;
div.appendChild(label);
div.appendChild(input);
return div;
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=dataquantals/quantals-collect-version-2" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Participants - Quantals Collect</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/ag-grid-community/dist/ag-grid-community.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ag-grid-community/styles/ag-grid.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ag-grid-community/styles/ag-theme-alpine.css">
<style>
/* Custom styles */
.participant-card {
transition: transform 0.2s ease-in-out;
min-width: 300px;
}
.participant-card:hover {
transform: translateY(-2px);
}
.status-badge {
padding: 0.25rem 0.75rem;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 500;
}
.status-consented {
background-color: #dcfce7;
color: #166534;
}
.status-withdrawn {
background-color: #fee2e2;
color: #991b1b;
}
.status-pending {
background-color: #fef3c7;
color: #92400e;
}
.tag {
padding: 0.25rem 0.5rem;
border-radius: 0.375rem;
font-size: 0.75rem;
background-color: #e5e7eb;
color: #374151;
}
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 50;
}
.modal.active {
display: flex;
}
.timeline-item {
position: relative;
padding-left: 2rem;
}
.timeline-item::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 2px;
background: #e5e7eb;
}
.timeline-dot {
position: absolute;
left: -4px;
top: 0;
width: 8px;
height: 8px;
border-radius: 50%;
background: #3b82f6;
}
@keyframes slideUp {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
.slide-up {
animation: slideUp 0.3s ease-out;
}
@keyframes statusPulse {
0% { transform: scale(1); }
50% { transform: scale(1.1); }
100% { transform: scale(1); }
}
.status-pulse {
animation: statusPulse 0.3s ease-out 3;
}
.consent-preview {
transition: transform 0.2s ease-out;
}
.consent-preview:hover {
transform: scale(1.05);