dataquantals commited on
Commit
2a0dede
·
verified ·
1 Parent(s): f4af434

on the dashboard, among the Start New Session, for Join Doctor, Join Patient, add the "Search for Interpreter" button . this button should work like Uber driver or Yango with Geo-location, where, when the client click the Button it searches the nearest interpret with the status Online, and then when accepted it oppen jitsi App using internet. - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +237 -5
index.html CHANGED
@@ -181,9 +181,11 @@
181
  <i class="fas fa-cog mr-3"></i> Settings
182
  </a>
183
  </li>
184
- </ul>
185
- </nav>
186
-
 
 
187
  <div class="mt-auto pt-4 border-t border-[#022b3d]">
188
  <button id="logout-btn" class="flex items-center p-3 rounded-lg hover:bg-[#022b3d] transition w-full">
189
  <i class="fas fa-sign-out-alt mr-3"></i> Logout
@@ -263,7 +265,7 @@
263
  </div>
264
 
265
  <!-- Action Buttons -->
266
- <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
267
  <button id="start-session-btn" class="bg-gradient-to-r from-[#fb8500] to-[#ffb703] text-white py-4 px-6 rounded-xl shadow-md hover:shadow-lg transition-all transform hover:-translate-y-1 flex flex-col items-center justify-center">
268
  <i class="fas fa-video text-2xl mb-2"></i>
269
  <span class="font-bold text-lg">Start New Session</span>
@@ -281,6 +283,12 @@
281
  <span class="font-bold text-lg">Join Patient</span>
282
  <span class="text-sm font-light">Connect directly with patient</span>
283
  </button>
 
 
 
 
 
 
284
  </div>
285
 
286
  <!-- Incoming Call Banner (Hidden by Default) -->
@@ -620,6 +628,98 @@
620
  </div>
621
  </div>
622
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
623
  <!-- Settings Page -->
624
  <div id="settings-page" class="p-4 md:p-6 hidden">
625
  <div class="max-w-3xl mx-auto">
@@ -730,6 +830,29 @@
730
  </div>
731
  </main>
732
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733
  <!-- Call Modal (Hidden by Default) -->
734
  <div id="call-modal" class="fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 hidden">
735
  <div class="bg-white rounded-xl w-full max-w-md mx-4 call-modal">
@@ -830,7 +953,7 @@
830
  const videoCall = document.getElementById('video-call');
831
  const endCallBtn = document.getElementById('end-call-btn');
832
  const pageLinks = document.querySelectorAll('[data-page]');
833
- const pages = document.querySelectorAll('[id$="-page"]');
834
  const profilePicInput = document.getElementById('profile-pic');
835
  const profilePicPreview = document.getElementById('profile-pic-preview');
836
  const availabilityToggle = document.getElementById('availability-toggle');
@@ -853,6 +976,9 @@
853
  modalAcceptBtn.addEventListener('click', acceptCall);
854
  modalDeclineBtn.addEventListener('click', declineCall);
855
  endCallBtn.addEventListener('click', endCall);
 
 
 
856
  profilePicInput.addEventListener('change', updateProfilePic);
857
  availabilityToggle.addEventListener('change', toggleAvailability);
858
 
@@ -1050,6 +1176,109 @@
1050
  }
1051
  });
1052
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1053
  // Initialize
1054
  document.addEventListener('DOMContentLoaded', () => {
1055
  // Initialize any default values
@@ -1058,4 +1287,7 @@
1058
  });
1059
  </script>
1060
  <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/interpreter" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
 
 
 
1061
  </html>
 
181
  <i class="fas fa-cog mr-3"></i> Settings
182
  </a>
183
  </li>
184
+ <li>
185
+ <a href="#" data-page="admin" class="flex items-center p-3 rounded-lg hover:bg-[#022b3d] transition">
186
+ <i class="fas fa-user-shield mr-3"></i> Admin
187
+ </a>
188
+ </li>
189
  <div class="mt-auto pt-4 border-t border-[#022b3d]">
190
  <button id="logout-btn" class="flex items-center p-3 rounded-lg hover:bg-[#022b3d] transition w-full">
191
  <i class="fas fa-sign-out-alt mr-3"></i> Logout
 
265
  </div>
266
 
267
  <!-- Action Buttons -->
268
+ <div class="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6">
269
  <button id="start-session-btn" class="bg-gradient-to-r from-[#fb8500] to-[#ffb703] text-white py-4 px-6 rounded-xl shadow-md hover:shadow-lg transition-all transform hover:-translate-y-1 flex flex-col items-center justify-center">
270
  <i class="fas fa-video text-2xl mb-2"></i>
271
  <span class="font-bold text-lg">Start New Session</span>
 
283
  <span class="font-bold text-lg">Join Patient</span>
284
  <span class="text-sm font-light">Connect directly with patient</span>
285
  </button>
286
+
287
+ <button id="search-interpreter-btn" class="bg-gradient-to-r from-[#4CAF50] to-[#2E7D32] text-white py-4 px-6 rounded-xl shadow-md hover:shadow-lg transition-all transform hover:-translate-y-1 flex flex-col items-center justify-center">
288
+ <i class="fas fa-search-location text-2xl mb-2"></i>
289
+ <span class="font-bold text-lg">Find Interpreter</span>
290
+ <span class="text-sm font-light">Locate nearest available</span>
291
+ </button>
292
  </div>
293
 
294
  <!-- Incoming Call Banner (Hidden by Default) -->
 
628
  </div>
629
  </div>
630
 
631
+ <!-- Admin Page -->
632
+ <div id="admin-page" class="p-4 md:p-6 hidden">
633
+ <div class="max-w-6xl mx-auto">
634
+ <div class="mb-6">
635
+ <h2 class="text-2xl font-bold primary-text">Admin Dashboard</h2>
636
+ <p class="text-gray-600">Manage interpreters and system settings</p>
637
+ </div>
638
+
639
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
640
+ <div class="bg-white p-6 rounded-xl shadow-sm">
641
+ <h3 class="text-lg font-semibold mb-4 primary-text">Interpreter Management</h3>
642
+ <button id="add-interpreter-btn" class="w-full primary-bg text-white py-2 px-4 rounded-lg hover:bg-[#022b3d] transition font-medium mb-4">
643
+ <i class="fas fa-user-plus mr-2"></i> Add New Interpreter
644
+ </button>
645
+ <button id="view-interpreters-btn" class="w-full bg-white border border-[#023047] primary-text py-2 px-4 rounded-lg hover:bg-gray-50 transition font-medium">
646
+ <i class="fas fa-list mr-2"></i> View All Interpreters
647
+ </button>
648
+ </div>
649
+
650
+ <div class="bg-white p-6 rounded-xl shadow-sm">
651
+ <h3 class="text-lg font-semibold mb-4 primary-text">System Statistics</h3>
652
+ <div class="space-y-4">
653
+ <div>
654
+ <p class="text-sm text-gray-500">Total Interpreters</p>
655
+ <h3 class="text-xl font-bold">24</h3>
656
+ </div>
657
+ <div>
658
+ <p class="text-sm text-gray-500">Active Sessions</p>
659
+ <h3 class="text-xl font-bold">8</h3>
660
+ </div>
661
+ <div>
662
+ <p class="text-sm text-gray-500">Average Rating</p>
663
+ <h3 class="text-xl font-bold">4.6</h3>
664
+ </div>
665
+ </div>
666
+ </div>
667
+
668
+ <div class="bg-white p-6 rounded-xl shadow-sm">
669
+ <h3 class="text-lg font-semibold mb-4 primary-text">Quick Actions</h3>
670
+ <div class="space-y-3">
671
+ <button class="w-full text-left text-sm p-2 hover:bg-gray-50 rounded-lg">
672
+ <i class="fas fa-bell mr-2"></i> Send Announcement
673
+ </button>
674
+ <button class="w-full text-left text-sm p-2 hover:bg-gray-50 rounded-lg">
675
+ <i class="fas fa-file-export mr-2"></i> Export Reports
676
+ </button>
677
+ <button class="w-full text-left text-sm p-2 hover:bg-gray-50 rounded-lg">
678
+ <i class="fas fa-cog mr-2"></i> System Settings
679
+ </button>
680
+ </div>
681
+ </div>
682
+ </div>
683
+
684
+ <!-- Recent Activity -->
685
+ <div class="bg-white p-6 rounded-xl shadow-sm">
686
+ <h3 class="text-lg font-semibold mb-4 primary-text">Recent Activity</h3>
687
+ <div class="overflow-x-auto">
688
+ <table class="min-w-full divide-y divide-gray-200">
689
+ <thead class="bg-gray-50">
690
+ <tr>
691
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
692
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Activity</th>
693
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">User</th>
694
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Details</th>
695
+ </tr>
696
+ </thead>
697
+ <tbody class="bg-white divide-y divide-gray-200">
698
+ <tr>
699
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Today, 10:30 AM</td>
700
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">New Interpreter</td>
701
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Admin User</td>
702
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Registered John Mwansa</td>
703
+ </tr>
704
+ <tr>
705
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Today, 09:15 AM</td>
706
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Session Completed</td>
707
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Sarah K.</td>
708
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Duration: 22 minutes</td>
709
+ </tr>
710
+ <tr>
711
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Yesterday, 4:45 PM</td>
712
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">System Update</td>
713
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">System</td>
714
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Applied security patches</td>
715
+ </tr>
716
+ </tbody>
717
+ </table>
718
+ </div>
719
+ </div>
720
+ </div>
721
+ </div>
722
+
723
  <!-- Settings Page -->
724
  <div id="settings-page" class="p-4 md:p-6 hidden">
725
  <div class="max-w-3xl mx-auto">
 
830
  </div>
831
  </main>
832
 
833
+ <!-- Interpreter Search Modal (Hidden by Default) -->
834
+ <div id="interpreter-modal" class="fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 hidden">
835
+ <div class="bg-white rounded-xl w-full max-w-md mx-4">
836
+ <div class="p-6">
837
+ <div class="flex justify-between items-center mb-4">
838
+ <h3 class="text-xl font-bold">Available Interpreters</h3>
839
+ <button id="close-interpreter-modal" class="text-gray-500 hover:text-gray-700">
840
+ <i class="fas fa-times"></i>
841
+ </button>
842
+ </div>
843
+
844
+ <div id="interpreter-list" class="max-h-96 overflow-y-auto mb-4">
845
+ <!-- Interpreters will be listed here -->
846
+ </div>
847
+
848
+ <input type="hidden" id="selected-interpreter-id" value="">
849
+ <button id="connect-interpreter-btn" class="w-full bg-gray-400 text-white py-3 px-6 rounded-lg font-bold disabled:opacity-75" disabled>
850
+ <i class="fas fa-phone-alt mr-2"></i> Connect to Interpreter
851
+ </button>
852
+ </div>
853
+ </div>
854
+ </div>
855
+
856
  <!-- Call Modal (Hidden by Default) -->
857
  <div id="call-modal" class="fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 hidden">
858
  <div class="bg-white rounded-xl w-full max-w-md mx-4 call-modal">
 
953
  const videoCall = document.getElementById('video-call');
954
  const endCallBtn = document.getElementById('end-call-btn');
955
  const pageLinks = document.querySelectorAll('[data-page]');
956
+ const pages = document.querySelectorAll('[id$="-page"]:not([id="admin-page"])');
957
  const profilePicInput = document.getElementById('profile-pic');
958
  const profilePicPreview = document.getElementById('profile-pic-preview');
959
  const availabilityToggle = document.getElementById('availability-toggle');
 
976
  modalAcceptBtn.addEventListener('click', acceptCall);
977
  modalDeclineBtn.addEventListener('click', declineCall);
978
  endCallBtn.addEventListener('click', endCall);
979
+ document.getElementById('close-interpreter-modal').addEventListener('click', () => {
980
+ document.getElementById('interpreter-modal').classList.add('hidden');
981
+ });
982
  profilePicInput.addEventListener('change', updateProfilePic);
983
  availabilityToggle.addEventListener('change', toggleAvailability);
984
 
 
1176
  }
1177
  });
1178
 
1179
+ // Search Interpreter Elements
1180
+ const searchInterpreterBtn = document.getElementById('search-interpreter-btn');
1181
+ const interpreterModal = document.getElementById('interpreter-modal');
1182
+ const interpreterList = document.getElementById('interpreter-list');
1183
+ const connectInterpreterBtn = document.getElementById('connect-interpreter-btn');
1184
+ const selectedInterpreterId = document.getElementById('selected-interpreter-id');
1185
+
1186
+ // Mock interpreter data (in real app, this would come from API)
1187
+ const interpreters = [
1188
+ { id: 'int1', name: 'John Mwansa', distance: '0.5 km', rating: 4.8, languages: ['ZSL', 'English'] },
1189
+ { id: 'int2', name: 'Sarah Banda', distance: '1.2 km', rating: 4.9, languages: ['ZSL', 'Bemba'] },
1190
+ { id: 'int3', name: 'David Phiri', distance: '2.5 km', rating: 4.7, languages: ['ZSL', 'Nyanja'] }
1191
+ ];
1192
+
1193
+ // Event Listeners for new elements
1194
+ searchInterpreterBtn.addEventListener('click', searchInterpreters);
1195
+ connectInterpreterBtn.addEventListener('click', connectToInterpreter);
1196
+
1197
+ // Functions for interpreter search
1198
+ function searchInterpreters() {
1199
+ // In real app, this would use Geolocation API and fetch from server
1200
+ navigator.geolocation.getCurrentPosition((position) => {
1201
+ const { latitude, longitude } = position.coords;
1202
+ console.log(`Searching interpreters near ${latitude}, ${longitude}`);
1203
+
1204
+ // Show loading state
1205
+ interpreterList.innerHTML = '<div class="p-4 text-center">Searching nearby interpreters...</div>';
1206
+ interpreterModal.classList.remove('hidden');
1207
+
1208
+ // Simulate API call delay
1209
+ setTimeout(() => {
1210
+ renderInterpreterList();
1211
+ }, 1500);
1212
+ }, (error) => {
1213
+ alert('Please enable location services to find interpreters');
1214
+ console.error('Geolocation error:', error);
1215
+ });
1216
+ }
1217
+
1218
+ function renderInterpreterList() {
1219
+ interpreterList.innerHTML = interpreters.map(interpreter => `
1220
+ <div class="interpreter-item p-4 border-b border-gray-200 hover:bg-gray-50 cursor-pointer" data-id="${interpreter.id}">
1221
+ <div class="flex justify-between items-center">
1222
+ <div>
1223
+ <h4 class="font-medium">${interpreter.name}</h4>
1224
+ <div class="flex items-center text-sm text-gray-500 mt-1">
1225
+ <i class="fas fa-map-marker-alt mr-1"></i>
1226
+ <span>${interpreter.distance} away</span>
1227
+ </div>
1228
+ </div>
1229
+ <div class="text-right">
1230
+ <div class="flex items-center justify-end">
1231
+ <i class="fas fa-star text-yellow-400 mr-1"></i>
1232
+ <span>${interpreter.rating}</span>
1233
+ </div>
1234
+ <div class="text-xs mt-1">${interpreter.languages.join(', ')}</div>
1235
+ </div>
1236
+ </div>
1237
+ </div>
1238
+ `).join('');
1239
+
1240
+ // Add click handlers to interpreter items
1241
+ document.querySelectorAll('.interpreter-item').forEach(item => {
1242
+ item.addEventListener('click', function() {
1243
+ const id = this.getAttribute('data-id');
1244
+ selectInterpreter(id);
1245
+ });
1246
+ });
1247
+ }
1248
+
1249
+ function selectInterpreter(id) {
1250
+ // Highlight selected interpreter
1251
+ document.querySelectorAll('.interpreter-item').forEach(item => {
1252
+ item.classList.remove('bg-blue-50', 'border-l-4', 'border-blue-500');
1253
+ });
1254
+ const selected = document.querySelector(`.interpreter-item[data-id="${id}"]`);
1255
+ if (selected) {
1256
+ selected.classList.add('bg-blue-50', 'border-l-4', 'border-blue-500');
1257
+ }
1258
+
1259
+ // Enable connect button
1260
+ selectedInterpreterId.value = id;
1261
+ connectInterpreterBtn.disabled = false;
1262
+ connectInterpreterBtn.classList.remove('bg-gray-400');
1263
+ connectInterpreterBtn.classList.add('bg-green-600', 'hover:bg-green-700');
1264
+ }
1265
+
1266
+ function connectToInterpreter() {
1267
+ const interpreterId = selectedInterpreterId.value;
1268
+ if (!interpreterId) return;
1269
+
1270
+ const interpreter = interpreters.find(i => i.id === interpreterId);
1271
+ if (interpreter) {
1272
+ interpreterModal.classList.add('hidden');
1273
+ startJitsiSession(`ZSL-Interpreter-${interpreterId}-${Date.now()}`, {
1274
+ configOverwrite: {
1275
+ startWithAudioMuted: true,
1276
+ startWithVideoMuted: false
1277
+ }
1278
+ });
1279
+ }
1280
+ }
1281
+
1282
  // Initialize
1283
  document.addEventListener('DOMContentLoaded', () => {
1284
  // Initialize any default values
 
1287
  });
1288
  </script>
1289
  <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/interpreter" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1290
+ });
1291
+ </script>
1292
+ </body>
1293
  </html>