dataquantals commited on
Commit
34560f7
·
verified ·
1 Parent(s): acd22df

Add a "Schedule" button (Primary) and a "Cancel" button (Secondary) at the bottom of the modal. 4. On clicking "Schedule": → Validate that required fields are filled. → Save the interview data to a local database or server-side route as a new Interview record. Use this object structure for each saved interview: { id: auto_generated, participantId: selected_participant_id, projectId: selected_project_id, interviewerId: selected_user_id, datetime: ISO8601 format, mode: "in-person" | "online" | "phone", location: string, notes: optional string, status: "scheduled" } 5. After saving: - Close the modal. - Refresh or update the Upcoming Interviews panel to include the newly scheduled interview. - Show a toast notification: "Interview successfully scheduled." 6. (Optional Enhancement) - Allow document attachment (e.g., Interview Guide, Consent Form). - Add toggle: “Send notification to participant/interviewer”. - Auto-link participant and project fields so that this interview is accessible from both modules. 7. Accessibility: - Modal must be keyboard accessible (Tab to move, Enter to submit, Esc to close). - Include aria-labels on all fields and modal header. 8. Design: - Use Tailwind UI or ShadCN components (like Dialog, Input, Select, Textarea). - Follow the app’s primary colors from Quantals Collect branding. 9. File: Interviews.html - Keep all modal and event-handler code scoped to this file. - Use React component state to manage modal visibility and form state. - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +212 -26
index.html CHANGED
@@ -6,7 +6,9 @@
6
  <title>Interview Management - 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.quilljs.com/1.3.6/quill.min.js"></script>
 
10
  <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
11
  <style>
12
  /* Custom styles */
@@ -365,36 +367,68 @@
365
  <h3 class="text-lg font-semibold text-gray-800 mb-4">Schedule New Interview</h3>
366
  <form class="space-y-4">
367
  <div>
368
- <label class="block text-sm font-medium text-gray-700">Project</label>
369
- <select class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
370
- <option>Select Project</option>
 
 
 
371
  </select>
372
  </div>
373
  <div>
374
- <label class="block text-sm font-medium text-gray-700">Participant</label>
375
- <select class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
376
- <option>Select Participant</option>
 
 
 
377
  </select>
378
  </div>
379
  <div>
380
- <label class="block text-sm font-medium text-gray-700">Date</label>
381
- <input type="date" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
382
  </div>
383
  <div>
384
- <label class="block text-sm font-medium text-gray-700">Time</label>
385
- <input type="time" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
 
 
 
 
 
386
  </div>
387
  <div>
388
- <label class="block text-sm font-medium text-gray-700">Interviewer</label>
389
- <select class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
390
- <option>Select Interviewer</option>
391
- </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
  </div>
393
  <div class="flex justify-end space-x-3 mt-6">
394
- <button type="button" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-md hover:bg-gray-200">
 
395
  Cancel
396
  </button>
397
- <button type="submit" class="px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-md hover:bg-indigo-700">
 
398
  Schedule
399
  </button>
400
  </div>
@@ -617,19 +651,48 @@
617
  document.querySelector('button:has(.fa-stop)').addEventListener('click', stopRecording);
618
 
619
  // Schedule interview modal
620
- const scheduleModal = document.getElementById('scheduleModal');
621
- const scheduleButtons = document.querySelectorAll('button:has(.fa-plus)');
622
- const cancelButton = document.querySelector('#scheduleModal button:has-text("Cancel")');
 
 
 
 
 
 
 
 
 
 
 
 
 
623
 
624
- scheduleButtons.forEach(button => {
625
- button.addEventListener('click', () => {
626
- scheduleModal.classList.remove('hidden');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
627
  });
628
- });
629
 
630
- cancelButton.addEventListener('click', () => {
631
- scheduleModal.classList.add('hidden');
632
- });
633
 
634
  // Auto-save notes
635
  setInterval(() => {
@@ -652,5 +715,128 @@
652
  }
653
  });
654
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
655
  <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" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
656
  </html>
 
6
  <title>Interview Management - 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
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
10
  <script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script>
11
+ <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
12
  <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
13
  <style>
14
  /* Custom styles */
 
367
  <h3 class="text-lg font-semibold text-gray-800 mb-4">Schedule New Interview</h3>
368
  <form class="space-y-4">
369
  <div>
370
+ <label class="block text-sm font-medium text-gray-700 mb-1">Participant *</label>
371
+ <select class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" required>
372
+ <option value="">Select Participant</option>
373
+ <option>John Doe (ID: P001)</option>
374
+ <option>Jane Smith (ID: P002)</option>
375
+ <!-- Will be populated dynamically -->
376
  </select>
377
  </div>
378
  <div>
379
+ <label class="block text-sm font-medium text-gray-700 mb-1">Project *</label>
380
+ <select class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" required>
381
+ <option value="">Select Project</option>
382
+ <option>UX Research</option>
383
+ <option>Market Study</option>
384
+ <!-- Will be populated dynamically -->
385
  </select>
386
  </div>
387
  <div>
388
+ <label class="block text-sm font-medium text-gray-700 mb-1">Date & Time *</label>
389
+ <input type="datetime-local" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" required>
390
  </div>
391
  <div>
392
+ <label class="block text-sm font-medium text-gray-700 mb-1">Interviewer *</label>
393
+ <select class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" required>
394
+ <option value="">Select Interviewer</option>
395
+ <option>Research Team</option>
396
+ <option>Alex Johnson</option>
397
+ <option>Sam Williams</option>
398
+ </select>
399
  </div>
400
  <div>
401
+ <label class="block text-sm font-medium text-gray-700 mb-1">Mode *</label>
402
+ <div class="space-y-2 mt-1">
403
+ <div class="flex items-center">
404
+ <input type="radio" id="mode-in-person" name="mode" value="in-person" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500">
405
+ <label for="mode-in-person" class="ml-2 block text-sm text-gray-700">In-Person</label>
406
+ </div>
407
+ <div class="flex items-center">
408
+ <input type="radio" id="mode-online" name="mode" value="online" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500">
409
+ <label for="mode-online" class="ml-2 block text-sm text-gray-700">Zoom/Online</label>
410
+ </div>
411
+ <div class="flex items-center">
412
+ <input type="radio" id="mode-phone" name="mode" value="phone" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500">
413
+ <label for="mode-phone" class="ml-2 block text-sm text-gray-700">Phone</label>
414
+ </div>
415
+ </div>
416
+ </div>
417
+ <div id="locationField">
418
+ <label for="location" class="block text-sm font-medium text-gray-700 mb-1">Location/Link *</label>
419
+ <input type="text" id="location" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" required>
420
+ </div>
421
+ <div>
422
+ <label for="notes" class="block text-sm font-medium text-gray-700 mb-1">Notes (Optional)</label>
423
+ <textarea id="notes" rows="3" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"></textarea>
424
  </div>
425
  <div class="flex justify-end space-x-3 mt-6">
426
+ <button type="button" id="cancelScheduleBtn"
427
+ class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
428
  Cancel
429
  </button>
430
+ <button type="submit" id="submitScheduleBtn"
431
+ class="px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
432
  Schedule
433
  </button>
434
  </div>
 
651
  document.querySelector('button:has(.fa-stop)').addEventListener('click', stopRecording);
652
 
653
  // Schedule interview modal
654
+ function setupScheduleModal() {
655
+ const scheduleButtons = document.querySelectorAll('button:has(.fa-plus)');
656
+
657
+ scheduleButtons.forEach(button => {
658
+ button.addEventListener('click', () => {
659
+ modal.classList.remove('hidden');
660
+ document.body.style.overflow = 'hidden';
661
+ modal.querySelector('input').focus();
662
+ });
663
+ });
664
+
665
+ // Pre-populate with today's date
666
+ const now = new Date();
667
+ const timeString = `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}`;
668
+ const today = `${now.getFullYear()}-${(now.getMonth()+1).toString().padStart(2, '0')}-${now.getDate().toString().padStart(2, '0')}`;
669
+ document.querySelector('input[type="datetime-local"]').value = `${today}T${timeString}`;
670
 
671
+ // Handle mode selection changes
672
+ const modeRadios = document.querySelectorAll('input[name="mode"]');
673
+ const locationField = document.getElementById('locationField');
674
+ const locationInput = document.getElementById('location');
675
+
676
+ modeRadios.forEach(radio => {
677
+ radio.addEventListener('change', (e) => {
678
+ const mode = e.target.value;
679
+ const label = locationField.querySelector('label');
680
+
681
+ if (mode === 'online') {
682
+ label.textContent = 'Meeting Link *';
683
+ locationInput.placeholder = 'https://zoom.us/j/...';
684
+ } else if (mode === 'phone') {
685
+ label.textContent = 'Phone Number *';
686
+ locationInput.placeholder = '+1 (555) 123-4567';
687
+ } else {
688
+ label.textContent = 'Location *';
689
+ locationInput.placeholder = 'Office address or room number';
690
+ }
691
+ });
692
  });
693
+ }
694
 
695
+ document.addEventListener('DOMContentLoaded', setupScheduleModal);
 
 
696
 
697
  // Auto-save notes
698
  setInterval(() => {
 
715
  }
716
  });
717
  </script>
718
+
719
+ <!-- Toast Notification -->
720
+ <div id="toast" class="hidden fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg">
721
+ Interview successfully scheduled.
722
+ </div>
723
+
724
+ <script>
725
+ // Modal handling
726
+ const modal = document.getElementById('scheduleModal');
727
+ const cancelBtn = document.getElementById('cancelScheduleBtn');
728
+ const submitBtn = document.getElementById('submitScheduleBtn');
729
+ const form = modal.querySelector('form');
730
+ const toast = document.getElementById('toast');
731
+
732
+ // Modal close functions
733
+ function closeModal() {
734
+ modal.classList.add('hidden');
735
+ document.body.style.overflow = 'auto';
736
+ }
737
+
738
+ // Keyboard accessibility
739
+ modal.addEventListener('keydown', (e) => {
740
+ if (e.key === 'Escape') closeModal();
741
+ if (e.key === 'Tab') {
742
+ const focusable = modal.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
743
+ if (focusable.length === 0) return;
744
+
745
+ const first = focusable[0];
746
+ const last = focusable[focusable.length - 1];
747
+
748
+ if (e.shiftKey) {
749
+ if (document.activeElement === first) {
750
+ last.focus();
751
+ e.preventDefault();
752
+ }
753
+ } else {
754
+ if (document.activeElement === last) {
755
+ first.focus();
756
+ e.preventDefault();
757
+ }
758
+ }
759
+ }
760
+ });
761
+
762
+ // Close buttons
763
+ cancelBtn.addEventListener('click', closeModal);
764
+
765
+ // Form submission
766
+ form.addEventListener('submit', async (e) => {
767
+ e.preventDefault();
768
+
769
+ // Validate required fields
770
+ const requiredFields = form.querySelectorAll('[required]');
771
+ let isValid = true;
772
+
773
+ requiredFields.forEach(field => {
774
+ if (!field.value) {
775
+ isValid = false;
776
+ field.classList.add('border-red-500');
777
+ } else {
778
+ field.classList.remove('border-red-500');
779
+ }
780
+ });
781
+
782
+ if (!isValid) return;
783
+
784
+ // Get form values
785
+ const formData = {
786
+ participantId: form.querySelector('select:nth-of-type(1)').value,
787
+ projectId: form.querySelector('select:nth-of-type(2)').value,
788
+ interviewerId: form.querySelector('select:nth-of-type(3)').value,
789
+ datetime: form.querySelector('input[type="datetime-local"]').value,
790
+ mode: form.querySelector('input[name="mode"]:checked').value,
791
+ location: document.getElementById('location').value,
792
+ notes: document.getElementById('notes').value,
793
+ status: 'scheduled'
794
+ };
795
+
796
+ try {
797
+ // In a real app, you would call an API here
798
+ // For demo, we'll use localStorage
799
+ const interviews = JSON.parse(localStorage.getItem('interviews') || '[]');
800
+ const newInterview = {
801
+ ...formData,
802
+ id: 'IVW-' + Date.now().toString().slice(-6)
803
+ };
804
+
805
+ interviews.push(newInterview);
806
+ localStorage.setItem('interviews', JSON.stringify(interviews));
807
+
808
+ // Show success & close modal
809
+ toast.classList.remove('hidden');
810
+ setTimeout(() => toast.classList.add('hidden'), 3000);
811
+ closeModal();
812
+
813
+ // Refresh upcoming interviews
814
+ refreshUpcomingInterviews();
815
+ } catch (error) {
816
+ console.error('Error saving interview:', error);
817
+ alert('Failed to schedule interview');
818
+ }
819
+ });
820
+
821
+ function refreshUpcomingInterviews() {
822
+ const interviews = JSON.parse(localStorage.getItem('interviews') || '[]');
823
+ const upcomingContainer = document.querySelector('.space-y-4');
824
+
825
+ // Sort by datetime
826
+ const sorted = interviews
827
+ .filter(i => new Date(i.datetime) > new Date())
828
+ .sort((a, b) => new Date(a.datetime) - new Date(b.datetime));
829
+
830
+ // Update UI
831
+ upcomingContainer.innerHTML = sorted
832
+ .map(interview => `
833
+ <div class="p-3 bg-gray-50 rounded-lg">
834
+ <div class="text-sm text-gray-600">${new Date(interview.datetime).toLocaleString()}</div>
835
+ <div class="font-medium">${interview.participantId}</div>
836
+ <div class="text-sm text-gray-500">Project: ${interview.projectId}</div>
837
+ </div>
838
+ `).join('');
839
+ }
840
+ </script>
841
  <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" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
842
  </html>