-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af57852
commit 728034d
Showing
13 changed files
with
285 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ flask-restx = "*" | |
flask-login = "*" | ||
python-dotenv = "*" | ||
pylint = "*" | ||
requests = "*" | ||
|
||
[dev-packages] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
from flask import Blueprint, render_template | ||
from flask import Blueprint, render_template, url_for, session | ||
from flask_login import login_required | ||
import requests | ||
|
||
institution_blueprint = Blueprint('institution', __name__) | ||
|
||
@institution_blueprint.route('/institution') | ||
@login_required | ||
def institution(): | ||
return render_template('institution/index.html') | ||
api_url = url_for('institution', _external=True) | ||
response = requests.get(api_url) | ||
institutions = response.json().get('institutions', []) | ||
user_id = session.get('_user_id') | ||
|
||
return render_template('institution/index.html', institutions=institutions, user_id=user_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
from flask import Blueprint, render_template | ||
from flask import Blueprint, render_template, url_for | ||
from flask_login import login_required | ||
import requests | ||
|
||
|
||
institution_account_blueprint = Blueprint('institution_account', __name__) | ||
|
||
@institution_account_blueprint.route('/account') | ||
@login_required | ||
def institution_account(): | ||
return render_template('institution_account/index.html') | ||
api_url = url_for('institution_account', _external=True) | ||
response = requests.get(api_url) | ||
accounts = response.json().get('accounts', []) | ||
|
||
return render_template('institution_account/index.html', accounts=accounts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function instituionFormSubmit(event) { | ||
event.preventDefault(); | ||
|
||
const institutionName = document.getElementById('institutionName').value; | ||
const institutionLocation = document.getElementById('institutionLocation').value; | ||
const institutionDescription = document.getElementById('institutionDescription').value; | ||
const user_id = document.getElementById('user_id').value; | ||
|
||
const data = { | ||
name: institutionName, | ||
location: institutionLocation, | ||
description: institutionDescription, | ||
user_id: user_id | ||
}; | ||
|
||
fetch('/api/institution', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(data), | ||
}) | ||
.then(response => response.json()) | ||
.then(data => { | ||
console.log('Success:', data); | ||
// redirect to the institutions page | ||
window.location.href = '/institution'; | ||
}) | ||
.catch((error) => { | ||
console.error('Error:', error); | ||
}); | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.