-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrackStatus.php
91 lines (81 loc) · 3.17 KB
/
trackStatus.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
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lato&display=swap" rel="stylesheet">
<title>Track - HackFest 2K24 - An National Level Hackathon | Erode Sengunthar Engineering College </title>
<?php include "./includes.php"; ?>
</head>
<body>
<?php include "nav.php" ?>
<section class="track">
<form method="post" id="searchForm">
<div class="input-group">
<label for="search">User ID:</label>
<div class="ip-grp">
<input type="text" name="search" id="search" placeholder="Enter Your User ID">
<button>
<i class="fa-solid fa-magnifying-glass"></i>
</button>
</div>
</div>
</form>
<div class="track-card" style="display: none;">
</div>
</section>
<script>
$("#searchForm").submit((ev) => {
ev.preventDefault();
var userID = $("#search").val();
if (userID == "") {
document.append("<span class='message error'>Please enter a valid User ID</span>");
return;
}
const icons = {
"UPLOADED": {
"icon": "fa-regular fa-clock",
"color": "var(--secondary)"
},
"UNDER REVIEW": {
"icon": "fa-regular fa-eye",
"color": "var(--warning)"
},
"ACCEPTED": {
"icon": "fa-solid fa-check",
"color": "var(--success)"
},
"REJECTED": {
"icon": "fa-solid fa-times",
"color": "var(--danger)"
}
};
$.ajax({
url: "trackPaper.php",
method: "POST",
data: {
userID: userID
},
success: (data) => {
if (data == "error") {
document.append(`<span class='message error'>No data found for the given User ID</span>`);
return;
}
console.log(data)
var res = JSON.parse(data);
var trackCard = `<div class="track-icon" style="--clr: ${icons[res.STATUS].color}">
<i class="${icons[res.STATUS].icon}"></i>
</div>
<div class="track-content">
<h2>${res.NAME}</h2>
<p>${res.PAPER_TITLE}</p>
<span>Status: <span style="--clr: ${icons[res.STATUS].color}">${res.STATUS}</span></span>
</div>`;
$(".track-card").html(trackCard);
$(".track-card").show();
}
});
});
</script>
<?php include "./footer.php"; ?>
</body>
</html>