diff --git a/Desktop/organchain-main/organchain-main/TransplantChain-Organ_Donation_Application-main/src/admin-dashboard-script.js b/Desktop/organchain-main/organchain-main/TransplantChain-Organ_Donation_Application-main/src/admin-dashboard-script.js index 569207e..bdd3466 100644 --- a/Desktop/organchain-main/organchain-main/TransplantChain-Organ_Donation_Application-main/src/admin-dashboard-script.js +++ b/Desktop/organchain-main/organchain-main/TransplantChain-Organ_Donation_Application-main/src/admin-dashboard-script.js @@ -67,7 +67,7 @@ function renderPatients(list) { const tbody = document.getElementById('patientTableBody'); document.getElementById('tableCount').textContent = '(' + list.length + ')'; if (list.length === 0) { tbody.innerHTML = 'No results found.'; return; } - tbody.innerHTML = list.map(p => { + tbody.innerHTML = (list ?? []).map(p => { const roleColor = p.role === 'DONOR' ? 'bg-emerald-50 text-emerald-700 border-emerald-200' : 'bg-blue-50 text-blue-700 border-blue-200'; const hla = p.hlaMarkers ? p.hlaMarkers.split(',').slice(0, 3).join(', ') : '—'; const hospName = p.hospitalName || p.hospitalId || '—'; @@ -236,7 +236,7 @@ function openMatchModal() { function closeMatchModal() { document.getElementById('matchModal').classList.add('hidden'); } function runMatching() { - const donorId = parseInt(document.getElementById('donorSelect').value); + const donorId = parseInt(document.getElementById('donorSelect', 10).value); if (!donorId) { document.getElementById('matchResults').classList.add('hidden'); document.getElementById('matchPlaceholder').classList.remove('hidden'); return; } const donor = allPledges.find(p => p.id === donorId); if (!donor) return; diff --git a/Desktop/organchain-main/organchain-main/Version_1_Frontend/src/admin-dashboard-script.js b/Desktop/organchain-main/organchain-main/Version_1_Frontend/src/admin-dashboard-script.js index 569207e..bdd3466 100644 --- a/Desktop/organchain-main/organchain-main/Version_1_Frontend/src/admin-dashboard-script.js +++ b/Desktop/organchain-main/organchain-main/Version_1_Frontend/src/admin-dashboard-script.js @@ -67,7 +67,7 @@ function renderPatients(list) { const tbody = document.getElementById('patientTableBody'); document.getElementById('tableCount').textContent = '(' + list.length + ')'; if (list.length === 0) { tbody.innerHTML = 'No results found.'; return; } - tbody.innerHTML = list.map(p => { + tbody.innerHTML = (list ?? []).map(p => { const roleColor = p.role === 'DONOR' ? 'bg-emerald-50 text-emerald-700 border-emerald-200' : 'bg-blue-50 text-blue-700 border-blue-200'; const hla = p.hlaMarkers ? p.hlaMarkers.split(',').slice(0, 3).join(', ') : '—'; const hospName = p.hospitalName || p.hospitalId || '—'; @@ -236,7 +236,7 @@ function openMatchModal() { function closeMatchModal() { document.getElementById('matchModal').classList.add('hidden'); } function runMatching() { - const donorId = parseInt(document.getElementById('donorSelect').value); + const donorId = parseInt(document.getElementById('donorSelect', 10).value); if (!donorId) { document.getElementById('matchResults').classList.add('hidden'); document.getElementById('matchPlaceholder').classList.remove('hidden'); return; } const donor = allPledges.find(p => p.id === donorId); if (!donor) return;