-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetailed-export-mockup-actual-multiselects.jsx
More file actions
476 lines (453 loc) · 21.2 KB
/
detailed-export-mockup-actual-multiselects.jsx
File metadata and controls
476 lines (453 loc) · 21.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
import React, { useState } from 'react';
const columnGroups = {
'Request Information': [
{ id: 'id', label: 'ID', visible: true },
{ id: 'status', label: 'Status', visible: true },
{ id: 'instruction_type', label: 'Instruction Type', visible: true },
{ id: 'duration', label: 'Duration (Minutes)', visible: true },
{ id: 'number_of_students', label: 'Number of Students', visible: true },
],
'Instructor Information': [
{ id: 'instructor_name', label: 'Instructor Name', visible: true },
{ id: 'instructor_email', label: 'Instructor Email', visible: true },
],
'Course Information': [
{ id: 'campus', label: 'Campus', visible: true },
{ id: 'department', label: 'Department', visible: true },
{ id: 'course_number', label: 'Course Number', visible: true },
{ id: 'course_crn', label: 'Course CRN', visible: false },
{ id: 'class_description', label: 'Class Description', visible: false },
],
'Scheduling': [
{ id: 'instruction_datetime', label: 'Instruction Date/Time', visible: true },
{ id: 'preferred_datetime', label: 'Preferred Date/Time', visible: false },
{ id: 'alternate_datetime', label: 'Alternate Date/Time', visible: false },
{ id: 'async_ready_date', label: 'Async Ready Date', visible: false },
],
'Learning Outcomes': [
{ id: 'assignment_description', label: 'Assignment Description', visible: false },
{ id: 'learning_outcomes', label: 'Learning Outcomes', visible: false },
{ id: 'received_assignment', label: 'Received Assignment', visible: false },
{ id: 'selected_topics', label: 'Selected Topics', visible: false },
{ id: 'explored_background', label: 'Explored Background', visible: false },
{ id: 'written_draft', label: 'Written Draft', visible: false },
],
'Accessibility': [
{ id: 'ada_needed', label: 'ADA Provisions Needed', visible: true },
{ id: 'ada_description', label: 'ADA Description', visible: false },
],
'Librarian': [
{ id: 'assigned_librarian', label: 'Assigned Librarian', visible: true },
{ id: 'requested_librarian', label: 'Requested Librarian', visible: false },
],
'Timestamps': [
{ id: 'created_at', label: 'Created Date', visible: true },
{ id: 'updated_at', label: 'Updated Date', visible: false },
],
};
export default function DetailedExportMockup() {
const [filtersExpanded, setFiltersExpanded] = useState(true);
const [activeTab, setActiveTab] = useState('institutional');
const [viewMode, setViewMode] = useState('year');
const [showColumnModal, setShowColumnModal] = useState(false);
const [columns, setColumns] = useState(columnGroups);
const allColumns = Object.values(columns).flat();
const visibleCount = allColumns.filter(col => col.visible).length;
const totalCount = allColumns.length;
const handleMultiSelectChange = (groupName, selectedOptions) => {
const selectedIds = Array.from(selectedOptions).map(opt => opt.value);
setColumns(prev => ({
...prev,
[groupName]: prev[groupName].map(col => ({
...col,
visible: selectedIds.includes(col.id)
}))
}));
};
const selectAll = () => {
setColumns(prev => {
const updated = {};
Object.keys(prev).forEach(group => {
updated[group] = prev[group].map(col => ({ ...col, visible: true }));
});
return updated;
});
};
const deselectAll = () => {
setColumns(prev => {
const updated = {};
Object.keys(prev).forEach(group => {
updated[group] = prev[group].map(col => ({ ...col, visible: false }));
});
return updated;
});
};
// Organize groups into 3 columns
const groupNames = Object.keys(columns);
const col1Groups = groupNames.slice(0, 3);
const col2Groups = groupNames.slice(3, 6);
const col3Groups = groupNames.slice(6);
return (
<div className="min-h-screen bg-gray-100 p-8">
<div className="max-w-7xl mx-auto">
{/* Page Header */}
<div className="mb-6">
<h1 className="text-3xl font-bold text-gray-900">Detailed Export</h1>
<p className="text-gray-600 mt-1">Export individual session data with customizable columns.</p>
</div>
{/* Filter Panel */}
<div className="mb-6 bg-white rounded-lg shadow border border-gray-200">
<div className="bg-purple-500 px-4 py-3 rounded-t-lg flex items-center justify-between">
<h3 className="text-lg font-medium text-white">Report Filters</h3>
<button
onClick={() => setFiltersExpanded(!filtersExpanded)}
className="text-white hover:text-gray-200"
>
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
{filtersExpanded ? (
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 15l7-7 7 7" />
) : (
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
)}
</svg>
</button>
</div>
{filtersExpanded && (
<div className="p-4">
{/* Tabs */}
<div className="mb-4">
<div className="flex border-b border-gray-200">
<button
onClick={() => setActiveTab('institutional')}
className={`flex items-center gap-2 px-4 py-2 font-medium text-sm transition-all ${
activeTab === 'institutional'
? 'text-purple-600 border-b-2 border-purple-600'
: 'text-gray-600 hover:text-gray-900'
}`}
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
<span>Institutional Periods</span>
</button>
<button
onClick={() => setActiveTab('custom')}
className={`flex items-center gap-2 px-4 py-2 font-medium text-sm transition-all ${
activeTab === 'custom'
? 'text-purple-600 border-b-2 border-purple-600'
: 'text-gray-600 hover:text-gray-900'
}`}
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span>Custom Range</span>
</button>
</div>
{/* Tab Content */}
<div className="mt-4">
{activeTab === 'institutional' && (
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">View By</label>
<div className="flex gap-2 flex-wrap">
{['year', 'fiscal_year', 'term'].map(mode => (
<label
key={mode}
className={`flex items-center px-4 py-2 border rounded-md cursor-pointer ${
viewMode === mode
? 'bg-blue-50 border-blue-500'
: 'border-gray-300 hover:bg-gray-50'
}`}
>
<input
type="radio"
checked={viewMode === mode}
onChange={() => setViewMode(mode)}
className="mr-2"
/>
<span className="text-sm">
{mode === 'year' ? 'Academic Year' : mode === 'fiscal_year' ? 'Fiscal Year' : 'Term'}
</span>
</label>
))}
</div>
</div>
)}
{activeTab === 'custom' && (
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">View By</label>
<div className="flex gap-2">
{['month', 'day'].map(mode => (
<label
key={mode}
className={`flex items-center px-4 py-2 border rounded-md cursor-pointer ${
viewMode === mode
? 'bg-blue-50 border-blue-500'
: 'border-gray-300 hover:bg-gray-50'
}`}
>
<input
type="radio"
checked={viewMode === mode}
onChange={() => setViewMode(mode)}
className="mr-2"
/>
<span className="text-sm">{mode === 'month' ? 'Month' : 'Date Range'}</span>
</label>
))}
</div>
</div>
)}
</div>
</div>
{/* Secondary Filters */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4">
<div>
<label className="block text-sm font-medium text-gray-700 mb-1">Campus</label>
<select className="w-full border border-gray-300 rounded-md px-3 py-2 text-sm bg-white">
<option>All Campuses</option>
<option>Sylvania</option>
<option>Cascade</option>
<option>Rock Creek</option>
</select>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-1">Department</label>
<input
type="text"
placeholder="Type to search departments..."
className="w-full border border-gray-300 rounded-md px-3 py-2 text-sm"
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-1">Class</label>
<input
type="text"
placeholder="Type to search classes..."
className="w-full border border-gray-300 rounded-md px-3 py-2 text-sm"
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-1">Instructor</label>
<input
type="text"
placeholder="Type to search instructors..."
className="w-full border border-gray-300 rounded-md px-3 py-2 text-sm"
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-1">Assigned Librarian</label>
<select className="w-full border border-gray-300 rounded-md px-3 py-2 text-sm bg-white">
<option>All Librarians</option>
</select>
</div>
</div>
{/* Bottom Row: Clear Filters + Customize Fields */}
<div className="flex items-center justify-between mt-4">
<button className="px-4 py-2 text-sm bg-gray-600 text-white rounded hover:bg-gray-700">
Clear All Filters
</button>
<button
onClick={() => setShowColumnModal(true)}
className="flex items-center gap-2 text-red-600 hover:text-red-700 font-medium"
>
<span>customize fields</span>
<div className="w-6 h-6 border-2 border-red-600 rounded-full flex items-center justify-center">
<svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 4v16m8-8H4" />
</svg>
</div>
</button>
</div>
</div>
)}
</div>
{/* PowerGrid Table */}
<div className="bg-white rounded-lg shadow border border-gray-200 overflow-hidden">
{/* Table Header - Green like screenshot */}
<div className="bg-green-500 px-4 py-3">
<h3 className="text-lg font-medium text-white">Detailed Export Data</h3>
</div>
{/* PowerGrid Header with Export Buttons */}
<div className="px-4 py-3 border-b border-gray-200 flex items-center justify-between bg-gray-50">
<div className="text-sm text-gray-600">
{visibleCount} of {totalCount} columns visible
</div>
<div className="flex gap-2">
<button className="inline-flex items-center gap-1 px-3 py-1 text-sm border border-gray-300 rounded hover:bg-white">
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
CSV
</button>
<button className="inline-flex items-center gap-1 px-3 py-1 text-sm border border-gray-300 rounded hover:bg-white">
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
Excel
</button>
</div>
</div>
{/* Table */}
<div className="overflow-x-auto">
<table className="min-w-full divide-y divide-gray-200">
<thead className="bg-gray-100">
<tr>
{allColumns.filter(col => col.visible).map(col => (
<th key={col.id} className="px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider">
{col.label}
</th>
))}
</tr>
</thead>
<tbody className="bg-white divide-y divide-gray-200">
<tr>
{allColumns.filter(col => col.visible).map(col => (
<td key={col.id} className="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
Sample data
</td>
))}
</tr>
<tr className="bg-gray-50">
{allColumns.filter(col => col.visible).map(col => (
<td key={col.id} className="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
Sample data
</td>
))}
</tr>
</tbody>
</table>
</div>
</div>
</div>
{/* Column Selection Modal */}
{showColumnModal && (
<div
className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50"
onClick={(e) => {
if (e.target === e.currentTarget) setShowColumnModal(false);
}}
>
<div className="bg-white rounded-lg shadow-xl max-w-5xl w-full max-h-[85vh] flex flex-col">
{/* Modal Header */}
<div className="px-6 py-4 border-b border-gray-200 flex items-center justify-between">
<div>
<h2 className="text-lg font-semibold text-gray-900">Customize Columns</h2>
<p className="text-xs text-gray-500 mt-1">
Hold Ctrl/Cmd to select multiple • {visibleCount} of {totalCount} columns selected
</p>
</div>
<button
onClick={() => setShowColumnModal(false)}
className="text-gray-400 hover:text-gray-600"
>
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
{/* Modal Body - 3 Columns of Multiselects */}
<div className="flex-1 overflow-y-auto p-6">
{/* Quick Actions */}
<div className="mb-4 flex justify-end gap-2">
<button
onClick={selectAll}
className="px-3 py-1.5 text-xs border border-gray-300 rounded-md hover:bg-gray-50"
>
Select All
</button>
<button
onClick={deselectAll}
className="px-3 py-1.5 text-xs border border-gray-300 rounded-md hover:bg-gray-50"
>
Deselect All
</button>
</div>
{/* 3 Columns of Multiselects */}
<div className="grid grid-cols-3 gap-4">
{/* Column 1 */}
<div className="space-y-4">
{col1Groups.map(groupName => (
<div key={groupName}>
<label className="block text-xs font-semibold text-gray-700 mb-1 uppercase tracking-wide">
{groupName}
</label>
<select
multiple
size={Math.min(columns[groupName].length, 8)}
className="w-full border border-gray-300 rounded-md px-2 py-1 text-sm"
value={columns[groupName].filter(col => col.visible).map(col => col.id)}
onChange={(e) => handleMultiSelectChange(groupName, e.target.selectedOptions)}
>
{columns[groupName].map(column => (
<option key={column.id} value={column.id}>
{column.label}
</option>
))}
</select>
</div>
))}
</div>
{/* Column 2 */}
<div className="space-y-4">
{col2Groups.map(groupName => (
<div key={groupName}>
<label className="block text-xs font-semibold text-gray-700 mb-1 uppercase tracking-wide">
{groupName}
</label>
<select
multiple
size={Math.min(columns[groupName].length, 8)}
className="w-full border border-gray-300 rounded-md px-2 py-1 text-sm"
value={columns[groupName].filter(col => col.visible).map(col => col.id)}
onChange={(e) => handleMultiSelectChange(groupName, e.target.selectedOptions)}
>
{columns[groupName].map(column => (
<option key={column.id} value={column.id}>
{column.label}
</option>
))}
</select>
</div>
))}
</div>
{/* Column 3 */}
<div className="space-y-4">
{col3Groups.map(groupName => (
<div key={groupName}>
<label className="block text-xs font-semibold text-gray-700 mb-1 uppercase tracking-wide">
{groupName}
</label>
<select
multiple
size={Math.min(columns[groupName].length, 8)}
className="w-full border border-gray-300 rounded-md px-2 py-1 text-sm"
value={columns[groupName].filter(col => col.visible).map(col => col.id)}
onChange={(e) => handleMultiSelectChange(groupName, e.target.selectedOptions)}
>
{columns[groupName].map(column => (
<option key={column.id} value={column.id}>
{column.label}
</option>
))}
</select>
</div>
))}
</div>
</div>
</div>
{/* Modal Footer */}
<div className="px-6 py-3 border-t border-gray-200 flex justify-end">
<button
onClick={() => setShowColumnModal(false)}
className="px-4 py-2 text-sm bg-purple-600 text-white rounded-md hover:bg-purple-700"
>
Apply
</button>
</div>
</div>
</div>
)}
</div>
);
}