dataquantals commited on
Commit
8ed1590
·
verified ·
1 Parent(s): 369c63f

undefined - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +1046 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Quantals Collect Version 2
3
- emoji: 🌍
4
  colorFrom: green
5
- colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: quantals-collect-version-2
3
+ emoji: 🐳
4
  colorFrom: green
5
+ colorTo: pink
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,1046 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Participants - Quantals Collect</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <script src="https://cdn.jsdelivr.net/npm/ag-grid-community/dist/ag-grid-community.min.js"></script>
10
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ag-grid-community/styles/ag-grid.css">
11
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ag-grid-community/styles/ag-theme-alpine.css">
12
+ <style>
13
+ /* Custom styles */
14
+ .participant-card {
15
+ transition: transform 0.2s ease-in-out;
16
+ min-width: 300px;
17
+ }
18
+ .participant-card:hover {
19
+ transform: translateY(-2px);
20
+ }
21
+ .status-badge {
22
+ padding: 0.25rem 0.75rem;
23
+ border-radius: 9999px;
24
+ font-size: 0.75rem;
25
+ font-weight: 500;
26
+ }
27
+ .status-consented {
28
+ background-color: #dcfce7;
29
+ color: #166534;
30
+ }
31
+ .status-withdrawn {
32
+ background-color: #fee2e2;
33
+ color: #991b1b;
34
+ }
35
+ .status-pending {
36
+ background-color: #fef3c7;
37
+ color: #92400e;
38
+ }
39
+ .tag {
40
+ padding: 0.25rem 0.5rem;
41
+ border-radius: 0.375rem;
42
+ font-size: 0.75rem;
43
+ background-color: #e5e7eb;
44
+ color: #374151;
45
+ }
46
+ .modal {
47
+ display: none;
48
+ position: fixed;
49
+ top: 0;
50
+ left: 0;
51
+ width: 100%;
52
+ height: 100%;
53
+ background-color: rgba(0, 0, 0, 0.5);
54
+ z-index: 50;
55
+ }
56
+ .modal.active {
57
+ display: flex;
58
+ }
59
+ .timeline-item {
60
+ position: relative;
61
+ padding-left: 2rem;
62
+ }
63
+ .timeline-item::before {
64
+ content: '';
65
+ position: absolute;
66
+ left: 0;
67
+ top: 0;
68
+ bottom: 0;
69
+ width: 2px;
70
+ background: #e5e7eb;
71
+ }
72
+ .timeline-dot {
73
+ position: absolute;
74
+ left: -4px;
75
+ top: 0;
76
+ width: 8px;
77
+ height: 8px;
78
+ border-radius: 50%;
79
+ background: #3b82f6;
80
+ }
81
+ @keyframes slideUp {
82
+ from { transform: translateY(20px); opacity: 0; }
83
+ to { transform: translateY(0); opacity: 1; }
84
+ }
85
+ .slide-up {
86
+ animation: slideUp 0.3s ease-out;
87
+ }
88
+ @keyframes statusPulse {
89
+ 0% { transform: scale(1); }
90
+ 50% { transform: scale(1.1); }
91
+ 100% { transform: scale(1); }
92
+ }
93
+ .status-pulse {
94
+ animation: statusPulse 0.3s ease-out 3;
95
+ }
96
+ .consent-preview {
97
+ transition: transform 0.2s ease-out;
98
+ }
99
+ .consent-preview:hover {
100
+ transform: scale(1.05);
101
+ }
102
+
103
+ /* New Action Button Styles */
104
+ :root {
105
+ --bg-primary: #ffffff;
106
+ --border-color: #e5e7eb;
107
+ --button-hover: #f3f4f6;
108
+ --button-active: #e5e7eb;
109
+ --button-text: #374151;
110
+ --button-icon: #6b7280;
111
+ }
112
+
113
+ .participant-actions {
114
+ display: grid;
115
+ grid-template-columns: repeat(auto-fit, minmax(min(90px, 100%), 1fr));
116
+ gap: 0.5rem;
117
+ padding: 0.75rem;
118
+ background: var(--bg-primary);
119
+ position: sticky;
120
+ bottom: 0;
121
+ border-top: 1px solid var(--border-color);
122
+ min-height: 44px;
123
+ align-items: center;
124
+ }
125
+
126
+ .action-button {
127
+ display: flex;
128
+ align-items: center;
129
+ justify-content: center;
130
+ gap: 0.5rem;
131
+ padding: 0.5rem;
132
+ border-radius: 0.375rem;
133
+ background: transparent;
134
+ color: var(--button-text);
135
+ border: 1px solid var(--border-color);
136
+ min-height: 44px;
137
+ transition: all 0.15s ease-in-out;
138
+ cursor: pointer;
139
+ }
140
+
141
+ .action-button:hover {
142
+ background: var(--button-hover);
143
+ }
144
+
145
+ .action-button:active {
146
+ background: var(--button-active);
147
+ }
148
+
149
+ .action-button:focus {
150
+ outline: 2px solid #3b82f6;
151
+ outline-offset: 2px;
152
+ }
153
+
154
+ .action-button svg {
155
+ width: 1.25rem;
156
+ height: 1.25rem;
157
+ color: var(--button-icon);
158
+ }
159
+
160
+ /* Container Queries */
161
+ @container (min-width: 600px) {
162
+ .action-button {
163
+ flex-direction: row;
164
+ }
165
+ }
166
+
167
+ @container (max-width: 599px) {
168
+ .action-button {
169
+ flex-direction: column;
170
+ width: 100%;
171
+ }
172
+ .action-button span {
173
+ display: none;
174
+ }
175
+ }
176
+
177
+ /* High Contrast Mode */
178
+ @media (forced-colors: active) {
179
+ .action-button {
180
+ border: 2px solid CanvasText;
181
+ }
182
+ .action-button:focus {
183
+ outline: 2px solid CanvasText;
184
+ }
185
+ }
186
+
187
+ /* Tooltip Styles */
188
+ .tooltip {
189
+ position: relative;
190
+ }
191
+
192
+ .tooltip::after {
193
+ content: attr(data-tooltip);
194
+ position: absolute;
195
+ bottom: 100%;
196
+ left: 50%;
197
+ transform: translateX(-50%);
198
+ padding: 0.25rem 0.5rem;
199
+ background: #1f2937;
200
+ color: white;
201
+ border-radius: 0.25rem;
202
+ font-size: 0.75rem;
203
+ white-space: nowrap;
204
+ opacity: 0;
205
+ pointer-events: none;
206
+ transition: opacity 0.15s ease-in-out;
207
+ }
208
+
209
+ .tooltip:hover::after {
210
+ opacity: 1;
211
+ }
212
+
213
+ /* Edit Modal Styles */
214
+ .modal {
215
+ display: none;
216
+ position: fixed;
217
+ top: 0;
218
+ left: 0;
219
+ width: 100%;
220
+ height: 100%;
221
+ background-color: rgba(0, 0, 0, 0.5);
222
+ z-index: 50;
223
+ }
224
+
225
+ .modal.active {
226
+ display: flex;
227
+ }
228
+
229
+ /* Focus styles */
230
+ .focus-visible:focus-visible {
231
+ outline: 2px solid #3b82f6;
232
+ outline-offset: 2px;
233
+ }
234
+
235
+ /* Toast styles */
236
+ .toast {
237
+ position: fixed;
238
+ bottom: 1rem;
239
+ right: 1rem;
240
+ padding: 0.75rem 1rem;
241
+ border-radius: 0.375rem;
242
+ background-color: white;
243
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
244
+ z-index: 50;
245
+ }
246
+
247
+ .toast-success {
248
+ background-color: #dcfce7;
249
+ color: #166534;
250
+ }
251
+
252
+ .toast-error {
253
+ background-color: #fee2e2;
254
+ color: #991b1b;
255
+ }
256
+
257
+ .toast-info {
258
+ background-color: #e0f2fe;
259
+ color: #075985;
260
+ }
261
+ </style>
262
+ </head>
263
+ <body class="bg-gray-50 font-sans">
264
+ <div class="flex h-screen overflow-hidden">
265
+ <!-- Sidebar -->
266
+ <div class="sidebar bg-indigo-800 text-white w-64 flex flex-col">
267
+ <div class="p-4 flex items-center space-x-3 border-b border-indigo-700">
268
+ <div class="bg-white p-2 rounded-lg">
269
+ <i class="fas fa-microscope text-indigo-800 text-xl"></i>
270
+ </div>
271
+ <h1 class="text-xl font-bold">Quantals Collect</h1>
272
+ </div>
273
+
274
+ <nav class="flex-1 p-4 space-y-2">
275
+ <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">
276
+ <i class="fas fa-home"></i>
277
+ <span>Dashboard</span>
278
+ </a>
279
+ <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">
280
+ <i class="fas fa-project-diagram"></i>
281
+ <span>Projects</span>
282
+ </a>
283
+ <a href="participants.html" class="flex items-center space-x-3 p-2 rounded-lg bg-indigo-700 text-white">
284
+ <i class="fas fa-users"></i>
285
+ <span>Participants</span>
286
+ </a>
287
+ <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">
288
+ <i class="fas fa-microphone"></i>
289
+ <span>Interviews</span>
290
+ </a>
291
+ <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">
292
+ <i class="fas fa-sticky-note"></i>
293
+ <span>Notes</span>
294
+ </a>
295
+ <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">
296
+ <i class="fas fa-chart-pie"></i>
297
+ <span>Analysis</span>
298
+ </a>
299
+ <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">
300
+ <i class="fas fa-robot"></i>
301
+ <span>AI Assist</span>
302
+ </a>
303
+ <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">
304
+ <i class="fas fa-keyboard"></i>
305
+ <span>Transcriber</span>
306
+ </a>
307
+ </nav>
308
+
309
+ <div class="p-4 border-t border-indigo-700">
310
+ <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">
311
+ <i class="fas fa-cog"></i>
312
+ <span>Settings</span>
313
+ </a>
314
+ </div>
315
+ </div>
316
+
317
+ <!-- Main Content -->
318
+ <div class="flex-1 flex flex-col overflow-hidden">
319
+ <!-- Header -->
320
+ <header class="bg-white shadow-sm p-4 flex justify-between items-center">
321
+ <div class="flex items-center space-x-4">
322
+ <h2 class="text-xl font-semibold text-gray-800">Participants</h2>
323
+ <div class="offline-indicator hidden px-3 py-1 bg-yellow-100 text-yellow-800 rounded-full text-sm">
324
+ <i class="fas fa-wifi-slash mr-1"></i> Offline
325
+ </div>
326
+ </div>
327
+ <div class="flex items-center space-x-4">
328
+ <button class="p-2 rounded-full hover:bg-gray-100 relative">
329
+ <i class="fas fa-bell text-gray-600"></i>
330
+ <span class="absolute top-0 right-0 w-2 h-2 bg-red-500 rounded-full"></span>
331
+ </button>
332
+ <div class="flex items-center space-x-2">
333
+ <div class="w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center">
334
+ <span class="text-xs font-medium text-indigo-800">RS</span>
335
+ </div>
336
+ <span class="text-sm">Research Team</span>
337
+ </div>
338
+ </div>
339
+ </header>
340
+
341
+ <!-- Main Content Area -->
342
+ <main class="flex-1 overflow-y-auto p-6">
343
+ <div class="max-w-7xl mx-auto">
344
+ <!-- Sticky Toolbar -->
345
+ <div class="sticky top-0 bg-white p-4 rounded-lg shadow-sm mb-6 z-10">
346
+ <div class="flex justify-between items-center">
347
+ <div class="flex space-x-4 flex-1">
348
+ <div class="relative flex-1 max-w-md">
349
+ <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">
350
+ <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
351
+ </div>
352
+ <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()">
353
+ <i class="fas fa-user-plus"></i>
354
+ <span>Add Participant</span>
355
+ </button>
356
+ </div>
357
+ <div class="flex space-x-2">
358
+ <button class="p-2 rounded-lg hover:bg-gray-100" onclick="toggleView()" title="Toggle View">
359
+ <i class="fas fa-th-large text-gray-600"></i>
360
+ </button>
361
+ <button class="px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center space-x-2">
362
+ <i class="fas fa-download"></i>
363
+ <span>Export CSV</span>
364
+ </button>
365
+ </div>
366
+ </div>
367
+ </div>
368
+
369
+ <!-- Card View -->
370
+ <div id="cardView" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
371
+ <!-- Participant Card Template -->
372
+ <div class="participant-card bg-white rounded-lg shadow-sm p-6 slide-up">
373
+ <div class="flex justify-between items-start mb-4">
374
+ <div class="flex items-center space-x-3">
375
+ <div class="w-12 h-12 rounded-full bg-indigo-100 flex items-center justify-center">
376
+ <span class="text-lg font-medium text-indigo-800">P-12</span>
377
+ </div>
378
+ <div>
379
+ <h3 class="text-lg font-semibold text-gray-800">Participant #12</h3>
380
+ <p class="text-sm text-gray-500">Enrolled: Jan 15, 2024</p>
381
+ </div>
382
+ </div>
383
+ <span class="status-badge status-consented">Consented</span>
384
+ </div>
385
+
386
+ <div class="space-y-4">
387
+ <div>
388
+ <h4 class="text-sm font-medium text-gray-700 mb-2">Demographics</h4>
389
+ <div class="grid grid-cols-2 gap-2 text-sm">
390
+ <div>
391
+ <span class="text-gray-500">Age:</span>
392
+ <span class="text-gray-800">32</span>
393
+ </div>
394
+ <div>
395
+ <span class="text-gray-500">Gender:</span>
396
+ <span class="text-gray-800">Female</span>
397
+ </div>
398
+ <div>
399
+ <span class="text-gray-500">Language:</span>
400
+ <span class="text-gray-800">English (Native)</span>
401
+ </div>
402
+ </div>
403
+ </div>
404
+
405
+ <div>
406
+ <h4 class="text-sm font-medium text-gray-700 mb-2">Activity</h4>
407
+ <div class="flex items-center space-x-4 text-sm">
408
+ <div>
409
+ <span class="text-gray-500">Interviews:</span>
410
+ <span class="text-gray-800">3</span>
411
+ </div>
412
+ <div>
413
+ <span class="text-gray-500">Last Session:</span>
414
+ <span class="text-gray-800">Feb 1, 2024</span>
415
+ </div>
416
+ </div>
417
+ </div>
418
+
419
+ <div>
420
+ <h4 class="text-sm font-medium text-gray-700 mb-2">Tags</h4>
421
+ <div class="flex flex-wrap gap-2">
422
+ <span class="tag">High-frequency user</span>
423
+ <span class="tag">Urban</span>
424
+ <span class="tag">Tech-savvy</span>
425
+ </div>
426
+ </div>
427
+ </div>
428
+
429
+ <div class="participant-actions">
430
+ <button
431
+ class="action-button tooltip"
432
+ onclick="handleEdit('P-12')"
433
+ data-tooltip="Edit participant"
434
+ aria-label="Edit participant">
435
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
436
+ <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
437
+ <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
438
+ </svg>
439
+ <span>Edit</span>
440
+ </button>
441
+ <button
442
+ class="action-button tooltip"
443
+ onclick="handleNewSession('P-12')"
444
+ data-tooltip="Create new session"
445
+ aria-label="Create new session">
446
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
447
+ <path d="M12 5v14M5 12h14"></path>
448
+ </svg>
449
+ <span>New Session</span>
450
+ </button>
451
+ <button
452
+ class="action-button tooltip"
453
+ onclick="handleConsent('P-12')"
454
+ data-tooltip="Manage consent forms"
455
+ aria-label="Manage consent forms">
456
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
457
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
458
+ <path d="M14 2v6h6"></path>
459
+ <path d="M16 13H8"></path>
460
+ <path d="M16 17H8"></path>
461
+ <path d="M10 9H8"></path>
462
+ </svg>
463
+ <span>Consent</span>
464
+ </button>
465
+ </div>
466
+ </div>
467
+ </div>
468
+
469
+ <!-- Table View (Hidden by default) -->
470
+ <div id="tableView" class="hidden">
471
+ <div id="participantsGrid" class="ag-theme-alpine" style="height: 600px;"></div>
472
+ </div>
473
+ </div>
474
+ </main>
475
+ </div>
476
+ </div>
477
+
478
+ <!-- New Participant Modal -->
479
+ <div id="newParticipantModal" class="modal">
480
+ <div class="bg-white rounded-lg shadow-xl max-w-2xl w-full mx-auto my-8">
481
+ <div class="p-6">
482
+ <div class="flex justify-between items-center mb-4">
483
+ <h3 class="text-xl font-semibold text-gray-800">Add New Participant</h3>
484
+ <button onclick="closeNewParticipantModal()" class="text-gray-400 hover:text-gray-600">
485
+ <i class="fas fa-times"></i>
486
+ </button>
487
+ </div>
488
+ <form class="space-y-4">
489
+ <!-- Identity Management -->
490
+ <div>
491
+ <label class="block text-sm font-medium text-gray-700 mb-1">Participant ID</label>
492
+ <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>
493
+ </div>
494
+ <div>
495
+ <label class="block text-sm font-medium text-gray-700 mb-1">Contact Information (Optional)</label>
496
+ <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">
497
+ </div>
498
+
499
+ <!-- Demographics -->
500
+ <div class="grid grid-cols-2 gap-4">
501
+ <div>
502
+ <label class="block text-sm font-medium text-gray-700 mb-1">Age</label>
503
+ <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">
504
+ </div>
505
+ <div>
506
+ <label class="block text-sm font-medium text-gray-700 mb-1">Gender</label>
507
+ <select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
508
+ <option>Prefer not to say</option>
509
+ <option>Male</option>
510
+ <option>Female</option>
511
+ <option>Other</option>
512
+ </select>
513
+ </div>
514
+ </div>
515
+ <div>
516
+ <label class="block text-sm font-medium text-gray-700 mb-1">Language Preference</label>
517
+ <select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
518
+ <option>English</option>
519
+ <option>Bemba</option>
520
+ <option>Nyanja</option>
521
+ <option>Tonga</option>
522
+ <option>Lozi</option>
523
+ </select>
524
+ </div>
525
+
526
+ <!-- Ethical Compliance -->
527
+ <div>
528
+ <label class="block text-sm font-medium text-gray-700 mb-1">Consent Status</label>
529
+ <div class="flex items-center space-x-4">
530
+ <label class="inline-flex items-center">
531
+ <input type="checkbox" class="form-checkbox text-indigo-600">
532
+ <span class="ml-2">Consent Obtained</span>
533
+ </label>
534
+ <button type="button" class="text-indigo-600 hover:text-indigo-700 text-sm">
535
+ <i class="fas fa-upload mr-1"></i>
536
+ Upload Consent Form
537
+ </button>
538
+ </div>
539
+ </div>
540
+
541
+ <!-- Custom Fields -->
542
+ <div>
543
+ <label class="block text-sm font-medium text-gray-700 mb-1">Custom Tags</label>
544
+ <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">
545
+ </div>
546
+
547
+ <!-- Researcher Notes -->
548
+ <div>
549
+ <label class="block text-sm font-medium text-gray-700 mb-1">Researcher Notes (Private)</label>
550
+ <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>
551
+ </div>
552
+
553
+ <div class="flex justify-end space-x-3">
554
+ <button type="button" onclick="closeNewParticipantModal()" class="px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50">Cancel</button>
555
+ <button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">Add Participant</button>
556
+ </div>
557
+ </form>
558
+ </div>
559
+ </div>
560
+ </div>
561
+
562
+ <!-- Add Edit Modal Template -->
563
+ <div id="editParticipantModal" class="modal" role="dialog" aria-labelledby="edit-participant-title">
564
+ <div class="bg-white rounded-lg shadow-xl max-w-2xl w-full mx-auto my-8">
565
+ <div class="p-6">
566
+ <div class="flex justify-between items-center mb-4">
567
+ <h2 id="edit-participant-title" class="text-xl font-semibold text-gray-800">Edit Participant</h2>
568
+ <button onclick="closeEditModal()" class="text-gray-400 hover:text-gray-600" aria-label="Close modal">
569
+ <i class="fas fa-times"></i>
570
+ </button>
571
+ </div>
572
+
573
+ <!-- Live Region for Screen Readers -->
574
+ <div aria-live="polite" class="sr-only">
575
+ Editing participant, tab to navigate fields
576
+ </div>
577
+
578
+ <form id="editParticipantForm" class="space-y-6" onsubmit="handleEditSubmit(event)">
579
+ <!-- Core Metadata Section -->
580
+ <div class="space-y-4">
581
+ <h3 class="text-lg font-medium text-gray-900">Core Metadata</h3>
582
+ <div class="grid grid-cols-2 gap-4">
583
+ <div>
584
+ <label class="block text-sm font-medium text-gray-700">Participant ID</label>
585
+ <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>
586
+ </div>
587
+ <div>
588
+ <label class="block text-sm font-medium text-gray-700">Status</label>
589
+ <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>
590
+ <option value="ACTIVE">Active</option>
591
+ <option value="PENDING">Pending</option>
592
+ <option value="WITHDRAWN">Withdrawn</option>
593
+ <option value="ARCHIVED">Archived</option>
594
+ </select>
595
+ </div>
596
+ </div>
597
+ </div>
598
+
599
+ <!-- Demographics Section -->
600
+ <div class="space-y-4">
601
+ <h3 class="text-lg font-medium text-gray-900">Demographics</h3>
602
+ <div class="grid grid-cols-2 gap-4">
603
+ <div>
604
+ <label class="block text-sm font-medium text-gray-700">Age</label>
605
+ <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>
606
+ </div>
607
+ <div>
608
+ <label class="block text-sm font-medium text-gray-700">Language</label>
609
+ <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>
610
+ <option value="en">English</option>
611
+ <option value="bem">Bemba</option>
612
+ <option value="nya">Nyanja</option>
613
+ <option value="ton">Tonga</option>
614
+ <option value="loz">Lozi</option>
615
+ </select>
616
+ </div>
617
+ </div>
618
+ </div>
619
+
620
+ <!-- Contact Section -->
621
+ <div class="space-y-4">
622
+ <h3 class="text-lg font-medium text-gray-900">Contact Information</h3>
623
+ <div class="flex items-center space-x-2">
624
+ <input type="checkbox" id="showContact" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
625
+ <label for="showContact" class="text-sm text-gray-700">Show contact information</label>
626
+ </div>
627
+ <div id="contactFields" class="hidden space-y-4">
628
+ <div>
629
+ <label class="block text-sm font-medium text-gray-700">Email</label>
630
+ <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">
631
+ </div>
632
+ </div>
633
+ </div>
634
+
635
+ <!-- Custom Fields Section -->
636
+ <div class="space-y-4">
637
+ <h3 class="text-lg font-medium text-gray-900">Custom Fields</h3>
638
+ <div id="customFields" class="space-y-4">
639
+ <!-- Custom fields will be dynamically inserted here -->
640
+ </div>
641
+ </div>
642
+
643
+ <!-- Form Actions -->
644
+ <div class="flex justify-end space-x-3">
645
+ <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">
646
+ Cancel
647
+ </button>
648
+ <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">
649
+ Save Changes
650
+ </button>
651
+ </div>
652
+ </form>
653
+ </div>
654
+ </div>
655
+ </div>
656
+
657
+ <script>
658
+ // View Toggle
659
+ function toggleView() {
660
+ const cardView = document.getElementById('cardView');
661
+ const tableView = document.getElementById('tableView');
662
+ const toggleButton = document.querySelector('[title="Toggle View"] i');
663
+
664
+ if (cardView.classList.contains('hidden')) {
665
+ cardView.classList.remove('hidden');
666
+ tableView.classList.add('hidden');
667
+ toggleButton.classList.remove('fa-list');
668
+ toggleButton.classList.add('fa-th-large');
669
+ } else {
670
+ cardView.classList.add('hidden');
671
+ tableView.classList.remove('hidden');
672
+ toggleButton.classList.remove('fa-th-large');
673
+ toggleButton.classList.add('fa-list');
674
+ initGrid();
675
+ }
676
+ }
677
+
678
+ // AG Grid Initialization
679
+ function initGrid() {
680
+ const gridDiv = document.querySelector('#participantsGrid');
681
+ const gridOptions = {
682
+ columnDefs: [
683
+ { field: 'id', headerName: 'ID', width: 100 },
684
+ { field: 'status', headerName: 'Status', width: 120 },
685
+ { field: 'enrollmentDate', headerName: 'Enrolled', width: 120 },
686
+ { field: 'age', headerName: 'Age', width: 80 },
687
+ { field: 'gender', headerName: 'Gender', width: 120 },
688
+ { field: 'language', headerName: 'Language', width: 150 },
689
+ { field: 'interviews', headerName: 'Interviews', width: 100 },
690
+ { field: 'lastSession', headerName: 'Last Session', width: 120 },
691
+ { field: 'tags', headerName: 'Tags', width: 200 }
692
+ ],
693
+ defaultColDef: {
694
+ sortable: true,
695
+ filter: true,
696
+ resizable: true
697
+ },
698
+ rowData: [
699
+ {
700
+ id: 'P-12',
701
+ status: 'Consented',
702
+ enrollmentDate: 'Jan 15, 2024',
703
+ age: 32,
704
+ gender: 'Female',
705
+ language: 'English (Native)',
706
+ interviews: 3,
707
+ lastSession: 'Feb 1, 2024',
708
+ tags: 'High-frequency user, Urban, Tech-savvy'
709
+ }
710
+ // Add more row data as needed
711
+ ]
712
+ };
713
+ new agGrid.Grid(gridDiv, gridOptions);
714
+ }
715
+
716
+ // Modal Functions
717
+ function openNewParticipantModal() {
718
+ document.getElementById('newParticipantModal').classList.add('active');
719
+ }
720
+
721
+ function closeNewParticipantModal() {
722
+ document.getElementById('newParticipantModal').classList.remove('active');
723
+ }
724
+
725
+ // Close modal when clicking outside
726
+ window.onclick = function(event) {
727
+ const modal = document.getElementById('newParticipantModal');
728
+ if (event.target === modal) {
729
+ closeNewParticipantModal();
730
+ }
731
+ }
732
+
733
+ // Status Change Animation
734
+ function animateStatusChange(element) {
735
+ element.classList.add('status-pulse');
736
+ setTimeout(() => {
737
+ element.classList.remove('status-pulse');
738
+ }, 1000);
739
+ }
740
+
741
+ // Add new button handler functions
742
+ function handleEdit(participantId) {
743
+ openEditModal(participantId);
744
+ }
745
+
746
+ function handleNewSession(participantId) {
747
+ // Check consent status first
748
+ const participant = fetchParticipant(participantId);
749
+ if (!participant.hasValidConsent) {
750
+ showError('Participant withdrew consent (Code: ETH-403)');
751
+ return;
752
+ }
753
+
754
+ // Check for incomplete sessions
755
+ const incompleteSessions = getIncompleteSessions(participantId);
756
+ if (incompleteSessions.length >= 3) {
757
+ if (!confirm('Participant has 3+ incomplete sessions. Continue?')) {
758
+ return;
759
+ }
760
+ }
761
+
762
+ navigate(`/sessions/new?participant=${participantId}`, {
763
+ state: {
764
+ preset: getParticipantPreferences(participantId)
765
+ }
766
+ });
767
+ }
768
+
769
+ function handleConsent(participantId) {
770
+ openWizard({
771
+ steps: [
772
+ {
773
+ title: "Verify Identity",
774
+ component: IdentityVerification
775
+ },
776
+ {
777
+ title: "Consent Form",
778
+ component: ConsentManager,
779
+ props: {
780
+ versions: fetchConsentForms(participantId),
781
+ eSign: supportsDigitalSignature()
782
+ }
783
+ }
784
+ ]
785
+ });
786
+ }
787
+
788
+ // Utility functions
789
+ function fetchParticipant(id) {
790
+ // Implementation for fetching participant data
791
+ return {
792
+ id,
793
+ hasValidConsent: true,
794
+ // ... other participant data
795
+ };
796
+ }
797
+
798
+ function getIncompleteSessions(participantId) {
799
+ // Implementation for getting incomplete sessions
800
+ return [];
801
+ }
802
+
803
+ function getParticipantPreferences(participantId) {
804
+ // Implementation for getting participant preferences
805
+ return {
806
+ language: 'en',
807
+ // ... other preferences
808
+ };
809
+ }
810
+
811
+ function supportsDigitalSignature() {
812
+ // Implementation for checking digital signature support
813
+ return true;
814
+ }
815
+
816
+ function showError(message) {
817
+ // Implementation for showing error messages
818
+ alert(message);
819
+ }
820
+
821
+ // Container query setup
822
+ document.querySelectorAll('.participant-card').forEach(card => {
823
+ const container = document.createElement('div');
824
+ container.style.containerType = 'inline-size';
825
+ card.parentNode.insertBefore(container, card);
826
+ container.appendChild(card);
827
+ });
828
+
829
+ // Edit Modal Functions
830
+ let originalData = null;
831
+ let editModal = null;
832
+
833
+ function openEditModal(participantId) {
834
+ const participant = fetchParticipant(participantId);
835
+
836
+ // Check if participant is archived
837
+ if (participant.status === 'ARCHIVED') {
838
+ showToast('Archived participants cannot be edited');
839
+ return;
840
+ }
841
+
842
+ // Store original data for diff comparison
843
+ originalData = { ...participant };
844
+
845
+ // Populate form fields
846
+ document.getElementById('participantId').value = participant.id;
847
+ document.getElementById('participantStatus').value = participant.status;
848
+ document.getElementById('participantAge').value = participant.age;
849
+ document.getElementById('participantLanguage').value = participant.language;
850
+
851
+ // Handle contact information visibility
852
+ const showContact = document.getElementById('showContact');
853
+ const contactFields = document.getElementById('contactFields');
854
+ if (hasPermission('VIEW_PII')) {
855
+ showContact.checked = true;
856
+ contactFields.classList.remove('hidden');
857
+ document.getElementById('participantEmail').value = decrypt(participant.encryptedEmail);
858
+ }
859
+
860
+ // Populate custom fields
861
+ populateCustomFields(participant.customFields);
862
+
863
+ // Show modal
864
+ editModal = document.getElementById('editParticipantModal');
865
+ editModal.classList.add('active');
866
+
867
+ // Focus trap
868
+ focusTrap(editModal);
869
+ }
870
+
871
+ function closeEditModal() {
872
+ if (editModal) {
873
+ editModal.classList.remove('active');
874
+ // Return focus to edit button
875
+ document.querySelector(`[data-participant-id="${originalData.id}"]`).focus();
876
+ }
877
+ }
878
+
879
+ async function handleEditSubmit(event) {
880
+ event.preventDefault();
881
+
882
+ const formData = new FormData(event.target);
883
+ const editedData = Object.fromEntries(formData.entries());
884
+
885
+ // Check for changes
886
+ const changes = deepDiff(originalData, editedData);
887
+ if (Object.keys(changes).length === 0) {
888
+ closeEditModal();
889
+ return;
890
+ }
891
+
892
+ // Ethical compliance check
893
+ if (changes.status === 'WITHDRAWN') {
894
+ const approved = await requireEthicalApproval('WITHDRAWAL');
895
+ if (!approved) return;
896
+ }
897
+
898
+ try {
899
+ // Save changes
900
+ const response = await saveParticipantChanges(originalData.id, changes);
901
+
902
+ // Update UI
903
+ updateParticipantCard(response.data);
904
+ showSuccessToast(`Participant ${originalData.id} updated`);
905
+
906
+ // Log audit trail
907
+ logAuditEvent('PARTICIPANT_EDIT', {
908
+ id: originalData.id,
909
+ changes: maskPII(changes)
910
+ });
911
+
912
+ closeEditModal();
913
+ } catch (error) {
914
+ handleEditError(error);
915
+ }
916
+ }
917
+
918
+ // Utility Functions
919
+ function deepDiff(original, edited) {
920
+ const changes = {};
921
+ for (const key in edited) {
922
+ if (JSON.stringify(original[key]) !== JSON.stringify(edited[key])) {
923
+ changes[key] = edited[key];
924
+ }
925
+ }
926
+ return changes;
927
+ }
928
+
929
+ function focusTrap(modal) {
930
+ const focusableElements = modal.querySelectorAll(
931
+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
932
+ );
933
+ const firstFocusable = focusableElements[0];
934
+ const lastFocusable = focusableElements[focusableElements.length - 1];
935
+
936
+ modal.addEventListener('keydown', (e) => {
937
+ if (e.key === 'Tab') {
938
+ if (e.shiftKey) {
939
+ if (document.activeElement === firstFocusable) {
940
+ lastFocusable.focus();
941
+ e.preventDefault();
942
+ }
943
+ } else {
944
+ if (document.activeElement === lastFocusable) {
945
+ firstFocusable.focus();
946
+ e.preventDefault();
947
+ }
948
+ }
949
+ }
950
+ });
951
+
952
+ firstFocusable.focus();
953
+ }
954
+
955
+ function showToast(message, type = 'info') {
956
+ // Implementation for showing toast messages
957
+ console.log(`${type.toUpperCase()}: ${message}`);
958
+ }
959
+
960
+ function showSuccessToast(message) {
961
+ showToast(message, 'success');
962
+ }
963
+
964
+ function hasPermission(permission) {
965
+ // Implementation for permission checking
966
+ return true; // Placeholder
967
+ }
968
+
969
+ function decrypt(encrypted) {
970
+ // Implementation for decryption
971
+ return encrypted; // Placeholder
972
+ }
973
+
974
+ function maskPII(data) {
975
+ // Implementation for masking PII in audit logs
976
+ return data; // Placeholder
977
+ }
978
+
979
+ async function requireEthicalApproval(action) {
980
+ // Implementation for ethical approval workflow
981
+ return true; // Placeholder
982
+ }
983
+
984
+ async function saveParticipantChanges(id, changes) {
985
+ // Implementation for saving changes
986
+ return { data: { ...originalData, ...changes } }; // Placeholder
987
+ }
988
+
989
+ function updateParticipantCard(data) {
990
+ // Implementation for updating the participant card in the UI
991
+ console.log('Updating card with:', data);
992
+ }
993
+
994
+ function logAuditEvent(action, data) {
995
+ // Implementation for audit logging
996
+ console.log('Audit:', action, data);
997
+ }
998
+
999
+ function handleEditError(error) {
1000
+ if (error.status === 403) {
1001
+ showToast('Permission denied', 'error');
1002
+ } else if (error.status === 409) {
1003
+ showVersionConflictUI(error);
1004
+ } else if (isOffline()) {
1005
+ queueForSync(error.data);
1006
+ showToast('Changes queued for sync', 'info');
1007
+ } else {
1008
+ showToast('An error occurred', 'error');
1009
+ }
1010
+ }
1011
+
1012
+ function populateCustomFields(fields) {
1013
+ const container = document.getElementById('customFields');
1014
+ container.innerHTML = ''; // Clear existing fields
1015
+
1016
+ fields.forEach(field => {
1017
+ const fieldElement = createCustomFieldElement(field);
1018
+ container.appendChild(fieldElement);
1019
+ });
1020
+ }
1021
+
1022
+ function createCustomFieldElement(field) {
1023
+ const div = document.createElement('div');
1024
+ div.className = 'space-y-1';
1025
+
1026
+ const label = document.createElement('label');
1027
+ label.className = 'block text-sm font-medium text-gray-700';
1028
+ label.textContent = field.label;
1029
+
1030
+ const input = document.createElement('input');
1031
+ input.type = field.type || 'text';
1032
+ input.name = field.name;
1033
+ input.value = field.value;
1034
+ 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';
1035
+
1036
+ if (field.required) input.required = true;
1037
+ if (field.pattern) input.pattern = field.pattern;
1038
+
1039
+ div.appendChild(label);
1040
+ div.appendChild(input);
1041
+
1042
+ return div;
1043
+ }
1044
+ </script>
1045
+ <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>
1046
+ </html>