This commit is contained in:
louiscklaw
2025-02-01 01:58:47 +08:00
parent b3da7aaef5
commit 04dbefcbaf
1259 changed files with 280657 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
<%--
Document : dashboard
Created on : 2019/11/11, 下午 10:08:39
Author : JerryKwok
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="system.bean.ClassBean, java.util.ArrayList"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Teacher Area | Attendance</title>
<!-- Bootstrap core CSS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<link href="../css/bootstrap.css" rel="stylesheet">
<link href="../css/style.css" rel="stylesheet">
</head>
<body>
<jsp:include page="../header.jsp"></jsp:include>
<section id="main">
<div class="container">
<div class="row">
<div class="col-lg-3">
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
<nav:showNav role="Teacher" active="attendance" />
</div>
<div class="col-lg-9">
<!-- Main -->
<div class="card">
<div class="card-header main-color-bg">
<h5 class="card-title">Class</h5>
</div>
<div class="card-body">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Class</th>
<th scope="col"> </th>
<th scope="col">Head</th>
</tr>
</thead>
<tbody>
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
<%
for (ClassBean classVal : classList) {
out.print("<tr data-href=\"attendance?class=" + classVal.getClassName() + "\">");
out.print("<td colspan=2>" + classVal.getClassName() + "</td>");
out.print("<td>" + classVal.getTeacherBean().getTeacherFormalName() + "</td>");
out.print("</tr>");
}
%>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
<br><br>
<footer></footer>
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script>
$(document).ready(function () {
$("tr[data-href]").click(function () {
window.location.href = $(this).attr("data-href");
})
});
</script>
</body>
</html>

View File

@@ -0,0 +1,176 @@
<%--
Document : dashboard
Created on : 2019/11/11, 下午 10:08:39
Author : JerryKwok
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="system.bean.ClassBean, system.bean.AttendBean, java.util.ArrayList, java.util.Date, java.text.SimpleDateFormat"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Teacher Area | Attendance</title>
<!-- Bootstrap core CSS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<link href="../css/bootstrap.css" rel="stylesheet">
<link href="../css/bootstrap-datepicker.min.css" rel="stylesheet">
<link href="../css/style.css" rel="stylesheet">
</head>
<%!
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
%>
<%
String urlForm = "attendance?";
String urlDate = request.getParameter("date");
String urlClass = request.getParameter("class");
if (urlDate != null) {
urlForm += ("date=" + urlDate + "&");
}
if (urlDate != null) {
urlForm += ("class=" + urlClass);
}
%>
<body>
<jsp:include page="../header.jsp"></jsp:include>
<section id="main">
<div class="container">
<div class="row">
<div class="col-lg-3">
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
<nav:showNav role="Teacher" active="attendance" />
</div>
<div class="col-lg-9">
<%
if (request.getAttribute("message") != null) {
out.print("<div class='alert alert-success alert-dismissible fade show' role='alert'>");
out.print("<strong>Attendance Saved</strong>");
out.print("<button type='button' class='close' data-dismiss='alert' aria-label='Close'>");
out.print("<span aria-hidden='true'>&times;</span></button></div>");
}
%>
<!-- Main -->
<div class="card">
<div class="card-header main-color-bg">
<h5 class="card-title">Select Date</h5>
</div>
<form action="attendance" method="GET">
<div class="card-body">
<div class="form-group">
<label>Class</label>
<select class="form-control" name="class">
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
<%
for (ClassBean classVal : classList) {
if (request.getParameter("class").equals(classVal.getClassName())) {
out.print("<option value='" + classVal.getClassName() + "' selected>" + classVal.getClassName() + "</option>");
} else {
out.print("<option value='" + classVal.getClassName() + "'>" + classVal.getClassName() + "</option>");
}
}
%>
</select>
</div>
<div class="form-group">
<label>Select Date</label>
<div class="input-group date">
<input type="text" class="form-control" id="datepicker" name="date" value="<%= request.getParameter("date") == null ? formatter.format(date) : request.getParameter("date")%>">
<div class="input-group-addon">
<span class="glyphicon glyphicon-th"></span>
</div>
</div>
</div>
<br>
<a href="attendance">
<button type="button" class="btn btn-secondary">
Back
</button>
</a>
<button type="submit" class="btn btn-primary right">Submit</button>
</div>
</form>
</div>
<!-- Main -->
<div class="card">
<div class="card-header main-color-bg">
<h5 class="card-title">Attend List</h5>
</div>
<form action="<%= urlForm%>" method="POST">
<div class="card-body">
<div class="form-group">
<label>Class</label>
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Attend</th>
<th scope="col">Student ID</th>
<th scope="col">Student Name</th>
<th scope="col">Gender</th>
</tr>
</thead>
<tbody>
<jsp:useBean id="studentAttendList" scope="request" class="java.util.ArrayList<system.bean.AttendBean>"/>
<%
for (AttendBean student : studentAttendList) {
out.print("<tr>");
out.print("<td>");
out.print("<input type='checkbox' name='attend' value='" + student.getStBean().getId() + "'");
if (student.isAttend()) {
out.print(" checked>");
} else {
out.print(" >");
}
out.print("</td>");
out.print("<td>" + student.getStBean().getId() + "</td>");
out.print("<td>" + student.getStBean().getName() + "</td>");
out.print("<td>" + student.getStBean().getGender() + "</td>");
out.print("</tr>");
}
%>
</tbody>
</table>
</div>
<button type="submit" class="btn btn-primary float-right">Save</button>
<br><br>
<input type="hidden" name="action" value="save">
<input type="hidden" name="class" id="attendDate" value="<%= request.getParameter("class")%>">
<input type="hidden" name="date" id="class" value=" <%= request.getParameter("date") == null ? formatter.format(date) : request.getParameter("date")%>">
</div>
</form>
</div>
</div>
</div>
</section>
<br><br>
<footer></footer>
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/bootstrap-datepicker.min.js"></script>
<script>
$(document).ready(function () {
$('#datepicker').datepicker({
format: "yyyy-mm-dd",
daysOfWeekDisabled: "0,6",
daysOfWeekHighlighted: "1,2,3,4,5",
todayHighlight: true
});
});
</script>
</body>
</html>

View File

@@ -0,0 +1,141 @@
<%--
Document : dashboard
Created on : 2019/11/11, 下午 10:08:39
Author : JerryKwok
--%>
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.LectureBean, system.bean.LectureDayBean, system.bean.LectureTimeBean"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Teacher Area | Dashboard</title>
<!-- Bootstrap core CSS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<link href="../css/bootstrap.css" rel="stylesheet">
<link href="../css/style.css" rel="stylesheet">
</head>
<body>
<jsp:include page="../header.jsp"></jsp:include>
<section id="main">
<div class="container">
<div class="row">
<div class="col-lg-3">
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
<nav:showNav role="Teacher" active="dashboard" />
</div>
<div class="col-lg-9">
<!-- Website Overview -->
<div class="card">
<div class="card-header main-color-bg">
<h5 class="card-title">Overview</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6 col-sm-12">
<div class="card bg-light card-body mb-3 dash-box">
<h2><i class="material-icons">library_books</i> ${courseCount}</h2>
<h4>Lecture</h4>
</div>
</div>
<div class="col-md-6 col-sm-12">
<div class="card bg-light card-body mb-3 dash-box">
<h2> <i class="material-icons">school</i> ${studentCount}</h2>
<h4>Student</h4>
</div>
</div>
</div>
</div>
</div>
<!-- Latest Users -->
<div class="card">
<div class="card-header main-color-bg">
<h5 class="card-title">Schedule</h5>
</div>
<div class="card-body">
<jsp:useBean id="dayList" scope="request" class="java.util.ArrayList<system.bean.LectureDayBean>"/>
<jsp:useBean id="timeList" scope="request" class="java.util.ArrayList<system.bean.LectureTimeBean>"/>
<jsp:useBean id="lectureList" scope="request" class="java.util.ArrayList<system.bean.LectureBean>"/>
<table class="table table-bordered table-hover text-center">
<%
out.print("<tr>");
out.print("<th> Time </th>");
for (LectureDayBean day : dayList) {
out.print("<th>DAY " + day.getDay() + "</th>");
}
String[] schoolDays = {"A", "B", "C", "D", "E", "F"};
out.print("</tr>");
int countDay = dayList.size();
for (LectureTimeBean time : timeList) {
out.print("<tr>");
out.print("<td>" + time.getStartTime() + "-" + time.getEndTime());
int count = 0;
int countPrint = 0;
loopout:
for (String schoolDay : schoolDays) {
boolean printed = false;
System.out.println("TEST---" + schoolDay);
for (LectureBean lecture : lectureList) {
if (lecture.getTime().getStartTime().equals(time.getStartTime()) && lecture.getTime().getEndTime().equals(time.getEndTime())) {
if (lecture.getTime().isFullweek()) {
System.out.println("FullWEEK");
out.print("<td colspan='" + dayList.size() + "'>" + lecture.getLecture() + "</td>");
break loopout;
} else {
System.out.println("Lecture---" + lecture.getDay().getDay());
if (schoolDay.equalsIgnoreCase(lecture.getDay().getDay())) {
System.out.println("printed");
out.print("<td>" + lecture.getLecture() + "</td>");
printed = true;
countPrint++;
}
}
}
count++;
}
if (!printed) {
System.out.println("NOTPrintandPrintTDTD");
out.print("<td></td>");
}
if (lectureList.size() == 0) {
for (int i = dayList.size(); i > 0; i--) {
out.print("<td></td>");
}
}
}
out.print("</tr>");
}
%>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
<br><br>
<footer></footer>
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<%--
Document : isError
Created on : 2019/12/14, 下午 02:00:01
Author : JerryKwok
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>

View File

@@ -0,0 +1,82 @@
<%--
Document : dashboard
Created on : 2019/11/11, 下午 10:08:39
Author : JerryKwok
--%>
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.ClassBean"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Teacher Area | Report</title>
<!-- Bootstrap core CSS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<link href="../css/bootstrap.css" rel="stylesheet">
<link href="../css/style.css" rel="stylesheet">
</head>
<body>
<jsp:include page="../header.jsp"></jsp:include>
<section id="main">
<div class="container">
<div class="row">
<div class="col-lg-3">
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
<nav:showNav role="Teacher" active="report" />
</div>
<div class="col-lg-9">
<!-- Website Overview -->
<div class="card">
<div class="card-header main-color-bg">
<h5 class="card-title">SELECT Class to Generate Report </h5>
</div>
<div class="card-body">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Class</th>
<th scope="col"> </th>
<th scope="col">Head</th>
</tr>
</thead>
<tbody>
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
<%
for (ClassBean classVal : classList) {
out.print("<tr data-href=\"report?class=" + classVal.getClassName() + "\">");
out.print("<td colspan=2>" + classVal.getClassName() + "</td>");
out.print("<td>" + classVal.getTeacherBean().getTeacherFormalName() + "</td>");
out.print("</tr>");
}
%>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
<br>
<footer></footer>
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function () {
$("tr[data-href]").click(function () {
window.location.href = $(this).attr("data-href");
})
});
</script>
</body>
</html>

View File

@@ -0,0 +1,258 @@
<%--
Document : dashboard
Created on : 2019/11/11, 下午 10:08:39
Author : JerryKwok
--%>
<%@page import="java.util.Calendar"%>
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.ClassBean, system.bean.SemesterBean, system.bean.StudentBean"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Teacher Area | Report</title>
<!-- Bootstrap core CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<link href="../css/bootstrap.css" rel="stylesheet">
<link href="../css/style.css" rel="stylesheet">
</head>
<%
String urlStudent = "report?";
if (request.getParameter("class") != null) {
urlStudent += "class=" + request.getParameter("class") + "&";
}
if (request.getParameter("year") != null) {
urlStudent += "year=" + request.getParameter("year") + "&";
} else {
urlStudent += "year=" + Calendar.getInstance().get(Calendar.YEAR) + "&";
}
if (request.getParameter("term") != null) {
urlStudent += "term=" + request.getParameter("term") + "&";
} else {
urlStudent += "term=1&";
}
%>
<body>
<jsp:include page="../header.jsp"></jsp:include>
<section id="main">
<div class="container">
<div class="row">
<div class="col-lg-3">
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
<nav:showNav role="Teacher" active="report" />
</div>
<div class="col-lg-9">
<div class="card">
<div class="card-header main-color-bg">
<h5 class="card-title">Select Class to Generate Report</h5>
</div>
<form action="report" method="GET">
<div class="card-body">
<div class="form-group">
<label>Class</label>
<select class="form-control" name="class">
<jsp:useBean id="classList" scope="request" class="java.util.ArrayList<system.bean.ClassBean>"/>
<% for (ClassBean classVal : classList) {
if (request.getParameter("class").equals(classVal.getClassName())) {
out.print("<option value='" + classVal.getClassName() + "' selected>" + classVal.getClassName() + "</option>");
} else {
out.print("<option value='" + classVal.getClassName() + "'>" + classVal.getClassName() + "</option>");
}
}
%>
</select>
</div>
<div class="form-group">
<label>Year</label>
<select class="form-control" name="year">
<jsp:useBean id="yearList" scope="request" class="java.util.ArrayList<system.bean.SemesterBean>"/>
<%
int counter = 1;
for (SemesterBean year : yearList) {
if (counter == 1) {
out.print("<option value='" + year.getYear() + "' selected>" + year.getYear() + "</option>");
} else {
out.print("<option value='" + year.getYear() + "'>" + year.getYear() + "</option>");
}
counter++;
}
%>
</select>
</div>
<div class="form-group">
<label>Term</label>
<select class="form-control" name="term">
<jsp:useBean id="termList" scope="request" class="java.util.ArrayList<system.bean.SemesterBean>"/>
<%
int count = 1;
for (SemesterBean term : termList) {
if (count == 1) {
out.print("<option value='" + term.getTerm() + "' selected>" + term.getTerm() + " term</option>");
} else {
out.print("<option value='" + term.getTerm() + "'>" + term.getTerm() + " term</option>");
}
count++;
}
%>
</select>
</div>
<br>
<input type="hidden" name="report" id="report" value="">
<button type="button" id="btnGenReport" class="btn btn-primary right">Generate</button>
<button type="button" id="btnGenLowReport" class="btn btn-danger">Generate Low Attendance</button>
</div>
</form>
</div>
<div class="card">
<div class="card-header main-color-bg">
<h5 class="card-title"> Report </h5>
</div>
<div class="card-body">
<canvas id="reportChart" width="50px"></canvas>
Average Attendance (%): ${attendAVG}
</div>
</div>
<!-- Website Overview -->
<div class="card">
<div class="card-body">
<button type="button" id="btnExportExcel" class="btn btn-outline-info">Export Attendance Data to Excel</button>
<br><br>
<div class="form-group">
<table class="table table-hover exportExcel">
<thead>
<tr>
<th scope="col">Student ID</th>
<th scope="col">Student Name</th>
<th scope="col">Attend Rate</th>
</tr>
</thead>
<tbody>
<jsp:useBean id="studentAttendList" scope="request" class="java.util.ArrayList<system.bean.StudentBean>"/>
<%
for (StudentBean student : studentAttendList) {
out.print("<tr data-href='" + urlStudent + "studentId=" + student.getId() + "'>");
out.print("<td>" + student.getId() + "</td>");
out.print("<td>" + student.getName() + "</td>");
out.print("<td>" + student.getAttendRate() + " %</td>");
out.print("</tr>");
}
%>
</tbody>
</table>
</div>
</div>
</div>
<a href="report">
<button type="button" class="btn btn-secondary">
Back
</button>
</a>
</div>
</div>
</section>
<footer></footer>
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>
<script src="../js/jquery.tableToexcel.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function () {
$("tr[data-href]").click(function () {
window.location.href = $(this).attr("data-href");
});
$("#btnGenReport").click(function(){
$("form").submit();
});
$("#btnGenLowReport").click(function(){
$("#report").val("low");
$("form").submit();
});
$("#btnExportExcel").click(function () {
$(".exportExcel").table2excel({
exclude: ".excludeThisClass",
name: "Worksheet Name",
filename: "<%= request.getParameter("studentId") + "_Report"%>.xls", // do include extension
preserveColors: false // set to true if you want background colors and font colors preserved
});
});
});
</script>
<script>
let reportChart = document.getElementById('reportChart').getContext('2d');
Chart.defaults.global.defaultFontFamily = 'Lato';
Chart.defaults.global.defaultFontSize = 18;
Chart.defaults.global.defaultFontColor = 'black';
let massPopChart = new Chart(reportChart, {
type: 'pie', // bar, horizontalBar, pie, line, doughnut, radar, polarArea
data: {
<%
if(request.getParameter("report") != null && request.getParameter("report").equals("low"))
out.print("labels: ['Student < 39%','Student 40-49%', 'Student 50-60%']");
else
out.print("labels: ['Student < 60%', 'Student >=60%']");
%>,
datasets: [{
label: 'Population',
data: [
<%
if(request.getParameter("report") != null && request.getParameter("report").equals("low"))
out.print(request.getAttribute("numberOfStudentLowAtt") + ", " + request.getAttribute("numberOfStudentDanger") + ", " + request.getAttribute("numberOfStudentWarning"));
else
out.print(request.getAttribute("numberOfStudentNotMeetTar") + ", " + request.getAttribute("numberOfStudentMeetTar"));
%>
],
//backgroundColor:'green',
backgroundColor: [
'rgba(236, 107, 86, 0.6)',
'rgba(71, 179, 156, 0.9)',
'rgba(88,80,141,0.8)'
],
borderWidth: 1,
borderColor: '#777',
hoverBorderWidth: 3,
hoverBorderColor: '#000'
}]
},
options: {
title: {
display: true,
text: 'Meet the Attendance Target',
fontSize: 20
},
legend: {
display: true,
position: 'right',
labels: {
fontColor: '#000'
}
},
layout: {
padding: {
left: 30,
right: 0,
bottom: 0,
top: 0
}
},
tooltips: {
enabled: true
}
}
});
</script>
</body>
</html>

View File

@@ -0,0 +1,192 @@
<%@page contentType="text/html" pageEncoding="UTF-8" import="system.bean.AttendBean, system.bean.StudentBean"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Teacher Area | Report</title>
<!-- Bootstrap core CSS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<link href="../css/bootstrap.css" rel="stylesheet">
<link href="../css/style.css" rel="stylesheet">
</head>
<body>
<jsp:include page="../header.jsp"></jsp:include>
<section id="main">
<div class="container">
<div class="row">
<div class="col-lg-3">
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
<nav:showNav role="Teacher" active="report" />
</div>
<div class="col-lg-9">
<!-- Website Overview -->
<!-- Latest Users -->
<div class="card">
<div class="card-header main-color-bg">
<h5 class="card-title">Student Report</h5>
</div>
<div class="card-body">
<button type="button" id="btnExportExcel" class="btn btn-outline-info">Export Attendance Data to Excel</button>
<br><br>
<jsp:useBean id="studentDetials" scope="request" class="system.bean.StudentBean"/>
<table class="table table-borderless">
<tbody>
<tr>
<th scope="row">Student ID:</th>
<td><jsp:getProperty name="studentDetials" property="id"/></td>
</tr>
<tr>
<th scope="row">Student Name:</th>
<td><jsp:getProperty name="studentDetials" property="name"/></td>
</tr>
<tr>
<th scope="row">Gender :</th>
<td><jsp:getProperty name="studentDetials" property="gender"/></td>
</tr>
<tr>
<th scope="row">Student Email:</th>
<td><jsp:getProperty name="studentDetials" property="email"/></td>
</tr>
<tr>
<th scope="row">Birthday:</th>
<td><jsp:getProperty name="studentDetials" property="birthday"/></td>
</tr>
</tbody>
</table>
<div class="card">
<div class="card-body">
<canvas id="reportChart" width="50px"></canvas>
<table>
<tr>
<td>Total Present Day: </td>
<td> ${totalAttendDay}</td>
</tr>
<tr>
<td>Present Day: </td>
<td> ${presentDay}</td>
</tr>
<tr>
<td>Absent: </td>
<td> ${absDay}</td>
</tr>
</table>
</div>
</div>
<table class="table table-hover exportExcel">
<thead class="thead-dark">
<tr>
<th>ID</th>
<th>Date</th>
<th>Attend</th>
</tr>
</thead>
<%
int id = 1;
for (AttendBean attend : studentDetials.getAttendList()) {
out.print("<tr>");
out.print("<td>" + (id++) + "</td>");
out.print("<td>" + attend.getDate() + "</td>");
if (attend.isAttend()) {
out.print("<td><a href='#' class='badge badge-success'>Present</a></td>");
} else {
out.print("<td><a href='#' class='badge badge-danger'>Absent</a></td>");
}
out.print("</tr>");
}
%>
</table>
</div>
</div>
<a href="report?class=<%= request.getParameter("class")%>&year=<%= request.getParameter("year")%>&term=<%= request.getParameter("term")%>">
<button type="button" class="btn btn-secondary">
Back
</button>
</a>
</div>
</div>
</div>
</section>
<br><br>
<footer></footer>
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/jquery.tableToexcel.js"></script>
<script>
$(document).ready(function () {
$("#btnExportExcel").click(function () {
$(".exportExcel").table2excel({
exclude: ".excludeThisClass",
name: "Worksheet Name",
filename: "<%= request.getParameter("studentId") + "_Report"%>.xls", // do include extension
preserveColors: false // set to true if you want background colors and font colors preserved
});
});
});
let reportChart = document.getElementById('reportChart').getContext('2d');
Chart.defaults.global.defaultFontFamily = 'Lato';
Chart.defaults.global.defaultFontSize = 18;
Chart.defaults.global.defaultFontColor = 'black';
let massPopChart = new Chart(reportChart, {
type: 'pie', // bar, horizontalBar, pie, line, doughnut, radar, polarArea
data: {
labels: ['Present(%)', 'Absent(%)'],
datasets: [{
label: false,
data: [
Math.round(${presentDay/totalAttendDay*100}),
Math.round(${absDay/totalAttendDay*100})
],
//backgroundColor:'green',
backgroundColor: [
'rgba(71, 179, 156, 0.9)',
'rgba(236, 107, 86, 0.6)'
],
borderWidth: 1,
borderColor: '#777',
hoverBorderWidth: 3,
hoverBorderColor: '#000'
}]
},
options: {
title: {
display: true,
text: 'Attendance',
fontSize: 20
},
legend: {
display: true,
position: 'right',
labels: {
fontColor: '#000'
}
},
layout: {
padding: {
left: 20,
right: 0,
bottom: 0,
top: 0
}
},
tooltips: {
enabled: true
}
}
});
</script>
</body>
</html>