mavodanovic commited on
Commit
9ee545c
·
verified ·
1 Parent(s): 6629733

enhance the Schedules section section so that I can edit each doctor's working hours and mark days as off duty - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +161 -23
index.html CHANGED
@@ -82,6 +82,11 @@
82
  font-weight: 500;
83
  }
84
 
 
 
 
 
 
85
  /* Modal styles */
86
  #edit-doctor-modal {
87
  transition: opacity 0.3s ease;
@@ -588,7 +593,7 @@
588
  </tr>
589
  </thead>
590
  <tbody class="bg-white divide-y divide-gray-200">
591
- <tr class="hover:bg-gray-50">
592
  <td class="px-4 py-4 whitespace-nowrap">
593
  <div class="flex items-center">
594
  <img src="https://randomuser.me/api/portraits/women/44.jpg" class="w-10 h-10 rounded-full mr-3" alt="Dr. Sarah Johnson">
@@ -598,37 +603,103 @@
598
  </div>
599
  </div>
600
  </td>
601
- <td class="px-4 py-4 text-sm text-gray-700">
602
- <div>9:00 AM - 5:00 PM</div>
603
- <div class="text-xs text-gray-500 mt-1">12 slots available</div>
 
 
 
 
 
 
 
 
 
604
  </td>
605
- <td class="px-4 py-4 text-sm text-gray-700">
606
- <div>9:00 AM - 5:00 PM</div>
607
- <div class="text-xs text-gray-500 mt-1">8 slots available</div>
 
 
 
 
 
 
 
 
 
608
  </td>
609
- <td class="px-4 py-4 text-sm text-gray-700">
610
- <div>9:00 AM - 5:00 PM</div>
611
- <div class="text-xs text-gray-500 mt-1">10 slots available</div>
 
 
 
 
 
 
 
 
 
612
  </td>
613
- <td class="px-4 py-4 text-sm text-gray-500 italic">
614
- Off Duty
 
 
 
 
 
 
 
 
 
 
615
  </td>
616
- <td class="px-4 py-4 text-sm text-gray-700">
617
- <div>9:00 AM - 3:00 PM</div>
618
- <div class="text-xs text-gray-500 mt-1">6 slots available</div>
 
 
 
 
 
 
 
 
 
619
  </td>
620
- <td class="px-4 py-4 text-sm text-gray-500 italic">
621
- Off Duty
 
 
 
 
 
 
 
 
 
 
622
  </td>
623
- <td class="px-4 py-4 text-sm text-gray-500 italic">
624
- Off Duty
 
 
 
 
 
 
 
 
 
 
625
  </td>
626
  <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
627
- <button class="text-blue-600 hover:text-blue-800 mr-2" title="Edit Schedule">
628
- <i class="fas fa-edit"></i>
629
  </button>
630
- <button class="text-red-600 hover:text-red-800" title="Block Time">
631
- <i class="fas fa-ban"></i>
632
  </button>
633
  </td>
634
  </tr>
@@ -1070,6 +1141,73 @@
1070
 
1071
  document.addEventListener('DOMContentLoaded', function() {
1072
  animateValue("appointment-counter", 0, 142, 1500);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1073
  });
1074
 
1075
  // Time block functionality
 
82
  font-weight: 500;
83
  }
84
 
85
+ input[type="time"]:disabled {
86
+ background-color: #f3f4f6;
87
+ cursor: not-allowed;
88
+ }
89
+
90
  /* Modal styles */
91
  #edit-doctor-modal {
92
  transition: opacity 0.3s ease;
 
593
  </tr>
594
  </thead>
595
  <tbody class="bg-white divide-y divide-gray-200">
596
+ <tr class="hover:bg-gray-50" data-doctor-id="1">
597
  <td class="px-4 py-4 whitespace-nowrap">
598
  <div class="flex items-center">
599
  <img src="https://randomuser.me/api/portraits/women/44.jpg" class="w-10 h-10 rounded-full mr-3" alt="Dr. Sarah Johnson">
 
603
  </div>
604
  </div>
605
  </td>
606
+ <td class="px-4 py-4 text-sm text-gray-700 day-cell" data-day="monday">
607
+ <div class="flex items-center space-x-2">
608
+ <input type="time" value="09:00" class="border rounded px-2 py-1 text-sm w-20 start-time">
609
+ <span>to</span>
610
+ <input type="time" value="17:00" class="border rounded px-2 py-1 text-sm w-20 end-time">
611
+ </div>
612
+ <div class="flex items-center mt-2">
613
+ <label class="inline-flex items-center">
614
+ <input type="checkbox" class="rounded text-primary focus:ring-primary off-day">
615
+ <span class="ml-2 text-xs">Off Duty</span>
616
+ </label>
617
+ </div>
618
  </td>
619
+ <td class="px-4 py-4 text-sm text-gray-700 day-cell" data-day="tuesday">
620
+ <div class="flex items-center space-x-2">
621
+ <input type="time" value="09:00" class="border rounded px-2 py-1 text-sm w-20 start-time">
622
+ <span>to</span>
623
+ <input type="time" value="17:00" class="border rounded px-2 py-1 text-sm w-20 end-time">
624
+ </div>
625
+ <div class="flex items-center mt-2">
626
+ <label class="inline-flex items-center">
627
+ <input type="checkbox" class="rounded text-primary focus:ring-primary off-day">
628
+ <span class="ml-2 text-xs">Off Duty</span>
629
+ </label>
630
+ </div>
631
  </td>
632
+ <td class="px-4 py-4 text-sm text-gray-700 day-cell" data-day="wednesday">
633
+ <div class="flex items-center space-x-2">
634
+ <input type="time" value="09:00" class="border rounded px-2 py-1 text-sm w-20 start-time">
635
+ <span>to</span>
636
+ <input type="time" value="17:00" class="border rounded px-2 py-1 text-sm w-20 end-time">
637
+ </div>
638
+ <div class="flex items-center mt-2">
639
+ <label class="inline-flex items-center">
640
+ <input type="checkbox" class="rounded text-primary focus:ring-primary off-day">
641
+ <span class="ml-2 text-xs">Off Duty</span>
642
+ </label>
643
+ </div>
644
  </td>
645
+ <td class="px-4 py-4 text-sm text-gray-700 day-cell" data-day="thursday">
646
+ <div class="flex items-center space-x-2">
647
+ <input type="time" value="09:00" class="border rounded px-2 py-1 text-sm w-20 start-time">
648
+ <span>to</span>
649
+ <input type="time" value="17:00" class="border rounded px-2 py-1 text-sm w-20 end-time">
650
+ </div>
651
+ <div class="flex items-center mt-2">
652
+ <label class="inline-flex items-center">
653
+ <input type="checkbox" class="rounded text-primary focus:ring-primary off-day" checked>
654
+ <span class="ml-2 text-xs">Off Duty</span>
655
+ </label>
656
+ </div>
657
  </td>
658
+ <td class="px-4 py-4 text-sm text-gray-700 day-cell" data-day="friday">
659
+ <div class="flex items-center space-x-2">
660
+ <input type="time" value="09:00" class="border rounded px-2 py-1 text-sm w-20 start-time">
661
+ <span>to</span>
662
+ <input type="time" value="15:00" class="border rounded px-2 py-1 text-sm w-20 end-time">
663
+ </div>
664
+ <div class="flex items-center mt-2">
665
+ <label class="inline-flex items-center">
666
+ <input type="checkbox" class="rounded text-primary focus:ring-primary off-day">
667
+ <span class="ml-2 text-xs">Off Duty</span>
668
+ </label>
669
+ </div>
670
  </td>
671
+ <td class="px-4 py-4 text-sm text-gray-700 day-cell" data-day="saturday">
672
+ <div class="flex items-center space-x-2">
673
+ <input type="time" value="09:00" class="border rounded px-2 py-1 text-sm w-20 start-time">
674
+ <span>to</span>
675
+ <input type="time" value="17:00" class="border rounded px-2 py-1 text-sm w-20 end-time">
676
+ </div>
677
+ <div class="flex items-center mt-2">
678
+ <label class="inline-flex items-center">
679
+ <input type="checkbox" class="rounded text-primary focus:ring-primary off-day" checked>
680
+ <span class="ml-2 text-xs">Off Duty</span>
681
+ </label>
682
+ </div>
683
  </td>
684
+ <td class="px-4 py-4 text-sm text-gray-700 day-cell" data-day="sunday">
685
+ <div class="flex items-center space-x-2">
686
+ <input type="time" value="09:00" class="border rounded px-2 py-1 text-sm w-20 start-time">
687
+ <span>to</span>
688
+ <input type="time" value="17:00" class="border rounded px-2 py-1 text-sm w-20 end-time">
689
+ </div>
690
+ <div class="flex items-center mt-2">
691
+ <label class="inline-flex items-center">
692
+ <input type="checkbox" class="rounded text-primary focus:ring-primary off-day" checked>
693
+ <span class="ml-2 text-xs">Off Duty</span>
694
+ </label>
695
+ </div>
696
  </td>
697
  <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
698
+ <button class="text-blue-600 hover:text-blue-800 mr-2 save-schedule" title="Save Schedule">
699
+ <i class="fas fa-save"></i>
700
  </button>
701
+ <button class="text-red-600 hover:text-red-800" title="Reset Changes">
702
+ <i class="fas fa-undo"></i>
703
  </button>
704
  </td>
705
  </tr>
 
1141
 
1142
  document.addEventListener('DOMContentLoaded', function() {
1143
  animateValue("appointment-counter", 0, 142, 1500);
1144
+
1145
+ // Handle off day toggles
1146
+ document.querySelectorAll('.off-day').forEach(checkbox => {
1147
+ checkbox.addEventListener('change', function() {
1148
+ const dayCell = this.closest('.day-cell');
1149
+ const inputs = dayCell.querySelectorAll('input[type="time"]');
1150
+
1151
+ inputs.forEach(input => {
1152
+ input.disabled = this.checked;
1153
+ if (this.checked) {
1154
+ input.classList.add('opacity-50');
1155
+ } else {
1156
+ input.classList.remove('opacity-50');
1157
+ }
1158
+ });
1159
+ });
1160
+ });
1161
+
1162
+ // Initialize disabled states
1163
+ document.querySelectorAll('.off-day').forEach(checkbox => {
1164
+ if (checkbox.checked) {
1165
+ const dayCell = checkbox.closest('.day-cell');
1166
+ const inputs = dayCell.querySelectorAll('input[type="time"]');
1167
+ inputs.forEach(input => {
1168
+ input.disabled = true;
1169
+ input.classList.add('opacity-50');
1170
+ });
1171
+ }
1172
+ });
1173
+
1174
+ // Save schedule handler
1175
+ document.querySelectorAll('.save-schedule').forEach(button => {
1176
+ button.addEventListener('click', function() {
1177
+ const row = this.closest('tr');
1178
+ const doctorId = row.dataset.doctorId;
1179
+ const scheduleData = {};
1180
+
1181
+ row.querySelectorAll('.day-cell').forEach(dayCell => {
1182
+ const day = dayCell.dataset.day;
1183
+ const isOff = dayCell.querySelector('.off-day').checked;
1184
+ const startTime = dayCell.querySelector('.start-time').value;
1185
+ const endTime = dayCell.querySelector('.end-time').value;
1186
+
1187
+ scheduleData[day] = {
1188
+ off: isOff,
1189
+ start: startTime,
1190
+ end: endTime
1191
+ };
1192
+ });
1193
+
1194
+ // Here you would typically send this data to your backend
1195
+ console.log('Saving schedule for doctor', doctorId, scheduleData);
1196
+ alert('Schedule saved successfully!');
1197
+ });
1198
+ });
1199
+
1200
+ // Reset changes handler
1201
+ document.querySelectorAll('.fa-undo').forEach(button => {
1202
+ button.addEventListener('click', function() {
1203
+ const row = this.closest('tr');
1204
+ if (confirm('Are you sure you want to reset all changes?')) {
1205
+ // Here you would typically reload the original data
1206
+ // For demo, we'll just reload the page
1207
+ location.reload();
1208
+ }
1209
+ });
1210
+ });
1211
  });
1212
 
1213
  // Time block functionality