Refactor and remove sqlite and replace with MySQL

This commit is contained in:
2025-10-23 18:43:31 +01:00
parent d53e27eea8
commit 21ebc9c34b
139 changed files with 1013 additions and 529 deletions

View File

@@ -0,0 +1,17 @@
{{ define "footer" }}
<footer class="bg-light text-center text-muted py-3 mt-auto border-top">
<small>
&copy; Copyright {{ .SiteName }}
{{ $currentYear := now.Year }}
{{ if eq .CopyrightYearStart $currentYear }}
{{ $currentYear }}
{{ else }}
{{ .CopyrightYearStart }} - {{ $currentYear }}
{{ end }}
All rights reserved.
| <a href="/legal/privacy">Privacy Policy</a> |
<a href="/legal/terms">Terms & Conditions</a> |
<a href="/contact">Contact Us</a>
</small>
</footer>
{{ end }}

View File

@@ -0,0 +1,86 @@
{{ define "layout" }}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ .SiteName }}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet">
<link rel="stylesheet" href="/static/css/site.css">
</head>
<body class="d-flex flex-column min-vh-100">
<!-- Topbar -->
{{ template "topbar" . }}
<!-- Main layout using Flexbox -->
<div class="d-flex flex-grow-1">
<!-- Sidebar -->
<nav class="col-md-2 d-none d-md-block bg-light sidebar pt-3">
<div class="position-sticky">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link d-flex justify-content-between align-items-center" data-bs-toggle="collapse" href="#lotterySubmenu" role="button" aria-expanded="false" aria-controls="lotterySubmenu">
<strong>Lottery Results</strong>
<i class="bi bi-chevron-down small"></i>
</a>
<div class="collapse ps-3" id="lotterySubmenu">
<ul class="nav flex-column">
<li class="nav-item"><a class="nav-link" href="/lottery/today">Today's Results</a></li>
<li class="nav-item"><a class="nav-link" href="/results/lotto">Lotto</a></li>
<li class="nav-item"><a class="nav-link" href="/results/thunderball">Thunderball</a></li>
<li class="nav-item"><a class="nav-link" href="/results/euromillions">EuroMillions</a></li>
<li class="nav-item"><a class="nav-link" href="/results/Set For Life">Set For Life</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link d-flex justify-content-between align-items-center" data-bs-toggle="collapse" href="#statisticsSubmenu" role="button" aria-expanded="false" aria-controls="statisticsSubmenu">
<strong>Statistics</strong>
</a>
<div class="collapse ps-3" id="statisticsSubmenu">
<ul class="nav flex-column">
<li class="nav-item"><a class="nav-link" href="/lottery/today">Today's Results</a></li>
<li class="nav-item"><a class="nav-link" href="/lottery/history">Lotto</a></li>
<li class="nav-item"><a class="nav-link" href="/statistics/thunderball">Thunderball</a></li>
<li class="nav-item"><a class="nav-link" href="/lottery/history">Set For Life</a></li>
<li class="nav-item"><a class="nav-link" href="/lottery/stats">EuroMillions</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link d-flex justify-content-between align-items-center" data-bs-toggle="collapse" href="#syndicateSubmenu" role="button" aria-expanded="false" aria-controls="syndicateSubmenu">
<strong>Syndicate</strong>
</a>
<div class="collapse ps-3" id="syndicateSubmenu">
<ul class="nav flex-column">
<li class="nav-item"><a class="nav-link" href="/syndicate/create">Create new Syndicate</a></li>
</ul>
</div>
</li>
</ul>
</div>
</nav>
<!-- Main Content -->
<main class="col px-md-4 pt-4">
{{ if .Flash }}
<div class="alert alert-info" role="alert">
{{ .Flash }}
</div>
{{ end }}
{{ template "content" . }}
</main>
</div>
<!-- Footer -->
{{ template "footer" . }}
<!-- JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
{{ end }}

View File

@@ -0,0 +1,129 @@
{{ define "topbar" }}
<nav class="navbar navbar-expand-lg navbar-light bg-light px-3">
<a class="navbar-brand d-flex align-items-center" href="/">
<img src="/static/img/logo.png" alt="Logo" height="30" class="me-2">
<span>SynLotto</span>
</a>
<div class="ms-auto d-flex align-items-center gap-3">
{{ if .User }}
{{ if .IsAdmin }}
<!-- Admin Dropdown -->
<div class="dropdown">
<a class="nav-link text-dark" href="#" id="adminDropdown" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
<i class="bi bi-shield-lock fs-5 position-relative"></i>
</a>
<ul class="dropdown-menu dropdown-menu-end dropdown-admin-box shadow-sm dropdown-with-arrow"
aria-labelledby="adminDropdown">
<li class="dropdown-header text-center fw-bold">Admin Menu</li>
<li><hr class="dropdown-divider"></li>
<li class="text-center"><a href="/admin/dashboard" class="dropdown-item">Tools</a></li>
<li class="text-center"><a href="/admin/dashboard" class="dropdown-item">Audit Logs</a></li>
<li><hr class="dropdown-divider"></li>
<li class="text-center"><a href="/admin/dashboard" class="dropdown-item">Open Dashboard</a></li>
</ul>
</div>
{{ end }}
<!-- Notification Dropdown -->
<div class="dropdown">
<a class="nav-link text-dark" href="#" id="notificationDropdown" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
<i class="bi bi-bell fs-5 position-relative">
{{ if gt .NotificationCount 0 }}
<span class="position-absolute top-0 start-0 translate-middle badge rounded-pill bg-warning text-dark badge-small">
{{ if gt .NotificationCount 15 }}15+{{ else }}{{ .NotificationCount }}{{ end }}
</span>
{{ end }}
</i>
</a>
<ul class="dropdown-menu dropdown-menu-end dropdown-notification-box shadow-sm dropdown-with-arrow"
aria-labelledby="notificationDropdown">
<li class="dropdown-header text-center fw-bold">Notifications</li>
<li><hr class="dropdown-divider"></li>
{{ $total := len .Notifications }}
{{ range $i, $n := .Notifications }}
<li class="px-3 py-2">
<a href="/account/notifications/read?id={{ $n.ID }}" class="text-decoration-none text-dark d-block">
<div class="d-flex align-items-start">
<i class="bi bi-info-circle text-primary me-2 fs-4"></i>
<div>
<div class="fw-semibold">{{ $n.Subject }}</div>
<small class="text-muted">{{ $n.Body }}</small>
</div>
</div>
</a>
</li>
{{ if lt (add $i 1) $total }}
<li><hr class="dropdown-divider"></li>
{{ end }}
{{ end }}
{{ if not .Notifications }}
<li class="text-center text-muted py-2">No notifications</li>
{{ end }}
<li><hr class="dropdown-divider"></li>
<li class="text-center"><a href="/account/notifications" class="dropdown-item">View all notifications</a></li>
</ul>
</div>
<!-- Message Dropdown -->
<div class="dropdown">
<a class="nav-link text-dark" href="#" id="messageDropdown" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
<i class="bi bi-envelope fs-5 position-relative">
{{ if gt .MessageCount 0 }}
<span class="position-absolute top-0 start-0 translate-middle badge rounded-pill bg-danger text-dark badge-small">
{{ if gt .MessageCount 15 }}15+{{ else }}{{ .MessageCount }}{{ end }}
</span>
{{ end }}
</i>
</a>
<ul class="dropdown-menu dropdown-menu-end dropdown-message-box shadow-sm dropdown-with-arrow"
aria-labelledby="messageDropdown">
<li class="dropdown-header text-center fw-bold">Messages</li>
<li><hr class="dropdown-divider"></li>
{{ if .Messages }}
{{ range $i, $m := .Messages }}
<li class="px-3 py-2">
<a href="/account/messages/read?id={{ $m.ID }}" class="text-decoration-none text-dark d-block">
<div class="d-flex align-items-start">
<i class="bi bi-person-circle me-2 fs-4 text-secondary"></i>
<div>
<div class="fw-semibold">{{ $m.Subject }}</div>
<small class="text-muted">{{ truncate $m.Message 40 }}</small>
</div>
</div>
</a>
</li>
{{ end }}
{{ else }}
<li class="text-center text-muted py-2">No messages</li>
{{ end }}
<li><hr class="dropdown-divider"></li>
<li class="text-center"><a href="/account/messages" class="dropdown-item">View all messages</a></li>
</ul>
</div>
<!-- User Greeting/Dropdown -->
<div class="dropdown">
<a class="nav-link dropdown-toggle text-dark" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Hello, {{ .User.Username }}
</a>
<ul class="dropdown-menu dropdown-menu-end shadow-sm" aria-labelledby="userDropdown">
<li><a class="dropdown-item" href="/account/profile">Update Profile</a></li>
<li><a class="dropdown-item" href="/account/password">Change Password</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item text-danger" href="/logout">Logout</a></li>
</ul>
</div>
{{ else }}
<a class="btn btn-outline-primary btn-sm" href="/account/login">Login</a>
{{ end }}
</div>
</nav>
{{ end }}