diff --git a/api/update_theme.php b/api/update_theme.php new file mode 100644 index 0000000..f3ca96e --- /dev/null +++ b/api/update_theme.php @@ -0,0 +1,21 @@ + false, 'error' => 'Invalid theme']); + exit; +} + +try { + $stmt = db()->prepare("UPDATE users SET theme = ? WHERE id = ?"); + $stmt->execute([$theme, $_SESSION['user_id']]); + echo json_encode(['success' => true]); +} catch (Exception $e) { + echo json_encode(['success' => false, 'error' => $e->getMessage()]); +} diff --git a/assets/css/dashboard.css b/assets/css/dashboard.css index c8aa7e1..73a0516 100644 --- a/assets/css/dashboard.css +++ b/assets/css/dashboard.css @@ -415,3 +415,142 @@ body.dashboard-body { gap: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); } + +/* Dark Theme Variables */ +body.dark-theme { + --bg-light: #0f172a; + --sidebar-bg: #1e293b; + --sidebar-text: #94a3b8; + --border-color: #334155; + --sidebar-active-bg: #334155; + --sidebar-active-text: #6366f1; + color: #f1f5f9; +} + +body.dark-theme .top-header { + background: #1e293b; + border-color: #334155; +} + +body.dark-theme .stat-card, +body.dark-theme .analytics-card, +body.dark-theme .content-section, +body.dark-theme .settings-card, +body.dark-theme .modal-content { + background: #1e293b; + border-color: #334155; +} + +body.dark-theme .sidebar-brand, +body.dark-theme .user-name, +body.dark-theme .stat-value, +body.dark-theme .card-title, +body.dark-theme .section-title, +body.dark-theme .settings-info h3, +body.dark-theme .modal-title, +body.dark-theme h1 { + color: #f1f5f9 !important; +} + +body.dark-theme .welcome-msg, +body.dark-theme .user-role, +body.dark-theme .stat-label, +body.dark-theme .settings-info p { + color: #94a3b8; +} + +body.dark-theme .search-bar { + background: #334155; +} + +body.dark-theme .search-bar input { + color: #f1f5f9; +} + +body.dark-theme .election-table th { + background: #334155; + color: #94a3b8; + border-color: #475569; +} + +body.dark-theme .election-table td { + border-color: #334155; + color: #cbd5e1; +} + +body.dark-theme .nav-item:hover { + background: #334155; +} + +body.dark-theme .flatlogic-badge { + background: #1e293b; + color: #f1f5f9; +} + +/* Global Dark Theme Overrides */ +body.dark-theme .audit-table, +body.dark-theme .audit-table th, +body.dark-theme .table-container, +body.dark-theme .content-section, +body.dark-theme .settings-card { + background: #1e293b !important; + border-color: #334155 !important; +} + +body.dark-theme .audit-table td, +body.dark-theme .election-table td { + color: #cbd5e1 !important; + border-color: #334155 !important; +} + +body.dark-theme .audit-table th, +body.dark-theme .election-table th { + background: #334155 !important; + color: #94a3b8 !important; + border-color: #475569 !important; +} + +body.dark-theme .action-badge { + background: #334155; + color: #94a3b8; + padding: 2px 8px; + border-radius: 4px; + font-size: 0.75rem; +} + +body.dark-theme input, +body.dark-theme select, +body.dark-theme textarea { + background-color: #334155 !important; + border-color: #475569 !important; + color: #f1f5f9 !important; +} + +body.dark-theme .sidebar-brand, +body.dark-theme .user-name, +body.dark-theme .stat-value, +body.dark-theme .card-title, +body.dark-theme .section-title, +body.dark-theme .settings-info h3, +body.dark-theme .modal-title, +body.dark-theme h1, +body.dark-theme h2, +body.dark-theme h3 { + color: #f1f5f9 !important; +} + +body.dark-theme .nav-item { + color: #94a3b8; +} + +body.dark-theme .nav-item:hover { + background: #334155; + color: #f1f5f9; +} + +body.dark-theme .nav-item.active { + background: #334155; + color: #6366f1; +} + + diff --git a/assets/css/style.css b/assets/css/style.css index a3e865c..67998b3 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -156,3 +156,45 @@ body { .col-12 { flex: 0 0 100%; max-width: 100%; padding: 0.75rem; } .col-md-6 { flex: 0 0 50%; max-width: 50%; padding: 0.75rem; } .col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; padding: 0.75rem; } + +/* Dark Mode */ +body.dark-theme { + --bg-color: #0f172a; + --surface-color: #1e293b; + --border-color: #334155; + --text-main: #f1f5f9; + --text-muted: #94a3b8; +} + +body.dark-theme .navbar { + background: #1e293b; + border-color: #334155; +} + +body.dark-theme .brand { + color: #f1f5f9; +} + +body.dark-theme .btn-outline { + border-color: #475569; + color: #f1f5f9; +} + +body.dark-theme .btn-outline:hover { + background: #334155; +} + +body.dark-theme .table th { + border-color: #475569; +} + +body.dark-theme .table td { + border-color: #334155; +} + +body.dark-theme .form-control { + background-color: #334155; + border-color: #475569; + color: #f1f5f9; +} + diff --git a/assets/pasted-20260216-030508-3bcfe590.png b/assets/pasted-20260216-030508-3bcfe590.png new file mode 100644 index 0000000..2d468bf Binary files /dev/null and b/assets/pasted-20260216-030508-3bcfe590.png differ diff --git a/ballot.php b/ballot.php index 76dc2c8..4e5e325 100644 --- a/ballot.php +++ b/ballot.php @@ -23,7 +23,7 @@ if (!$election || $election['status'] !== 'Ongoing') { $check = $pdo->prepare("SELECT COUNT(*) FROM votes WHERE election_id = ? AND voter_id = ?"); $check->execute([$id, $user['id']]); if ($check->fetchColumn() > 0) { - header("Location: view_results.php?id=$id&error=AlreadyVoted"); + header("Location: index.php?error=already_voted"); exit; } @@ -44,6 +44,7 @@ $endTime = strtotime($election['end_date_and_time']) * 1000; - + + +
-

Cast Your Vote

-

Select one candidate for each position

+

+

Review the candidates carefully and cast your secure vote below.

@@ -360,86 +521,59 @@ $endTime = strtotime($election['end_date_and_time']) * 1000;
- -
- -
-
- -
-

-

Your choice matters. Review the candidates carefully and cast your secure vote below.

-
- -
- - - $pos): ?> -
-
- - +
+
+

Ready to submit?

+

Review your selections

- - prepare($sql); - $cStmt->execute($params); - $candidates = $cStmt->fetchAll(); - ?> - - -
-

No candidates available for your track.

-
- -
- - - -
- +
- - -
-
-

READY TO SUBMIT?

-

Review your selections

-
-
+ + + +
+ © Click to Vote | High School Online Election System +
+ diff --git a/candidate_management.php b/candidate_management.php index 1b79d8f..8595570 100644 --- a/candidate_management.php +++ b/candidate_management.php @@ -175,7 +175,7 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Online Election System } - + diff --git a/create_election.php b/create_election.php index 70cc12d..b969a16 100644 --- a/create_election.php +++ b/create_election.php @@ -19,7 +19,7 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Online Election System