diff --git a/servicePoints/templates/duplicateTutor.html b/servicePoints/templates/duplicateTutor.html index 68478dca6c94b4a073f8e9d7476ec8556be7a433..0d653bd205491913131a1475eff3588b19d2dee7 100644 --- a/servicePoints/templates/duplicateTutor.html +++ b/servicePoints/templates/duplicateTutor.html @@ -10,7 +10,7 @@ You have already signed up for tutoring </p> <form action="/accounts/duplicateTutor/" method="post" enctype="multipart/form-data"> - <input type="submit" name="return" value="Return to Home" /> + <input type="submit" name="return" value="Return to Tutoring Page" /> </form> </body> </html> diff --git a/servicePoints/templates/tutor.html b/servicePoints/templates/tutor.html index 1ac13052b76beb67d3ad3daad3c5869b38eff840..3903d76d1eb2b790e159a26ca0d6de079aaeda19 100644 --- a/servicePoints/templates/tutor.html +++ b/servicePoints/templates/tutor.html @@ -1,22 +1,115 @@ <!DOCTYPE html> <html> +<style> + body {font-family: Arial, Helvetica, sans-serif;} + * {box-sizing: border-box;} + + /* Full-width input fields */ + input[type=text] { + width: 100%; + padding: 15px; + margin: 5px 0 22px 0; + display: inline-block; + border: none; + background: #f1f1f1; + } + + /* The Modal (background) */ + .modal { + display: none; /* Hidden by default */ + position: fixed; /* Stay in place */ + z-index: 1; /* Sit on top */ + left: 0; + top: 0; + width: 100%; /* Full width */ + height: 100%; /* Full height */ + overflow: auto; /* Enable scroll if needed */ + background-color: #474e5d; + padding-top: 50px; + } + + /* Modal Content/Box */ + .modal-content { + background-color: #fefefe; + margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */ + border: 1px solid #888; + width: 80%; /* Could be more or less, depending on screen size */ + } + + /* The Close Button (x) */ + .close { + position: absolute; + right: 35px; + top: 15px; + font-size: 40px; + font-weight: bold; + color: #f1f1f1; + } + + /* Add padding to container elements */ + .container { + padding: 16px; + } + + .close:hover, + .close:focus { + color: #f44336; + cursor: pointer; + } + + .su { + float: right; + } + + /* Clear floats */ + .clearfix::after { + content: ""; + clear: both; + display: table; + } +</style> + + <body> <a href="/">Home</a> <title>ServicePoints</title> - <form action="/accounts/tutorsu/" method="post" enctype="multipart/form-data"> - <p> - Full Name - <input type="text" name="username" /> - </p> - <p> - Tutuoring Subject(s): - <input type="text" name="subjects" /> - </p> - <p> - Available times - <input type="text" name="time" /> - </p> - <input type="submit" name="signup" value="sign up" /> - </form> + + <div class="su"> + <button onclick="document.getElementById('id01').style.display='block'" style="width:auto; right: 35px">Sign Up</button> + </div> + + <div id="id01" class="modal"> + <span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span> + <form class="modal-content" action="/accounts/tutorsu/" method="post"> + <div class="container"> + <h1>Sign Up</h1> + <p>Please fill in this form to sign up as a tutor.</p> + <hr> + <label for="name"><b>Full Name</b></label> + <input type="text" placeholder="Enter Full Name" name="name" required> + + <label for="subjects"><b>Tutoring Subject(s)</b></label> + <input type="text" placeholder="Enter Subject(s)" name="subjects" required> + + <label for="time"><b>Available Times</b></label> + <input type="text" placeholder="Enter Times" name="time" required> + + <div class="clearfix"> + <button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancel</button> + <button type="submit" class="signup">Sign Up</button> + </div> + </div> + </form> + </div> + + <hr> + + <h3>Username, Subject, Time, Email</h3> + <p> + {% for tutor, email_ in zip(tutors, emails) %} + <p>{{tutor.username}}, {{tutor.subject}}, {{tutor.time}}, {{email_.email}}</p> + {% endfor %} + </p> + </body> </html> diff --git a/servicePoints/views/accounts.py b/servicePoints/views/accounts.py index 7737582590e710482ac65a35dde67bba447eae61..0e404e66bfefa16c5e738adf98b3b76d2447aba2 100644 --- a/servicePoints/views/accounts.py +++ b/servicePoints/views/accounts.py @@ -237,7 +237,7 @@ def duplicateOrgName(): @servicePoints.app.route('/accounts/duplicateTutor/', methods=['GET', 'POST']) def duplicateTutor(): if flask.request.method == 'POST': - return flask.redirect(flask.url_for('tutor')) + return flask.redirect(flask.url_for('tutorsu')) context = {} return render_template('duplicateTutor.html', **context) @@ -288,8 +288,20 @@ def tutorsu(): return flask.redirect(flask.url_for('index')) - context = {} - return render_template('tutor.html', **context) + cursor = servicePoints.model.get_db() + + cur = cursor.execute("SELECT * FROM tutors") + tutors = cur.fetchall() + + username = flask.session["username"] + cur2 = cursor.execute('SELECT email FROM users WHERE ' + 'username =:who', + {"who": username}) + emails = cur2.fetchall() + + # Add database info to context + context = {"tutors": tutors, "emails": emails} + return flask.render_template("tutor.html", **context,zip=zip) @servicePoints.app.route('/accounts/submitPoints/', methods=['GET', 'POST']) def submitPoints():