Figured out that I can use a single endpoint for a tons of additionalPOST requests, which has opened up a lot of doors. Started to create a robust add option. Also added a template button as an idea, but need to see what's possible
This commit is contained in:
Binary file not shown.
257
app/routes.py
257
app/routes.py
@ -5,17 +5,25 @@ import re
|
||||
import os
|
||||
import glob
|
||||
from app import app
|
||||
from flask import redirect, flash, request, render_template, session, make_response
|
||||
from flask import (
|
||||
redirect,
|
||||
flash,
|
||||
request,
|
||||
render_template,
|
||||
session,
|
||||
make_response,
|
||||
url_for,
|
||||
)
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
# Global Variables
|
||||
url = "https://api.northpass.com/"
|
||||
|
||||
# Upload folder
|
||||
UPLOAD_FOLDER = '/Users/normrasmussen/Documents/Projects/CSM_webapp/app/static/files'
|
||||
UPLOAD_FOLDER = "/Users/normrasmussen/Documents/Projects/CSM_webapp/app/static/files"
|
||||
# UPLOAD_FOLDER = 'static/files'
|
||||
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
||||
ALLOWED_EXTENSIONS = {'csv'}
|
||||
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
|
||||
ALLOWED_EXTENSIONS = {"csv"}
|
||||
|
||||
|
||||
def download_csv():
|
||||
@ -25,6 +33,7 @@ def download_csv():
|
||||
download.headers["Content-Type"] = "text/csv"
|
||||
return download
|
||||
|
||||
|
||||
def key_response(response):
|
||||
if "402" in str(response):
|
||||
error = response.text
|
||||
@ -46,17 +55,19 @@ def correct_key(response):
|
||||
print(session["school"])
|
||||
return render_template("options.html", title="Options")
|
||||
|
||||
|
||||
def allowed_file(filename):
|
||||
return '.' in filename and \
|
||||
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
||||
return "." in filename and filename.rsplit(".", 1)[1].lower() in ALLOWED_EXTENSIONS
|
||||
|
||||
|
||||
@app.route("/dev", methods=["GET", "POST"])
|
||||
def dev_test():
|
||||
return render_template("options.html", title="Dev Test")
|
||||
# TODO: Remove header for main page.
|
||||
|
||||
|
||||
# DONE: Remove header for main page.
|
||||
# TODO: Leave boxes but change outcome depending if file has been uploaded.
|
||||
'''
|
||||
"""
|
||||
So create a session['file'] variable with the recently uploaded file name.
|
||||
Then, when someone clicks one of the buttons,
|
||||
after that if request == "POST",
|
||||
@ -64,7 +75,8 @@ create a secondary if statement for if file == session['file'],
|
||||
directly upload emails etc else,
|
||||
bring to the secondary pages already created and
|
||||
allow them to copy and paste.
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def ask_key():
|
||||
@ -72,58 +84,75 @@ def ask_key():
|
||||
Without this key, no other functions will work.
|
||||
It also assigns the api key to the session and clears the session upon each reload.
|
||||
"""
|
||||
if session.get('key'):
|
||||
if session.get("key"):
|
||||
return render_template("options.html", title="Options Home")
|
||||
if request.method == "POST":
|
||||
session["key"] = request.form.get("apikey")
|
||||
#if re.search(r"\s", session["key"]):
|
||||
# if re.search(r"\s", session["key"]):
|
||||
# error = "Hm. That doesn't seem right"
|
||||
# return render_template("index.html", title="Home", errors=error)
|
||||
if session["key"] is not None and len(session["key"]) > 10:
|
||||
endpoint = "/v2/properties/school"
|
||||
headers = {"accept": "application/json", "X-Api-Key": session["key"]}
|
||||
response = requests.get(url+endpoint, headers=headers)
|
||||
response = requests.get(url + endpoint, headers=headers)
|
||||
return key_response(response)
|
||||
error = "Hm. That doesn't seem right"
|
||||
return render_template("index.html", title="Home", error=error)
|
||||
|
||||
return render_template("index.html", title="Home")
|
||||
|
||||
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def render_home():
|
||||
if session.get('key'):
|
||||
if session.get("key"):
|
||||
return render_template("options.html", title="Home")
|
||||
return render_template("index.html", title="Enter Key")
|
||||
|
||||
|
||||
@app.route("/options", methods=["GET", "POST"])
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def clear_session():
|
||||
session.clear()
|
||||
return render_template("index.html", title="Home, New session")
|
||||
|
||||
|
||||
"""
|
||||
uploaded_file = request.files['file']
|
||||
if uploaded_file.filename != '':
|
||||
print("File has name")
|
||||
uploaded_file.save(uploaded_file.filename)
|
||||
return render_template("options.html", title="Home, Now with CSV!")
|
||||
"""
|
||||
|
||||
|
||||
@app.route("/csv", methods=["GET", "POST"])
|
||||
def parse_csv():
|
||||
def csv():
|
||||
print("Uploading CSV")
|
||||
csvData = pd.DataFrame()
|
||||
if request.method == 'POST':
|
||||
if 'file' not in request.files:
|
||||
flash('No file found or uploaded')
|
||||
if request.method == "POST":
|
||||
if "file" not in request.files:
|
||||
print("file not in request.files")
|
||||
flash("No file found or uploaded")
|
||||
return redirect(request.url)
|
||||
file = request.files['file']
|
||||
if file.filename == '':
|
||||
flash('No file found or uploaded')
|
||||
file = request.files["file"]
|
||||
if file.filename == "":
|
||||
print("no file exists")
|
||||
flash("No file found or uploaded")
|
||||
return redirect(request.url)
|
||||
if file and allowed_file(file.filename):
|
||||
filename = secure_filename(file.filename)
|
||||
session['file'] = filename
|
||||
file_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)
|
||||
session['filepath'] = file_path
|
||||
session["file"] = filename
|
||||
file_path = os.path.join(app.config["UPLOAD_FOLDER"], filename)
|
||||
session["filepath"] = file_path
|
||||
file.save(file_path)
|
||||
csvData = pd.read_csv(file_path, usecols = ['Email'], index_col=False)
|
||||
csvData = pd.read_csv(file_path, usecols=["Email"], index_col=False)
|
||||
html_data = csvData.to_html()
|
||||
return render_template("csv.html", table=html_data, title="Uploaded File")
|
||||
return render_template(
|
||||
"options.html", table=html_data, title="Uploaded File"
|
||||
)
|
||||
# TODO: Figure out how to delete the file after use.
|
||||
return render_template("csv.html", title="Upload")
|
||||
print("nothing happened")
|
||||
return render_template("options.html", title="Home, now with a CSV Table!")
|
||||
|
||||
|
||||
@app.route("/table")
|
||||
@ -144,7 +173,7 @@ def get_courses():
|
||||
count += 1
|
||||
endpoint = f"v2/courses?page={count}"
|
||||
headers = {"accept": "application/json", "X-Api-Key": session["key"]}
|
||||
response = requests.get(url+endpoint, headers=headers)
|
||||
response = requests.get(url + endpoint, headers=headers)
|
||||
data = response.json()
|
||||
nextlink = data["links"]
|
||||
|
||||
@ -155,11 +184,11 @@ def get_courses():
|
||||
course_dict[keys] = values
|
||||
array.append(course_dict)
|
||||
dataframe = pd.DataFrame(array).drop(
|
||||
["list_image_url", "permalink"], axis=1
|
||||
)
|
||||
["list_image_url", "permalink"], axis=1
|
||||
)
|
||||
dataframe["full_description"] = dataframe[
|
||||
"full_description"
|
||||
].str.replace(r"<[^<>]*>", "", regex=True)
|
||||
"full_description"
|
||||
].str.replace(r"<[^<>]*>", "", regex=True)
|
||||
print(dataframe)
|
||||
|
||||
if "next" not in nextlink:
|
||||
@ -171,6 +200,7 @@ def get_courses():
|
||||
else:
|
||||
return "This isn't working. Let's go our own way."
|
||||
|
||||
|
||||
@app.route("/get_people", methods=["GET", "POST"])
|
||||
def get_people():
|
||||
array = []
|
||||
@ -184,7 +214,7 @@ def get_people():
|
||||
count += 1
|
||||
endpoint = f"v2/people?page={count}"
|
||||
headers = {"accept": "application/json", "X-Api-Key": session["key"]}
|
||||
response = requests.get(url+endpoint, headers=headers)
|
||||
response = requests.get(url + endpoint, headers=headers)
|
||||
data = response.json()
|
||||
nextlink = data["links"]
|
||||
|
||||
@ -206,15 +236,16 @@ def get_people():
|
||||
else:
|
||||
return render_template("get.html", error="Something went wrong")
|
||||
|
||||
@app.route("/bulk_add_ppl_opts", methods=["GET", "POST"])
|
||||
def bulk_add_ppl_opts():
|
||||
|
||||
@app.route("/bulk_add_opts", methods=["GET", "POST"])
|
||||
def bulk_add_opts():
|
||||
array = []
|
||||
dict_response = {}
|
||||
dataframe = pd.DataFrame()
|
||||
count = 0
|
||||
|
||||
if request.method == "POST":
|
||||
if session.get('file'):
|
||||
if session.get("file"):
|
||||
print("file exists! uploading data...")
|
||||
return "File Exists! Test Complete"
|
||||
else:
|
||||
@ -222,7 +253,7 @@ def bulk_add_ppl_opts():
|
||||
count += 1
|
||||
endpoint = f"v2/groups?page={count}"
|
||||
headers = {"accept": "application/json", "X-Api-Key": session["key"]}
|
||||
response = requests.get(url+endpoint, headers=headers)
|
||||
response = requests.get(url + endpoint, headers=headers)
|
||||
data = response.json()
|
||||
nextlink = data["links"]
|
||||
|
||||
@ -232,7 +263,9 @@ def bulk_add_ppl_opts():
|
||||
for keys, values in response["attributes"].items():
|
||||
dict_response[keys] = values
|
||||
array.append(dict_response)
|
||||
dataframe = pd.DataFrame(array).drop("group_enrollment_link", axis=1)
|
||||
dataframe = pd.DataFrame(array).drop(
|
||||
"group_enrollment_link", axis=1
|
||||
)
|
||||
print(dataframe)
|
||||
|
||||
if "next" not in nextlink:
|
||||
@ -241,11 +274,12 @@ def bulk_add_ppl_opts():
|
||||
dfgroups = dataframe.to_html()
|
||||
session["dfcsv"] = dataframe.to_csv()
|
||||
return render_template(
|
||||
"bulk_add_ppl.html", table=dfgroups, titles="Bulk Add Learners"
|
||||
"bulk_add.html", table=dfgroups, titles="Bulk Add"
|
||||
)
|
||||
else:
|
||||
return "This isn't working. Let's go our own way."
|
||||
|
||||
|
||||
@app.route("/bulk_add_groups_opts", methods=["GET", "POST"])
|
||||
def bulk_add_groups_opts():
|
||||
array = []
|
||||
@ -258,7 +292,7 @@ def bulk_add_groups_opts():
|
||||
count += 1
|
||||
endpoint = f"v2/groups?page={count}"
|
||||
headers = {"accept": "application/json", "X-Api-Key": session["key"]}
|
||||
response = requests.get(url+endpoint, headers=headers)
|
||||
response = requests.get(url + endpoint, headers=headers)
|
||||
data = response.json()
|
||||
nextlink = data["links"]
|
||||
|
||||
@ -282,31 +316,105 @@ def bulk_add_groups_opts():
|
||||
else:
|
||||
return "This isn't working. Let's go our own way."
|
||||
|
||||
|
||||
@app.route("/options", methods=["GET", "POST"])
|
||||
def ppl_to_groups_opts():
|
||||
pass
|
||||
|
||||
|
||||
@app.route("/bulk_add_ppl", methods=["GET", "POST"])
|
||||
def bulk_add_ppl():
|
||||
@app.route("/bulk_add", methods=["GET", "POST"])
|
||||
def bulk_add():
|
||||
if request.method == "POST":
|
||||
emails = request.form.get("emails")
|
||||
groups = request.form.get("groups")
|
||||
emails.split(",")
|
||||
groups.split(",")
|
||||
print(emails)
|
||||
print(type(emails))
|
||||
if emails:
|
||||
if "\n" in emails:
|
||||
emails = emails.split("\n")
|
||||
emails = [email.strip() for email in emails]
|
||||
print(emails)
|
||||
print(type(emails))
|
||||
# return api_add_ppl_groups(emails, groups)
|
||||
elif "," in emails:
|
||||
emails = emails.split(",")
|
||||
emails = [email.strip() for email in emails]
|
||||
# return api_add_ppl_groups(emails, groups)
|
||||
if groups:
|
||||
if "\n" in groups:
|
||||
groups.split("\n")
|
||||
groups = [group.strip() for group in groups]
|
||||
elif "," in groups:
|
||||
groups.split(",")
|
||||
groups = [group.strip() for group in groups]
|
||||
|
||||
# print(groups)
|
||||
# print(type(groups))
|
||||
# print(emails)
|
||||
# print(type(emails))
|
||||
|
||||
return render_template('bulk_add.html')
|
||||
|
||||
|
||||
# for group in groups:
|
||||
# groupdict = {}
|
||||
groupdict["name"] = group
|
||||
|
||||
def api_add_ppl(emails):
|
||||
pass
|
||||
|
||||
|
||||
def api_add_groups(groups):
|
||||
pass
|
||||
|
||||
|
||||
def api_add_ppl_groups(emails, groups):
|
||||
if not emails:
|
||||
if not groups:
|
||||
endpoint = "v2/bulk/people"
|
||||
combinations = list(itertools.product(emails, groups))
|
||||
print(combinations)
|
||||
payload = {
|
||||
"data": {
|
||||
"attributes": {"people": [{"email": emails, "groups": groups}]}
|
||||
}
|
||||
}
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": session["key"],
|
||||
}
|
||||
response = requests.post(url + endpoint, json=payload, headers=headers)
|
||||
response = str(response)
|
||||
if "202" in response:
|
||||
error = "Success! People have been added successfully."
|
||||
return render_template(
|
||||
"bulk_add_ppl.html",
|
||||
table=session["dfgroups"],
|
||||
title="People Added",
|
||||
error=error,
|
||||
)
|
||||
elif "403" in response:
|
||||
error = "Uh oh. Looks like you don't have appropriate privileges."
|
||||
elif "422" in response:
|
||||
error = "Hm. Looks like something was wrong with the names."
|
||||
return render_template(
|
||||
"bulk_add_people.html",
|
||||
table=session["dfgroups"],
|
||||
title="People Added",
|
||||
error=error,
|
||||
)
|
||||
else:
|
||||
error = "Shrug"
|
||||
return render_template("bulk_add_ppl.html", title="Shrug", errors=error)
|
||||
endpoint = "v2/bulk/people"
|
||||
combinations = list(itertools.product(emails, groups))
|
||||
print(combinations)
|
||||
payload = {
|
||||
"data": {"attributes": {"people": [{"email": emails, "groups": groups}]}}
|
||||
}
|
||||
payload = {"data": {"attributes": {"people": [{"email": emails}]}}}
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": session["key"],
|
||||
}
|
||||
response = requests.post(url+endpoint, json=payload, headers=headers)
|
||||
response = requests.post(url + endpoint, json=payload, headers=headers)
|
||||
response = str(response)
|
||||
if "202" in response:
|
||||
error = "Success! People have been added successfully."
|
||||
@ -329,6 +437,13 @@ def bulk_add_ppl():
|
||||
else:
|
||||
error = "Shrug"
|
||||
return render_template("bulk_add_ppl.html", title="Shrug", errors=error)
|
||||
error = "No Data was Loaded. Try again, bozo."
|
||||
return render_template("bulk_add_ppl.html", title="No Data", errors=error)
|
||||
|
||||
|
||||
@app.route("/templates", methods=["GET", "POST"])
|
||||
def templates():
|
||||
pass
|
||||
|
||||
|
||||
@app.route("/bulk_add_groups", methods=["GET", "POST"])
|
||||
@ -337,10 +452,10 @@ def bulk_add_groups():
|
||||
count = 0
|
||||
if request.method == "POST":
|
||||
groups = request.form.get("groups")
|
||||
if '\n' in groups:
|
||||
groups.split('\n')
|
||||
if "\n" in groups:
|
||||
groups.split("\n")
|
||||
groups = [group.strip() for group in groups]
|
||||
elif ',' in groups:
|
||||
elif "," in groups:
|
||||
groups.split(",")
|
||||
groups = [group.strip() for group in groups]
|
||||
for group in groups:
|
||||
@ -355,7 +470,7 @@ def bulk_add_groups():
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": session["key"],
|
||||
}
|
||||
response = requests.post(url+endpoint, json=payload, headers=headers)
|
||||
response = requests.post(url + endpoint, json=payload, headers=headers)
|
||||
print(type(response))
|
||||
response = str(response)
|
||||
if "202" in response:
|
||||
@ -367,12 +482,16 @@ def bulk_add_groups():
|
||||
error=error,
|
||||
)
|
||||
elif "403" in response:
|
||||
error = [ "Uh oh. Looks like you're not the",
|
||||
"admin or don't have appropriate privileges.",
|
||||
"Please talk to your academy admin." ]
|
||||
error = [
|
||||
"Uh oh. Looks like you're not the",
|
||||
"admin or don't have appropriate privileges.",
|
||||
"Please talk to your academy admin.",
|
||||
]
|
||||
elif "422" in response:
|
||||
error = ["Hm. Looks like something was wrong with the group names.",
|
||||
"Reach out to the manager of this app."]
|
||||
error = [
|
||||
"Hm. Looks like something was wrong with the group names.",
|
||||
"Reach out to the manager of this app.",
|
||||
]
|
||||
return render_template(
|
||||
"bulk_add_groups.html",
|
||||
table=session["dfgroups"],
|
||||
@ -384,23 +503,6 @@ def bulk_add_groups():
|
||||
return render_template("bulk_add_groups.html", title="Shrug", errors=error)
|
||||
|
||||
|
||||
@app.route("/ppl_to_groups", methods=["GET", "POST"])
|
||||
def ppl_to_groups():
|
||||
person_ids = []
|
||||
group_ids = []
|
||||
endpoint = "v2/bulk/people/membership"
|
||||
payload = {
|
||||
"payload": {
|
||||
"person_ids": person_ids,
|
||||
"group_ids": group_ids,
|
||||
}
|
||||
}
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": session["key"],
|
||||
}
|
||||
|
||||
@app.route("/bulk_courses_to_groups", methods=["GET", "POST"])
|
||||
def bulk_courses_to_groups():
|
||||
pass
|
||||
@ -410,8 +512,9 @@ def bulk_courses_to_groups():
|
||||
def bulk_invite_ppl():
|
||||
pass
|
||||
|
||||
#@app.teardown_request
|
||||
#def clear_session():
|
||||
|
||||
# @app.teardown_request
|
||||
# def clear_session():
|
||||
# session.clear()
|
||||
|
||||
app.secret_key = "@&I\x1a?\xce\x94\xbb0w\x17\xbf&Y\xa2\xc2(A\xf5\xf2\x97\xba\xeb\xfa"
|
||||
|
||||
@ -151,6 +151,14 @@ li {
|
||||
padding: 8px 16px 8px 12px;
|
||||
}
|
||||
|
||||
.man-csv-opts {
|
||||
display: flex
|
||||
|
||||
}
|
||||
.csv-upload {
|
||||
align-items: right;
|
||||
}
|
||||
|
||||
.navoption {
|
||||
color: var(--background);
|
||||
text-decoration: none;
|
||||
|
||||
62
app/templates/_backup_options.html
Normal file
62
app/templates/_backup_options.html
Normal file
@ -0,0 +1,62 @@
|
||||
|
||||
{% block content %}
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="card-grid">
|
||||
|
||||
<form class="card"
|
||||
id="get_people"
|
||||
action="{{ url_for('get_people')}}"
|
||||
method="post">
|
||||
<a class="a-card"
|
||||
onclick="document.forms['get_people'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-car-line card__icon"></i>
|
||||
<p class="card__name">Get People</p>
|
||||
</a></form>
|
||||
|
||||
<form class="card"
|
||||
id="get_courses"
|
||||
action="{{ url_for('get_courses')}}"
|
||||
method="post">
|
||||
<a class="a-card"
|
||||
onclick="document.forms['get_courses'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-plane-line card__icon"></i>
|
||||
<p class="card__name">Get Courses</p>
|
||||
</a></form>
|
||||
|
||||
<form class="card"
|
||||
id="bulk_add_ppl_opts"
|
||||
action="{{ url_for('bulk_add_ppl_opts')}}"
|
||||
method="post">
|
||||
<a class="a-card"
|
||||
onclick="document.forms['bulk_add_ppl_opts'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-send-plane-line card__icon"></i>
|
||||
<p class="card__name">Bulk Add People</p>
|
||||
</a></form>
|
||||
|
||||
<form class="card"
|
||||
id="add_groups_opts"
|
||||
action="{{ url_for('bulk_add_groups_opts')}}"
|
||||
method="post">
|
||||
<a class="a-card"
|
||||
onclick="document.forms['bulk_add_groups_opts'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-shape-2-line card__icon"></i>
|
||||
<p class="card__name">Bulk Add Groups</p>
|
||||
</a></form>
|
||||
|
||||
<form class="card"
|
||||
id="ppl_to_groups_opts"
|
||||
action="{{ url_for('ppl_to_groups_opts')}}"
|
||||
method="post">
|
||||
<a class="a-card"
|
||||
onclick="document.forms['ppl_to_groups_opts'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-group-line card__icon"></i>
|
||||
<p class="card__name">Add Active People to Groups</p>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
@ -3,19 +3,25 @@
|
||||
{% include 'header.html' %}
|
||||
{% include 'logo.html' %}
|
||||
{% block content %}
|
||||
<h4>Hello! Please enter the emails below.</h4>
|
||||
<h4>Please find your options below. Some things to note:</h4>
|
||||
{% if error %}
|
||||
<p class=error><strong> </strong>{{ error }}</p>
|
||||
{% endif %}
|
||||
|
||||
<p> </p>
|
||||
<div class="man-csv-opts">
|
||||
<div class="manual-opts">
|
||||
<p><label for="Bulk Add People"> Please select the appropriate options below.</label></p>
|
||||
<form action="{{ url_for("bulk_add_ppl")}}" method="post">
|
||||
<form action="{{ url_for("bulk_add")}}" method="post">
|
||||
<p>Please Copy and Paste Emails of learners you'd like to add</p>
|
||||
<textarea id="emails" name="emails" rows="4" cols="50"></textarea>
|
||||
<p>Please paste in the Group UUIDs which these learners should be added to.</p>
|
||||
<p>Please paste in the Group Names which these learners should be added to.</p>
|
||||
<textarea id="groups" name="groups" rows="4" cols="50"></textarea>
|
||||
<p></p>
|
||||
<input type="submit" value="Submit"></input>
|
||||
</form>
|
||||
</div>
|
||||
{% include 'csv.html' %}
|
||||
</div>
|
||||
</div>
|
||||
{% include 'table.html' %}
|
||||
{% endblock %}
|
||||
@ -1,13 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<div class="csv-upload">
|
||||
<h3> If you'd like to upload a CSV. Please do so here:<h3>
|
||||
<p></p>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<form method="POST"
|
||||
action="{{ url_for('csv') }}"
|
||||
enctype="multipart/form-data">
|
||||
<p><input type="file" name="file"></p>
|
||||
<p><input type="submit" value="Submit CSV"></p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% if table %}
|
||||
{% include 'table.html' %}
|
||||
{% else %}
|
||||
<p></p>
|
||||
{% endif %}
|
||||
|
||||
@ -11,64 +11,38 @@
|
||||
</form>
|
||||
|
||||
<form class="navbutton"
|
||||
id="get_people"
|
||||
action="{{ url_for('bulk_add_ppl_opts')}}"
|
||||
id="bulk_add_opts"
|
||||
action="{{ url_for('bulk_add_opts')}}"
|
||||
method="post">
|
||||
<a class="navoption"
|
||||
onclick="document.forms['bulk_add_ppl_opts'].submit()"
|
||||
onclick="document.forms['bulk_add_opts'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-send-plane-line card__icon"></i>
|
||||
<p class="navselection">Bulk Courses</p>
|
||||
<p class="navselection">Bulk Add</p>
|
||||
</a>
|
||||
</form>
|
||||
|
||||
<form class="navbutton"
|
||||
id="get_people"
|
||||
action="{{ url_for('bulk_add_groups_opts')}}"
|
||||
method="post">
|
||||
<a class="navoption"
|
||||
onclick="document.forms['bulk_add_groups_opts'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-shape-2-line card__icon"></i>
|
||||
<p class="navselection">Bulk Courses</p>
|
||||
</a>
|
||||
</form>
|
||||
|
||||
<form class="navbutton"
|
||||
id="get_people"
|
||||
action="{{ url_for('ppl_to_groups_opts')}}"
|
||||
method="post">
|
||||
<a class="navoption"
|
||||
onclick="document.forms['ppl_to_groups_opts'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-group-line card__icon"></i>
|
||||
<p class="navselection">Bulk Courses</p>
|
||||
</a>
|
||||
</form>
|
||||
|
||||
|
||||
<form class="navbutton"
|
||||
id="get_people"
|
||||
id="bulk_courses_to_groups"
|
||||
action="{{ url_for('bulk_courses_to_groups')}}"
|
||||
method="post">
|
||||
<a class="navoption"
|
||||
onclick="document.forms['bulk_add_course_groups'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-car-line card__icon"></i>
|
||||
<p class="navselection">Bulk Courses</p>
|
||||
<p class="navselection">Add Courses</p>
|
||||
</a>
|
||||
</form>
|
||||
|
||||
<form
|
||||
class="navbutton"
|
||||
id="get_courses"
|
||||
action="{{ url_for('bulk_invite_ppl')}}"
|
||||
<form class="navbutton"
|
||||
id="templates"
|
||||
action="{{ url_for('templates')}}"
|
||||
method="post">
|
||||
<a class = "navoption"
|
||||
onclick="document.forms['bulk_invite_ppl'].submit()"
|
||||
<a class="navoption"
|
||||
onclick="document.forms['templates'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-briefcase-line card__icon"></i>
|
||||
<p class="navselection">Bulk Invite</p>
|
||||
<i class="ri-car-line card__icon"></i>
|
||||
<p class="navselection">Templates</p>
|
||||
</a>
|
||||
</form>
|
||||
|
||||
@ -77,7 +51,7 @@
|
||||
href="{{ url_for('clear_session')}}"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-scissors-line card__icon"></i>
|
||||
<p class="navselection">Clear Session</p>
|
||||
<p class="navselection">New Customer</p>
|
||||
</a>
|
||||
</form>
|
||||
|
||||
|
||||
@ -2,68 +2,15 @@
|
||||
{% extends 'head.html' %}
|
||||
{% include 'logo.html' %}
|
||||
{% include 'header.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h4>Hello! Please find the options for {{ session.school }}.</h4>
|
||||
<h2>Hello! You're currently accessing {{ session.school }}.</h2>
|
||||
<h3>You have two options here. You can click one of the options above and upload
|
||||
people/courses/groups manually. Or, you can upload a CSV, and then select one
|
||||
of the options and perform the action with the data in the CSV. Note that you
|
||||
may need specific IDs for certain tasks.
|
||||
<p></p>
|
||||
|
||||
{% include 'csv.html' %}
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="card-grid">
|
||||
|
||||
<form class="card"
|
||||
id="get_people"
|
||||
action="{{ url_for('get_people')}}"
|
||||
method="post">
|
||||
<a class="a-card"
|
||||
onclick="document.forms['get_people'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-car-line card__icon"></i>
|
||||
<p class="card__name">Get People</p>
|
||||
</a></form>
|
||||
|
||||
<form class="card"
|
||||
id="get_courses"
|
||||
action="{{ url_for('get_courses')}}"
|
||||
method="post">
|
||||
<a class="a-card"
|
||||
onclick="document.forms['get_courses'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-plane-line card__icon"></i>
|
||||
<p class="card__name">Get Courses</p>
|
||||
</a></form>
|
||||
|
||||
<form class="card"
|
||||
id="bulk_add_ppl_opts"
|
||||
action="{{ url_for('bulk_add_ppl_opts')}}"
|
||||
method="post">
|
||||
<a class="a-card"
|
||||
onclick="document.forms['bulk_add_ppl_opts'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-send-plane-line card__icon"></i>
|
||||
<p class="card__name">Bulk Add People</p>
|
||||
</a></form>
|
||||
|
||||
<form class="card"
|
||||
id="add_groups_opts"
|
||||
action="{{ url_for('bulk_add_groups_opts')}}"
|
||||
method="post">
|
||||
<a class="a-card"
|
||||
onclick="document.forms['bulk_add_groups_opts'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-shape-2-line card__icon"></i>
|
||||
<p class="card__name">Bulk Add Groups</p>
|
||||
</a></form>
|
||||
|
||||
<form class="card"
|
||||
id="ppl_to_groups_opts"
|
||||
action="{{ url_for('ppl_to_groups_opts')}}"
|
||||
method="post">
|
||||
<a class="a-card"
|
||||
onclick="document.forms['ppl_to_groups_opts'].submit()"
|
||||
style="cursor:pointer;">
|
||||
<i class="ri-group-line card__icon"></i>
|
||||
<p class="card__name">Add Active People to Groups</p>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<div class="table">
|
||||
<h4>Hello! Here are your results.</h4>
|
||||
<a id="download" href="/downloadcsv">Click here to download as CSV.</a>
|
||||
</div>
|
||||
<div class="panda-table">
|
||||
{{ table | safe }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user