diff --git a/__pycache__/app.cpython-310.pyc b/__pycache__/app.cpython-310.pyc
index f3b1111..cb01f4b 100644
Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ
diff --git a/__pycache__/decorganc.cpython-310.pyc b/__pycache__/decorganc.cpython-310.pyc
index 49d08a5..4fe614d 100644
Binary files a/__pycache__/decorganc.cpython-310.pyc and b/__pycache__/decorganc.cpython-310.pyc differ
diff --git a/__pycache__/main.cpython-310.pyc b/__pycache__/main.cpython-310.pyc
index a3cbac1..ccc25cc 100644
Binary files a/__pycache__/main.cpython-310.pyc and b/__pycache__/main.cpython-310.pyc differ
diff --git a/__pycache__/updatehosp.cpython-310.pyc b/__pycache__/updatehosp.cpython-310.pyc
index 1e37498..ab59c15 100644
Binary files a/__pycache__/updatehosp.cpython-310.pyc and b/__pycache__/updatehosp.cpython-310.pyc differ
diff --git a/__pycache__/updateorganc.cpython-310.pyc b/__pycache__/updateorganc.cpython-310.pyc
index 2901053..6c01dbe 100644
Binary files a/__pycache__/updateorganc.cpython-310.pyc and b/__pycache__/updateorganc.cpython-310.pyc differ
diff --git a/app.py b/app.py
index 1373a10..c467508 100644
--- a/app.py
+++ b/app.py
@@ -7,7 +7,7 @@
import csv as csv
from csv import writer
from flask import request
-from flask import Flask, render_template, Blueprint
+from flask import Flask, render_template, Blueprint,redirect, url_for
hosp=pd.read_csv('static/Database/hospitals.csv')
app=Flask(__name__)
@@ -86,7 +86,9 @@ def UpdateDatabase():
return result
-@app.route('/OrganRequest', methods=['POST'])
+orderedlist = []
+sortdist = []
+@app.route('/OrganRequest', methods=['POST','GET'])
def OrganRequest():
output = request.get_json()
print(output) # This is the output that was stored in the JSON within the browser
@@ -98,18 +100,19 @@ def OrganRequest():
sourcee=result['HospitalIndex']
organname=result['OrganName']
- orderedlist, sortdist=main.shortestsorting(int(sourcee), organname)
+ orderedlists, sortdists=main.shortestsorting(int(sourcee), organname)
+ orderedlist.append(orderedlists)
+ sortdist.append(str(sortdists))
print(orderedlist, sortdist)
return result
@app.route('/NearestHospital')
def NearestHospital():
-
- return render_template('Nearesthospital.html')
+ return render_template('Nearesthospital.html',OrderedList=orderedlist,SortList=sortdist)
if __name__ == "__main__":
- app.run(debug=True)
+ app.run(debug=False)
diff --git a/static/Database/hospitals.csv b/static/Database/hospitals.csv
index 8682244..611d6ca 100644
--- a/static/Database/hospitals.csv
+++ b/static/Database/hospitals.csv
@@ -1,6 +1,6 @@
Index,Hospital_Name,Password,Email,cornea,heart,kidney,liver,lung,pancreas
0,malin,psword,malinhosp@gmail.com,0,3,0,3,1,0
-1,aspatre,helloworld,aspatrehosp@gmail.com,0,3,0,0,0,3
-2,lazarett,savlives,lazaretthosp@gmail.com,1,10,2,0,0,0
-3,ospedale,iloquis,ospedalehosp@gmail.com,0,0,3,4,6,0
+1,aspatre,helloworld,aspatrehosp@gmail.com,0,0,0,9,10,1
+2,lazarett,savlives,lazaretthosp@gmail.com,0,0,0,0,0,0
+3,ospedale,iloquis,ospedalehosp@gmail.com,0,0,0,3,6,0
4,ziekenhuis,medsch,ziekenhuishosp@gmail.com,0,0,0,0,0,0
diff --git a/static/JavaScript/NearesHospital.js b/static/JavaScript/NearesHospital.js
index 446d386..bef9297 100644
--- a/static/JavaScript/NearesHospital.js
+++ b/static/JavaScript/NearesHospital.js
@@ -1,8 +1,26 @@
-var ListofNearbyHospital = ['malin','aspatre','lazarett','ospedale','ziekenhuis'];
-var ListOfDistance = [20,12,123,121,12];
+var ListofNearbyHospital = [];
+var ListOfDistance = [];
+
+
+
+
+
+
+
const Hospitals = document.getElementById("Hospitals");
function AddHospitals() {
- for (let index = 0; index < ListOfDistance.length; index++) {
+ OrderedList.forEach(Hos=>{
+ if (Hos[0] != undefined) {
+ ListofNearbyHospital.push(Hos[0]);
+ }
+ });
+ SortList.forEach(Hos=>{
+ if (Hos != undefined) {
+ ListOfDistance.push(Hos[1]);
+ }
+ });
+ console.log(ListofNearbyHospital.length);
+ for (let index = 0; index < ListofNearbyHospital.length; index++) {
var div = document.createElement("div");
div.setAttribute("class","card");
Hospitals.appendChild(div);
@@ -16,9 +34,9 @@ function AddHospitals() {
i.setAttribute("class","fa-solid fa-hospital");
div.appendChild(i);
var h3 = document.createElement("h3");
- h3.innerHTML="Hospital Name :
"+ListofNearbyHospital[index]+"
Distance: "+ListOfDistance[index];
+ h3.innerHTML="Hospital Name
"+ListofNearbyHospital[index]+"
Distance: "+ListOfDistance[index]+" Km";
div.appendChild(h3);
- }
+ }
const cards = document.querySelectorAll(".card");
const popup = document.getElementById("popup");
diff --git a/static/JavaScript/SelectOrgan.js b/static/JavaScript/SelectOrgan.js
index 46b374b..6152390 100644
--- a/static/JavaScript/SelectOrgan.js
+++ b/static/JavaScript/SelectOrgan.js
@@ -37,19 +37,3 @@ function getCookie(cname) {
}
return "";
}
-
-var Cards = document.querySelectorAll(".card");
-Cards.forEach(card=>{
- card.addEventListener("click",()=>{
- let HospitalIndex = getCookie("User");
- let OrganName = card.classList[1];
- console.log(OrganName);
- const dict_values = {OrganName,HospitalIndex} //Pass the javascript variables to a dictionary.
- const s = JSON.stringify(dict_values); // Stringify converts a JavaScript object or value to a JSON string
- $.ajax({
- url:"/OrganRequest",
- type:"POST",
- contentType: "application/json",
- data: JSON.stringify(s)});
- });
-});
diff --git a/tempCodeRunnerFile.py b/tempCodeRunnerFile.py
index a64f3e2..eefe778 100644
--- a/tempCodeRunnerFile.py
+++ b/tempCodeRunnerFile.py
@@ -1 +1 @@
-Request
\ No newline at end of file
+OrderedList
\ No newline at end of file
diff --git a/templates/Nearesthospital.html b/templates/Nearesthospital.html
index 0692268..6fd8ae8 100644
--- a/templates/Nearesthospital.html
+++ b/templates/Nearesthospital.html
@@ -6,6 +6,12 @@