Spaces:
Running
Running
complete the project by linking all functions to the database - Follow Up Deployment
Browse files- README.md +7 -5
- index.html +1418 -19
- prompts.txt +2 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: e-voting-testing
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,1418 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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device-width, initial-scale=1.0">
|
| 6 |
+
<title>Nkoranza SHTs - E-Voting System</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<script>
|
| 10 |
+
tailwind.config = {
|
| 11 |
+
theme: {
|
| 12 |
+
extend: {
|
| 13 |
+
colors: {
|
| 14 |
+
primary: {
|
| 15 |
+
DEFAULT: '#1E40AF',
|
| 16 |
+
light: '#3B82F6',
|
| 17 |
+
},
|
| 18 |
+
secondary: '#10B981',
|
| 19 |
+
accent: '#F59E0B',
|
| 20 |
+
dark: '#1F2937',
|
| 21 |
+
},
|
| 22 |
+
fontFamily: {
|
| 23 |
+
sans: ['Inter', 'sans-serif'],
|
| 24 |
+
},
|
| 25 |
+
}
|
| 26 |
+
},
|
| 27 |
+
plugins: [],
|
| 28 |
+
}
|
| 29 |
+
</script>
|
| 30 |
+
<style>
|
| 31 |
+
/* Custom CSS for elements not covered by Tailwind */
|
| 32 |
+
.auth-container {
|
| 33 |
+
background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
|
| 34 |
+
}
|
| 35 |
+
.vote-card:hover {
|
| 36 |
+
transform: translateY(-5px);
|
| 37 |
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
| 38 |
+
}
|
| 39 |
+
.pulse {
|
| 40 |
+
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
| 41 |
+
}
|
| 42 |
+
@keyframes pulse {
|
| 43 |
+
0%, 100% {
|
| 44 |
+
opacity: 1;
|
| 45 |
+
}
|
| 46 |
+
50% {
|
| 47 |
+
opacity: 0.5;
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
#loader {
|
| 51 |
+
border-top-color: #3B82F6;
|
| 52 |
+
-webkit-animation: spinner 1.5s linear infinite;
|
| 53 |
+
animation: spinner 1.5s linear infinite;
|
| 54 |
+
}
|
| 55 |
+
@-webkit-keyframes spinner {
|
| 56 |
+
0% { -webkit-transform: rotate(0deg); }
|
| 57 |
+
100% { -webkit-transform: rotate(360deg); }
|
| 58 |
+
}
|
| 59 |
+
@keyframes spinner {
|
| 60 |
+
0% { transform: rotate(0deg); }
|
| 61 |
+
100% { transform: rotate(360deg); }
|
| 62 |
+
}
|
| 63 |
+
</style>
|
| 64 |
+
</head>
|
| 65 |
+
<body class="font-sans bg-gray-50 min-h-screen">
|
| 66 |
+
<!-- App Container -->
|
| 67 |
+
<div id="app" class="min-h-screen flex flex-col">
|
| 68 |
+
<!-- Header -->
|
| 69 |
+
<header class="bg-primary text-white shadow-md">
|
| 70 |
+
<div class="container mx-auto px-4 py-4 flex justify-between items-center">
|
| 71 |
+
<div class="flex items-center space-x-2">
|
| 72 |
+
<i class="fas fa-vote-yea text-2xl"></i>
|
| 73 |
+
<h1 class="text-xl font-bold">Nkoranza SHTs E-Voting</h1>
|
| 74 |
+
</div>
|
| 75 |
+
<nav>
|
| 76 |
+
<ul class="flex space-x-6">
|
| 77 |
+
<li><a href="#home" class="hover:text-accent transition" onclick="showSection('home')">Home</a></li>
|
| 78 |
+
<li><a href="#vote" class="hover:text-accent transition" onclick="showSection('vote')">Vote</a></li>
|
| 79 |
+
<li><a href="#results" class="hover:text-accent transition" onclick="showSection('results')">Results</a></li>
|
| 80 |
+
<li id="admin-nav" class="hidden"><a href="#admin" class="hover:text-accent transition" onclick="showSection('admin')">Admin</a></li>
|
| 81 |
+
<li id="login-nav"><a href="#login" class="hover:text-accent transition" onclick="showSection('login')">Login</a></li>
|
| 82 |
+
<li id="logout-nav" class="hidden"><a href="#" class="hover:text-accent transition" onclick="logout()">Logout</a></li>
|
| 83 |
+
</ul>
|
| 84 |
+
</nav>
|
| 85 |
+
</div>
|
| 86 |
+
</header>
|
| 87 |
+
|
| 88 |
+
<!-- Main Content -->
|
| 89 |
+
<main class="flex-grow container mx-auto px-4 py-8">
|
| 90 |
+
<!-- Loader -->
|
| 91 |
+
<div id="loader-section" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center z-50">
|
| 92 |
+
<div id="loader" class="w-16 h-16 border-4 border-white border-solid rounded-full animate-spin"></div>
|
| 93 |
+
</div>
|
| 94 |
+
|
| 95 |
+
<!-- Home Section -->
|
| 96 |
+
<section id="home-section" class="max-w-4xl mx-auto">
|
| 97 |
+
<div class="text-center mb-8">
|
| 98 |
+
<h2 class="text-3xl font-bold text-dark mb-4">Welcome to Nkoranza SHTs E-Voting System</h2>
|
| 99 |
+
<p class="text-gray-600 mb-6">Cast your vote securely and conveniently for your school elections</p>
|
| 100 |
+
<div class="flex justify-center space-x-4">
|
| 101 |
+
<button onclick="showSection('vote')" class="bg-primary hover:bg-primary-light text-white px-6 py-2 rounded-lg transition">Vote Now</button>
|
| 102 |
+
<button onclick="showSection('results')" class="bg-secondary hover:bg-green-500 text-white px-6 py-2 rounded-lg transition">View Results</button>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
|
| 106 |
+
<div class="grid md:grid-cols-3 gap-6">
|
| 107 |
+
<div class="bg-white p-6 rounded-lg shadow-md">
|
| 108 |
+
<div class="text-accent mb-4 text-2xl">
|
| 109 |
+
<i class="fas fa-user-shield"></i>
|
| 110 |
+
</div>
|
| 111 |
+
<h3 class="font-bold text-lg mb-2">Secure Voting</h3>
|
| 112 |
+
<p class="text-gray-600">Our system uses advanced encryption to ensure your vote remains anonymous and secure.</p>
|
| 113 |
+
</div>
|
| 114 |
+
<div class="bg-white p-6 rounded-lg shadow-md">
|
| 115 |
+
<div class="text-accent mb-4 text-2xl">
|
| 116 |
+
<i class="fas fa-bolt"></i>
|
| 117 |
+
</div>
|
| 118 |
+
<h3 class="font-bold text-lg mb-2">Fast Results</h3>
|
| 119 |
+
<p class="text-gray-600">Get real-time election results as soon as voting ends, eliminating long waits.</p>
|
| 120 |
+
</div>
|
| 121 |
+
<div class="bg-white p-6 rounded-lg shadow-md">
|
| 122 |
+
<div class="text-accent mb-4 text-2xl">
|
| 123 |
+
<i class="fas fa-mobile-alt"></i>
|
| 124 |
+
</div>
|
| 125 |
+
<h3 class="font-bold text-lg mb-2">Mobile Friendly</h3>
|
| 126 |
+
<p class="text-gray-600">Vote from any device, whether you're using a computer, tablet, or smartphone.</p>
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
|
| 130 |
+
<div class="mt-12 bg-white p-6 rounded-lg shadow-md">
|
| 131 |
+
<h3 class="font-bold text-xl mb-4 text-center">Upcoming Elections</h3>
|
| 132 |
+
<div class="overflow-x-auto">
|
| 133 |
+
<table class="min-w-full bg-white">
|
| 134 |
+
<thead class="bg-gray-100">
|
| 135 |
+
<tr>
|
| 136 |
+
<th class="py-2 px-4 border-b">Position</th>
|
| 137 |
+
<th class="py-2 px-4 border-b">Start Date</th>
|
| 138 |
+
<th class="py-2 px-4 border-b">End Date</th>
|
| 139 |
+
<th class="py-2 px-4 border-b">Status</th>
|
| 140 |
+
</tr>
|
| 141 |
+
</thead>
|
| 142 |
+
<tbody>
|
| 143 |
+
<tr>
|
| 144 |
+
<td class="py-2 px-4 border-b text-center">SRC President</td>
|
| 145 |
+
<td class="py-2 px-4 border-b text-center">2023-06-01</td>
|
| 146 |
+
<td class="py-2 px-4 border-b text-center">2023-06-05</td>
|
| 147 |
+
<td class="py-2 px-4 border-b text-center"><span class="bg-green-100 text-green-800 px-2 py-1 rounded-full text-xs">Active</span></td>
|
| 148 |
+
</tr>
|
| 149 |
+
<tr>
|
| 150 |
+
<td class="py-2 px-4 border-b text-center">Academic Committee</td>
|
| 151 |
+
<td class="py-2 px-4 border-b text-center">2023-06-10</td>
|
| 152 |
+
<td class="py-2 px-4 border-b text-center">2023-06-12</td>
|
| 153 |
+
<td class="py-2 px-4 border-b text-center"><span class="bg-yellow-100 text-yellow-800 px-2 py-1 rounded-full text-xs">Upcoming</span></td>
|
| 154 |
+
</tr>
|
| 155 |
+
<tr>
|
| 156 |
+
<td class="py-2 px-4 border-b text-center">Sports Committee</td>
|
| 157 |
+
<td class="py-2 px-4 border-b text-center">2023-05-20</td>
|
| 158 |
+
<td class="py-2 px-4 border-b text-center">2023-05-22</td>
|
| 159 |
+
<td class="py-2 px-4 border-b text-center"><span class="bg-red-100 text-red-800 px-2 py-1 rounded-full text-xs">Ended</span></td>
|
| 160 |
+
</tr>
|
| 161 |
+
</tbody>
|
| 162 |
+
</table>
|
| 163 |
+
</div>
|
| 164 |
+
</div>
|
| 165 |
+
</section>
|
| 166 |
+
|
| 167 |
+
<!-- Login Section -->
|
| 168 |
+
<section id="login-section" class="hidden max-w-md mx-auto">
|
| 169 |
+
<div class="auth-container p-8 rounded-lg shadow-xl text-white">
|
| 170 |
+
<div class="text-center mb-8">
|
| 171 |
+
<i class="fas fa-user-lock text-4xl mb-4"></i>
|
| 172 |
+
<h2 class="text-2xl font-bold">Voter Login</h2>
|
| 173 |
+
<p class="opacity-80">Enter your credentials to access the voting system</p>
|
| 174 |
+
</div>
|
| 175 |
+
|
| 176 |
+
<form id="loginForm" class="space-y-6">
|
| 177 |
+
<div>
|
| 178 |
+
<label for="studentId" class="block mb-1">Student ID</label>
|
| 179 |
+
<input type="text" id="studentId" class="w-full px-4 py-2 rounded bg-primary-light bg-opacity-20 border border-white border-opacity-30 focus:outline-none focus:ring-2 focus:ring-accent focus:border-transparent" placeholder="NKSHT20230XX" required>
|
| 180 |
+
</div>
|
| 181 |
+
|
| 182 |
+
<div>
|
| 183 |
+
<label for="password" class="block mb-1">Password</label>
|
| 184 |
+
<input type="password" id="password" class="w-full px-4 py-2 rounded bg-primary-light bg-opacity-20 border border-white border-opacity-30 focus:outline-none focus:ring-2 focus:ring-accent focus:border-transparent" placeholder="••••••••" required>
|
| 185 |
+
</div>
|
| 186 |
+
|
| 187 |
+
<div>
|
| 188 |
+
<button type="button" onclick="authenticateUser()" class="w-full bg-accent hover:bg-yellow-600 text-white font-bold py-2 px-4 rounded transition duration-300">
|
| 189 |
+
Login
|
| 190 |
+
</button>
|
| 191 |
+
</div>
|
| 192 |
+
|
| 193 |
+
<p class="text-center text-sm opacity-80">
|
| 194 |
+
Forgot your password? Contact the electoral committee
|
| 195 |
+
</p>
|
| 196 |
+
|
| 197 |
+
<div id="login-error" class="hidden bg-red-100 border-l-4 border-red-500 text-red-700 p-3">
|
| 198 |
+
<p>Invalid credentials. Please try again.</p>
|
| 199 |
+
</div>
|
| 200 |
+
</form>
|
| 201 |
+
</div>
|
| 202 |
+
</section>
|
| 203 |
+
|
| 204 |
+
<!-- Voting Section -->
|
| 205 |
+
<section id="vote-section" class="hidden">
|
| 206 |
+
<div class="text-center mb-8">
|
| 207 |
+
<h2 class="text-3xl font-bold text-dark mb-2">Cast Your Vote</h2>
|
| 208 |
+
<p class="text-gray-600">Current Election: SRC President 2023/2024</p>
|
| 209 |
+
<div class="mt-4">
|
| 210 |
+
<span id="time-left" class="bg-primary text-white px-3 py-1 rounded-full text-sm">Time left: 2 days 4 hours</span>
|
| 211 |
+
</div>
|
| 212 |
+
</div>
|
| 213 |
+
|
| 214 |
+
<div class="max-w-4xl mx-auto">
|
| 215 |
+
<div class="bg-white rounded-lg shadow-md p-6 mb-8">
|
| 216 |
+
<h3 class="text-xl font-bold mb-4">Instructions</h3>
|
| 217 |
+
<ol class="list-decimal list-inside space-y-2 text-gray-700">
|
| 218 |
+
<li>Select your preferred candidate for each position</li>
|
| 219 |
+
<li>Review your selections before submission</li>
|
| 220 |
+
<li>Click "Submit Votes" to cast your ballot</li>
|
| 221 |
+
<li>Note: You cannot change your vote after submission</li>
|
| 222 |
+
</ol>
|
| 223 |
+
</div>
|
| 224 |
+
|
| 225 |
+
<div class="grid md:grid-cols-2 gap-6 mb-8">
|
| 226 |
+
<!-- Position 1 -->
|
| 227 |
+
<div class="bg-white rounded-lg shadow-md p-6">
|
| 228 |
+
<h3 class="text-xl font-bold mb-4 border-b pb-2">SRC President</h3>
|
| 229 |
+
<div class="space-y-4">
|
| 230 |
+
<div class="vote-card bg-gray-50 p-4 rounded-lg border border-gray-200 hover:border-primary transition duration-300 cursor-pointer" onclick="selectCandidate('president', 'candidate1')">
|
| 231 |
+
<div class="flex items-center space-x-4">
|
| 232 |
+
<div class="h-12 w-12 rounded-full bg-primary-light flex items-center justify-center text-white font-bold">AK</div>
|
| 233 |
+
<div>
|
| 234 |
+
<h4 class="font-semibold">Andrew Kwarteng</h4>
|
| 235 |
+
<p class="text-sm text-gray-600">Computer Science</p>
|
| 236 |
+
</div>
|
| 237 |
+
<div class="ml-auto">
|
| 238 |
+
<div class="h-5 w-5 border-2 border-gray-400 rounded-full flex items-center justify-center">
|
| 239 |
+
<div id="president-candidate1-check" class="h-3 w-3 bg-primary rounded-full hidden"></div>
|
| 240 |
+
</div>
|
| 241 |
+
</div>
|
| 242 |
+
</div>
|
| 243 |
+
<input type="radio" id="president-candidate1" name="president" class="hidden" value="Andrew Kwarteng">
|
| 244 |
+
</div>
|
| 245 |
+
|
| 246 |
+
<div class="vote-card bg-gray-50 p-4 rounded-lg border border-gray-200 hover:border-primary transition duration-300 cursor-pointer" onclick="selectCandidate('president', 'candidate2')">
|
| 247 |
+
<div class="flex items-center space-x-4">
|
| 248 |
+
<div class="h-12 w-12 rounded-full bg-secondary flex items-center justify-center text-white font-bold">EA</div>
|
| 249 |
+
<div>
|
| 250 |
+
<h4 class="font-semibold">Esi Amankwah</h4>
|
| 251 |
+
<p class="text-sm text-gray-600">Business Administration</p>
|
| 252 |
+
</div>
|
| 253 |
+
<div class="ml-auto">
|
| 254 |
+
<div class="h-5 w-5 border-2 border-gray-400 rounded-full flex items-center justify-center">
|
| 255 |
+
<div id="president-candidate2-check" class="h-3 w-3 bg-primary rounded-full hidden"></div>
|
| 256 |
+
</div>
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
<input type="radio" id="president-candidate2" name="president" class="hidden" value="Esi Amankwah">
|
| 260 |
+
</div>
|
| 261 |
+
|
| 262 |
+
<div class="vote-card bg-gray-50 p-4 rounded-lg border border-gray-200 hover:border-primary transition duration-300 cursor-pointer" onclick="selectCandidate('president', 'candidate3')">
|
| 263 |
+
<div class="flex items-center space-x-4">
|
| 264 |
+
<div class="h-12 w-12 rounded-full bg-accent flex items-center justify-center text-white font-bold">KB</div>
|
| 265 |
+
<div>
|
| 266 |
+
<h4 class="font-semibold">Kwame Boateng</h4>
|
| 267 |
+
<p class="text-sm text-gray-600">Electrical Engineering</p>
|
| 268 |
+
</div>
|
| 269 |
+
<div class="ml-auto">
|
| 270 |
+
<div class="h-5 w-5 border-2 border-gray-400 rounded-full flex items-center justify-center">
|
| 271 |
+
<div id="president-candidate3-check" class="h-3 w-3 bg-primary rounded-full hidden"></div>
|
| 272 |
+
</div>
|
| 273 |
+
</div>
|
| 274 |
+
</div>
|
| 275 |
+
<input type="radio" id="president-candidate3" name="president" class="hidden" value="Kwame Boateng">
|
| 276 |
+
</div>
|
| 277 |
+
</div>
|
| 278 |
+
</div>
|
| 279 |
+
|
| 280 |
+
<!-- Position 2 -->
|
| 281 |
+
<div class="bg-white rounded-lg shadow-md p-6">
|
| 282 |
+
<h3 class="text-xl font-bold mb-4 border-b pb-2">General Secretary</h3>
|
| 283 |
+
<div class="space-y-4">
|
| 284 |
+
<div class="vote-card bg-gray-50 p-4 rounded-lg border border-gray-200 hover:border-primary transition duration-300 cursor-pointer" onclick="selectCandidate('secretary', 'candidate1')">
|
| 285 |
+
<div class="flex items-center space-x-4">
|
| 286 |
+
<div class="h-12 w-12 rounded-full bg-primary-light flex items-center justify-center text-white font-bold">SA</div>
|
| 287 |
+
<div>
|
| 288 |
+
<h4 class="font-semibold">Sandra Addo</h4>
|
| 289 |
+
<p class="text-sm text-gray-600">Accounting</p>
|
| 290 |
+
</div>
|
| 291 |
+
<div class="ml-auto">
|
| 292 |
+
<div class="h-5 w-5 border-2 border-gray-400 rounded-full flex items-center justify-center">
|
| 293 |
+
<div id="secretary-candidate1-check" class="h-3 w-3 bg-primary rounded-full hidden"></div>
|
| 294 |
+
</div>
|
| 295 |
+
</div>
|
| 296 |
+
</div>
|
| 297 |
+
<input type="radio" id="secretary-candidate1" name="secretary" class="hidden" value="Sandra Addo">
|
| 298 |
+
</div>
|
| 299 |
+
|
| 300 |
+
<div class="vote-card bg-gray-50 p-4 rounded-lg border border-gray-200 hover:border-primary transition duration-300 cursor-pointer" onclick="selectCandidate('secretary', 'candidate2')">
|
| 301 |
+
<div class="flex items-center space-x-4">
|
| 302 |
+
<div class="h-12 w-12 rounded-full bg-secondary flex items-center justify-center text-white font-bold">DJ</div>
|
| 303 |
+
<div>
|
| 304 |
+
<h4 class="font-semibold">David Johnson</h4>
|
| 305 |
+
<p class="text-sm text-gray-600">Mechanical Engineering</p>
|
| 306 |
+
</div>
|
| 307 |
+
<div class="ml-auto">
|
| 308 |
+
<div class="h-5 w-5 border-2 border-gray-400 rounded-full flex items-center justify-center">
|
| 309 |
+
<div id="secretary-candidate2-check" class="h-3 w-3 bg-primary rounded-full hidden"></div>
|
| 310 |
+
</div>
|
| 311 |
+
</div>
|
| 312 |
+
</div>
|
| 313 |
+
<input type="radio" id="secretary-candidate2" name="secretary" class="hidden" value="David Johnson">
|
| 314 |
+
</div>
|
| 315 |
+
</div>
|
| 316 |
+
</div>
|
| 317 |
+
</div>
|
| 318 |
+
|
| 319 |
+
<div id="confirmation-modal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center z-50">
|
| 320 |
+
<div class="bg-white rounded-lg shadow-xl p-6 w-full max-w-md">
|
| 321 |
+
<h3 class="text-xl font-bold mb-4">Confirm Your Votes</h3>
|
| 322 |
+
<div class="mb-6">
|
| 323 |
+
<p class="font-semibold">SRC President:</p>
|
| 324 |
+
<p id="confirm-president" class="text-gray-600">Not selected</p>
|
| 325 |
+
|
| 326 |
+
<p class="font-semibold mt-3">General Secretary:</p>
|
| 327 |
+
<p id="confirm-secretary" class="text-gray-600">Not selected</p>
|
| 328 |
+
</div>
|
| 329 |
+
<div class="flex justify-end space-x-4">
|
| 330 |
+
<button onclick="document.getElementById('confirmation-modal').classList.add('hidden')" class="px-4 py-2 border border-gray-300 rounded hover:bg-gray-100 transition">Cancel</button>
|
| 331 |
+
<button onclick="submitVotes()" class="bg-primary hover:bg-primary-light text-white px-4 py-2 rounded transition">Confirm & Submit</button>
|
| 332 |
+
</div>
|
| 333 |
+
</div>
|
| 334 |
+
</div>
|
| 335 |
+
|
| 336 |
+
<div class="text-center">
|
| 337 |
+
<button id="submit-votes-btn" onclick="confirmVotes()" disabled class="bg-primary hover:bg-primary-light text-white font-bold py-3 px-8 rounded-lg transition disabled:bg-gray-400 disabled:cursor-not-allowed">
|
| 338 |
+
Submit Votes
|
| 339 |
+
</button>
|
| 340 |
+
</div>
|
| 341 |
+
</div>
|
| 342 |
+
</section>
|
| 343 |
+
|
| 344 |
+
<!-- Results Section -->
|
| 345 |
+
<section id="results-section" class="hidden max-w-4xl mx-auto">
|
| 346 |
+
<div class="text-center mb-8">
|
| 347 |
+
<h2 class="text-3xl font-bold text-dark">Election Results</h2>
|
| 348 |
+
<p class="text-gray-600">SRC Elections 2023/2024 - Final Results</p>
|
| 349 |
+
</div>
|
| 350 |
+
|
| 351 |
+
<div class="bg-white rounded-lg shadow-md p-6 mb-8">
|
| 352 |
+
<div class="flex justify-between items-center mb-6">
|
| 353 |
+
<h3 class="text-xl font-bold">SRC President</h3>
|
| 354 |
+
<div class="text-sm text-gray-500">
|
| 355 |
+
<span>Total Votes: 1,245</span>
|
| 356 |
+
<span class="ml-4">Voter Turnout: 82%</span>
|
| 357 |
+
</div>
|
| 358 |
+
</div>
|
| 359 |
+
|
| 360 |
+
<div class="space-y-4">
|
| 361 |
+
<!-- Candidate 1 -->
|
| 362 |
+
<div class="border-l-4 border-primary pl-4">
|
| 363 |
+
<div class="flex justify-between items-center mb-1">
|
| 364 |
+
<div class="font-semibold">Andrew Kwarteng - Computer Science</div>
|
| 365 |
+
<div class="font-bold">56%</div>
|
| 366 |
+
</div>
|
| 367 |
+
<div class="w-full bg-gray-200 rounded-full h-4">
|
| 368 |
+
<div class="bg-primary h-4 rounded-full" style="width: 56%"></div>
|
| 369 |
+
</div>
|
| 370 |
+
<div class="text-sm text-gray-500 mt-1">698 votes</div>
|
| 371 |
+
</div>
|
| 372 |
+
|
| 373 |
+
<!-- Candidate 2 -->
|
| 374 |
+
<div class="border-l-4 border-secondary pl-4">
|
| 375 |
+
<div class="flex justify-between items-center mb-1">
|
| 376 |
+
<div class="font-semibold">Esi Amankwah - Business Administration</div>
|
| 377 |
+
<div class="font-bold">32%</div>
|
| 378 |
+
</div>
|
| 379 |
+
<div class="w-full bg-gray-200 rounded-full h-4">
|
| 380 |
+
<div class="bg-secondary h-4 rounded-full" style="width: 32%"></div>
|
| 381 |
+
</div>
|
| 382 |
+
<div class="text-sm text-gray-500 mt-1">398 votes</div>
|
| 383 |
+
</div>
|
| 384 |
+
|
| 385 |
+
<!-- Candidate 3 -->
|
| 386 |
+
<div class="border-l-4 border-accent pl-4">
|
| 387 |
+
<div class="flex justify-between items-center mb-1">
|
| 388 |
+
<div class="font-semibold">Kwame Boateng - Electrical Engineering</div>
|
| 389 |
+
<div class="font-bold">12%</div>
|
| 390 |
+
</div>
|
| 391 |
+
<div class="w-full bg-gray-200 rounded-full h-4">
|
| 392 |
+
<div class="bg-accent h-4 rounded-full" style="width: 12%"></div>
|
| 393 |
+
</div>
|
| 394 |
+
<div class="text-sm text-gray-500 mt-1">149 votes</div>
|
| 395 |
+
</div>
|
| 396 |
+
</div>
|
| 397 |
+
</div>
|
| 398 |
+
|
| 399 |
+
<div class="bg-white rounded-lg shadow-md p-6">
|
| 400 |
+
<div class="flex justify-between items-center mb-6">
|
| 401 |
+
<h3 class="text-xl font-bold">General Secretary</h3>
|
| 402 |
+
<div class="text-sm text-gray-500">
|
| 403 |
+
<span>Total Votes: 1,245</span>
|
| 404 |
+
<span class="ml-4">Voter Turnout: 82%</span>
|
| 405 |
+
</div>
|
| 406 |
+
</div>
|
| 407 |
+
|
| 408 |
+
<div class="space-y-4">
|
| 409 |
+
<!-- Candidate 1 -->
|
| 410 |
+
<div class="border-l-4 border-primary-light pl-4">
|
| 411 |
+
<div class="flex justify-between items-center mb-1">
|
| 412 |
+
<div class="font-semibold">Sandra Addo - Accounting</div>
|
| 413 |
+
<div class="font-bold">64%</div>
|
| 414 |
+
</div>
|
| 415 |
+
<div class="w-full bg-gray-200 rounded-full h-4">
|
| 416 |
+
<div class="bg-primary-light h-4 rounded-full" style="width: 64%"></div>
|
| 417 |
+
</div>
|
| 418 |
+
<div class="text-sm text-gray-500 mt-1">797 votes</div>
|
| 419 |
+
</div>
|
| 420 |
+
|
| 421 |
+
<!-- Candidate 2 -->
|
| 422 |
+
<div class="border-l-4 border-green-400 pl-4">
|
| 423 |
+
<div class="flex justify-between items-center mb-1">
|
| 424 |
+
<div class="font-semibold">David Johnson - Mechanical Engineering</div>
|
| 425 |
+
<div class="font-bold">36%</div>
|
| 426 |
+
</div>
|
| 427 |
+
<div class="w-full bg-gray-200 rounded-full h-4">
|
| 428 |
+
<div class="bg-green-400 h-4 rounded-full" style="width: 36%"></div>
|
| 429 |
+
</div>
|
| 430 |
+
<div class="text-sm text-gray-500 mt-1">448 votes</div>
|
| 431 |
+
</div>
|
| 432 |
+
</div>
|
| 433 |
+
</div>
|
| 434 |
+
|
| 435 |
+
<div class="mt-8 bg-white rounded-lg shadow-md p-6">
|
| 436 |
+
<h3 class="text-xl font-bold mb-4">Summary</h3>
|
| 437 |
+
<div class="grid md:grid-cols-3 gap-4">
|
| 438 |
+
<div class="text-center p-4 border rounded-lg">
|
| 439 |
+
<div class="text-3xl font-bold text-primary">1,245</div>
|
| 440 |
+
<div class="text-gray-600">Total Votes</div>
|
| 441 |
+
</div>
|
| 442 |
+
<div class="text-center p-4 border rounded-lg">
|
| 443 |
+
<div class="text-3xl font-bold text-secondary">82%</div>
|
| 444 |
+
<div class="text-gray-600">Voter Turnout</div>
|
| 445 |
+
</div>
|
| 446 |
+
<div class="text-center p-4 border rounded-lg">
|
| 447 |
+
<div class="text-3xl font-bold text-accent">5</div>
|
| 448 |
+
<div class="text-gray-600">Contested Positions</div>
|
| 449 |
+
</div>
|
| 450 |
+
</div>
|
| 451 |
+
</div>
|
| 452 |
+
</section>
|
| 453 |
+
|
| 454 |
+
<!-- Admin Dashboard Section -->
|
| 455 |
+
<section id="admin-section" class="hidden max-w-6xl mx-auto">
|
| 456 |
+
<div class="text-center mb-8">
|
| 457 |
+
<h2 class="text-3xl font-bold text-dark">Admin Dashboard</h2>
|
| 458 |
+
<p class="text-gray-600">Manage elections, candidates, and voter information</p>
|
| 459 |
+
</div>
|
| 460 |
+
|
| 461 |
+
<div class="grid md:grid-cols-3 gap-6 mb-8">
|
| 462 |
+
<div class="bg-white rounded-lg shadow-md p-6 cursor-pointer hover:shadow-lg transition" onclick="showAdminSection('elections')">
|
| 463 |
+
<div class="flex items-center space-x-4">
|
| 464 |
+
<div class="bg-primary-light bg-opacity-10 p-3 rounded-full">
|
| 465 |
+
<i class="fas fa-calendar-alt text-primary text-xl"></i>
|
| 466 |
+
</div>
|
| 467 |
+
<div>
|
| 468 |
+
<h3 class="font-bold text-lg">Elections</h3>
|
| 469 |
+
<p class="text-gray-600 text-sm">Manage active and upcoming elections</p>
|
| 470 |
+
</div>
|
| 471 |
+
</div>
|
| 472 |
+
</div>
|
| 473 |
+
<div class="bg-white rounded-lg shadow-md p-6 cursor-pointer hover:shadow-lg transition" onclick="showAdminSection('candidates')">
|
| 474 |
+
<div class="flex items-center space-x-4">
|
| 475 |
+
<div class="bg-secondary bg-opacity-10 p-3 rounded-full">
|
| 476 |
+
<i class="fas fa-users text-secondary text-xl"></i>
|
| 477 |
+
</div>
|
| 478 |
+
<div>
|
| 479 |
+
<h3 class="font-bold text-lg">Candidates</h3>
|
| 480 |
+
<p class="text-gray-600 text-sm">Add and manage candidates</p>
|
| 481 |
+
</div>
|
| 482 |
+
</div>
|
| 483 |
+
</div>
|
| 484 |
+
<div class="bg-white rounded-lg shadow-md p-6 cursor-pointer hover:shadow-lg transition" onclick="showAdminSection('voters')">
|
| 485 |
+
<div class="flex items-center space-x-4">
|
| 486 |
+
<div class="bg-accent bg-opacity-10 p-3 rounded-full">
|
| 487 |
+
<i class="fas fa-user-graduate text-accent text-xl"></i>
|
| 488 |
+
</div>
|
| 489 |
+
<div>
|
| 490 |
+
<h3 class="font-bold text-lg">Voters</h3>
|
| 491 |
+
<p class="text-gray-600 text-sm">Manage voter registration</p>
|
| 492 |
+
</div>
|
| 493 |
+
</div>
|
| 494 |
+
</div>
|
| 495 |
+
</div>
|
| 496 |
+
|
| 497 |
+
<!-- Admin Elections Subsection -->
|
| 498 |
+
<div id="admin-elections" class="bg-white rounded-lg shadow-md p-6">
|
| 499 |
+
<div class="flex justify-between items-center mb-6">
|
| 500 |
+
<h3 class="text-xl font-bold">Elections Management</h3>
|
| 501 |
+
<button onclick="showAddElectionModal()" class="bg-primary hover:bg-primary-light text-white px-4 py-2 rounded text-sm">
|
| 502 |
+
<i class="fas fa-plus mr-1"></i> Add Election
|
| 503 |
+
</button>
|
| 504 |
+
</div>
|
| 505 |
+
|
| 506 |
+
<div class="overflow-x-auto">
|
| 507 |
+
<table class="min-w-full">
|
| 508 |
+
<thead class="bg-gray-50">
|
| 509 |
+
<tr>
|
| 510 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Title</th>
|
| 511 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Start Date</th>
|
| 512 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">End Date</th>
|
| 513 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
|
| 514 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
|
| 515 |
+
</tr>
|
| 516 |
+
</thead>
|
| 517 |
+
<tbody class="bg-white divide-y divide-gray-200">
|
| 518 |
+
<tr>
|
| 519 |
+
<td class="px-6 py-4 whitespace-nowrap">SRC President 2023/2024</td>
|
| 520 |
+
<td class="px-6 py-4 whitespace-nowrap">2023-06-01</td>
|
| 521 |
+
<td class="px-6 py-4 whitespace-nowrap">2023-06-05</td>
|
| 522 |
+
<td class="px-6 py-4 whitespace-nowrap"><span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Active</span></td>
|
| 523 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 524 |
+
<button class="text-primary hover:text-primary-light mr-3"><i class="fas fa-edit"></i></button>
|
| 525 |
+
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash"></i></button>
|
| 526 |
+
</td>
|
| 527 |
+
</tr>
|
| 528 |
+
<tr>
|
| 529 |
+
<td class="px-6 py-4 whitespace-nowrap">Academic Committee</td>
|
| 530 |
+
<td class="px-6 py-4 whitespace-nowrap">2023-06-10</td>
|
| 531 |
+
<td class="px-6 py-4 whitespace-nowrap">2023-06-12</td>
|
| 532 |
+
<td class="px-6 py-4 whitespace-nowrap"><span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">Upcoming</span></td>
|
| 533 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 534 |
+
<button class="text-primary hover:text-primary-light mr-3"><i class="fas fa-edit"></i></button>
|
| 535 |
+
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash"></i></button>
|
| 536 |
+
</td>
|
| 537 |
+
</tr>
|
| 538 |
+
<tr>
|
| 539 |
+
<td class="px-6 py-4 whitespace-nowrap">Sports Committee</td>
|
| 540 |
+
<td class="px-6 py-4 whitespace-nowrap">2023-05-20</td>
|
| 541 |
+
<td class="px-6 py-4 whitespace-nowrap">2023-05-22</td>
|
| 542 |
+
<td class="px-6 py-4 whitespace-nowrap"><span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">Ended</span></td>
|
| 543 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 544 |
+
<button class="text-primary hover:text-primary-light mr-3"><i class="fas fa-edit"></i></button>
|
| 545 |
+
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash"></i></button>
|
| 546 |
+
</td>
|
| 547 |
+
</tr>
|
| 548 |
+
</tbody>
|
| 549 |
+
</table>
|
| 550 |
+
</div>
|
| 551 |
+
</div>
|
| 552 |
+
|
| 553 |
+
<!-- Admin Candidates Subsection (Hidden by default) -->
|
| 554 |
+
<div id="admin-candidates" class="hidden bg-white rounded-lg shadow-md p-6">
|
| 555 |
+
<div class="flex justify-between items-center mb-6">
|
| 556 |
+
<h3 class="text-xl font-bold">Candidates Management</h3>
|
| 557 |
+
<button onclick="showAddCandidateModal()" class="bg-primary hover:bg-primary-light text-white px-4 py-2 rounded text-sm">
|
| 558 |
+
<i class="fas fa-plus mr-1"></i> Add Candidate
|
| 559 |
+
</button>
|
| 560 |
+
</div>
|
| 561 |
+
|
| 562 |
+
<div class="overflow-x-auto">
|
| 563 |
+
<table class="min-w-full">
|
| 564 |
+
<thead class="bg-gray-50">
|
| 565 |
+
<tr>
|
| 566 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
|
| 567 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Position</th>
|
| 568 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Department</th>
|
| 569 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Election</th>
|
| 570 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
|
| 571 |
+
</tr>
|
| 572 |
+
</thead>
|
| 573 |
+
<tbody class="bg-white divide-y divide-gray-200">
|
| 574 |
+
<tr>
|
| 575 |
+
<td class="px-6 py-4 whitespace-nowrap">Andrew Kwarteng</td>
|
| 576 |
+
<td class="px-6 py-4 whitespace-nowrap">SRC President</td>
|
| 577 |
+
<td class="px-6 py-4 whitespace-nowrap">Computer Science</td>
|
| 578 |
+
<td class="px-6 py-4 whitespace-nowrap">SRC President 2023/2024</td>
|
| 579 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 580 |
+
<button class="text-primary hover:text-primary-light mr-3"><i class="fas fa-edit"></i></button>
|
| 581 |
+
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash"></i></button>
|
| 582 |
+
</td>
|
| 583 |
+
</tr>
|
| 584 |
+
<tr>
|
| 585 |
+
<td class="px-6 py-4 whitespace-nowrap">Esi Amankwah</td>
|
| 586 |
+
<td class="px-6 py-4 whitespace-nowrap">SRC President</td>
|
| 587 |
+
<td class="px-6 py-4 whitespace-nowrap">Business Administration</td>
|
| 588 |
+
<td class="px-6 py-4 whitespace-nowrap">SRC President 2023/2024</td>
|
| 589 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 590 |
+
<button class="text-primary hover:text-primary-light mr-3"><i class="fas fa-edit"></i></button>
|
| 591 |
+
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash"></i></button>
|
| 592 |
+
</td>
|
| 593 |
+
</tr>
|
| 594 |
+
<tr>
|
| 595 |
+
<td class="px-6 py-4 whitespace-nowrap">Sandra Addo</td>
|
| 596 |
+
<td class="px-6 py-4 whitespace-nowrap">General Secretary</td>
|
| 597 |
+
<td class="px-6 py-4 whitespace-nowrap">Accounting</td>
|
| 598 |
+
<td class="px-6 py-4 whitespace-nowrap">SRC President 2023/2024</td>
|
| 599 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 600 |
+
<button class="text-primary hover:text-primary-light mr-3"><i class="fas fa-edit"></i></button>
|
| 601 |
+
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash"></i></button>
|
| 602 |
+
</td>
|
| 603 |
+
</tr>
|
| 604 |
+
</tbody>
|
| 605 |
+
</table>
|
| 606 |
+
</div>
|
| 607 |
+
</div>
|
| 608 |
+
|
| 609 |
+
<!-- Admin Voters Subsection (Hidden by default) -->
|
| 610 |
+
<div id="admin-voters" class="hidden bg-white rounded-lg shadow-md p-6">
|
| 611 |
+
<div class="flex justify-between items-center mb-6">
|
| 612 |
+
<h3 class="text-xl font-bold">Voters Management</h3>
|
| 613 |
+
<div class="flex space-x-3">
|
| 614 |
+
<button onclick="showImportVotersModal()" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded text-sm">
|
| 615 |
+
<i class="fas fa-file-import mr-1"></i> Import
|
| 616 |
+
</button>
|
| 617 |
+
<button onclick="showAddVoterModal()" class="bg-primary hover:bg-primary-light text-white px-4 py-2 rounded text-sm">
|
| 618 |
+
<i class="fas fa-plus mr-1"></i> Add Voter
|
| 619 |
+
</button>
|
| 620 |
+
</div>
|
| 621 |
+
</div>
|
| 622 |
+
|
| 623 |
+
<div class="mb-4 flex justify-between items-center">
|
| 624 |
+
<div class="relative max-w-xs">
|
| 625 |
+
<label for="voter-search" class="sr-only">Search</label>
|
| 626 |
+
<div class="relative">
|
| 627 |
+
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
| 628 |
+
<i class="fas fa-search text-gray-400"></i>
|
| 629 |
+
</div>
|
| 630 |
+
<input type="text" id="voter-search" class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md leading-5 bg-white placeholder-gray-500 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" placeholder="Search">
|
| 631 |
+
</div>
|
| 632 |
+
</div>
|
| 633 |
+
<div class="flex items-center space-x-2">
|
| 634 |
+
<span class="text-sm text-gray-600">Filter by:</span>
|
| 635 |
+
<select class="block w-full pl-3 pr-10 py-2 text-base border border-gray-300 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm rounded-md">
|
| 636 |
+
<option>All</option>
|
| 637 |
+
<option>Students</option>
|
| 638 |
+
<option>Staff</option>
|
| 639 |
+
</select>
|
| 640 |
+
</div>
|
| 641 |
+
</div>
|
| 642 |
+
|
| 643 |
+
<div class="overflow-x-auto">
|
| 644 |
+
<table class="min-w-full">
|
| 645 |
+
<thead class="bg-gray-50">
|
| 646 |
+
<tr>
|
| 647 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Student ID</th>
|
| 648 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Full Name</th>
|
| 649 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Program</th>
|
| 650 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Level</th>
|
| 651 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Voted</th>
|
| 652 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
|
| 653 |
+
</tr>
|
| 654 |
+
</thead>
|
| 655 |
+
<tbody class="bg-white divide-y divide-gray-200">
|
| 656 |
+
<tr>
|
| 657 |
+
<td class="px-6 py-4 whitespace-nowrap">NKSHT2023001</td>
|
| 658 |
+
<td class="px-6 py-4 whitespace-nowrap">John Mensah</td>
|
| 659 |
+
<td class="px-6 py-4 whitespace-nowrap">Computer Science</td>
|
| 660 |
+
<td class="px-6 py-4 whitespace-nowrap">200</td>
|
| 661 |
+
<td class="px-6 py-4 whitespace-nowrap"><span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Yes</span></td>
|
| 662 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 663 |
+
<button class="text-primary hover:text-primary-light mr-3"><i class="fas fa-edit"></i></button>
|
| 664 |
+
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash"></i></button>
|
| 665 |
+
</td>
|
| 666 |
+
</tr>
|
| 667 |
+
<tr>
|
| 668 |
+
<td class="px-6 py-4 whitespace-nowrap">NKSHT2023002</td>
|
| 669 |
+
<td class="px-6 py-4 whitespace-nowrap">Ama Asante</td>
|
| 670 |
+
<td class="px-6 py-4 whitespace-nowrap">Business Admin</td>
|
| 671 |
+
<td class="px-6 py-4 whitespace-nowrap">100</td>
|
| 672 |
+
<td class="px-6 py-4 whitespace-nowrap"><span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Yes</span></td>
|
| 673 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 674 |
+
<button class="text-primary hover:text-primary-light mr-3"><i class="fas fa-edit"></i></button>
|
| 675 |
+
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash"></i></button>
|
| 676 |
+
</td>
|
| 677 |
+
</tr>
|
| 678 |
+
<tr>
|
| 679 |
+
<td class="px-6 py-4 whitespace-nowrap">NKSHT2023003</td>
|
| 680 |
+
<td class="px-6 py-4 whitespace-nowrap">Kwaku Boateng</td>
|
| 681 |
+
<td class="px-6 py-4 whitespace-nowrap">Electrical Eng.</td>
|
| 682 |
+
<td class="px-6 py-4 whitespace-nowrap">300</td>
|
| 683 |
+
<td class="px-6 py-4 whitespace-nowrap"><span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">No</span></td>
|
| 684 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
| 685 |
+
<button class="text-primary hover:text-primary-light mr-3"><i class="fas fa-edit"></i></button>
|
| 686 |
+
<button class="text-red-500 hover:text-red-700"><i class="fas fa-trash"></i></button>
|
| 687 |
+
</td>
|
| 688 |
+
</tr>
|
| 689 |
+
</tbody>
|
| 690 |
+
</table>
|
| 691 |
+
</div>
|
| 692 |
+
|
| 693 |
+
<div class="mt-4 flex justify-between items-center">
|
| 694 |
+
<div class="text-sm text-gray-500">
|
| 695 |
+
Showing <span class="font-medium">1</span> to <span class="font-medium">3</span> of <span class="font-medium">1,245</span> voters
|
| 696 |
+
</div>
|
| 697 |
+
<nav class="flex space-x-2">
|
| 698 |
+
<button class="px-3 py-1 border border-gray-300 rounded text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
|
| 699 |
+
Previous
|
| 700 |
+
</button>
|
| 701 |
+
<button class="px-3 py-1 border border-gray-300 rounded text-sm font-medium bg-primary text-white">
|
| 702 |
+
1
|
| 703 |
+
</button>
|
| 704 |
+
<button class="px-3 py-1 border border-gray-300 rounded text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
|
| 705 |
+
2
|
| 706 |
+
</button>
|
| 707 |
+
<button class="px-3 py-1 border border-gray-300 rounded text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
|
| 708 |
+
3
|
| 709 |
+
</button>
|
| 710 |
+
<button class="px-3 py-1 border border-gray-300 rounded text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">
|
| 711 |
+
Next
|
| 712 |
+
</button>
|
| 713 |
+
</nav>
|
| 714 |
+
</div>
|
| 715 |
+
</div>
|
| 716 |
+
</section>
|
| 717 |
+
|
| 718 |
+
<!-- Success Modal -->
|
| 719 |
+
<div id="success-modal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center z-50">
|
| 720 |
+
<div class="bg-white rounded-lg shadow-xl p-6 w-full max-w-md">
|
| 721 |
+
<div class="flex flex-col items-center">
|
| 722 |
+
<div class="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4">
|
| 723 |
+
<i class="fas fa-check text-green-600 text-2xl"></i>
|
| 724 |
+
</div>
|
| 725 |
+
<h3 class="text-xl font-bold mb-2 text-center">Vote Submitted Successfully!</h3>
|
| 726 |
+
<p class="text-gray-600 text-center mb-4">Thank you for participating in the Nkoranza SHTs elections.</p>
|
| 727 |
+
<button onclick="document.getElementById('success-modal').classList.add('hidden'); showSection('home')" class="bg-primary hover:bg-primary-light text-white px-4 py-2 rounded transition w-full">
|
| 728 |
+
Continue
|
| 729 |
+
</button>
|
| 730 |
+
</div>
|
| 731 |
+
</div>
|
| 732 |
+
</div>
|
| 733 |
+
|
| 734 |
+
<!-- Admin Modals -->
|
| 735 |
+
<!-- Add Election Modal -->
|
| 736 |
+
<div id="add-election-modal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center z-50">
|
| 737 |
+
<div class="bg-white rounded-lg shadow-xl p-6 w-full max-w-lg">
|
| 738 |
+
<div class="flex justify-between items-center mb-4">
|
| 739 |
+
<h3 class="text-xl font-bold">Add New Election</h3>
|
| 740 |
+
<button onclick="document.getElementById('add-election-modal').classList.add('hidden')" class="text-gray-400 hover:text-gray-500">
|
| 741 |
+
<i class="fas fa-times"></i>
|
| 742 |
+
</button>
|
| 743 |
+
</div>
|
| 744 |
+
|
| 745 |
+
<form class="space-y-4">
|
| 746 |
+
<div>
|
| 747 |
+
<label for="election-title" class="block text-sm font-medium text-gray-700 mb-1">Election Title</label>
|
| 748 |
+
<input type="text" id="election-title" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 749 |
+
</div>
|
| 750 |
+
|
| 751 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 752 |
+
<div>
|
| 753 |
+
<label for="start-date" class="block text-sm font-medium text-gray-700 mb-1">Start Date</label>
|
| 754 |
+
<input type="datetime-local" id="start-date" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 755 |
+
</div>
|
| 756 |
+
<div>
|
| 757 |
+
<label for="end-date" class="block text-sm font-medium text-gray-700 mb-1">End Date</label>
|
| 758 |
+
<input type="datetime-local" id="end-date" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 759 |
+
</div>
|
| 760 |
+
</div>
|
| 761 |
+
|
| 762 |
+
<div>
|
| 763 |
+
<label for="election-description" class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
| 764 |
+
<textarea id="election-description" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary"></textarea>
|
| 765 |
+
</div>
|
| 766 |
+
|
| 767 |
+
<div class="flex justify-end space-x-3 pt-4">
|
| 768 |
+
<button type="button" onclick="document.getElementById('add-election-modal').classList.add('hidden')" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
|
| 769 |
+
Cancel
|
| 770 |
+
</button>
|
| 771 |
+
<button type="button" onclick="addNewElection()" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary hover:bg-primary-light focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
|
| 772 |
+
Save Election
|
| 773 |
+
</button>
|
| 774 |
+
</div>
|
| 775 |
+
</form>
|
| 776 |
+
</div>
|
| 777 |
+
</div>
|
| 778 |
+
|
| 779 |
+
<!-- Add Candidate Modal -->
|
| 780 |
+
<div id="add-candidate-modal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center z-50">
|
| 781 |
+
<div class="bg-white rounded-lg shadow-xl p-6 w-full max-w-lg">
|
| 782 |
+
<div class="flex justify-between items-center mb-4">
|
| 783 |
+
<h3 class="text-xl font-bold">Add New Candidate</h3>
|
| 784 |
+
<button onclick="document.getElementById('add-candidate-modal').classList.add('hidden')" class="text-gray-400 hover:text-gray-500">
|
| 785 |
+
<i class="fas fa-times"></i>
|
| 786 |
+
</button>
|
| 787 |
+
</div>
|
| 788 |
+
|
| 789 |
+
<form class="space-y-4">
|
| 790 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 791 |
+
<div>
|
| 792 |
+
<label for="candidate-firstname" class="block text-sm font-medium text-gray-700 mb-1">First Name</label>
|
| 793 |
+
<input type="text" id="candidate-firstname" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 794 |
+
</div>
|
| 795 |
+
<div>
|
| 796 |
+
<label for="candidate-lastname" class="block text-sm font-medium text-gray-700 mb-1">Last Name</label>
|
| 797 |
+
<input type="text" id="candidate-lastname" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 798 |
+
</div>
|
| 799 |
+
</div>
|
| 800 |
+
|
| 801 |
+
<div>
|
| 802 |
+
<label for="candidate-election" class="block text-sm font-medium text-gray-700 mb-1">Election</label>
|
| 803 |
+
<select id="candidate-election" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 804 |
+
<option>Select Election</option>
|
| 805 |
+
<option>SRC President 2023/2024</option>
|
| 806 |
+
<option>Academic Committee 2023/2024</option>
|
| 807 |
+
</select>
|
| 808 |
+
</div>
|
| 809 |
+
|
| 810 |
+
<div>
|
| 811 |
+
<label for="candidate-position" class="block text-sm font-medium text-gray-700 mb-1">Position</label>
|
| 812 |
+
<input type="text" id="candidate-position" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 813 |
+
</div>
|
| 814 |
+
|
| 815 |
+
<div>
|
| 816 |
+
<label for="candidate-department" class="block text-sm font-medium text-gray-700 mb-1">Department</label>
|
| 817 |
+
<select id="candidate-department" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 818 |
+
<option>Select Department</option>
|
| 819 |
+
<option>Computer Science</option>
|
| 820 |
+
<option>Business Administration</option>
|
| 821 |
+
<option>Electrical Engineering</option>
|
| 822 |
+
<option>Mechanical Engineering</option>
|
| 823 |
+
<option>Accounting</option>
|
| 824 |
+
</select>
|
| 825 |
+
</div>
|
| 826 |
+
|
| 827 |
+
<div>
|
| 828 |
+
<label for="candidate-manifesto" class="block text-sm font-medium text-gray-700 mb-1">Manifesto (Optional)</label>
|
| 829 |
+
<textarea id="candidate-manifesto" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary"></textarea>
|
| 830 |
+
</div>
|
| 831 |
+
|
| 832 |
+
<div>
|
| 833 |
+
<label for="candidate-photo" class="block text-sm font-medium text-gray-700 mb-1">Photo</label>
|
| 834 |
+
<div class="mt-1 flex items-center">
|
| 835 |
+
<span class="inline-block h-12 w-12 rounded-full overflow-hidden bg-gray-100">
|
| 836 |
+
<svg class="h-full w-full text-gray-300" fill="currentColor" viewBox="0 0 24 24">
|
| 837 |
+
<path d="M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z" />
|
| 838 |
+
</svg>
|
| 839 |
+
</span>
|
| 840 |
+
<button type="button" class="ml-5 bg-white py-2 px-3 border border-gray-300 rounded-md shadow-sm text-sm leading-4 font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
|
| 841 |
+
Upload
|
| 842 |
+
</button>
|
| 843 |
+
</div>
|
| 844 |
+
</div>
|
| 845 |
+
|
| 846 |
+
<div class="flex justify-end space-x-3 pt-4">
|
| 847 |
+
<button type="button" onclick="document.getElementById('add-candidate-modal').classList.add('hidden')" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
|
| 848 |
+
Cancel
|
| 849 |
+
</button>
|
| 850 |
+
<button type="button" onclick="addNewCandidate()" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary hover:bg-primary-light focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
|
| 851 |
+
Save Candidate
|
| 852 |
+
</button>
|
| 853 |
+
</div>
|
| 854 |
+
</form>
|
| 855 |
+
</div>
|
| 856 |
+
</div>
|
| 857 |
+
|
| 858 |
+
<!-- Add Voter Modal -->
|
| 859 |
+
<div id="add-voter-modal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center z-50">
|
| 860 |
+
<div class="bg-white rounded-lg shadow-xl p-6 w-full max-w-lg">
|
| 861 |
+
<div class="flex justify-between items-center mb-4">
|
| 862 |
+
<h3 class="text-xl font-bold">Add New Voter</h3>
|
| 863 |
+
<button onclick="document.getElementById('add-voter-modal').classList.add('hidden')" class="text-gray-400 hover:text-gray-500">
|
| 864 |
+
<i class="fas fa-times"></i>
|
| 865 |
+
</button>
|
| 866 |
+
</div>
|
| 867 |
+
|
| 868 |
+
<form class="space-y-4">
|
| 869 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 870 |
+
<div>
|
| 871 |
+
<label for="voter-id" class="block text-sm font-medium text-gray-700 mb-1">Student ID</label>
|
| 872 |
+
<input type="text" id="voter-id" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 873 |
+
</div>
|
| 874 |
+
<div>
|
| 875 |
+
<label for="voter-password" class="block text-sm font-medium text-gray-700 mb-1">Password</label>
|
| 876 |
+
<input type="password" id="voter-password" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 877 |
+
</div>
|
| 878 |
+
</div>
|
| 879 |
+
|
| 880 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 881 |
+
<div>
|
| 882 |
+
<label for="voter-firstname" class="block text-sm font-medium text-gray-700 mb-1">First Name</label>
|
| 883 |
+
<input type="text" id="voter-firstname" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 884 |
+
</div>
|
| 885 |
+
<div>
|
| 886 |
+
<label for="voter-lastname" class="block text-sm font-medium text-gray-700 mb-1">Last Name</label>
|
| 887 |
+
<input type="text" id="voter-lastname" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 888 |
+
</div>
|
| 889 |
+
</div>
|
| 890 |
+
|
| 891 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 892 |
+
<div>
|
| 893 |
+
<label for="voter-department" class="block text-sm font-medium text-gray-700 mb-1">Department</label>
|
| 894 |
+
<select id="voter-department" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 895 |
+
<option>Select Department</option>
|
| 896 |
+
<option>Computer Science</option>
|
| 897 |
+
<option>Business Administration</option>
|
| 898 |
+
<option>Electrical Engineering</option>
|
| 899 |
+
<option>Mechanical Engineering</option>
|
| 900 |
+
<option>Accounting</option>
|
| 901 |
+
</select>
|
| 902 |
+
</div>
|
| 903 |
+
<div>
|
| 904 |
+
<label for="voter-level" class="block text-sm font-medium text-gray-700 mb-1">Level</label>
|
| 905 |
+
<select id="voter-level" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 906 |
+
<option>100</option>
|
| 907 |
+
<option>200</option>
|
| 908 |
+
<option>300</option>
|
| 909 |
+
<option>400</option>
|
| 910 |
+
</select>
|
| 911 |
+
</div>
|
| 912 |
+
</div>
|
| 913 |
+
|
| 914 |
+
<div>
|
| 915 |
+
<label for="voter-email" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
|
| 916 |
+
<input type="email" id="voter-email" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary">
|
| 917 |
+
</div>
|
| 918 |
+
|
| 919 |
+
<div class="flex justify-end space-x-3 pt-4">
|
| 920 |
+
<button type="button" onclick="document.getElementById('add-voter-modal').classList.add('hidden')" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
|
| 921 |
+
Cancel
|
| 922 |
+
</button>
|
| 923 |
+
<button type="button" onclick="addNewVoter()" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary hover:bg-primary-light focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
|
| 924 |
+
Save Voter
|
| 925 |
+
</button>
|
| 926 |
+
</div>
|
| 927 |
+
</form>
|
| 928 |
+
</div>
|
| 929 |
+
</div>
|
| 930 |
+
|
| 931 |
+
<!-- Import Voters Modal -->
|
| 932 |
+
<div id="import-voters-modal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center z-50">
|
| 933 |
+
<div class="bg-white rounded-lg shadow-xl p-6 w-full max-w-lg">
|
| 934 |
+
<div class="flex justify-between items-center mb-4">
|
| 935 |
+
<h3 class="text-xl font-bold">Import Voters</h3>
|
| 936 |
+
<button onclick="document.getElementById('import-voters-modal').classList.add('hidden')" class="text-gray-400 hover:text-gray-500">
|
| 937 |
+
<i class="fas fa-times"></i>
|
| 938 |
+
</button>
|
| 939 |
+
</div>
|
| 940 |
+
|
| 941 |
+
<div class="space-y-4">
|
| 942 |
+
<div>
|
| 943 |
+
<p class="text-sm text-gray-500 mb-4">Upload a CSV file containing voter information. The file should include the following columns in order: Student ID, Password, First Name, Last Name, Department, Level, Email.</p>
|
| 944 |
+
|
| 945 |
+
<div class="mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md">
|
| 946 |
+
<div class="space-y-1 text-center">
|
| 947 |
+
<svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48" aria-hidden="true">
|
| 948 |
+
<path d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
| 949 |
+
</svg>
|
| 950 |
+
<div class="flex text-sm text-gray-600">
|
| 951 |
+
<label for="voter-file" class="relative cursor-pointer bg-white rounded-md font-medium text-primary hover:text-primary-light focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-primary">
|
| 952 |
+
<span>Upload a file</span>
|
| 953 |
+
<input id="voter-file" type="file" class="sr-only">
|
| 954 |
+
</label>
|
| 955 |
+
<p class="pl-1">or drag and drop</p>
|
| 956 |
+
</div>
|
| 957 |
+
<p class="text-xs text-gray-500">
|
| 958 |
+
CSV file up to 10MB
|
| 959 |
+
</p>
|
| 960 |
+
</div>
|
| 961 |
+
</div>
|
| 962 |
+
</div>
|
| 963 |
+
|
| 964 |
+
<div class="flex justify-end space-x-3 pt-4">
|
| 965 |
+
<button type="button" onclick="document.getElementById('import-voters-modal').classList.add('hidden')" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
|
| 966 |
+
Cancel
|
| 967 |
+
</button>
|
| 968 |
+
<button type="button" onclick="importVoters()" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary hover:bg-primary-light focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
|
| 969 |
+
Import Voters
|
| 970 |
+
</button>
|
| 971 |
+
</div>
|
| 972 |
+
</div>
|
| 973 |
+
</div>
|
| 974 |
+
</div>
|
| 975 |
+
</main>
|
| 976 |
+
|
| 977 |
+
<!-- Footer -->
|
| 978 |
+
<footer class="bg-dark text-white py-8">
|
| 979 |
+
<div class="container mx-auto px-4">
|
| 980 |
+
<div class="grid md:grid-cols-3 gap-8">
|
| 981 |
+
<div>
|
| 982 |
+
<h3 class="text-xl font-bold mb-4">Nkoranza SHTs</h3>
|
| 983 |
+
<p class="text-gray-300">Empowering students through democratic processes and transparent elections.</p>
|
| 984 |
+
</div>
|
| 985 |
+
<div>
|
| 986 |
+
<h4 class="text-lg font-semibold mb-4">Quick Links</h4>
|
| 987 |
+
<ul class="space-y-2">
|
| 988 |
+
<li><a href="#" class="text-gray-300 hover:text-white transition">Home</a></li>
|
| 989 |
+
<li><a href="#" class="text-gray-300 hover:text-white transition">Vote</a></li>
|
| 990 |
+
<li><a href="#" class="text-gray-300 hover:text-white transition">Results</a></li>
|
| 991 |
+
<li><a href="#" class="text-gray-300 hover:text-white transition">Contact</a></li>
|
| 992 |
+
</ul>
|
| 993 |
+
</div>
|
| 994 |
+
<div>
|
| 995 |
+
<h4 class="text-lg font-semibold mb-4">Contact Us</h4>
|
| 996 |
+
<address class="text-gray-300 not-italic">
|
| 997 |
+
<p><i class="fas fa-map-marker-alt mr-2"></i> Nkoranza Technical Institute, Ghana</p>
|
| 998 |
+
<p><i class="fas fa-phone-alt mr-2"></i> +233 24 123 4567</p>
|
| 999 |
+
<p><i class="fas fa-envelope mr-2"></i> election@nkoranzashts.edu.gh</p>
|
| 1000 |
+
</address>
|
| 1001 |
+
</div>
|
| 1002 |
+
</div>
|
| 1003 |
+
<div class="border-t border-gray-700 mt-8 pt-6 text-center text-gray-400">
|
| 1004 |
+
<p>© 2023 Nkoranza Senior High Technical School. All rights reserved.</p>
|
| 1005 |
+
</div>
|
| 1006 |
+
</div>
|
| 1007 |
+
</footer>
|
| 1008 |
+
</div>
|
| 1009 |
+
|
| 1010 |
+
<script>
|
| 1011 |
+
// Backend API base URL
|
| 1012 |
+
const API_BASE_URL = 'https://your-api-domain.com/api';
|
| 1013 |
+
// JWT token storage
|
| 1014 |
+
let authToken = localStorage.getItem('authToken') || null;
|
| 1015 |
+
let currentUser = null;
|
| 1016 |
+
|
| 1017 |
+
let selectedCandidates = {
|
| 1018 |
+
president: null,
|
| 1019 |
+
secretary: null
|
| 1020 |
+
};
|
| 1021 |
+
|
| 1022 |
+
// Helper function for API calls
|
| 1023 |
+
async function apiCall(endpoint, method = 'GET', body = null) {
|
| 1024 |
+
const headers = {
|
| 1025 |
+
'Content-Type': 'application/json',
|
| 1026 |
+
};
|
| 1027 |
+
|
| 1028 |
+
if (authToken) {
|
| 1029 |
+
headers['Authorization'] = `Bearer ${authToken}`;
|
| 1030 |
+
}
|
| 1031 |
+
|
| 1032 |
+
const options = {
|
| 1033 |
+
method,
|
| 1034 |
+
headers,
|
| 1035 |
+
};
|
| 1036 |
+
|
| 1037 |
+
if (body) {
|
| 1038 |
+
options.body = JSON.stringify(body);
|
| 1039 |
+
}
|
| 1040 |
+
|
| 1041 |
+
try {
|
| 1042 |
+
const response = await fetch(`${API_BASE_URL}${endpoint}`, options);
|
| 1043 |
+
const data = await response.json();
|
| 1044 |
+
|
| 1045 |
+
if (!response.ok) {
|
| 1046 |
+
throw new Error(data.message || 'API request failed');
|
| 1047 |
+
}
|
| 1048 |
+
|
| 1049 |
+
return data;
|
| 1050 |
+
} catch (error) {
|
| 1051 |
+
console.error('API Error:', error);
|
| 1052 |
+
throw error;
|
| 1053 |
+
}
|
| 1054 |
+
}
|
| 1055 |
+
|
| 1056 |
+
// Initialize app on page load
|
| 1057 |
+
document.addEventListener('DOMContentLoaded', async function() {
|
| 1058 |
+
try {
|
| 1059 |
+
// Try to authenticate with stored token
|
| 1060 |
+
if (authToken) {
|
| 1061 |
+
showLoader();
|
| 1062 |
+
const userData = await apiCall('/auth/verify');
|
| 1063 |
+
currentUser = userData.user;
|
| 1064 |
+
updateNavForAdmin();
|
| 1065 |
+
}
|
| 1066 |
+
} catch (error) {
|
| 1067 |
+
localStorage.removeItem('authToken');
|
| 1068 |
+
authToken = null;
|
| 1069 |
+
} finally {
|
| 1070 |
+
hideLoader();
|
| 1071 |
+
showSection('home');
|
| 1072 |
+
}
|
| 1073 |
+
});
|
| 1074 |
+
|
| 1075 |
+
// Section navigation
|
| 1076 |
+
function showSection(sectionId) {
|
| 1077 |
+
// Hide all sections
|
| 1078 |
+
document.getElementById('home-section').classList.add('hidden');
|
| 1079 |
+
document.getElementById('login-section').classList.add('hidden');
|
| 1080 |
+
document.getElementById('vote-section').classList.add('hidden');
|
| 1081 |
+
document.getElementById('results-section').classList.add('hidden');
|
| 1082 |
+
document.getElementById('admin-section').classList.add('hidden');
|
| 1083 |
+
|
| 1084 |
+
// Show selected section
|
| 1085 |
+
document.getElementById(`${sectionId}-section`).classList.remove('hidden');
|
| 1086 |
+
|
| 1087 |
+
// Check authentication for protected sections
|
| 1088 |
+
if ((sectionId === 'vote' || sectionId === 'admin') && !currentUser) {
|
| 1089 |
+
showSection('login');
|
| 1090 |
+
}
|
| 1091 |
+
|
| 1092 |
+
// Check if admin and show admin nav if true
|
| 1093 |
+
updateNavForAdmin();
|
| 1094 |
+
}
|
| 1095 |
+
|
| 1096 |
+
// Admin management sections
|
| 1097 |
+
function showAdminSection(section) {
|
| 1098 |
+
// Hide all admin subsections
|
| 1099 |
+
document.getElementById('admin-elections').classList.add('hidden');
|
| 1100 |
+
document.getElementById('admin-candidates').classList.add('hidden');
|
| 1101 |
+
document.getElementById('admin-voters').classList.add('hidden');
|
| 1102 |
+
|
| 1103 |
+
// Show selected subsection
|
| 1104 |
+
document.getElementById(`admin-${section}`).classList.remove('hidden');
|
| 1105 |
+
}
|
| 1106 |
+
|
| 1107 |
+
// Update navigation based on user role
|
| 1108 |
+
function updateNavForAdmin() {
|
| 1109 |
+
const adminNav = document.getElementById('admin-nav');
|
| 1110 |
+
const loginNav = document.getElementById('login-nav');
|
| 1111 |
+
const logoutNav = document.getElementById('logout-nav');
|
| 1112 |
+
|
| 1113 |
+
if (currentUser && currentUser.isAdmin) {
|
| 1114 |
+
adminNav.classList.remove('hidden');
|
| 1115 |
+
loginNav.classList.add('hidden');
|
| 1116 |
+
logoutNav.classList.remove('hidden');
|
| 1117 |
+
} else if (currentUser) {
|
| 1118 |
+
adminNav.classList.add('hidden');
|
| 1119 |
+
loginNav.classList.add('hidden');
|
| 1120 |
+
logoutNav.classList.remove('hidden');
|
| 1121 |
+
} else {
|
| 1122 |
+
adminNav.classList.add('hidden');
|
| 1123 |
+
loginNav.classList.remove('hidden');
|
| 1124 |
+
logoutNav.classList.add('hidden');
|
| 1125 |
+
}
|
| 1126 |
+
}
|
| 1127 |
+
|
| 1128 |
+
// User authentication
|
| 1129 |
+
async function authenticateUser() {
|
| 1130 |
+
const studentId = document.getElementById('studentId').value;
|
| 1131 |
+
const password = document.getElementById('password').value;
|
| 1132 |
+
|
| 1133 |
+
showLoader();
|
| 1134 |
+
|
| 1135 |
+
try {
|
| 1136 |
+
const response = await apiCall('/auth/login', 'POST', {
|
| 1137 |
+
studentId,
|
| 1138 |
+
password
|
| 1139 |
+
});
|
| 1140 |
+
|
| 1141 |
+
authToken = response.token;
|
| 1142 |
+
localStorage.setItem('authToken', authToken);
|
| 1143 |
+
currentUser = response.user;
|
| 1144 |
+
|
| 1145 |
+
hideLoader();
|
| 1146 |
+
updateNavForAdmin();
|
| 1147 |
+
|
| 1148 |
+
if (currentUser.isAdmin) {
|
| 1149 |
+
showSection('admin');
|
| 1150 |
+
} else {
|
| 1151 |
+
showSection('home');
|
| 1152 |
+
}
|
| 1153 |
+
|
| 1154 |
+
// Reset login form
|
| 1155 |
+
document.getElementById('studentId').value = '';
|
| 1156 |
+
document.getElementById('password').value = '';
|
| 1157 |
+
document.getElementById('login-error').classList.add('hidden');
|
| 1158 |
+
|
| 1159 |
+
// Load elections data
|
| 1160 |
+
await loadElectionsData();
|
| 1161 |
+
} catch (error) {
|
| 1162 |
+
hideLoader();
|
| 1163 |
+
document.getElementById('login-error').querySelector('p').textContent =
|
| 1164 |
+
error.message || 'Invalid credentials. Please try again.';
|
| 1165 |
+
document.getElementById('login-error').classList.remove('hidden');
|
| 1166 |
+
console.error('Login error:', error);
|
| 1167 |
+
}
|
| 1168 |
+
}
|
| 1169 |
+
|
| 1170 |
+
// Logout functionality
|
| 1171 |
+
function logout() {
|
| 1172 |
+
authToken = null;
|
| 1173 |
+
currentUser = null;
|
| 1174 |
+
localStorage.removeItem('authToken');
|
| 1175 |
+
updateNavForAdmin();
|
| 1176 |
+
showSection('home');
|
| 1177 |
+
}
|
| 1178 |
+
|
| 1179 |
+
// Load elections data
|
| 1180 |
+
async function loadElectionsData() {
|
| 1181 |
+
try {
|
| 1182 |
+
showLoader();
|
| 1183 |
+
const elections = await apiCall('/elections/active');
|
| 1184 |
+
// Update UI with elections data
|
| 1185 |
+
// ... implementation depends on your API response structure
|
| 1186 |
+
} catch (error) {
|
| 1187 |
+
console.error('Failed to load elections:', error);
|
| 1188 |
+
} finally {
|
| 1189 |
+
hideLoader();
|
| 1190 |
+
}
|
| 1191 |
+
}
|
| 1192 |
+
|
| 1193 |
+
// Voting functionality
|
| 1194 |
+
function selectCandidate(position, candidateId) {
|
| 1195 |
+
// Reset all selections for this position
|
| 1196 |
+
const allChecks = document.querySelectorAll(`[id^="${position}-"]`);
|
| 1197 |
+
allChecks.forEach(check => {
|
| 1198 |
+
if (check.id.endsWith('-check')) {
|
| 1199 |
+
check.classList.add('hidden');
|
| 1200 |
+
}
|
| 1201 |
+
});
|
| 1202 |
+
|
| 1203 |
+
// Select the chosen candidate
|
| 1204 |
+
document.getElementById(`${position}-${candidateId}`).checked = true;
|
| 1205 |
+
document.getElementById(`${position}-${candidateId}-check`).classList.remove('hidden');
|
| 1206 |
+
|
| 1207 |
+
// Update our selected candidates object
|
| 1208 |
+
const candidateName = document.getElementById(`${position}-${candidateId}`).value;
|
| 1209 |
+
selectedCandidates[position] = candidateName;
|
| 1210 |
+
|
| 1211 |
+
// Enable submit button if all positions have a selection
|
| 1212 |
+
const submitBtn = document.getElementById('submit-votes-btn');
|
| 1213 |
+
const allPositionsFilled = Object.values(selectedCandidates).every(candidate => candidate !== null);
|
| 1214 |
+
submitBtn.disabled = !allPositionsFilled;
|
| 1215 |
+
}
|
| 1216 |
+
|
| 1217 |
+
// Confirm votes before submission
|
| 1218 |
+
function confirmVotes() {
|
| 1219 |
+
document.getElementById('confirm-president').textContent = selectedCandidates.president || 'Not selected';
|
| 1220 |
+
document.getElementById('confirm-secretary').textContent = selectedCandidates.secretary || 'Not selected';
|
| 1221 |
+
document.getElementById('confirmation-modal').classList.remove('hidden');
|
| 1222 |
+
}
|
| 1223 |
+
|
| 1224 |
+
// Submit votes
|
| 1225 |
+
async function submitVotes() {
|
| 1226 |
+
showLoader();
|
| 1227 |
+
|
| 1228 |
+
try {
|
| 1229 |
+
await apiCall('/votes/submit', 'POST', {
|
| 1230 |
+
elections: selectedCandidates
|
| 1231 |
+
});
|
| 1232 |
+
|
| 1233 |
+
hideLoader();
|
| 1234 |
+
document.getElementById('confirmation-modal').classList.add('hidden');
|
| 1235 |
+
document.getElementById('success-modal').classList.remove('hidden');
|
| 1236 |
+
|
| 1237 |
+
// Mark user as voted
|
| 1238 |
+
if (currentUser) {
|
| 1239 |
+
currentUser.hasVoted = true;
|
| 1240 |
+
}
|
| 1241 |
+
|
| 1242 |
+
resetVoteSelections();
|
| 1243 |
+
} catch (error) {
|
| 1244 |
+
hideLoader();
|
| 1245 |
+
alert(`Failed to submit votes: ${error.message}`);
|
| 1246 |
+
console.error('Vote submission error:', error);
|
| 1247 |
+
}
|
| 1248 |
+
}
|
| 1249 |
+
|
| 1250 |
+
// Reset vote selections
|
| 1251 |
+
function resetVoteSelections() {
|
| 1252 |
+
selectedCandidates = {
|
| 1253 |
+
president: null,
|
| 1254 |
+
secretary: null
|
| 1255 |
+
};
|
| 1256 |
+
|
| 1257 |
+
// Uncheck all radio buttons
|
| 1258 |
+
document.querySelectorAll('input[type="radio"]').forEach(radio => {
|
| 1259 |
+
radio.checked = false;
|
| 1260 |
+
});
|
| 1261 |
+
|
| 1262 |
+
// Hide all checkmarks
|
| 1263 |
+
document.querySelectorAll('[id$="-check"]').forEach(check => {
|
| 1264 |
+
check.classList.add('hidden');
|
| 1265 |
+
});
|
| 1266 |
+
|
| 1267 |
+
// Disable submit button
|
| 1268 |
+
document.getElementById('submit-votes-btn').disabled = true;
|
| 1269 |
+
}
|
| 1270 |
+
|
| 1271 |
+
// Admin modal functions
|
| 1272 |
+
function showAddElectionModal() {
|
| 1273 |
+
document.getElementById('add-election-modal').classList.remove('hidden');
|
| 1274 |
+
}
|
| 1275 |
+
|
| 1276 |
+
function showAddCandidateModal() {
|
| 1277 |
+
document.getElementById('add-candidate-modal').classList.remove('hidden');
|
| 1278 |
+
}
|
| 1279 |
+
|
| 1280 |
+
function showAddVoterModal() {
|
| 1281 |
+
document.getElementById('add-voter-modal').classList.remove('hidden');
|
| 1282 |
+
}
|
| 1283 |
+
|
| 1284 |
+
function showImportVotersModal() {
|
| 1285 |
+
document.getElementById('import-voters-modal').classList.remove('hidden');
|
| 1286 |
+
}
|
| 1287 |
+
|
| 1288 |
+
// Admin CRUD functions
|
| 1289 |
+
async function addNewElection() {
|
| 1290 |
+
showLoader();
|
| 1291 |
+
try {
|
| 1292 |
+
const title = document.getElementById('election-title').value;
|
| 1293 |
+
const startDate = document.getElementById('start-date').value;
|
| 1294 |
+
const endDate = document.getElementById('end-date').value;
|
| 1295 |
+
const description = document.getElementById('election-description').value;
|
| 1296 |
+
|
| 1297 |
+
await apiCall('/elections', 'POST', {
|
| 1298 |
+
title,
|
| 1299 |
+
startDate,
|
| 1300 |
+
endDate,
|
| 1301 |
+
description
|
| 1302 |
+
});
|
| 1303 |
+
|
| 1304 |
+
hideLoader();
|
| 1305 |
+
document.getElementById('add-election-modal').classList.add('hidden');
|
| 1306 |
+
alert('Election added successfully!');
|
| 1307 |
+
await showAdminSection('elections');
|
| 1308 |
+
} catch (error) {
|
| 1309 |
+
hideLoader();
|
| 1310 |
+
alert(`Failed to add election: ${error.message}`);
|
| 1311 |
+
}
|
| 1312 |
+
}
|
| 1313 |
+
|
| 1314 |
+
async function addNewCandidate() {
|
| 1315 |
+
showLoader();
|
| 1316 |
+
try {
|
| 1317 |
+
const firstName = document.getElementById('candidate-firstname').value;
|
| 1318 |
+
const lastName = document.getElementById('candidate-lastname').value;
|
| 1319 |
+
const electionId = document.getElementById('candidate-election').value;
|
| 1320 |
+
const position = document.getElementById('candidate-position').value;
|
| 1321 |
+
const department = document.getElementById('candidate-department').value;
|
| 1322 |
+
const manifesto = document.getElementById('candidate-manifesto').value;
|
| 1323 |
+
// File upload would need separate handling
|
| 1324 |
+
|
| 1325 |
+
await apiCall('/candidates', 'POST', {
|
| 1326 |
+
firstName,
|
| 1327 |
+
lastName,
|
| 1328 |
+
electionId,
|
| 1329 |
+
position,
|
| 1330 |
+
department,
|
| 1331 |
+
manifesto
|
| 1332 |
+
});
|
| 1333 |
+
|
| 1334 |
+
hideLoader();
|
| 1335 |
+
document.getElementById('add-candidate-modal').classList.add('hidden');
|
| 1336 |
+
alert('Candidate added successfully!');
|
| 1337 |
+
await showAdminSection('candidates');
|
| 1338 |
+
} catch (error) {
|
| 1339 |
+
hideLoader();
|
| 1340 |
+
alert(`Failed to add candidate: ${error.message}`);
|
| 1341 |
+
}
|
| 1342 |
+
}
|
| 1343 |
+
|
| 1344 |
+
async function addNewVoter() {
|
| 1345 |
+
showLoader();
|
| 1346 |
+
try {
|
| 1347 |
+
const studentId = document.getElementById('voter-id').value;
|
| 1348 |
+
const password = document.getElementById('voter-password').value;
|
| 1349 |
+
const firstName = document.getElementById('voter-firstname').value;
|
| 1350 |
+
const lastName = document.getElementById('voter-lastname').value;
|
| 1351 |
+
const department = document.getElementById('voter-department').value;
|
| 1352 |
+
const level = document.getElementById('voter-level').value;
|
| 1353 |
+
const email = document.getElementById('voter-email').value;
|
| 1354 |
+
|
| 1355 |
+
await apiCall('/voters', 'POST', {
|
| 1356 |
+
studentId,
|
| 1357 |
+
password,
|
| 1358 |
+
firstName,
|
| 1359 |
+
lastName,
|
| 1360 |
+
department,
|
| 1361 |
+
level,
|
| 1362 |
+
email
|
| 1363 |
+
});
|
| 1364 |
+
|
| 1365 |
+
hideLoader();
|
| 1366 |
+
document.getElementById('add-voter-modal').classList.add('hidden');
|
| 1367 |
+
alert('Voter added successfully!');
|
| 1368 |
+
await showAdminSection('voters');
|
| 1369 |
+
} catch (error) {
|
| 1370 |
+
hideLoader();
|
| 1371 |
+
alert(`Failed to add voter: ${error.message}`);
|
| 1372 |
+
}
|
| 1373 |
+
}
|
| 1374 |
+
|
| 1375 |
+
async function importVoters() {
|
| 1376 |
+
showLoader();
|
| 1377 |
+
try {
|
| 1378 |
+
const fileInput = document.getElementById('voter-file');
|
| 1379 |
+
if (!fileInput.files.length) {
|
| 1380 |
+
throw new Error('Please select a file');
|
| 1381 |
+
}
|
| 1382 |
+
|
| 1383 |
+
const formData = new FormData();
|
| 1384 |
+
formData.append('file', fileInput.files[0]);
|
| 1385 |
+
|
| 1386 |
+
const response = await fetch(`${API_BASE_URL}/voters/import`, {
|
| 1387 |
+
method: 'POST',
|
| 1388 |
+
headers: {
|
| 1389 |
+
'Authorization': `Bearer ${authToken}`
|
| 1390 |
+
},
|
| 1391 |
+
body: formData
|
| 1392 |
+
});
|
| 1393 |
+
|
| 1394 |
+
if (!response.ok) {
|
| 1395 |
+
throw new Error(await response.text());
|
| 1396 |
+
}
|
| 1397 |
+
|
| 1398 |
+
hideLoader();
|
| 1399 |
+
document.getElementById('import-voters-modal').classList.add('hidden');
|
| 1400 |
+
alert('Voters imported successfully!');
|
| 1401 |
+
await showAdminSection('voters');
|
| 1402 |
+
} catch (error) {
|
| 1403 |
+
hideLoader();
|
| 1404 |
+
alert(`Failed to import voters: ${error.message}`);
|
| 1405 |
+
}
|
| 1406 |
+
}
|
| 1407 |
+
|
| 1408 |
+
// Loader functions
|
| 1409 |
+
function showLoader() {
|
| 1410 |
+
document.getElementById('loader-section').classList.remove('hidden');
|
| 1411 |
+
}
|
| 1412 |
+
|
| 1413 |
+
function hideLoader() {
|
| 1414 |
+
document.getElementById('loader-section').classList.add('hidden');
|
| 1415 |
+
}
|
| 1416 |
+
</script>
|
| 1417 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Truth-Bongo/e-voting-testing" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 1418 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Develop a full-stuck e-voting system with both frontend and backend for my school, Nkoranza SHTs
|
| 2 |
+
complete the project by linking all functions to the database
|