Attendance/templates/admin.html

250 lines
11 KiB
HTML
Raw Normal View History

2021-09-12 02:39:09 -07:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
2021-09-24 22:31:36 -07:00
<title>Admin 管理員 - Attendance 點名</title>
2021-09-12 02:39:09 -07:00
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<link rel="stylesheet" href="/static/allpages.css">
<link rel="stylesheet" href="/static/homeroom.css">
2021-09-18 04:26:06 -07:00
<link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico" />
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-H6D61RSBHR"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-H6D61RSBHR');
</script>
2021-09-12 02:39:09 -07:00
</head>
<body>
2021-09-26 06:37:34 -07:00
<div class="showTime"><span id="showTime"></span></div>
2021-09-12 02:39:09 -07:00
<div class="container">
2021-09-18 04:26:06 -07:00
<h1 class="margin-top">Admin View | 管理頁面</h1>
<h2 class="margin-top">{{homeroomCode[0]}} {{homeroomCode[1]}}</h2>
<h2>[{{currDate}}]</h2>
2021-09-26 06:37:34 -07:00
{% if 'confirm' in absData[currDate] %}
<h2 style="color: rgb(61, 194, 0); text-align: center;">Homeroom Confirmed 班導已確認</h2>
{% else %}
<h2 style="color: red; text-align: center;">Homeroom NOT Confirmed 班導尚未確認</h2>
{% endif %}
2021-09-18 04:26:06 -07:00
<a href="/logout"><button class="btn btn-primary logout margin-top">Logout 登出</button></a>
2021-09-12 02:39:09 -07:00
<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>
<option value="">選擇年級</option>
{% for grade in homerooms %}
<option value="{{grade}}">{{grade}}</option>
{% endfor %}
</select>
</div>
<div class="col">
<select name="room" id="sel-room" class="form-select" disabled required>
<option value="">請先選擇年級</option>
</select>
</div>
<div class="col">
<select name="date" id="date" class="form-select">
{% for date in absData %}
{% if date == currDate %}
<option value="{{date}}" selected="selected">{{date}}</option>
{% else %}
<option value="{{date}}">{{date}}</option>
{% endif %}
{% endfor %}
</select>
</div>
<div class="col-1">
2021-09-18 04:26:06 -07:00
<button type="button" class="btn btn-primary" onclick="loadingAnimation()">查詢</button>
2021-09-12 02:39:09 -07:00
</div>
</div>
</form>
</div>
<div class="col">
2021-09-14 07:55:11 -07:00
<div class="sticky-top" style="background-color: white;">
<div class="row title">
2021-09-18 07:04:31 -07:00
<div class="col">班級</div>
<div class="col">座號</div>
<div class="col">姓名</div>
<div class="col">英文姓名</div>
{% for p in periods %}
<div class="col">{{p}}</div>
{% endfor %}
2021-09-14 07:55:11 -07:00
</div>
<div class="row title">
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
{% for i in periods %}
<div class="col">{{absData[currDate][i]['name']}}</div>
{% endfor %}
</div>
<div class="row title">
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
{% for i in periods %}
<div class="col">{{absData[currDate][i]['teacher']}}</div>
{% endfor %}
</div>
2021-09-12 02:39:09 -07:00
</div>
{% if data != None %}
{% for i in homeroomData %}
<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]['eng_name'] }}</div>
{% for j in periods %}
2021-09-18 07:04:31 -07:00
<div class="col" {% if currPeriod==j %} style="background-color: #ffdf81;" {% endif %}>
{% if 'signature' in absData[currDate][j] %}
{% if i in absData[currDate][j] %}
{% if absData[currDate][j][i] == 1 %}
2021-09-12 02:39:09 -07:00
<p class="highlightAbs n-2">X</p>
2021-09-18 07:04:31 -07:00
{% else %}
<p class="highlightAbs n-3">𝜑</p>
{% endif %}
{% else %}
{% if absData[currDate][j]['name'] != 'GP' %}
2021-09-12 02:39:09 -07:00
<p class="highlightAbs n-1">V</p>
2021-09-18 07:04:31 -07:00
{% else %}
{% if (homeroomData[i]['GP_Class'][absData[currDate][j]['teacher']] in
absData[currDate][j]['signature'])%}
2021-09-12 02:39:09 -07:00
<p class="highlightAbs n-1">V</p>
2021-09-18 07:04:31 -07:00
{% else %}
2021-09-12 02:39:09 -07:00
<p class="highlightAbs n-2"></p>
2021-09-18 07:04:31 -07:00
{% endif %}
{% endif %}
{% endif %}
{% elif absData[currDate][j]['name'] == 'GP' %}
2021-09-12 02:39:09 -07:00
<p class="highlightAbs"></p>
2021-09-18 07:04:31 -07:00
{% else %}
{% if 'confirm' in absData[currDate] %}
<p class="highlightAbs"></p>
{% else %}
2021-09-18 07:10:14 -07:00
<p class="highlightAbs"></p>
2021-09-18 07:04:31 -07:00
{% endif %}
<!-- <input type="checkbox" class="tobeform {{j}}^{{i}}"> -->
{% endif %}
2021-09-12 02:39:09 -07:00
</div>
{% endfor %}
</div>
{% endfor %}
{% endif %}
{% for c in range(periods|length + 1) %}
2021-09-14 07:55:11 -07:00
{% if c % 4 == 0 %}
2021-09-12 02:39:09 -07:00
<div class="row signatures">
{% endif %}
<div class="col half">
{% if c == 0 %}
2021-09-26 06:37:34 -07:00
<div class="row">Homeroom Teacher 導師</div>
{% if 'confirm' in absData[currDate] %}
2021-09-12 02:39:09 -07:00
<div class="row"><img src="{{absData[currDate]['confirm']}}" alt=""></div>
{% else %}
<div class="row"><span style="color:red;">No Signature 導師尚未簽名</span></div>
{% endif %}
{% else %}
2021-09-12 02:39:09 -07:00
{% if absData[currDate][periods[c-1]]['name'] == 'GP' %}
{% if 'signature' in absData[currDate][periods[c-1]] %}
{% for i in absData[currDate][periods[c-1]]['signature'] %}
2021-09-16 06:19:10 -07:00
<div class="row">{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: {{i}}:
{{absData[currDate][periods[c-1]]['names'][i]}}</div>
2021-09-14 07:55:11 -07:00
<div class="row"><img src="{{absData[currDate][periods[c-1]]['signature'][i]}}" alt=""><br>備註:
{{absData[currDate][periods[c-1]]['notes']}}</div>
2021-09-12 02:39:09 -07:00
{% endfor %}
{% else %}
<div class="row">{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['teacher']}}: No Signature
</div>
<div class="row"></div>
{% endif %}
{% else %}
<div class="row">{{periods[c-1]}}: {{absData[currDate][periods[c-1]]['name']}}:
{{absData[currDate][periods[c-1]]['teacher']}}
</div>
2021-09-14 07:55:11 -07:00
<div class="row"><img src="{{absData[currDate][periods[c-1]]['signature']}}"
alt=""><br>備註:{{absData[currDate][periods[c-1]]['notes']}}</div>
2021-09-12 02:39:09 -07:00
{% endif %}
{% endif %}
</div>
2021-09-14 07:55:11 -07:00
{% if c % 4 == 3 %}
2021-09-12 02:39:09 -07:00
</div>
{% endif %}
{% endfor %}
</div>
{% if showUpload == '1' %}
2021-09-12 02:39:09 -07:00
<div class="row margin-top">
<div class="col">
2021-09-18 04:26:06 -07:00
<h3 style="color: red;">此排 [請勿] 隨意點選</h3>
2021-09-12 02:39:09 -07:00
</div>
<div class="col">
2021-09-18 04:26:06 -07:00
<a href="/upload/1"><button class="btn btn-danger">1. Add Homeroom</button></a>
2021-09-12 02:39:09 -07:00
</div>
<div class="col">
2021-09-18 04:26:06 -07:00
<a href="/upload/2"><button class="btn btn-danger">2. Add GP Classes</button></a>
2021-09-12 02:39:09 -07:00
</div>
<div class="col">
2021-09-18 04:26:06 -07:00
<a href="/upload/3"><button class="btn btn-danger">3. Add GP Student List</button></a>
2021-09-12 02:39:09 -07:00
</div>
<div class="col">
2021-09-18 04:26:06 -07:00
<a href="/upload/4"><button class="btn btn-danger">4. Period List</button></a>
2021-09-12 02:39:09 -07:00
</div>
<div class="col">
2021-09-18 04:26:06 -07:00
<a href="/upload/dates"><button class="btn btn-warning">[WEEKLY] Dates</button></a>
2021-09-12 02:39:09 -07:00
</div>
</div>
{% endif %}
2021-09-12 02:39:09 -07:00
</div>
2021-09-12 02:44:27 -07:00
<script type="text/javascript" src="/static/jquery.min.js"></script>
2021-09-12 02:39:09 -07:00
<div id="loading" style="text-align:center; width:100%; display:none;"><img src="/static/loading.gif" alt=""
style="height:100%;" />
</div>
2021-09-24 22:31:36 -07:00
{% include 'footer.html' %}
2021-09-12 02:39:09 -07:00
<script>
var homerooms = {};
{% for i in homerooms %}
homerooms['{{i}}'] = [];
{% for j in homerooms[i] %}
homerooms['{{i}}'].push({{ j }});
{% endfor %}
{% endfor %}
console.log(homerooms)
function loadingAnimation() {
2021-09-18 04:26:06 -07:00
if ($("#sel-room").val() == "") {
alert("請選擇年級 / 班級!");
return;
}
document.getElementById('adminSelForm').submit();
2021-09-12 02:39:09 -07:00
$('.container').hide();
$('#loading').show();
}
function getHR() {
var grade = $('#sel-grade').val();
$('#sel-room').html('<option value="">請先選擇年級</option>');
if (grade === "") {
$('#sel-room').attr('disabled', 'disabled')
return
}
homerooms[grade].forEach(element => {
$('#sel-room').append(`<option value="${element}">${element}</option>`)
});
$('#sel-room').removeAttr('disabled')
}
function submitQuery() {
loadingAnimation();
document.getElementById('hrSelForm').submit();
}
</script>
2021-09-18 07:04:31 -07:00
<script src="/static/time.js"></script>
2021-09-12 02:39:09 -07:00
</body>
</html>