dataquantals commited on
Commit
b8313f5
·
verified ·
1 Parent(s): e0b8927

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Projects - 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"> <style> /* Custom styles */ .project-card { transition: all 0.2s ease; } .project-card:hover { transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); } .priority-dot { width: 8px; height: 8px; border-radius: 50%; } .priority-high { background-color: #ef4444; } .priority-medium { background-color: #f59e0b; } .priority-low { background-color: #10b981; } .status-badge { padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; } .status-active { background-color: #dcfce7; color: #166534; } .status-paused { background-color: #fef3c7; color: #92400e; } .status-completed { background-color: #dbeafe; color: #1e40af; } .status-archived { background-color: #f3f4f6; color: #374151; } .create-project-btn { position: fixed; bottom: 2rem; right: 2rem; z-index: 50; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); } .modal { transition: opacity 0.25s ease; } .modal-backdrop { background-color: rgba(0, 0, 0, 0.5); transition: opacity 0.25s ease; } .tag { transition: all 0.2s ease; } .tag:hover { transform: scale(1.05); } .drag-drop-zone { border: 2px dashed #e5e7eb; transition: all 0.2s ease; } .drag-drop-zone.dragover { border-color: #3b82f6; background-color: #eff6ff; } /* Table styles */ .table-container { overflow-x: auto; } .table-view th { position: sticky; top: 0; background-color: #f9fafb; z-index: 10; } .table-view tr:hover { background-color: #f3f4f6; } </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="dashboard.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 bg-indigo-700 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 text-indigo-200 hover:bg-indigo-700 hover: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> </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"> <div class="flex justify-between items-center"> <div class="flex items-center space-x-4"> <nav class="text-sm"> <ol class="list-none p-0 inline-flex"> <li class="flex items-center"> <a href="dashboard.html" class="text-gray-500 hover:text-gray-700">Dashboard</a> <i class="fas fa-chevron-right text-gray-400 mx-2"></i> </li> <li class="text-gray-700">Projects</li> </ol> </nav> </div> <div class="flex items-center space-x-4"> <button id="viewToggle" class="p-2 rounded-lg hover:bg-gray-100"> <i class="fas fa-th-large text-gray-600"></i> </button> <div class="relative"> <input type="text" placeholder="Search projects..." class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i> </div> </div> </div> </header> <!-- Main Content Area --> <main class="flex-1 overflow-y-auto p-6"> <div class="max-w-7xl mx-auto"> <!-- Filters --> <div class="mb-6 flex flex-wrap gap-4"> <select class="px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> <option value="">All Status</option> <option value="active">Active</option> <option value="paused">Paused</option> <option value="completed">Completed</option> <option value="archived">Archived</option> </select> <select class="px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> <option value="">All Methodologies</option> <option value="qualitative">Qualitative</option> <option value="quantitative">Quantitative</option> <option value="mixed">Mixed Methods</option> </select> <select class="px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> <option value="">All Team Members</option> <option value="1">John Doe</option> <option value="2">Jane Smith</option> </select> </div> <!-- Grid View --> <div id="gridView" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> <!-- Project Card --> <div class="project-card bg-white rounded-lg shadow-sm p-6"> <div class="flex justify-between items-start mb-4"> <div class="flex items-center space-x-2"> <div class="priority-dot priority-high"></div> <h3 class="text-lg font-semibold text-gray-800">Urban Sustainability Study</h3> </div> <div class="flex items-center space-x-2"> <span class="status-badge status-active">Active</span> <button class="p-2 hover:bg-gray-100 rounded-lg"> <i class="fas fa-ellipsis-v text-gray-600"></i> </button> </div> </div> <div class="space-y-4"> <div> <p class="text-sm text-gray-600">Research Questions:</p> <p class="text-sm text-gray-800 line-clamp-2">How do urban residents perceive and interact with green spaces? What factors influence their usage patterns?</p> </div> <div class="flex items-center justify-between"> <div class="flex items-center space-x-2"> <span class="px-2 py-1 bg-blue-100 text-blue-800 text-xs rounded-full">Qualitative</span> <span class="px-2 py-1 bg-green-100 text-green-800 text-xs rounded-full">#Sustainability</span> </div> <div class="flex items-center space-x-2"> <i class="fas fa-users text-gray-400"></i> <span class="text-sm text-gray-600">3 members</span> </div> </div> <div> <div class="flex justify-between text-sm text-gray-600 mb-1"> <span>Progress</span> <span>45%</span> </div> <div class="h-2 bg-gray-200 rounded-full"> <div class="h-2 bg-indigo-600 rounded-full" style="width: 45%"></div> </div> </div> </div> </div> <!-- More Project Cards... --> </div> <!-- Table View (Hidden by default) --> <div id="tableView" class="hidden"> <div class="table-container"> <table class="table-view w-full"> <thead> <tr class="text-left"> <th class="p-4">Project</th> <th class="p-4">Status</th> <th class="p-4">Methodology</th> <th class="p-4">Progress</th> <th class="p-4">Team</th> <th class="p-4">Actions</th> </tr> </thead> <tbody> <tr> <td class="p-4"> <div class="flex items-center space-x-2"> <div class="priority-dot priority-high"></div> <span class="font-medium">Urban Sustainability Study</span> </div> </td> <td class="p-4"> <span class="status-badge status-active">Active</span> </td> <td class="p-4"> <span class="px-2 py-1 bg-blue-100 text-blue-800 text-xs rounded-full">Qualitative</span> </td> <td class="p-4"> <div class="w-32"> <div class="h-2 bg-gray-200 rounded-full"> <div class="h-2 bg-indigo-600 rounded-full" style="width: 45%"></div> </div> </div> </td> <td class="p-4"> <div class="flex -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">JD</span> </div> <div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center"> <span class="text-xs font-medium text-green-800">JS</span> </div> </div> </td> <td class="p-4"> <button class="p-2 hover:bg-gray-100 rounded-lg"> <i class="fas fa-ellipsis-v text-gray-600"></i> </button> </td> </tr> </tbody> </table> </div> </div> </div> </main> </div> </div> <!-- Create Project Button --> <button class="create-project-btn p-4 bg-indigo-600 text-white rounded-full hover:bg-indigo-700 transition-colors"> <i class="fas fa-plus mr-2"></i> Create Project </button> <!-- Create Project Modal --> <div id="createProjectModal" class="modal hidden fixed inset-0 z-50"> <div class="modal-backdrop absolute inset-0"></div> <div class="relative min-h-screen flex items-center justify-center p-4"> <div class="bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[90vh] overflow-y-auto"> <div class="p-6 border-b border-gray-200"> <div class="flex justify-between items-center"> <h3 class="text-xl font-semibold text-gray-800">Create New Project</h3> <button class="p-2 hover:bg-gray-100 rounded-lg"> <i class="fas fa-times text-gray-600"></i> </button> </div> </div> <div class="p-6"> <form class="space-y-6"> <!-- Basic Info --> <div> <h4 class="text-lg font-medium text-gray-800 mb-4">Basic Information</h4> <div class="space-y-4"> <div> <label class="block text-sm font-medium text-gray-700 mb-1">Project Title</label> <input type="text" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" required> </div> <div> <label class="block text-sm font-medium text-gray-700 mb-1">Description</label> <textarea class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" rows="4"></textarea> </div> <div class="grid grid-cols-2 gap-4"> <div> <label class="block text-sm font-medium text-gray-700 mb-1">Start Date</label> <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> </div> <div> <label class="block text-sm font-medium text-gray-700 mb-1">End Date</label> <input type="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> </div> </div> </div> </div> <!-- Research Design --> <div> <h4 class="text-lg font-medium text-gray-800 mb-4">Research Design</h4> <div class="space-y-4"> <div> <label class="block text-sm font-medium text-gray-700 mb-1">Methodology</label> <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> <option value="qualitative">Qualitative</option> <option value="quantitative">Quantitative</option> <option value="mixed">Mixed Methods</option> </select> </div> <div> <label class="block text-sm font-medium text-gray-700 mb-1">Research Questions</label> <div class="space-y-2"> <div class="flex items-center space-x-2"> <input type="text" class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="Enter research question"> <button class="p-2 text-gray-600 hover:text-gray-800"> <i class="fas fa-plus"></i> </button> </div> </div> </div> <div class="flex items-center"> <input type="checkbox" id="ethicsApproval" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded"> <label for="ethicsApproval" class="ml-2 block text-sm text-gray-700">Ethics approval required</label> </div> </div> </div> <!-- Team Assignment --> <div> <h4 class="text-lg font-medium text-gray-800 mb-4">Team Assignment</h4> <div class="space-y-4"> <div> <label class="block text-sm font-medium text-gray-700 mb-1">Search Team Members</label> <input type="text" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="Search by name or email"> </div> <div class="space-y-2"> <div class="flex items-center justify-between p-2 bg-gray-50 rounded-lg"> <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">JD</span> </div> <span class="text-sm">John Doe</span> </div> <select class="px-3 py-1 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> <option value="owner">Owner</option> <option value="editor">Editor</option> <option value="viewer">Viewer</option> </select> </div> </div> </div> </div> <!-- Document Upload --> <div> <h4 class="text-lg font-medium text-gray-800 mb-4">Documents</h4> <div class="drag-drop-zone p-8 text-center rounded-lg"> <i class="fas fa-cloud-upload-alt text-4xl text-gray-400 mb-2"></i> <p class="text-gray-600">Drag and drop files here or click to browse</p> <p class="text-sm text-gray-500 mt-1">Supports PDF, DOCX (max 10MB)</p> </div> </div> </form> </div> <div class="p-6 border-t border-gray-200 flex justify-end space-x-4"> <button class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50">Cancel</button> <button class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">Create Project</button> </div> </div> </div> </div> <script> // View Toggle const viewToggle = document.getElementById('viewToggle'); const gridView = document.getElementById('gridView'); const tableView = document.getElementById('tableView'); let isGridView = true; viewToggle.addEventListener('click', () => { isGridView = !isGridView; gridView.classList.toggle('hidden'); tableView.classList.toggle('hidden'); viewToggle.querySelector('i').classList.toggle('fa-th-large'); viewToggle.querySelector('i').classList.toggle('fa-list'); }); // Create Project Modal const createProjectBtn = document.querySelector('.create-project-btn'); const createProjectModal = document.getElementById('createProjectModal'); const modalBackdrop = createProjectModal.querySelector('.modal-backdrop'); createProjectBtn.addEventListener('click', () => { createProjectModal.classList.remove('hidden'); document.body.style.overflow = 'hidden'; }); function closeModal() { createProjectModal.classList.add('hidden'); document.body.style.overflow = ''; } modalBackdrop.addEventListener('click', closeModal); createProjectModal.querySelector('.fa-times').closest('button').addEventListener('click', closeModal); // Drag and Drop const dragDropZone = document.querySelector('.drag-drop-zone'); ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { dragDropZone.addEventListener(eventName, preventDefaults, false); }); function preventDefaults(e) { e.preventDefault(); e.stopPropagation(); } ['dragenter', 'dragover'].forEach(eventName => { dragDropZone.addEventListener(eventName, highlight, false); }); ['dragleave', 'drop'].forEach(eventName => { dragDropZone.addEventListener(eventName, unhighlight, false); }); function highlight(e) { dragDropZone.classList.add('dragover'); } function unhighlight(e) { dragDropZone.classList.remove('dragover'); } dragDropZone.addEventListener('drop', handleDrop, false); function handleDrop(e) { const dt = e.dataTransfer; const files = dt.files; handleFiles(files); } function handleFiles(files) { // Handle file upload logic here console.log('Files to upload:', files); } // Auto-save functionality let saveTimeout; const form = document.querySelector('form'); form.addEventListener('input', () => { clearTimeout(saveTimeout); saveTimeout = setTimeout(() => { // Simulate auto-save console.log('Auto-saving...'); }, 1500); }); // Initialize tooltips and other UI components document.addEventListener('DOMContentLoaded', () => { // Add any initialization code here }); </script> </body> </html> - Initial Deployment

Browse files
Files changed (1) hide show
  1. index.html +646 -70
index.html CHANGED
@@ -67,100 +67,99 @@
67
  /* Participant Card Action Buttons */
68
  .participant-actions {
69
  display: grid;
70
- grid-template-columns: repeat(auto-fit, minmax(min(90px, 100%), 1fr));
71
  gap: 0.5rem;
72
  padding: 0.75rem;
73
- background: var(--bg-primary, #ffffff);
74
- position: sticky;
75
- bottom: 0;
76
- border-top: 1px solid var(--border-color, #e5e7eb);
77
- margin-top: auto;
78
  }
79
 
80
  .action-button {
81
- display: inline-flex;
82
  align-items: center;
83
  justify-content: center;
84
- min-height: 44px;
85
  padding: 0.5rem;
86
  border-radius: 0.375rem;
87
  font-size: 0.875rem;
88
  font-weight: 500;
89
- color: var(--text-primary, #4f46e5);
90
- background: transparent;
91
- border: 1px solid transparent;
92
- transition: all 0.15s ease;
93
- cursor: pointer;
94
- text-decoration: none;
95
  }
96
 
97
  .action-button:hover {
98
- background: var(--hover-bg, #f3f4f6);
 
99
  }
100
 
101
  .action-button:focus {
102
- outline: 2px solid var(--focus-ring, #4f46e5);
103
- outline-offset: 2px;
104
  }
105
 
106
- .action-button .icon {
107
- display: inline-flex;
108
- align-items: center;
109
- justify-content: center;
110
- width: 1.25rem;
111
- height: 1.25rem;
112
  }
113
 
114
- .action-button .label {
115
- margin-left: 0.5rem;
 
116
  }
117
 
118
- /* Desktop Labels */
119
- .action-button .label-desktop {
120
- display: inline;
121
  }
122
 
123
- .action-button .label-tablet {
124
- display: none;
 
 
 
125
  }
126
 
127
- /* Container Queries for Responsive Design */
128
- @container (max-width: 600px) {
 
 
 
 
 
 
 
129
  .participant-actions {
130
  grid-template-columns: 1fr;
131
  }
132
- .action-button .label-desktop,
133
- .action-button .label-tablet {
134
- display: none;
135
- }
136
  .action-button {
137
- justify-content: center;
 
138
  }
139
- }
140
-
141
- @container (min-width: 601px) and (max-width: 768px) {
142
- .action-button .label-desktop {
143
- display: none;
144
- }
145
- .action-button .label-tablet {
146
- display: inline;
147
  }
148
  }
149
 
150
- /* High Contrast Mode Support */
151
  @media (forced-colors: active) {
152
  .action-button {
153
- border: 1px solid CanvasText;
154
  }
155
- .action-button:focus {
156
- outline: 2px solid CanvasText;
 
157
  }
158
  }
159
 
160
- /* Safe Area Insets for Mobile */
161
  @supports (padding: max(0px)) {
162
  .participant-actions {
163
- padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
 
164
  }
165
  }
166
  </style>
@@ -322,26 +321,20 @@
322
  </div>
323
 
324
  <div class="participant-actions">
325
- <button class="action-button" aria-label="Edit participant">
326
- <span class="icon">✏️</span>
327
- <span class="label">
328
- <span class="label-desktop">Edit</span>
329
- <span class="label-tablet">✏ Edit</span>
330
- </span>
331
  </button>
332
- <button class="action-button" aria-label="Create new session">
333
- <span class="icon">➕</span>
334
- <span class="label">
335
- <span class="label-desktop">New Session</span>
336
- <span class="label-tablet">🗓 New</span>
337
- </span>
338
  </button>
339
- <button class="action-button" aria-label="Manage consent forms">
340
- <span class="icon">📋</span>
341
- <span class="label">
342
- <span class="label-desktop">Consent</span>
343
- <span class="label-tablet">📝 Consent</span>
344
- </span>
345
  </button>
346
  </div>
347
  </div>
@@ -568,6 +561,238 @@
568
  <!-- Add Toast Container -->
569
  <div id="toastContainer" class="fixed bottom-4 right-4 space-y-2"></div>
570
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  <script>
572
  // View Toggle
573
  function toggleView(view) {
@@ -888,7 +1113,7 @@
888
  const participantEditor = new ParticipantEditor();
889
 
890
  // Update edit button click handler
891
- document.querySelectorAll('.action-button[aria-label="Edit participant"]').forEach(button => {
892
  button.addEventListener('click', () => {
893
  const participantId = button.closest('.participant-card').querySelector('.text-lg').textContent;
894
  participantEditor.openEditModal(participantId);
@@ -914,6 +1139,357 @@
914
  if (window.matchMedia('(forced-colors: active)').matches) {
915
  document.documentElement.classList.add('high-contrast');
916
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
917
  </script>
918
  <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://deepsite.hf.co/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://deepsite.hf.co" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://deepsite.hf.co?remix=dataquantals/quantals-collect" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
919
  </html>
 
67
  /* Participant Card Action Buttons */
68
  .participant-actions {
69
  display: grid;
70
+ grid-template-columns: repeat(3, 1fr);
71
  gap: 0.5rem;
72
  padding: 0.75rem;
73
+ background: #f9fafb;
74
+ border-top: 1px solid #e5e7eb;
 
 
 
75
  }
76
 
77
  .action-button {
78
+ display: flex;
79
  align-items: center;
80
  justify-content: center;
81
+ gap: 0.5rem;
82
  padding: 0.5rem;
83
  border-radius: 0.375rem;
84
  font-size: 0.875rem;
85
  font-weight: 500;
86
+ color: #374151;
87
+ background: white;
88
+ border: 1px solid #e5e7eb;
89
+ transition: all 0.2s;
90
+ min-height: 2.5rem;
 
91
  }
92
 
93
  .action-button:hover {
94
+ background: #f3f4f6;
95
+ border-color: #d1d5db;
96
  }
97
 
98
  .action-button:focus {
99
+ outline: none;
100
+ box-shadow: 0 0 0 2px #3b82f6, 0 0 0 4px white;
101
  }
102
 
103
+ .action-button i {
104
+ font-size: 1rem;
 
 
 
 
105
  }
106
 
107
+ /* Responsive text labels */
108
+ .desktop-label {
109
+ display: none;
110
  }
111
 
112
+ .tablet-label {
113
+ display: none;
 
114
  }
115
 
116
+ /* Desktop view (≥768px) */
117
+ @media (min-width: 768px) {
118
+ .desktop-label {
119
+ display: inline;
120
+ }
121
  }
122
 
123
+ /* Tablet view (601px-768px) */
124
+ @media (min-width: 601px) and (max-width: 767px) {
125
+ .tablet-label {
126
+ display: inline;
127
+ }
128
+ }
129
+
130
+ /* Mobile view (≤600px) */
131
+ @media (max-width: 600px) {
132
  .participant-actions {
133
  grid-template-columns: 1fr;
134
  }
135
+
 
 
 
136
  .action-button {
137
+ justify-content: flex-start;
138
+ padding: 0.75rem;
139
  }
140
+
141
+ .action-button::after {
142
+ content: attr(aria-label);
143
+ margin-left: 0.5rem;
 
 
 
 
144
  }
145
  }
146
 
147
+ /* High contrast mode support */
148
  @media (forced-colors: active) {
149
  .action-button {
150
+ border: 2px solid ButtonText;
151
  }
152
+
153
+ .action-button:hover {
154
+ border-color: Highlight;
155
  }
156
  }
157
 
158
+ /* Safe area insets for mobile */
159
  @supports (padding: max(0px)) {
160
  .participant-actions {
161
+ padding-left: max(0.75rem, env(safe-area-inset-left));
162
+ padding-right: max(0.75rem, env(safe-area-inset-right));
163
  }
164
  }
165
  </style>
 
321
  </div>
322
 
323
  <div class="participant-actions">
324
+ <button onclick="editParticipant('P-12')" class="action-button" aria-label="Edit Participant">
325
+ <i class="fas fa-edit"></i>
326
+ <span class="desktop-label">Edit</span>
327
+ <span class="tablet-label">Edit</span>
 
 
328
  </button>
329
+ <button onclick="newSession('P-12')" class="action-button" aria-label="Start New Session">
330
+ <i class="fas fa-plus-circle"></i>
331
+ <span class="desktop-label">New Session</span>
332
+ <span class="tablet-label">Session</span>
 
 
333
  </button>
334
+ <button onclick="updateConsent('P-12')" class="action-button" aria-label="Update Consent">
335
+ <i class="fas fa-file-signature"></i>
336
+ <span class="desktop-label">Consent</span>
337
+ <span class="tablet-label">Consent</span>
 
 
338
  </button>
339
  </div>
340
  </div>
 
561
  <!-- Add Toast Container -->
562
  <div id="toastContainer" class="fixed bottom-4 right-4 space-y-2"></div>
563
 
564
+ <!-- Add Consent Modal Template -->
565
+ <div id="consentModal" class="fixed inset-0 bg-black bg-opacity-50 hidden" role="dialog" aria-labelledby="consent-modal-title">
566
+ <div class="min-h-screen px-4 text-center">
567
+ <div class="fixed inset-0" aria-hidden="true">
568
+ <div class="absolute inset-0 bg-gray-500 opacity-75"></div>
569
+ </div>
570
+ <span class="inline-block h-screen align-middle" aria-hidden="true">&#8203;</span>
571
+ <div class="inline-block w-full max-w-4xl p-6 my-8 text-left align-middle transition-all transform bg-white shadow-xl rounded-2xl">
572
+ <div class="flex justify-between items-center mb-6">
573
+ <h2 id="consent-modal-title" class="text-lg font-medium text-gray-900">Consent Management</h2>
574
+ <button onclick="closeConsentModal()" class="text-gray-400 hover:text-gray-500" aria-label="Close modal">
575
+ <i class="fas fa-times"></i>
576
+ </button>
577
+ </div>
578
+
579
+ <div class="space-y-6">
580
+ <!-- Identity Verification Section -->
581
+ <div class="space-y-4">
582
+ <h3 class="font-medium text-gray-900">Identity Verification</h3>
583
+ <div class="grid grid-cols-2 gap-4">
584
+ <div>
585
+ <label class="block text-sm font-medium text-gray-700">Photo ID Upload</label>
586
+ <div class="mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md">
587
+ <div class="space-y-1 text-center">
588
+ <i class="fas fa-id-card text-gray-400 text-3xl"></i>
589
+ <div class="flex text-sm text-gray-600">
590
+ <label class="relative cursor-pointer bg-white rounded-md font-medium text-indigo-600 hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-indigo-500">
591
+ <span>Upload ID</span>
592
+ <input type="file" accept="image/*" class="sr-only" id="idUpload">
593
+ </label>
594
+ </div>
595
+ </div>
596
+ </div>
597
+ </div>
598
+ <div>
599
+ <label class="block text-sm font-medium text-gray-700">Liveness Check</label>
600
+ <div class="mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md">
601
+ <div class="space-y-1 text-center">
602
+ <i class="fas fa-camera text-gray-400 text-3xl"></i>
603
+ <button type="button" class="text-sm text-indigo-600 hover:text-indigo-500" id="startLivenessCheck">
604
+ Start Verification
605
+ </button>
606
+ </div>
607
+ </div>
608
+ </div>
609
+ </div>
610
+ </div>
611
+
612
+ <!-- Document Selection -->
613
+ <div class="space-y-4">
614
+ <h3 class="font-medium text-gray-900">Consent Form Selection</h3>
615
+ <div class="grid grid-cols-2 gap-4">
616
+ <div>
617
+ <label class="block text-sm font-medium text-gray-700">Language</label>
618
+ <select id="consentLanguage" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
619
+ <option value="en">English</option>
620
+ <option value="bem">Bemba</option>
621
+ <option value="nya">Nyanja</option>
622
+ <option value="ton">Tonga</option>
623
+ </select>
624
+ </div>
625
+ <div>
626
+ <label class="block text-sm font-medium text-gray-700">Form Version</label>
627
+ <select id="consentVersion" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
628
+ <option value="v2.1-2025">Version 2.1 (2025)</option>
629
+ <option value="v2.0-2024">Version 2.0 (2024)</option>
630
+ </select>
631
+ </div>
632
+ </div>
633
+ <div id="consentPreview" class="mt-4 border rounded-lg p-4 bg-gray-50">
634
+ <div class="aspect-w-16 aspect-h-9">
635
+ <iframe id="pdfPreview" class="w-full h-full"></iframe>
636
+ </div>
637
+ </div>
638
+ </div>
639
+
640
+ <!-- Signature Capture -->
641
+ <div class="space-y-4">
642
+ <h3 class="font-medium text-gray-900">Signature</h3>
643
+ <div class="grid grid-cols-2 gap-4">
644
+ <div>
645
+ <label class="block text-sm font-medium text-gray-700">Signature Type</label>
646
+ <div class="mt-2 space-y-2">
647
+ <div class="flex items-center">
648
+ <input type="radio" name="signatureType" value="draw" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500" checked>
649
+ <label class="ml-2 block text-sm text-gray-900">Draw Signature</label>
650
+ </div>
651
+ <div class="flex items-center">
652
+ <input type="radio" name="signatureType" value="type" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500">
653
+ <label class="ml-2 block text-sm text-gray-900">Type Signature</label>
654
+ </div>
655
+ </div>
656
+ </div>
657
+ <div>
658
+ <label class="block text-sm font-medium text-gray-700">Witness Required</label>
659
+ <div class="mt-2">
660
+ <input type="checkbox" id="witnessRequired" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500">
661
+ <label for="witnessRequired" class="ml-2 block text-sm text-gray-900">Require witness signature</label>
662
+ </div>
663
+ </div>
664
+ </div>
665
+ <div id="signaturePad" class="mt-4 border rounded-lg p-4">
666
+ <canvas id="signatureCanvas" class="w-full h-48 border rounded"></canvas>
667
+ <div class="mt-2 flex justify-end space-x-2">
668
+ <button type="button" class="px-3 py-1 text-sm text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50" onclick="clearSignature()">
669
+ Clear
670
+ </button>
671
+ </div>
672
+ </div>
673
+ </div>
674
+
675
+ <!-- Status and Actions -->
676
+ <div class="flex justify-between items-center pt-4 border-t">
677
+ <div id="consentStatus" class="text-sm text-gray-500">
678
+ Ready to process consent
679
+ </div>
680
+ <div class="space-x-3">
681
+ <button type="button" onclick="closeConsentModal()" 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">
682
+ Cancel
683
+ </button>
684
+ <button type="button" onclick="processConsent()" 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">
685
+ Process Consent
686
+ </button>
687
+ </div>
688
+ </div>
689
+ </div>
690
+ </div>
691
+ </div>
692
+ </div>
693
+
694
+ <!-- New Session Modal Template -->
695
+ <template id="newSessionModal">
696
+ <div class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
697
+ <div class="bg-white rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto">
698
+ <!-- Header -->
699
+ <div class="p-6 border-b border-gray-200">
700
+ <div class="flex items-center justify-between">
701
+ <h3 class="text-xl font-semibold text-gray-900">Start New Session</h3>
702
+ <button type="button" class="text-gray-400 hover:text-gray-500" onclick="closeNewSessionModal()">
703
+ <span class="sr-only">Close</span>
704
+ <i class="fas fa-times"></i>
705
+ </button>
706
+ </div>
707
+ </div>
708
+
709
+ <!-- Content -->
710
+ <div class="p-6">
711
+ <!-- Session Type Selection -->
712
+ <div class="mb-6">
713
+ <label class="block text-sm font-medium text-gray-700 mb-2">Session Type</label>
714
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
715
+ <button type="button" class="session-type-btn p-4 border rounded-lg hover:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500" data-type="interview">
716
+ <i class="fas fa-comments text-2xl mb-2 text-blue-500"></i>
717
+ <div class="font-medium">Interview</div>
718
+ <div class="text-sm text-gray-500">Qualitative research</div>
719
+ </button>
720
+ <button type="button" class="session-type-btn p-4 border rounded-lg hover:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500" data-type="survey">
721
+ <i class="fas fa-clipboard-list text-2xl mb-2 text-blue-500"></i>
722
+ <div class="font-medium">Survey</div>
723
+ <div class="text-sm text-gray-500">Quantitative research</div>
724
+ </button>
725
+ <button type="button" class="session-type-btn p-4 border rounded-lg hover:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500" data-type="observation">
726
+ <i class="fas fa-binoculars text-2xl mb-2 text-blue-500"></i>
727
+ <div class="font-medium">Observation</div>
728
+ <div class="text-sm text-gray-500">Field research</div>
729
+ </button>
730
+ </div>
731
+ </div>
732
+
733
+ <!-- Session Settings -->
734
+ <div class="space-y-4">
735
+ <div>
736
+ <label class="block text-sm font-medium text-gray-700 mb-2">Language</label>
737
+ <select class="session-language w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
738
+ <option value="bem_ZM">Bemba (Zambia)</option>
739
+ <option value="nya_ZM">Nyanja (Zambia)</option>
740
+ <option value="toi_ZM">Tonga (Zambia)</option>
741
+ <option value="en_ZM">English (Zambia)</option>
742
+ </select>
743
+ </div>
744
+
745
+ <div>
746
+ <label class="block text-sm font-medium text-gray-700 mb-2">Communication Preference</label>
747
+ <div class="flex space-x-4">
748
+ <label class="inline-flex items-center">
749
+ <input type="radio" name="communication" value="audio" class="form-radio text-blue-600" checked>
750
+ <span class="ml-2">Audio</span>
751
+ </label>
752
+ <label class="inline-flex items-center">
753
+ <input type="radio" name="communication" value="video" class="form-radio text-blue-600">
754
+ <span class="ml-2">Video</span>
755
+ </label>
756
+ <label class="inline-flex items-center">
757
+ <input type="radio" name="communication" value="text" class="form-radio text-blue-600">
758
+ <span class="ml-2">Text</span>
759
+ </label>
760
+ </div>
761
+ </div>
762
+
763
+ <div>
764
+ <label class="block text-sm font-medium text-gray-700 mb-2">Accessibility Requirements</label>
765
+ <div class="space-y-2">
766
+ <label class="inline-flex items-center">
767
+ <input type="checkbox" name="accessibility" value="screen_reader" class="form-checkbox text-blue-600">
768
+ <span class="ml-2">Screen Reader Support</span>
769
+ </label>
770
+ <label class="inline-flex items-center">
771
+ <input type="checkbox" name="accessibility" value="high_contrast" class="form-checkbox text-blue-600">
772
+ <span class="ml-2">High Contrast Mode</span>
773
+ </label>
774
+ <label class="inline-flex items-center">
775
+ <input type="checkbox" name="accessibility" value="keyboard_only" class="form-checkbox text-blue-600">
776
+ <span class="ml-2">Keyboard Navigation</span>
777
+ </label>
778
+ </div>
779
+ </div>
780
+ </div>
781
+ </div>
782
+
783
+ <!-- Footer -->
784
+ <div class="px-6 py-4 bg-gray-50 border-t border-gray-200 flex justify-end space-x-3">
785
+ <button type="button" class="px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" onclick="closeNewSessionModal()">
786
+ Cancel
787
+ </button>
788
+ <button type="button" class="px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" onclick="startNewSession()">
789
+ Start Session
790
+ </button>
791
+ </div>
792
+ </div>
793
+ </div>
794
+ </template>
795
+
796
  <script>
797
  // View Toggle
798
  function toggleView(view) {
 
1113
  const participantEditor = new ParticipantEditor();
1114
 
1115
  // Update edit button click handler
1116
+ document.querySelectorAll('.action-button[aria-label="Edit Participant"]').forEach(button => {
1117
  button.addEventListener('click', () => {
1118
  const participantId = button.closest('.participant-card').querySelector('.text-lg').textContent;
1119
  participantEditor.openEditModal(participantId);
 
1139
  if (window.matchMedia('(forced-colors: active)').matches) {
1140
  document.documentElement.classList.add('high-contrast');
1141
  }
1142
+
1143
+ // Consent Management
1144
+ class ConsentManager {
1145
+ constructor() {
1146
+ this.modal = document.getElementById('consentModal');
1147
+ this.signaturePad = null;
1148
+ this.identityVerified = false;
1149
+ this.setupEventListeners();
1150
+ }
1151
+
1152
+ setupEventListeners() {
1153
+ // ID Upload
1154
+ document.getElementById('idUpload').addEventListener('change', (e) => this.handleIdUpload(e));
1155
+
1156
+ // Liveness Check
1157
+ document.getElementById('startLivenessCheck').addEventListener('click', () => this.startLivenessCheck());
1158
+
1159
+ // Language Change
1160
+ document.getElementById('consentLanguage').addEventListener('change', () => this.updateConsentForm());
1161
+
1162
+ // Signature Type
1163
+ document.querySelectorAll('input[name="signatureType"]').forEach(input => {
1164
+ input.addEventListener('change', (e) => this.toggleSignatureType(e.target.value));
1165
+ });
1166
+ }
1167
+
1168
+ async openConsentModal(participantId) {
1169
+ try {
1170
+ const participant = await this.fetchParticipant(participantId);
1171
+ this.currentParticipant = participant;
1172
+
1173
+ // Load consent forms
1174
+ const forms = await this.fetchConsentForms({
1175
+ projectId: participant.projectId,
1176
+ locale: participant.language
1177
+ });
1178
+
1179
+ this.populateConsentForm(forms);
1180
+ this.modal.classList.remove('hidden');
1181
+ this.initializeSignaturePad();
1182
+ } catch (error) {
1183
+ this.handleError(error);
1184
+ }
1185
+ }
1186
+
1187
+ async handleIdUpload(event) {
1188
+ const file = event.target.files[0];
1189
+ if (!file) return;
1190
+
1191
+ try {
1192
+ const result = await this.verifyIdentity(file);
1193
+ this.identityVerified = result.isVerified;
1194
+ this.updateStatus('Identity verified');
1195
+ } catch (error) {
1196
+ this.handleError(error);
1197
+ }
1198
+ }
1199
+
1200
+ async startLivenessCheck() {
1201
+ try {
1202
+ const stream = await navigator.mediaDevices.getUserMedia({ video: true });
1203
+ // Implement liveness detection logic
1204
+ this.updateStatus('Liveness check completed');
1205
+ } catch (error) {
1206
+ this.handleError(error);
1207
+ }
1208
+ }
1209
+
1210
+ async updateConsentForm() {
1211
+ const language = document.getElementById('consentLanguage').value;
1212
+ const version = document.getElementById('consentVersion').value;
1213
+
1214
+ try {
1215
+ const form = await this.fetchConsentForm(language, version);
1216
+ this.displayConsentForm(form);
1217
+ } catch (error) {
1218
+ this.handleError(error);
1219
+ }
1220
+ }
1221
+
1222
+ initializeSignaturePad() {
1223
+ const canvas = document.getElementById('signatureCanvas');
1224
+ this.signaturePad = new SignaturePad(canvas, {
1225
+ backgroundColor: 'rgb(255, 255, 255)',
1226
+ penColor: 'rgb(0, 0, 0)'
1227
+ });
1228
+ }
1229
+
1230
+ toggleSignatureType(type) {
1231
+ const canvas = document.getElementById('signatureCanvas');
1232
+ const typeInput = document.createElement('input');
1233
+ typeInput.type = 'text';
1234
+ typeInput.className = 'w-full h-48 border rounded p-2';
1235
+
1236
+ if (type === 'type') {
1237
+ canvas.parentNode.replaceChild(typeInput, canvas);
1238
+ } else {
1239
+ typeInput.parentNode.replaceChild(canvas, typeInput);
1240
+ this.initializeSignaturePad();
1241
+ }
1242
+ }
1243
+
1244
+ async processConsent() {
1245
+ try {
1246
+ if (!this.identityVerified) {
1247
+ throw new Error('Identity verification required');
1248
+ }
1249
+
1250
+ const signature = await this.captureSignature();
1251
+ const pdfBlob = await this.generateConsentPDF(signature);
1252
+
1253
+ await this.saveConsent(pdfBlob);
1254
+ this.updateParticipantStatus();
1255
+ this.closeModal();
1256
+ } catch (error) {
1257
+ this.handleError(error);
1258
+ }
1259
+ }
1260
+
1261
+ async captureSignature() {
1262
+ if (this.signaturePad) {
1263
+ return await this.signaturePad.toDataURL();
1264
+ }
1265
+ return document.querySelector('input[type="text"]').value;
1266
+ }
1267
+
1268
+ async generateConsentPDF(signature) {
1269
+ // Implement PDF generation
1270
+ return new Blob(['PDF content'], { type: 'application/pdf' });
1271
+ }
1272
+
1273
+ async saveConsent(pdfBlob) {
1274
+ try {
1275
+ await this.api.post('/consents', {
1276
+ participant_id: this.currentParticipant.id,
1277
+ pdf: pdfBlob,
1278
+ audit_trail: this.createAuditTrail()
1279
+ });
1280
+ } catch (error) {
1281
+ if (error instanceof OfflineError) {
1282
+ await this.storeOfflineConsent(pdfBlob);
1283
+ }
1284
+ throw error;
1285
+ }
1286
+ }
1287
+
1288
+ createAuditTrail() {
1289
+ return {
1290
+ timestamp: new Date().toISOString(),
1291
+ action: 'CONSENT_UPDATE',
1292
+ participant: this.currentParticipant.id,
1293
+ device: this.getDeviceType(),
1294
+ offline: !navigator.onLine
1295
+ };
1296
+ }
1297
+
1298
+ getDeviceType() {
1299
+ return /Mobile|Android|iPhone/i.test(navigator.userAgent) ? 'mobile' : 'desktop';
1300
+ }
1301
+
1302
+ updateStatus(message) {
1303
+ document.getElementById('consentStatus').textContent = message;
1304
+ }
1305
+
1306
+ handleError(error) {
1307
+ console.error('Consent Error:', error);
1308
+ this.updateStatus(`Error: ${error.message}`);
1309
+ }
1310
+
1311
+ closeModal() {
1312
+ this.modal.classList.add('hidden');
1313
+ this.identityVerified = false;
1314
+ this.updateStatus('Ready to process consent');
1315
+ }
1316
+ }
1317
+
1318
+ // Initialize consent manager
1319
+ const consentManager = new ConsentManager();
1320
+
1321
+ // Update consent button click handler
1322
+ document.querySelectorAll('.action-button[aria-label="Update Consent"]').forEach(button => {
1323
+ button.addEventListener('click', () => {
1324
+ const participantId = button.closest('.participant-card').querySelector('.text-lg').textContent;
1325
+ consentManager.openConsentModal(participantId);
1326
+ });
1327
+ });
1328
+
1329
+ function closeConsentModal() {
1330
+ consentManager.closeModal();
1331
+ }
1332
+
1333
+ function clearSignature() {
1334
+ if (consentManager.signaturePad) {
1335
+ consentManager.signaturePad.clear();
1336
+ }
1337
+ }
1338
+
1339
+ function processConsent() {
1340
+ consentManager.processConsent();
1341
+ }
1342
+
1343
+ // Add SignaturePad library
1344
+ const signaturePadScript = document.createElement('script');
1345
+ signaturePadScript.src = 'https://cdn.jsdelivr.net/npm/signature_pad@4.0.0/dist/signature_pad.umd.min.js';
1346
+ document.head.appendChild(signaturePadScript);
1347
+
1348
+ // New Session Modal
1349
+ class SessionManager {
1350
+ constructor() {
1351
+ this.currentParticipant = null;
1352
+ this.currentProject = null;
1353
+ this.modal = null;
1354
+ this.selectedSessionType = null;
1355
+ }
1356
+
1357
+ async initializeSession(participantId) {
1358
+ try {
1359
+ // Check consent status
1360
+ const participant = await this.fetchParticipant(participantId);
1361
+ if (participant.consentStatus !== 'ACTIVE') {
1362
+ this.showConsentRequiredModal(participantId);
1363
+ return;
1364
+ }
1365
+
1366
+ // Check for incomplete sessions
1367
+ const incompleteSessions = await this.fetchIncompleteSessions(participantId);
1368
+ if (incompleteSessions.length >= 3) {
1369
+ this.showWarningModal('TooManyIncompleteSessions', { count: 3 });
1370
+ return;
1371
+ }
1372
+
1373
+ this.currentParticipant = participant;
1374
+ this.currentProject = await this.fetchCurrentProject();
1375
+ this.showNewSessionModal();
1376
+ } catch (error) {
1377
+ this.handleError(error);
1378
+ }
1379
+ }
1380
+
1381
+ async fetchParticipant(participantId) {
1382
+ // Simulated API call
1383
+ return {
1384
+ id: participantId,
1385
+ consentStatus: 'ACTIVE',
1386
+ language: 'bem_ZM'
1387
+ };
1388
+ }
1389
+
1390
+ async fetchCurrentProject() {
1391
+ // Simulated API call
1392
+ return {
1393
+ id: 'urban-sustainability',
1394
+ methodology: 'QUALITATIVE'
1395
+ };
1396
+ }
1397
+
1398
+ async fetchIncompleteSessions(participantId) {
1399
+ // Simulated API call
1400
+ return [];
1401
+ }
1402
+
1403
+ showNewSessionModal() {
1404
+ const template = document.getElementById('newSessionModal');
1405
+ const modalContent = template.content.cloneNode(true);
1406
+ this.modal = document.createElement('div');
1407
+ this.modal.appendChild(modalContent);
1408
+ document.body.appendChild(this.modal);
1409
+
1410
+ // Add event listeners
1411
+ this.modal.querySelectorAll('.session-type-btn').forEach(btn => {
1412
+ btn.addEventListener('click', () => this.selectSessionType(btn.dataset.type));
1413
+ });
1414
+ }
1415
+
1416
+ selectSessionType(type) {
1417
+ this.selectedSessionType = type;
1418
+ this.modal.querySelectorAll('.session-type-btn').forEach(btn => {
1419
+ btn.classList.toggle('border-blue-500', btn.dataset.type === type);
1420
+ });
1421
+ }
1422
+
1423
+ async startNewSession() {
1424
+ if (!this.selectedSessionType) {
1425
+ this.showError('Please select a session type');
1426
+ return;
1427
+ }
1428
+
1429
+ try {
1430
+ const sessionData = {
1431
+ participant_id: this.currentParticipant.id,
1432
+ project_id: this.currentProject.id,
1433
+ default_language: this.modal.querySelector('.session-language').value,
1434
+ metadata: {
1435
+ preferred_communication: this.modal.querySelector('input[name="communication"]:checked').value,
1436
+ accessibility_requirements: Array.from(this.modal.querySelectorAll('input[name="accessibility"]:checked')).map(cb => cb.value)
1437
+ }
1438
+ };
1439
+
1440
+ // Route based on session type
1441
+ switch (this.selectedSessionType) {
1442
+ case 'interview':
1443
+ window.location.href = `/interviews/new?participant=${this.currentParticipant.id}`;
1444
+ break;
1445
+ case 'survey':
1446
+ this.launchSurveyWizard(this.currentParticipant.id);
1447
+ break;
1448
+ case 'observation':
1449
+ window.location.href = `/observations?participant=${this.currentParticipant.id}`;
1450
+ break;
1451
+ }
1452
+ } catch (error) {
1453
+ this.handleError(error);
1454
+ }
1455
+ }
1456
+
1457
+ handleError(error) {
1458
+ console.error('Session error:', error);
1459
+ // Show appropriate error message to user
1460
+ this.showError(error.message);
1461
+ }
1462
+
1463
+ showError(message) {
1464
+ // Implement error display logic
1465
+ alert(message);
1466
+ }
1467
+
1468
+ showConsentRequiredModal(participantId) {
1469
+ // Implement consent required modal
1470
+ alert('Active consent required to start a new session');
1471
+ }
1472
+
1473
+ showWarningModal(type, data) {
1474
+ // Implement warning modal
1475
+ alert(`Warning: ${type} - ${JSON.stringify(data)}`);
1476
+ }
1477
+ }
1478
+
1479
+ // Initialize session manager
1480
+ const sessionManager = new SessionManager();
1481
+
1482
+ // Update the existing newSession function
1483
+ function newSession(participantId) {
1484
+ sessionManager.initializeSession(participantId);
1485
+ }
1486
+
1487
+ function closeNewSessionModal() {
1488
+ const modal = document.querySelector('#newSessionModal').parentElement;
1489
+ if (modal) {
1490
+ modal.remove();
1491
+ }
1492
+ }
1493
  </script>
1494
  <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://deepsite.hf.co/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://deepsite.hf.co" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://deepsite.hf.co?remix=dataquantals/quantals-collect" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1495
  </html>