Skip to content

Commit

Permalink
Fixed form
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhawesh02 committed Aug 9, 2022
1 parent 326165f commit 748f29f
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 28 deletions.
Binary file modified __pycache__/updatehosp.cpython-310.pyc
Binary file not shown.
Binary file modified __pycache__/updateorganc.cpython-310.pyc
Binary file not shown.
5 changes: 4 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
appBlueprint = Blueprint("app",__name__,template_folder='templates',static_folder='static')
app.register_blueprint(appBlueprint)

Hospital = {}


@app.route('/')
def index():
hsptalnam = [['' for _ in range(0, hosp.shape[0])] for _ in range(0, hosp.shape[0])]
Expand All @@ -20,7 +23,6 @@ def index():
for i in range (0, hosp.shape[0]):
hsptalnam[i]=hosp.iloc[i, 1]
hsptalpaz[i]=hosp.iloc[i, 2]
Hospital = {}
for i in range(len(hsptalnam)):
Hospital[hsptalnam[i]] = [hsptalpaz[i],i]
return render_template('index.html',Hospital=Hospital)
Expand Down Expand Up @@ -58,6 +60,7 @@ def test():
pasz=result['NewPass']
ema=result['NewEmail']
updatehosp.updatingdatabase(hsp, pasz, ema)

return result

@app.route('/UpdateDatabase', methods=['POST'])
Expand Down
13 changes: 7 additions & 6 deletions static/Database/hospitals.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Index,Hospital_Name,Password,Email,cornea,heart,kidney,liver,lung,pancreas
0,malin,psword,malinhosp@gmail.com,2,4,0,2,7,1
1,aspatre,helloworld,aspatrehosp@gmail.com,1,4,0,0,5,6
2,lazarett,savlives,lazaretthosp@gmail.com,3,8,2,0,0,0
3,ospedale,iloquis,ospedalehosp@gmail.com,0,0,3,4,6,2
4,ziekenhuis,medsch,ziekenhuishosp@gmail.com,0,0,0,0,0,0
Index,Hospital_Name,Password,Email,cornea,heart,kidney,liver,lung,pancreas
0,malin,psword,malinhosp@gmail.com,2,4,0,2,7,1
1,aspatre,helloworld,aspatrehosp@gmail.com,1,4,0,0,5,6
2,lazarett,savlives,lazaretthosp@gmail.com,3,8,2,0,0,0
3,ospedale,iloquis,ospedalehosp@gmail.com,0,0,3,4,6,2
4,ziekenhuis,medsch,ziekenhuishosp@gmail.com,0,0,0,0,0,0
5,asd,123,bhaweshagarwal02@gmail.com,0,0,0,0,0,0
Expand Down
4 changes: 2 additions & 2 deletions static/JavaScript/Update_DataBase_Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ function Pop() {
ListOfOrganUpdated[i] = ListOfOrgan[requireds[i].value];
}
else{
ListOfOrganUpdated[i-(2*i)] = ListOfOrgan[requireds[i].value];
ListOfOrganUpdated[i-(2*(i/3))] = ListOfOrgan[requireds[i].value];
}


}

console.log(ListOfOrganUpdated)
PopUp.style.display="flex";
}

Expand Down
19 changes: 0 additions & 19 deletions static/JavaScript/scrpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,7 @@
const SignUpBtnn = document.getElementById("SignUpBtn");
const Sinu = document.getElementsByClassName("sign-up-form")[0];

function myfunction() {

const NewhosName = document.getElementById("NewhosName").value;
const NewEmail = document.getElementById("NewEmail").value;
const NewPass = document.getElementById("NewPass").value;
const ConfiPass = document.getElementById("ConfiPass").value;

if (ConfiPass != NewPass) {
return;
}

const dict_values = {NewhosName, NewEmail,NewPass} //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:"/SignUp",
type:"POST",
contentType: "application/json",
data: JSON.stringify(s)});

}


SignUpBtnn.addEventListener("click",()=>{
Expand Down
20 changes: 20 additions & 0 deletions templates/Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,26 @@ <h3>One of us?</h3>
WrongPass.innerHTML="X Wrong Password";
}
});
function myfunction() {

const NewhosName = document.getElementById("NewhosName").value;
const NewEmail = document.getElementById("NewEmail").value;
const NewPass = document.getElementById("NewPass").value;
const ConfiPass = document.getElementById("ConfiPass").value;

if (ConfiPass != NewPass) {
return;
}

const dict_values = {NewhosName, NewEmail,NewPass} //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:"/SignUp",
type:"POST",
contentType: "application/json",
data: JSON.stringify(s)});
window.location.href-"{{url_for('index')}}"
}
</script>
</body>
</html>

0 comments on commit 748f29f

Please sign in to comment.