-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattend.html
99 lines (93 loc) · 3.9 KB
/
attend.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Attend</title>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<!--Referring to external JavaScript file-->
<script src="script.js" defer></script>
</head>
<body>
<!--Header with title and PSSCMUSM logo-->
<header>
<div class="logo">
<img src="images/logo.png" alt="Logo">
</div>
<h1>PSSCMUSM Management System</h1>
</header>
<div class="container">
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="anr.html" class="active">Attendance & Records</a></li>
<li><a href="sdm.html">Student Data Management</a></li>
<li><a href="visual.html">Data Visualization</a></li>
</ul>
<button class="logout-btn">Logout</button>
</nav>
</div>
<!-- Navigation text -->
<div class="navigation-text">
Attendance & Records > Set Up Class
</div>
<main>
<form id="dateForm" action="store_date.php" method="post">
<div class="class-setup-container">
<div class="choose-date">
<label for="class-date">Choose Class Date</label>
<input type="text" id="class-date" name="class-date">
</div>
<!-- Start Session Button -->
<div class="start-session-btn">
<button type="submit" class="start-session" disabled>Start Session</button>
</div>
</div>
</form>
<script>
$(document).ready(function() {
// Datepicker initialization
$("#class-date").datepicker({
// Set the date format to YYYY-MM-DD
dateFormat: 'yy-mm-dd',
onSelect: function(dateText) {
// Enable the start session button when a date is selected
$(".start-session").prop("disabled", false);
}
});
// "Start Session" button event handler
$(".start-session").click(function(event) {
event.preventDefault();
var classDate = $("#class-date").val();
if (!classDate) {
// Show error notification if date is not selected
alert("Must select a date first before 'Start Session'");
} else {
// Send AJAX request to clear the file
$.ajax({
url: 'clear_file.php',
type: 'POST',
data: { classDate: classDate },
success: function(response) {
// Optionally, handle the response here
$("#dateForm").submit();
},
error: function(xhr, status, error) {
console.error('Error clearing file:', error);
}
});
}
});
});
// Add event listener to the logout button
document.querySelector('.logout-btn').addEventListener('click', function() {
// Redirect to login.html
window.location.href = 'login.html';
});
</script>
</main>
</body>
</html>