Fixed bug with unresponsive button
All checks were successful
All checks were successful
This commit is contained in:
@@ -2,9 +2,15 @@ import { openModal } from "./components/modals.js";
|
|||||||
import { getDoctors, filterDoctors, saveDoctor } from "./services/doctorServices.js";
|
import { getDoctors, filterDoctors, saveDoctor } from "./services/doctorServices.js";
|
||||||
import { createDoctorCard } from "./components/doctorCard.js";
|
import { createDoctorCard } from "./components/doctorCard.js";
|
||||||
|
|
||||||
window.onload = function () {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
loadDoctorCards();
|
const loginBtn = document.getElementById("addDocBtn");
|
||||||
};
|
if (loginBtn) {
|
||||||
|
loginBtn.addEventListener("click", () => {
|
||||||
|
openModal("addDoctor");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
loadDoctorCards();
|
||||||
|
});
|
||||||
|
|
||||||
async function loadDoctorCards() {
|
async function loadDoctorCards() {
|
||||||
try {
|
try {
|
||||||
@@ -15,6 +21,16 @@ async function loadDoctorCards() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderDoctorCards(doctors) {
|
||||||
|
const contentDiv = document.getElementById("content");
|
||||||
|
contentDiv.innerHTML = "";
|
||||||
|
|
||||||
|
doctors.forEach(doctor => {
|
||||||
|
const card = createDoctorCard(doctor);
|
||||||
|
contentDiv.appendChild(card);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
window.adminAddDoctor = async function() {
|
window.adminAddDoctor = async function() {
|
||||||
const doctor = {
|
const doctor = {
|
||||||
"name": document.getElementById("doctorName").value,
|
"name": document.getElementById("doctorName").value,
|
||||||
|
|||||||
@@ -63,6 +63,13 @@ function attachHeaderButtonListeners() {
|
|||||||
if (signup) {
|
if (signup) {
|
||||||
signup.addEventListener('click', () => { openModal('patientSignup'); });
|
signup.addEventListener('click', () => { openModal('patientSignup'); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const addDoctor = document.getElementById("addDocBtn");
|
||||||
|
if (addDoctor) {
|
||||||
|
addDoctor.addEventListener('click', () => { openModal('addDoctor'); });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
<title>Admin Dashboard</title>
|
<title>Admin Dashboard</title>
|
||||||
<link rel="stylesheet" th:href="@{/assets/css/adminDashboard.css}">
|
<link rel="stylesheet" th:href="@{/assets/css/adminDashboard.css}">
|
||||||
<link rel="stylesheet" th:href="@{/assets/css/style.css}">
|
<link rel="stylesheet" th:href="@{/assets/css/style.css}">
|
||||||
|
<link rel="icon" type="image/png" th:href="@{/assets/images/logo/logo.png}" />
|
||||||
<script th:src="@{/js/render.js}" defer></script>
|
<script th:src="@{/js/render.js}" defer></script>
|
||||||
<script th:src="@{/js/util.js}" defer></script>
|
<script th:src="@{/js/util.js}" defer></script>
|
||||||
<script th:src="@{/js/components/header.js}" defer></script>
|
<script th:src="@{/js/components/header.js}" defer></script>
|
||||||
<script th:src="@{/js/components/footer.js}" defer></script>
|
<script th:src="@{/js/components/footer.js}" defer></script>
|
||||||
<link rel="icon" type="image/png" th:href="@{/assets/images/logo/logo.png}" />
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body onload="renderContent()">
|
<body onload="renderContent()">
|
||||||
|
|||||||
Reference in New Issue
Block a user