update,
This commit is contained in:
@@ -0,0 +1,191 @@
|
||||
<%@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>Student Area | Attendance</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>
|
||||
<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="Student" active="attendance" />
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<!-- Website Overview -->
|
||||
<!-- Latest Users -->
|
||||
<div class="card">
|
||||
<div class="card-header main-color-bg">
|
||||
<h5 class="card-title">Attendance</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: "Student_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>
|
||||
|
143
_resources/it114105/itp4511/Assignment/web/student/dashboard.jsp
Normal file
143
_resources/it114105/itp4511/Assignment/web/student/dashboard.jsp
Normal file
@@ -0,0 +1,143 @@
|
||||
<%@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>Student 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">
|
||||
<div class="list-group">
|
||||
<%@taglib uri="/WEB-INF/tlds/nav-taglib.tld" prefix="nav" %>
|
||||
<nav:showNav role="Student" active="dashboard" />
|
||||
</div>
|
||||
</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>Class</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>
|
||||
|
Reference in New Issue
Block a user