Spaces:
Running
Running
great, now that we have the doctors directory, enhance this so that I can actually edit their info when clicking the little edit button you have just added - Follow Up Deployment
Browse files- index.html +203 -3
index.html
CHANGED
|
@@ -61,14 +61,34 @@
|
|
| 61 |
.appointment-item:nth-child(odd) {
|
| 62 |
background-color: #f8fafc;
|
| 63 |
}
|
|
|
|
|
|
|
|
|
|
| 64 |
.doctor-card:hover {
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
}
|
| 67 |
.availability-day.active {
|
| 68 |
background-color: #dbeafe;
|
| 69 |
color: #2563eb;
|
| 70 |
font-weight: 500;
|
| 71 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
</style>
|
| 73 |
</head>
|
| 74 |
<body class="bg-gray-100">
|
|
@@ -417,8 +437,119 @@
|
|
| 417 |
|
| 418 |
<div id="doctors" class="section">
|
| 419 |
<div class="bg-white p-6 rounded-xl shadow-sm">
|
| 420 |
-
<
|
| 421 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 422 |
</div>
|
| 423 |
</div>
|
| 424 |
|
|
@@ -498,6 +629,75 @@
|
|
| 498 |
}
|
| 499 |
|
| 500 |
// Initialize counters on page load
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 501 |
document.addEventListener('DOMContentLoaded', function() {
|
| 502 |
animateValue("appointment-counter", 0, 142, 1500);
|
| 503 |
});
|
|
|
|
| 61 |
.appointment-item:nth-child(odd) {
|
| 62 |
background-color: #f8fafc;
|
| 63 |
}
|
| 64 |
+
.doctor-card {
|
| 65 |
+
transition: all 0.3s ease;
|
| 66 |
+
}
|
| 67 |
.doctor-card:hover {
|
| 68 |
+
transform: translateY(-2px);
|
| 69 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
| 70 |
+
}
|
| 71 |
+
.doctor-card .specialty {
|
| 72 |
+
background-color: #dbeafe;
|
| 73 |
+
color: #2563eb;
|
| 74 |
+
padding: 2px 8px;
|
| 75 |
+
border-radius: 4px;
|
| 76 |
+
font-size: 0.75rem;
|
| 77 |
+
font-weight: 500;
|
| 78 |
}
|
| 79 |
.availability-day.active {
|
| 80 |
background-color: #dbeafe;
|
| 81 |
color: #2563eb;
|
| 82 |
font-weight: 500;
|
| 83 |
}
|
| 84 |
+
|
| 85 |
+
/* Modal styles */
|
| 86 |
+
#edit-doctor-modal {
|
| 87 |
+
transition: opacity 0.3s ease;
|
| 88 |
+
}
|
| 89 |
+
#edit-doctor-modal input {
|
| 90 |
+
font-size: 0.875rem;
|
| 91 |
+
}
|
| 92 |
</style>
|
| 93 |
</head>
|
| 94 |
<body class="bg-gray-100">
|
|
|
|
| 437 |
|
| 438 |
<div id="doctors" class="section">
|
| 439 |
<div class="bg-white p-6 rounded-xl shadow-sm">
|
| 440 |
+
<div class="flex justify-between items-center mb-6">
|
| 441 |
+
<h3 class="text-xl font-bold text-gray-800">Doctors Directory</h3>
|
| 442 |
+
<button class="bg-primary hover:bg-secondary text-white px-4 py-2 rounded-lg text-sm flex items-center">
|
| 443 |
+
<i class="fas fa-plus mr-2"></i> Add New Doctor
|
| 444 |
+
</button>
|
| 445 |
+
</div>
|
| 446 |
+
|
| 447 |
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
| 448 |
+
<!-- Doctor Card 1 -->
|
| 449 |
+
<div class="doctor-card bg-white border border-gray-200 rounded-lg overflow-hidden hover:shadow-md transition-all">
|
| 450 |
+
<div class="p-4 border-b">
|
| 451 |
+
<div class="flex items-center">
|
| 452 |
+
<img src="https://randomuser.me/api/portraits/women/44.jpg" class="w-16 h-16 rounded-full object-cover" alt="Dr. Sarah Johnson">
|
| 453 |
+
<div class="ml-4">
|
| 454 |
+
<h4 class="font-bold text-gray-800">Dr. Sarah Johnson</h4>
|
| 455 |
+
<p class="text-sm text-primary">Cardiologist</p>
|
| 456 |
+
</div>
|
| 457 |
+
</div>
|
| 458 |
+
</div>
|
| 459 |
+
<div class="p-4">
|
| 460 |
+
<div class="flex items-center text-sm text-gray-600 mb-2">
|
| 461 |
+
<i class="fas fa-hospital mr-2"></i>
|
| 462 |
+
<span>Main Hospital</span>
|
| 463 |
+
</div>
|
| 464 |
+
<div class="text-sm text-gray-600 mb-2">
|
| 465 |
+
<i class="fas fa-map-marker-alt mr-2"></i>
|
| 466 |
+
<span>123 Medical Center Dr, Building A</span>
|
| 467 |
+
</div>
|
| 468 |
+
<div class="text-sm text-gray-600">
|
| 469 |
+
<i class="fas fa-door-open mr-2"></i>
|
| 470 |
+
<span>Floor 3, Office 302</span>
|
| 471 |
+
</div>
|
| 472 |
+
</div>
|
| 473 |
+
<div class="bg-gray-50 px-4 py-3 flex justify-end space-x-2">
|
| 474 |
+
<button class="text-blue-600 hover:text-blue-800">
|
| 475 |
+
<i class="fas fa-edit"></i>
|
| 476 |
+
</button>
|
| 477 |
+
<button class="text-red-600 hover:text-red-800">
|
| 478 |
+
<i class="fas fa-trash"></i>
|
| 479 |
+
</button>
|
| 480 |
+
</div>
|
| 481 |
+
</div>
|
| 482 |
+
|
| 483 |
+
<!-- Doctor Card 2 -->
|
| 484 |
+
<div class="doctor-card bg-white border border-gray-200 rounded-lg overflow-hidden hover:shadow-md transition-all">
|
| 485 |
+
<div class="p-4 border-b">
|
| 486 |
+
<div class="flex items-center">
|
| 487 |
+
<img src="https://randomuser.me/api/portraits/men/32.jpg" class="w-16 h-16 rounded-full object-cover" alt="Dr. Robert Chen">
|
| 488 |
+
<div class="ml-4">
|
| 489 |
+
<h4 class="font-bold text-gray-800">Dr. Robert Chen</h4>
|
| 490 |
+
<p class="text-sm text-primary">Dermatologist</p>
|
| 491 |
+
</div>
|
| 492 |
+
</div>
|
| 493 |
+
</div>
|
| 494 |
+
<div class="p-4">
|
| 495 |
+
<div class="flex items-center text-sm text-gray-600 mb-2">
|
| 496 |
+
<i class="fas fa-hospital mr-2"></i>
|
| 497 |
+
<span>Westside Clinic</span>
|
| 498 |
+
</div>
|
| 499 |
+
<div class="text-sm text-gray-600 mb-2">
|
| 500 |
+
<i class="fas fa-map-marker-alt mr-2"></i>
|
| 501 |
+
<span>456 Health Parkway, Suite 100</span>
|
| 502 |
+
</div>
|
| 503 |
+
<div class="text-sm text-gray-600">
|
| 504 |
+
<i class="fas fa-door-open mr-2"></i>
|
| 505 |
+
<span>Floor 1, Office 105</span>
|
| 506 |
+
</div>
|
| 507 |
+
</div>
|
| 508 |
+
<div class="bg-gray-50 px-4 py-3 flex justify-end space-x-2">
|
| 509 |
+
<button class="text-blue-600 hover:text-blue-800">
|
| 510 |
+
<i class="fas fa-edit"></i>
|
| 511 |
+
</button>
|
| 512 |
+
<button class="text-red-600 hover:text-red-800">
|
| 513 |
+
<i class="fas fa-trash"></i>
|
| 514 |
+
</button>
|
| 515 |
+
</div>
|
| 516 |
+
</div>
|
| 517 |
+
|
| 518 |
+
<!-- Doctor Card 3 -->
|
| 519 |
+
<div class="doctor-card bg-white border border-gray-200 rounded-lg overflow-hidden hover:shadow-md transition-all">
|
| 520 |
+
<div class="p-4 border-b">
|
| 521 |
+
<div class="flex items-center">
|
| 522 |
+
<img src="https://randomuser.me/api/portraits/women/68.jpg" class="w-16 h-16 rounded-full object-cover" alt="Dr. Emily Wilson">
|
| 523 |
+
<div class="ml-4">
|
| 524 |
+
<h4 class="font-bold text-gray-800">Dr. Emily Wilson</h4>
|
| 525 |
+
<p class="text-sm text-primary">Pediatrician</p>
|
| 526 |
+
</div>
|
| 527 |
+
</div>
|
| 528 |
+
</div>
|
| 529 |
+
<div class="p-4">
|
| 530 |
+
<div class="flex items-center text-sm text-gray-600 mb-2">
|
| 531 |
+
<i class="fas fa-hospital mr-2"></i>
|
| 532 |
+
<span>Children's Center</span>
|
| 533 |
+
</div>
|
| 534 |
+
<div class="text-sm text-gray-600 mb-2">
|
| 535 |
+
<i class="fas fa-map-marker-alt mr-2"></i>
|
| 536 |
+
<span>789 Wellness Blvd, Tower B</span>
|
| 537 |
+
</div>
|
| 538 |
+
<div class="text-sm text-gray-600">
|
| 539 |
+
<i class="fas fa-door-open mr-2"></i>
|
| 540 |
+
<span>Floor 2, Office 210</span>
|
| 541 |
+
</div>
|
| 542 |
+
</div>
|
| 543 |
+
<div class="bg-gray-50 px-4 py-3 flex justify-end space-x-2">
|
| 544 |
+
<button class="text-blue-600 hover:text-blue-800">
|
| 545 |
+
<i class="fas fa-edit"></i>
|
| 546 |
+
</button>
|
| 547 |
+
<button class="text-red-600 hover:text-red-800">
|
| 548 |
+
<i class="fas fa-trash"></i>
|
| 549 |
+
</button>
|
| 550 |
+
</div>
|
| 551 |
+
</div>
|
| 552 |
+
</div>
|
| 553 |
</div>
|
| 554 |
</div>
|
| 555 |
|
|
|
|
| 629 |
}
|
| 630 |
|
| 631 |
// Initialize counters on page load
|
| 632 |
+
// Doctor edit functionality
|
| 633 |
+
document.querySelectorAll('.doctor-card .fa-edit').forEach(button => {
|
| 634 |
+
button.addEventListener('click', function() {
|
| 635 |
+
const card = this.closest('.doctor-card');
|
| 636 |
+
const name = card.querySelector('h4').textContent;
|
| 637 |
+
const specialty = card.querySelector('.text-primary').textContent;
|
| 638 |
+
const [facility, address, floorOffice] = Array.from(card.querySelectorAll('.text-gray-600 span')).map(el => el.textContent);
|
| 639 |
+
|
| 640 |
+
// Set form values
|
| 641 |
+
document.getElementById('doctor-name').value = name;
|
| 642 |
+
document.getElementById('doctor-specialty').value = specialty;
|
| 643 |
+
document.getElementById('doctor-facility').value = facility;
|
| 644 |
+
document.getElementById('doctor-address').value = address;
|
| 645 |
+
|
| 646 |
+
// Split floor/office info if available
|
| 647 |
+
if (floorOffice) {
|
| 648 |
+
const [floor, office] = floorOffice.split(',').map(s => s.trim());
|
| 649 |
+
document.getElementById('doctor-floor').value = floor.replace('Floor ', '');
|
| 650 |
+
document.getElementById('doctor-office').value = office.replace('Office ', '');
|
| 651 |
+
}
|
| 652 |
+
|
| 653 |
+
// Show modal
|
| 654 |
+
document.getElementById('edit-doctor-modal').classList.remove('hidden');
|
| 655 |
+
});
|
| 656 |
+
});
|
| 657 |
+
|
| 658 |
+
// Close modal handlers
|
| 659 |
+
document.getElementById('close-modal').addEventListener('click', () => {
|
| 660 |
+
document.getElementById('edit-doctor-modal').classList.add('hidden');
|
| 661 |
+
});
|
| 662 |
+
|
| 663 |
+
document.getElementById('cancel-edit').addEventListener('click', () => {
|
| 664 |
+
document.getElementById('edit-doctor-modal').classList.add('hidden');
|
| 665 |
+
});
|
| 666 |
+
|
| 667 |
+
// Form submission handler
|
| 668 |
+
document.getElementById('doctor-form').addEventListener('submit', function(e) {
|
| 669 |
+
e.preventDefault();
|
| 670 |
+
|
| 671 |
+
// Here you would typically send the data to your backend
|
| 672 |
+
// For this demo, we'll just update the UI
|
| 673 |
+
|
| 674 |
+
const name = document.getElementById('doctor-name').value;
|
| 675 |
+
const specialty = document.getElementById('doctor-specialty').value;
|
| 676 |
+
const facility = document.getElementById('doctor-facility').value;
|
| 677 |
+
const address = document.getElementById('doctor-address').value;
|
| 678 |
+
const floor = document.getElementById('doctor-floor').value;
|
| 679 |
+
const office = document.getElementById('doctor-office').value;
|
| 680 |
+
|
| 681 |
+
// Find the card that initiated the edit
|
| 682 |
+
const card = document.querySelector('.doctor-card h4').textContent === name ?
|
| 683 |
+
document.querySelector('.doctor-card h4').closest('.doctor-card') : null;
|
| 684 |
+
|
| 685 |
+
if (card) {
|
| 686 |
+
card.querySelector('h4').textContent = name;
|
| 687 |
+
card.querySelector('.text-primary').textContent = specialty;
|
| 688 |
+
const spans = card.querySelectorAll('.text-gray-600 span');
|
| 689 |
+
spans[0].textContent = facility;
|
| 690 |
+
spans[1].textContent = address;
|
| 691 |
+
spans[2].textContent = `Floor ${floor}, Office ${office}`;
|
| 692 |
+
}
|
| 693 |
+
|
| 694 |
+
// Close modal
|
| 695 |
+
document.getElementById('edit-doctor-modal').classList.add('hidden');
|
| 696 |
+
|
| 697 |
+
// Show success message (could be enhanced)
|
| 698 |
+
alert('Doctor information updated successfully!');
|
| 699 |
+
});
|
| 700 |
+
|
| 701 |
document.addEventListener('DOMContentLoaded', function() {
|
| 702 |
animateValue("appointment-counter", 0, 142, 1500);
|
| 703 |
});
|