-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ejs
199 lines (175 loc) · 6.25 KB
/
index.ejs
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
<!DOCTYPE html>
<html>
<head>
<title>Timetable</title>
<style>
/* General Styles */
body {
font-family: Arial, sans-serif;
background-color: #121212; /* Dark background */
color: #e0e0e0; /* Light text color */
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
min-height: 100vh;
}
h1 {
color: #e0e0e0; /* Light text color */
margin-bottom: 20px;
}
form {
margin-bottom: 20px;
}
label {
font-size: 16px;
margin-right: 10px;
color: #e0e0e0; /* Light text color */
}
input[type="text"] {
padding: 8px;
font-size: 16px;
border-radius: 4px;
border: 1px solid #555; /* Darker border */
background-color: #333; /* Dark input background */
color: #e0e0e0; /* Light text color */
margin-right: 10px;
}
button {
background-color: #b518d4; /* Blue color */
color: #e0e0e0; /* Light text color */
border: none;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
font-size: px;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #8715c0; /* Darker blue color */
}
/* Timetable Styles */
table {
border-collapse: collapse;
width: 80%;
margin: 20px 0;
background-color: #1e1e1e; /* Dark table background */
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.2); /* Darker shadow */
}
table, th, td {
border: 1px solid #444; /* Darker border */
}
th, td {
padding: 12px;
text-align: center;
}
th {
background-color: #333; /* Darker header background */
color: #e0e0e0; /* Light text color */
}
tr:nth-child(even) {
background-color: #282828; /* Slightly lighter row background */
}
tr:hover {
background-color: #333; /* Darker hover effect */
}
/* Responsive Design */
@media screen and (max-width: 768px) {
body {
padding: 10px;
}
table {
width: 100%;
}
input[type="text"], button {
font-size: 14px;
padding: 8px;
}
}
/* Hidden class for dropdown functionality */
.hidden {
display: none;
}
</style>
</head>
<body>
<h1>Timetable</h1>
<!-- Batch Form -->
<form action="/batch" method="get">
<label for="batch_number">Batch Number:</label>
<input type="text" id="batch_number" name="batch_number" placeholder="Enter Batch Number">
<button type="submit">View Batch Timetable</button>
</form>
<!-- Teacher Form -->
<form action="/teacher" method="get">
<label for="teacher_id">Teacher ID:</label>
<input type="text" id="teacher_id" name="teacher_id" placeholder="Enter Teacher ID">
<button type="submit">View Teacher Timetable</button>
</form>
<div>
Download CSV :
</div>
<!-- Button to download CSV -->
<a href="/download_csv" class="btn btn-primary" style="background-color: #9f1ead; color: white; text-decoration: none; padding: 10px 20px; border-radius: 4px; transition: background-color 0.3s ease;">
Download Timetable as CSV
</a>
<br>
<!-- Toggle Button for Complete Timetable -->
<button id="toggleButton">Hide Complete Timetable</button>
<!-- Complete Timetable wrapped in a div -->
<div id="timetableDiv">
<h2>Complete Timetable</h2>
<table>
<thead>
<tr>
<th>Batch</th>
<th>Teacher</th>
<th>Classroom</th>
<th>Day</th>
<th>Start Time</th>
<th>End Time</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% timetable.forEach(function(row, index) { %>
<tr>
<td><%= row.batch %></td>
<td><%= row.teacher %></td>
<td><%= row.classroom %></td>
<td><%= row.day %></td>
<td><%= row.startTime %>:00</td>
<td><%= row.endTime %>:00</td>
<td>
<form action="/delete" method="POST" style="display: inline;">
<input type="hidden" name="index" value="<%= index %>">
<button type="submit">Delete</button>
</form>
<form action="/edit" method="GET" style="display: inline;">
<input type="hidden" name="index" value="<%= index %>">
<button type="submit">Edit</button>
</form>
</td>
</tr>
<% }); %>
</tbody>
</table>
</div>
<!-- JavaScript to toggle timetable visibility -->
<script>
const toggleButton = document.getElementById('toggleButton');
const timetableDiv = document.getElementById('timetableDiv');
toggleButton.addEventListener('click', function() {
if (timetableDiv.classList.contains('hidden')) {
timetableDiv.classList.remove('hidden');
toggleButton.textContent = 'Hide Complete Timetable';
} else {
timetableDiv.classList.add('hidden');
toggleButton.textContent = 'Show Complete Timetable';
}
});
</script>
</body>
</html>