-
Notifications
You must be signed in to change notification settings - Fork 5
/
attendance-report.php
293 lines (237 loc) · 12.3 KB
/
attendance-report.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<?php
require_once './includes/connection.php';
require_once './includes/authentication.php';
$query = "SELECT * FROM teacher_list WHERE teacher_username='" . $_SESSION['Username'] . "'";
$teacherData = $conn->query($query)->fetch_array();
if($_SESSION['userType'] == "Student") {
header("Location: student-dashboard.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="apple-touch-icon" sizes="76x76" href="./assets/img/apple-icon.png">
<link rel="icon" type="image/png" href="./assets/img/favicon.png">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>
Attendance GNDPC
</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
name='viewport' />
<!-- Fonts and icons -->
<link rel="stylesheet" type="text/css" href="./assets/css/material-icons.css" />
<link rel="stylesheet" href="./assets/css/font-awesome.min.css">
<link rel="stylesheet" href="./assets/main_styles.css">
<link rel="stylesheet" href="./assets/css/bootstrap-select.min.css">
<!-- CSS Files -->
<link href="./assets/css/material-dashboard.min.css?v=2.1.1" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="assets/css/daterangepicker.css" />
<style>
.custom-datepicker {
background: #fff !important;
cursor: pointer !important;
padding: 9px 10px !important;
border: 2px solid var(--themeColorDark) !important;
width: 100% !important;
border-radius: 4px;
margin-top: 4px;
}
</style>
<script src="./assets/js/core/jquery.min.js"></script>
<?php
include("./loader.php");
?>
</head>
<body class="">
<script>
let colorDark = localStorage.getItem("themeColorDark");
let colorLight = localStorage.getItem("themeColorLight");
if (typeof colorDark != "undefined" && colorDark != null && colorLight != "undefined" && colorLight != null) {
document.body.style.setProperty('--themeColorDark', colorDark);
document.body.style.setProperty('--themeColorLight', colorLight);
document.body.style.setProperty('--themeColorShadow', colorDark + '66');
}
</script>
<!-- LOADER -->
<div class="loader-container" style="display: flex">
<div class="loader-card">
<div class="loader"></div>
<div class="loader-text">Loading...</div>
</div>
</div>
<!-- END OF LOADER -->
<div class="modal" id="report-modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header custom_modal_header">
<h5 class="modal-title custom_modal_title">Attendance Report</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="table-container mt-4" style="position:relative;">
</div>
<div class="row justify-content-center mb-4 mx-sm-3 custom_add_form">
<button id="export_report_xlsx" class="btn btn-primary col-md-3 add_submit_button">Export
Excel</button>
<div class="col-md-1"></div>
<button id="" class="btn btn-primary col-md-3 add_submit_button">Export PDF</button>
</div>
</div>
</div>
</div>
</div>
<?php
require './includes/nav.php';
?>
<div class="wrapper ">
<div class="main-panel">
<?php
require_once './includes/header.php';
?>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 col-md-12">
<div class="card ">
<div class="card-header card-header-primary ">
<h4 class="card-title">Attendance Report</h4>
</div>
<div class="card-body">
<form id="" class="custom_add_form">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="bmd-label-floating">Select Date range
</label>
<div id="reportrange" class="custom-datepicker">
<i class="fa fa-calendar"></i>
<span></span> <i class="fa fa-caret-down"
style="float: right; margin-top: 4px;"></i>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="semester">Semester
</label>
<select class="selectpicker custom-select1 col-md-12" id="semester"
name="">
<?php
for ($i = 1; $i <= 6; $i++) {
echo "<option>" . $i . "</option>";
}
?>
</select>
</div>
</div>
</div>
<button type="button" class="btn btn-primary add_submit_button"
data-toggle="modal" data-target="#report-modal"
onclick="fetchReport()">Submit
</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
require './includes/footer.php';
?>
</div>
</div>
<!-- Core JS Files -->
<script src="./assets/js/core/popper.min.js"></script>
<script src="./assets/js/core/bootstrap-material-design.min.js"></script>
<script src="./assets/js/plugins/perfect-scrollbar.jquery.min.js"></script>
<!-- Control Center for Material Dashboard: parallax effects, scripts for the example pages etc -->
<script src="./assets/js/material-dashboard.js?v=2.1.1" type="text/javascript"></script>
<script src="assets/js/core/bootstrap-select.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<!--Table Export Excel-->
<script src="assets/js/tableExport/xlsx.core.min.js"></script>
<script src="assets/js/tableExport/Blob.min.js"></script>
<script src="assets/js/tableExport/FileSaver.min.js"></script>
<script src="assets/js/tableExport/tableexport.min.js"></script>
<script>
$(document).ready(function() {
$(".loader-container").css("display", "none");
});
function takeAttendance(el) {
window.location.href = "attendance.php?lecture=" + el.getAttribute("data-lecture") + "§ions=" + el
.getAttribute("data-section") + "&department=" + el.getAttribute("data-department") + "&semester=" + el
.getAttribute("data-semester") + "&subjectInitials=" + el.getAttribute("data-subject-initials") +
"&subject=" + encodeURIComponent(el.getAttribute("data-subject")) + "&subjectCode=" + el.getAttribute(
"data-subject-code");
}
</script>
<script>
function triggerExportExcelButton() {
var DefaultTable = document.getElementById('report-table');
new TableExport(DefaultTable, {
headers: true, // (Boolean), display table headers (th or td elements) in the <thead>, (default: true)
footers: true, // (Boolean), display table footers (th or td elements) in the <tfoot>, (default: false)
formats: ['xlsx'], // (String[]), filetype(s) for the export, (default: ['xlsx', 'csv', 'txt'])
// filename: 'id', // (id, String), filename for the downloaded file, (default: 'id')
bootstrap: false, // (Boolean), style buttons using bootstrap, (default: false)
position: 'bottom', // (top, bottom), position of the caption element relative to table, (default: 'bottom')
exportButtons: true,
ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file(s) (default: null)
ignoreCols: null, // (Number, Number[]), column indices to exclude from the exported file(s) (default: null)
ignoreCSS: '.table-ignore', // (selector, selector[]), selector(s) to exclude cells from the exported file(s) (default: '.tableexport-ignore')
emptyCSS: '.table-empty', // (selector, selector[]), selector(s) to replace cells with an empty string in the exported file(s) (default: '.tableexport-empty')
trimWhitespace: true, // (Boolean), remove all leading/trailing newlines, spaces, and tabs from cell text in the exported file(s) (default: true)
RTL: false, // (Boolean), set direction of the worksheet to right-to-left (default: false)
// sheetname: 'id' // (id, String), sheet name for the exported spreadsheet, (default: 'id')
});
}
</script>
<script type="text/javascript">
let startDate, endDate;
$(function() {
var start = moment().subtract(29, 'days');
var end = moment();
function cb(start, end) {
startDate = start._d;
endDate = end._d;
$('#reportrange span').html(start.format('MMMM D, YYYY'));
}
$('#reportrange').daterangepicker({
"singleDatePicker": true
}, cb);
cb(start, end);
});
function fetchReport() {
startDate = startDate.getFullYear() + "-" + (startDate.getMonth() + 1) + "-" + startDate.getDate();
endDate = endDate.getFullYear() + "-" + (endDate.getMonth() + 1) + "-" + endDate.getDate();
console.log(startDate, endDate);
$.ajax({
type: "POST",
url: "data-manipulation.php",
data: {
fetchReport: true,
semester: $("#semester").val(),
department: "<?php echo $teacherData['department']; ?>",
startDate: startDate,
endDate: endDate
},
success: function(response) {
$('.table-container').html(response);
triggerExportExcelButton();
}
});
}
</script>
<script src="assets/sidebarSript.js"></script>
<script>
setTimeout(function() {
document.querySelector('.cancelBtn').classList.remove('btn-default');
}, 100);
</script>
</body>
</html>