mirror of
https://github.com/aaronleetw/Attendance.git
synced 2024-11-14 19:11:39 -08:00
Change POST format
This commit is contained in:
parent
9ae3fd8c2a
commit
56957fdbdb
5 changed files with 97 additions and 76 deletions
6
app.py
6
app.py
|
@ -9,6 +9,12 @@ app.register_blueprint(upload)
|
|||
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY')
|
||||
|
||||
|
||||
@app.after_request
|
||||
def add_header(response):
|
||||
response.headers['SameSite'] = "Strict"
|
||||
return response
|
||||
|
||||
|
||||
@ app.route('/', methods=['GET', 'POST'])
|
||||
def index():
|
||||
if request.method == 'GET':
|
||||
|
|
14
manage.py
14
manage.py
|
@ -187,16 +187,16 @@ def manageRoot():
|
|||
return manageProcess("", "")
|
||||
|
||||
|
||||
@manage.route('/manage/date', methods=['POST'])
|
||||
def manage_date():
|
||||
return manageProcess("date", request.form['date'])
|
||||
@manage.route('/manage/date/<date>', methods=['GET'])
|
||||
def manage_date(date):
|
||||
return manageProcess("date", date)
|
||||
|
||||
|
||||
@manage.route('/manage/admin', methods=['POST'])
|
||||
def manage_admin():
|
||||
@manage.route('/manage/admin/<g>/<r>/<date>', methods=['GET'])
|
||||
def manage_admin(g, r, date):
|
||||
data = [
|
||||
request.form['grade'] + '^' + request.form['room'],
|
||||
request.form['date']
|
||||
g + '^' + r,
|
||||
date
|
||||
]
|
||||
return manageProcess("admin", data)
|
||||
|
||||
|
|
|
@ -34,8 +34,14 @@
|
|||
<h2 style="color: red; text-align: center;">Homeroom NOT Confirmed 班導尚未確認</h2>
|
||||
{% endif %}
|
||||
<a href="/logout"><button class="btn btn-primary logout margin-top">Logout 登出</button></a>
|
||||
<form action="/swapClass" method="post" id="swapClassForm" hidden>
|
||||
<input type="text" name="homeroom" value="{{homeroomCode[0]}}^{{homeroomCode[1]}}">
|
||||
<input type="text" name="date" value="{{currDate}}">
|
||||
<input type="text" name="type" value="seewindow">
|
||||
</form>
|
||||
<a href="/swapClass/{{homeroomCode[0]}}/{{homeroomCode[1]}}/{{currDate}}"><button
|
||||
class="btn btn-warning logout margin-top">Swap Classes 改、換課</button></a>
|
||||
<div class="container margin-bottom">
|
||||
<form action="/manage/admin" id="adminSelForm" method="post">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<select name="grade" id="sel-grade" class="form-select" onchange="getHR()" required>
|
||||
|
@ -62,10 +68,9 @@
|
|||
</select>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<button type="button" class="btn btn-primary" onclick="loadingAnimation()">查詢</button>
|
||||
<button type="button" class="btn btn-primary" onclick="redirAdmin()">查詢</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="sticky-top" style="background-color: white;">
|
||||
|
@ -84,7 +89,11 @@
|
|||
<div class="col"></div>
|
||||
<div class="col"></div>
|
||||
{% for i in periods %}
|
||||
<div class="col">{{absData[currDate][i]['name']}}</div>
|
||||
<div class="col">{{absData[currDate][i]['name']}}
|
||||
{% if 'changed' in absData[currDate][i] %}
|
||||
<span style="color: red;">(換)</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="row title">
|
||||
|
@ -102,7 +111,7 @@
|
|||
<div class="row">
|
||||
<div class="col">{{homeroomCode[0]}}{{homeroomCode[1]}}</div>
|
||||
<div class="col">{{i}}</div>
|
||||
<div class="col">{{ homeroomData[i]['name'] }}</div>
|
||||
<div class="col">{{ homeroomData[i]['name'] }} </div>
|
||||
<div class="col">{{ homeroomData[i]['eng_name'] }}</div>
|
||||
{% for j in periods %}
|
||||
<div class="col" {% if currPeriod==j %} style="background-color: #ffdf81;" {% endif %}>
|
||||
|
@ -222,16 +231,6 @@
|
|||
homerooms['{{i}}'].push({{ j }});
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
console.log(homerooms)
|
||||
function loadingAnimation() {
|
||||
if ($("#sel-room").val() == "") {
|
||||
alert("請選擇年級 / 班級!");
|
||||
return;
|
||||
}
|
||||
document.getElementById('adminSelForm').submit();
|
||||
$('.container').hide();
|
||||
$('#loading').show();
|
||||
}
|
||||
function getHR() {
|
||||
var grade = $('#sel-grade').val();
|
||||
$('#sel-room').html('<option value="">請先選擇年級</option>');
|
||||
|
@ -244,9 +243,19 @@
|
|||
});
|
||||
$('#sel-room').removeAttr('disabled')
|
||||
}
|
||||
function submitQuery() {
|
||||
loadingAnimation();
|
||||
document.getElementById('hrSelForm').submit();
|
||||
function redirAdmin() {
|
||||
if ($("#sel-room").val() == "") {
|
||||
alert("請選擇年級 / 班級!");
|
||||
return;
|
||||
}
|
||||
var url = "/manage/admin/" + $('#sel-grade').val() + "/" + $('#sel-room').val() + "/" + $('#date').val();
|
||||
var new_form = document.createElement('form');
|
||||
new_form.method = 'GET';
|
||||
new_form.action = url;
|
||||
document.body.appendChild(new_form);
|
||||
new_form.submit();
|
||||
$('.container').hide();
|
||||
$('#loading').show();
|
||||
}
|
||||
</script>
|
||||
<script src="/static/time.js"></script>
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
<h2>[{{currDate}}]</h2>
|
||||
<a href="/logout"><button class="btn btn-primary margin-top logout">Logout 登出</button></a>
|
||||
<a href="/select"><button class="btn btn-primary margin-top logout">Choose Subuser 選擇其他帳號</button></a>
|
||||
<form action="/manage/date" id="dateSelForm" method="post">
|
||||
<select name="date" id="date" class="form-select logout" onchange="chgDate(this);">
|
||||
<select name="date" id="date" class="form-select logout" onchange="chgDate();">
|
||||
{% for date in tmpAbsData %}
|
||||
{% if date == currDate %}
|
||||
<option value="{{date}}" selected="selected">{{date}}</option>
|
||||
|
@ -40,7 +39,6 @@
|
|||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</form>
|
||||
{% for i in absData %}
|
||||
{% set alr_fill = namespace(found=false) %}
|
||||
<form action="/manage/group_teach_publish" id="attendanceData^{{i}}" method="post">
|
||||
|
@ -202,7 +200,12 @@
|
|||
}
|
||||
function chgDate(sel) {
|
||||
loadingAnimation();
|
||||
document.getElementById('dateSelForm').submit();
|
||||
var url = '/manage/date/' + $('#date').val()
|
||||
var new_form = document.createElement('form');
|
||||
new_form.method = 'GET';
|
||||
new_form.action = url;
|
||||
document.body.appendChild(new_form);
|
||||
new_form.submit();
|
||||
}
|
||||
</script>
|
||||
<script src="/static/time.js"></script>
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
<h2>[{{currDate}}]</h2>
|
||||
<a href="/logout"><button class="btn btn-primary logout margin-top">Logout 登出</button></a>
|
||||
<a href="/select"><button class="btn btn-primary margin-top logout">Choose Subuser 選擇其他帳號</button></a>
|
||||
<form action="/manage/date" id="dateSelForm" method="post">
|
||||
<select name="date" id="date" class="form-select logout" onchange="chgDate();">
|
||||
{% for date in absData %}
|
||||
{% if date == currDate %}
|
||||
|
@ -41,7 +40,6 @@
|
|||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</form>
|
||||
<form action="/manage/homeroom_confirm" id="homeroom_confirm" method="post">
|
||||
<input type="hidden" name="date" value="{{currDate}}">
|
||||
<input type="hidden" name="homeroom" value="{{homeroomCode[0]}}^{{homeroomCode[1]}}">
|
||||
|
@ -239,7 +237,12 @@
|
|||
}
|
||||
function chgDate() {
|
||||
loadingAnimation();
|
||||
document.getElementById('dateSelForm').submit();
|
||||
var url = '/manage/date/' + $('#date').val()
|
||||
var new_form = document.createElement('form');
|
||||
new_form.method = 'GET';
|
||||
new_form.action = url;
|
||||
document.body.appendChild(new_form);
|
||||
new_form.submit();
|
||||
}
|
||||
function submitForm() {
|
||||
if (!signaturePad.isEmpty()) {
|
||||
|
|
Loading…
Reference in a new issue