-
Notifications
You must be signed in to change notification settings - Fork 0
/
Problem_Statements.php
389 lines (332 loc) · 12.2 KB
/
Problem_Statements.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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Problem Statements</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="https://use.typekit.net/ftj8drh.css">
<link rel="stylesheet" type="text/css" href="css/ps.css" />
<link rel="stylesheet" href="css/footersec.css">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://use.typekit.net/ftj8drh.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Nanum+Gothic+Coding&display=swap" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vanta/0.5.21/vanta.net.min.js"></script>
<script>
document.documentElement.className="js";
var supportsCssVars=function(){
var e,t=document.createElement("style");
t.innerHTML="root: { --tmp-var: bold; }";
document.head.appendChild(t);
e=!!(window.CSS&&window.CSS.supports&&window.CSS.supports("font-weight","var(--tmp-var)"));
t.parentNode.removeChild(t);
return e;
};
supportsCssVars()||alert("Please view this demo in a modern browser that supports CSS Variables.");
</script>
<style>
.frame{
z-index: 2;
}
.demo-1{
background: none !important;
}
</style>
</head>
<body>
<div class="demo-1">
<main>
<?php include('./resources/header.php') ?>
</main>
<!-- <div id="vanta-background" style="width: 100vw; height: 100vh;"></div> -->
<div id="vanta-background" style="width: 100vw; height: 70vh;">
<section class="total-statement totstat">
<div class="container">
<div class="row">
<div class="col-md-12 text-center mb-4">
<h2 class="heading-spacing heading">
<i>P</i>roblem <i>S</i>tatement
</h2>
</div>
</div>
<div class="row" >
<div class="col-md-12">
<div class="statement-box" >
<div class="row">
<div class="col-md-6">
<h3 class="ts">Total Statements</h3>
</div>
<div class="col-md-3">
<div class="hard statement-type">
<div class="icon-container">
<i class="fas fa-cogs"></i>
</div>
<h3>25</h3>
<p>Hardware</p>
</div>
</div>
<div class="col-md-3">
<div class="soft statement-type">
<div class="icon-container">
<i class="fas fa-laptop-code"></i>
</div>
<h3>25</h3>
<p>Software</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<div class="container mt-5">
</div>
<div class="table-section">
<div class="table-container">
<div class="col-md-12 text-center mb-4 mt-5">
<h2 class="heading-spacing pslist psl" style="">
<i>P</i>roblem <i>S</i>tatements <i>L</i>ist
</h2>
</div>
<div class="table-filter">
<!-- <div class="ideappt">
<a href="./NSCET HACKATHON 2024 - Idea PPT.pptx" download style="border-bottom: 1px solid #121212;">Idea Submission Format PPT</a>
</div> -->
<div class="category">
<h4>Category:</h4>
<select class="category-dropdown" id="category-filter">
<option value="all">All</option>
<option value="software">Software</option>
<option value="hardware">Hardware</option>
</select>
</div>
</div>
<table class="custom-table">
<thead class="custom-header">
<tr>
<th class="custom-header-cell">S.No.</th>
<th class="custom-header-cell">Problem Statement ID</th>
<th class="custom-header-cell">Problem Statement Title</th>
<th class="custom-header-cell">Category</th>
<th class="custom-header-cell">Submitted Idea(s) Count</th>
<th class="custom-header-cell">Theme</th>
</tr>
</thead>
<tbody id="table-body">
<!-- Rows will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
<!-- Pagination -->
<div class="pagination" id="pagination">
<!-- Pagination buttons will be populated by JavaScript -->
</div>
</div>
<?php include("./resources/footersec.php") ?>
<div id="problemModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<div class="modal-header">
<h2>Problem Statement Details</h2>
</div>
<div class="modal-body">
<table class="modal-table">
<tr>
<th>Problem Statement ID</th>
<td id="modal-ps-id"></td>
</tr>
<tr>
<th>Problem Statement Title</th>
<td id="modal-ps-title"></td>
</tr>
<tr>
<th>Description</th>
<td id="modal-description"></td>
</tr>
</table>
</div>
</div>
</div>
<a href="" class=" back-to-top pt-2" ><img src="./img/rocket.png" alt="" width="120px"></a>
<script src="./js/scripts.js"></script>
<!-- End of PS Section -->
<script src="js/gsap.min.js"></script>
<!-- <script type="module" src="js/index.js"></script> -->
<script>
document.addEventListener("DOMContentLoaded", function() {
VANTA.NET({
el: "#vanta-background",
mouseControls: true,
touchControls: true,
gyroControls: false,
minHeight: 200.00,
minWidth: 200.00,
scale: 1.00,
scaleMobile: 1.00,
color: 0xfffe3f,
backgroundColor: 0x0
})
})
</script>
<script>
let tableData = [];
let currentPage = 1;
const rowsPerPage = 10;
async function fetchData() {
try {
const response = await fetch('./resources/ps_fetch.php');
tableData = await response.json();
displayTable(currentPage); // Display data after fetching
} catch (error) {
console.error('Error fetching data:', error);
}
}
function displayTable(page) {
const start = (page - 1) * rowsPerPage;
const end = start + rowsPerPage;
const tableBody = document.getElementById('table-body');
tableBody.innerHTML = '';
const filteredData = filterData();
const paginatedData = filteredData.slice(start, end);
paginatedData.forEach((row, index) => {
const tr = document.createElement('tr');
tr.innerHTML = `
<td>${index + start + 1}</td>
<td>${row.ps_id}</td>
<td class="problem-title" data-description="${row.ps_description}" data-ps-id="${row.ps_id}" data-ps-title="${row.ps}">${row.ps}</td>
<td>${row.ps_type == 0 ? "Software" : "Hardware"}</td>
<td>${row.submission_count}</td>
<td>${row.ps_domain}</td>
`;
tableBody.appendChild(tr);
});
attachTitleClickEvents();
updatePagination(filteredData.length);
}
function filterData() {
const selectedCategory = document.getElementById('category-filter').value.toLowerCase();
if (selectedCategory === 'all') {
return tableData;
} else {
return tableData.filter(row => {
return row.ps_type == (selectedCategory === 'software' ? 0 : 1);
});
}
}
function attachTitleClickEvents() {
const titles = document.querySelectorAll('.problem-title');
titles.forEach(title => {
title.addEventListener('click', function() {
const description = this.getAttribute('data-description');
document.getElementById('modal-description').textContent = description;
const ps_id = this.getAttribute('data-ps-id');
document.getElementById('modal-ps-id').textContent = ps_id;
const ps_title = this.getAttribute('data-ps-title');
document.getElementById('modal-ps-title').textContent = ps_title;
openModal();
});
});
}
function openModal() {
const modal = document.getElementById('problemModal');
modal.style.display = "block";
}
function closeModal() {
const modal = document.getElementById('problemModal');
modal.style.display = "none";
}
function updatePagination(totalItems) {
const totalPages = Math.ceil(totalItems / rowsPerPage);
const paginationDiv = document.getElementById('pagination');
paginationDiv.innerHTML = '';
const prevBtn = document.createElement('button');
prevBtn.id = 'prev-btn';
prevBtn.innerText = 'Previous';
prevBtn.onclick = prevPage;
prevBtn.disabled = currentPage === 1;
paginationDiv.appendChild(prevBtn);
for (let i = 1; i <= totalPages; i++) {
const pageLink = document.createElement('span');
pageLink.innerText = i;
pageLink.className = 'page-link';
if (i === currentPage) {
pageLink.classList.add('active');
}
pageLink.onclick = () => goToPage(i);
paginationDiv.appendChild(pageLink);
}
const nextBtn = document.createElement('button');
nextBtn.id = 'next-btn';
nextBtn.innerText = 'Next';
nextBtn.onclick = nextPage;
nextBtn.disabled = currentPage === totalPages;
paginationDiv.appendChild(nextBtn);
}
function goToPage(page) {
currentPage = page;
displayTable(currentPage);
}
function prevPage() {
if (currentPage > 1) {
currentPage--;
displayTable(currentPage);
}
}
function nextPage() {
const totalPages = Math.ceil(filterData().length / rowsPerPage);
if (currentPage < totalPages) {
currentPage++;
displayTable(currentPage);
}
}
document.querySelector('.close').onclick = closeModal;
window.onclick = function(event) {
const modal = document.getElementById('problemModal');
if (event.target == modal) {
closeModal();
}
}
document.getElementById('category-filter').addEventListener('change', function() {
currentPage = 1;
displayTable(currentPage);
});
// Initial fetch and display
fetchData();
// animation H,S
document.addEventListener("DOMContentLoaded", function() {
function animateCount(element, start, end, duration) {
let startTimestamp = null;
const step = (timestamp) => {
if (!startTimestamp) startTimestamp = timestamp;
const progress = Math.min((timestamp - startTimestamp) / duration, 1);
element.innerText = Math.floor(progress * (end - start) + start);
if (progress < 1) {
window.requestAnimationFrame(step);
}
};
window.requestAnimationFrame(step);
}
const hardwareElement = document.querySelector('.hard h3');
const softwareElement = document.querySelector('.soft h3');
animateCount(hardwareElement, 0, 25, 2500);
animateCount(softwareElement, 0, 25, 2500);
});
document.getElementById('category-filter').addEventListener('change', function() {
const selectedCategory = this.value.toLowerCase(); // Get the selected category
const rows = document.querySelectorAll('#table-body tr'); // Select all rows in the table body
rows.forEach(row => {
const category = row.querySelector('td:nth-child(4)').textContent.toLowerCase();
if (selectedCategory === 'all' || category === selectedCategory) {
row.style.display = ''; // Show the row if it matches the selected category or if 'All' is selected
} else {
row.style.display = 'none'; // Hide the row if it doesn't match
}
});
});
</script>
</body>
</html>