Files
Sdk_TV_app/templates/modern_archive_index.html
T
bl3kunja-FW 5c7f255a02 Add tournament archives and results for multiple events
- Created JSON files for tournament archives on 2025-07-28 and 2025-07-29, including detailed player scores and shot results.
- Added a new tournament results file summarizing the outcomes of the tournament held on 2025-07-29, including participant scores and completion status.
2025-08-02 15:27:32 +02:00

701 lines
18 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Tournament Archive</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
box-sizing: border-box;
}
html, body {
margin: 0;
padding: 0;
background: #f5f5f5;
font-family: Arial, sans-serif;
min-height: 100vh;
}
/* Standardized Navigation Bar */
.navbar {
background: white;
color: black;
padding: 15px 25px;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 2px solid #ccc;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.navbar-title {
font-size: 1.8rem;
font-weight: bold;
color: #333;
}
.navbar-controls {
display: flex;
gap: 12px;
align-items: center;
}
.nav-btn {
background: #f8f9fa;
border: 2px solid #e9ecef;
cursor: pointer;
padding: 12px 20px;
border-radius: 8px;
transition: all 0.2s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
color: #333;
text-decoration: none;
font-weight: bold;
font-size: 0.9rem;
}
.nav-btn:hover {
background: #e9ecef;
border-color: #007bff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
transform: translateY(-1px);
color: #007bff;
}
.nav-btn.primary {
background: #007bff;
border-color: #0056b3;
color: white;
}
.nav-btn.primary:hover {
background: #0056b3;
color: white;
}
.nav-btn.success {
background: #28a745;
border-color: #1e7e34;
color: white;
}
.nav-btn.success:hover {
background: #1e7e34;
color: white;
}
.nav-btn.danger {
background: #dc3545;
border-color: #c82333;
color: white;
}
.nav-btn.danger:hover {
background: #c82333;
color: white;
}
/* Standardized Container */
.container {
max-width: 1400px;
margin: 0 auto;
padding: 20px;
}
/* White Scrollbar for main page */
body::-webkit-scrollbar {
width: 12px;
}
body::-webkit-scrollbar-track {
background: white;
}
body::-webkit-scrollbar-thumb {
background: #e0e0e0;
border-radius: 6px;
border: 2px solid white;
}
body::-webkit-scrollbar-thumb:hover {
background: #c0c0c0;
}
.section {
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
padding: 20px;
margin-bottom: 20px;
}
.section-title {
font-size: 1.3rem;
font-weight: bold;
color: #333;
margin-bottom: 15px;
border-bottom: 3px solid #007bff;
padding-bottom: 5px;
}
/* Compact Stats Overview */
.stats-overview {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 15px;
margin-bottom: 20px;
}
.stat-card {
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
padding: 20px;
text-align: center;
border: 1px solid #e9ecef;
transition: transform 0.2s ease;
}
.stat-card:hover {
transform: translateY(-2px);
}
.stat-icon {
font-size: 2rem;
margin-bottom: 10px;
display: block;
}
.stat-value {
font-size: 1.8rem;
font-weight: bold;
color: #333;
margin-bottom: 5px;
}
.stat-label {
color: #666;
font-size: 0.8rem;
font-weight: 500;
text-transform: uppercase;
}
/* Compact Archive Grid */
.archive-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 20px;
}
.archive-card {
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
border: 1px solid #e9ecef;
transition: all 0.2s ease;
cursor: pointer;
overflow: hidden;
position: relative;
}
.archive-card:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.archive-header {
background: #f8f9fa;
padding: 15px 20px;
border-bottom: 1px solid #e9ecef;
display: flex;
justify-content: space-between;
align-items: center;
}
.archive-card.league .archive-header {
background: #e8f5e8;
}
.archive-card.tournament .archive-header {
background: #fff3cd;
}
.archive-title {
font-size: 1.2rem;
font-weight: bold;
color: #333;
margin-bottom: 3px;
}
.archive-subtitle {
font-size: 0.85rem;
color: #666;
}
.archive-badge {
padding: 6px 12px;
border-radius: 15px;
font-size: 0.75rem;
font-weight: bold;
text-transform: uppercase;
}
.badge-league {
background: #28a745;
color: white;
}
.badge-tournament {
background: #ffc107;
color: #856404;
}
.archive-content {
padding: 15px 20px;
}
.archive-info {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
margin-bottom: 15px;
}
.info-item {
display: flex;
align-items: center;
gap: 6px;
font-size: 0.85rem;
color: #666;
}
.info-icon {
font-size: 1rem;
}
.info-value {
font-weight: 600;
color: #333;
}
.archive-actions {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
padding-top: 12px;
border-top: 1px solid #f0f0f0;
}
.view-btn {
background: #007bff;
border: none;
color: white;
padding: 8px 16px;
border-radius: 6px;
cursor: pointer;
font-size: 0.85rem;
font-weight: bold;
transition: all 0.2s ease;
text-decoration: none;
display: inline-block;
}
.view-btn:hover {
background: #0056b3;
transform: translateY(-1px);
}
.delete-btn {
background: #dc3545;
border: none;
color: white;
padding: 6px 12px;
border-radius: 6px;
cursor: pointer;
font-size: 0.75rem;
font-weight: bold;
transition: all 0.2s ease;
}
.delete-btn:hover {
background: #c82333;
}
/* Empty State */
.empty-state {
text-align: center;
padding: 40px 20px;
color: #666;
}
.empty-state h3 {
font-size: 1.3rem;
margin-bottom: 8px;
color: #333;
}
.empty-icon {
font-size: 3rem;
margin-bottom: 15px;
opacity: 0.5;
}
/* Confirmation Modal */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
opacity: 0;
visibility: hidden;
transition: all 0.2s ease;
}
.modal-overlay.active {
opacity: 1;
visibility: visible;
}
.confirmation-modal {
background: white;
border-radius: 8px;
padding: 20px;
max-width: 400px;
width: 90%;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
transform: scale(0.9);
transition: transform 0.2s ease;
}
.modal-overlay.active .confirmation-modal {
transform: scale(1);
}
.modal-title {
font-size: 1.1rem;
font-weight: bold;
color: #333;
margin-bottom: 10px;
}
.modal-message {
color: #666;
margin-bottom: 15px;
line-height: 1.4;
}
.modal-buttons {
display: flex;
gap: 10px;
justify-content: flex-end;
}
.modal-btn {
padding: 8px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
font-weight: 500;
transition: background-color 0.2s ease;
}
.modal-btn.cancel {
background: #6c757d;
color: white;
}
.modal-btn.cancel:hover {
background: #5a6268;
}
.modal-btn.confirm {
background: #dc3545;
color: white;
}
.modal-btn.confirm:hover {
background: #c82333;
}
/* Mobile responsive */
@media (max-width: 768px) {
.navbar {
padding: 12px 20px;
flex-direction: column;
gap: 15px;
}
.navbar-controls {
flex-wrap: wrap;
justify-content: center;
}
.container {
padding: 15px;
height: auto;
}
.archive-grid {
grid-template-columns: 1fr;
}
.stats-overview {
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.archive-header {
flex-direction: column;
align-items: flex-start;
gap: 8px;
}
.archive-info {
grid-template-columns: 1fr;
gap: 8px;
}
.archive-actions {
flex-direction: column;
align-items: stretch;
gap: 8px;
}
.view-btn {
text-align: center;
}
}
</style>
</head>
<body>
<div class="navbar">
<div class="navbar-title">📚 Tournament Archive</div>
<div class="navbar-controls">
<a href="/" class="nav-btn">← Dashboard</a>
<a href="/tournament" class="nav-btn">🏆 Tournament</a>
<a href="/archive/player-analysis" class="nav-btn success">👤 Player Analysis</a>
</div>
</div>
<div class="container">
<!-- Stats Overview -->
<div class="stats-overview">
<div class="stat-card">
<span class="stat-icon">🏆</span>
<div class="stat-value">{{ stats.total_tournaments }}</div>
<div class="stat-label">Standalone Tournaments</div>
</div>
<div class="stat-card">
<span class="stat-icon">🎖️</span>
<div class="stat-value">{{ stats.total_leagues }}</div>
<div class="stat-label">Completed Leagues</div>
</div>
<div class="stat-card">
<span class="stat-icon">👥</span>
<div class="stat-value">{{ stats.total_players }}</div>
<div class="stat-label">Active Players</div>
</div>
<div class="stat-card">
<span class="stat-icon">📊</span>
<div class="stat-value">{{ stats.total_matches }}</div>
<div class="stat-label">Total Competitions</div>
</div>
</div>
<!-- Leagues Section -->
{% if leagues %}
<div class="section">
<h2 class="section-title">🎖️ League Championships</h2>
<div class="archive-grid">
{% for league in leagues %}
<div class="archive-card league" onclick="viewLeague('{{ league.filename }}')">
<div class="archive-header">
<div>
<div class="archive-title">League Championship</div>
<div class="archive-subtitle">{{ league.created_at[:10] if league.created_at != 'Unknown' else 'Unknown Date' }}</div>
</div>
<span class="archive-badge badge-league">League</span>
</div>
<div class="archive-content">
<div class="archive-info">
<div class="info-item">
<span class="info-icon">👥</span>
<span class="info-value">{{ league.participants_count }} players</span>
</div>
<div class="info-item">
<span class="info-icon">🎯</span>
<span class="info-value">{{ league.tournament_type.replace('_', ' ')|title }}</span>
</div>
<div class="info-item">
<span class="info-icon">📅</span>
<span class="info-value">{{ league.archived_at[:10] if league.archived_at != 'Unknown' else 'Unknown Date' }}</span>
</div>
<div class="info-item">
<span class="info-icon"></span>
<span class="info-value">{{ league.completed_tournaments }}/{{ league.total_tournaments }} tournaments</span>
</div>
</div>
<div class="archive-actions">
<a href="/archive/league/{{ league.filename }}" class="view-btn">🏆 View Results</a>
<button class="delete-btn" onclick="event.stopPropagation(); deleteArchive('league', '{{ league.filename }}')">
🗑️ Delete
</button>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
<!-- Standalone Tournaments Section -->
{% if tournaments %}
<div class="section">
<h2 class="section-title">🏆 Standalone Tournaments</h2>
<div class="archive-grid">
{% for tournament in tournaments %}
<div class="archive-card tournament" onclick="viewTournament('{{ tournament.filename }}')">
<div class="archive-header">
<div>
<div class="archive-title">Single Tournament</div>
<div class="archive-subtitle">{{ tournament.created_at[:10] if tournament.created_at != 'Unknown' else 'Unknown Date' }}</div>
</div>
<span class="archive-badge badge-tournament">Tournament</span>
</div>
<div class="archive-content">
<div class="archive-info">
<div class="info-item">
<span class="info-icon">👥</span>
<span class="info-value">{{ tournament.participants_count }} players</span>
</div>
<div class="info-item">
<span class="info-icon">🎯</span>
<span class="info-value">{{ tournament.tournament_type.replace('_', ' ')|title }}</span>
</div>
<div class="info-item">
<span class="info-icon">📅</span>
<span class="info-value">{{ tournament.archived_at[:10] if tournament.archived_at != 'Unknown' else 'Unknown Date' }}</span>
</div>
<div class="info-item">
<span class="info-icon">🏁</span>
<span class="info-value">{{ 'Finished' if tournament.tournament_finished else 'Incomplete' }}</span>
</div>
</div>
<div class="archive-actions">
<a href="/archive/tournament/{{ tournament.filename }}" class="view-btn">📊 View Results</a>
<button class="delete-btn" onclick="event.stopPropagation(); deleteArchive('tournament', '{{ tournament.filename }}')">
🗑️ Delete
</button>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
<!-- Empty State -->
{% if not leagues and not tournaments %}
<div class="section">
<div class="empty-state">
<div class="empty-icon">📚</div>
<h3>No Archives Found</h3>
<p>Complete some tournaments or leagues to see them archived here</p>
<a href="/tournament" class="nav-btn primary" style="margin-top: 15px;">🏆 Start Tournament</a>
</div>
</div>
{% endif %}
</div>
<!-- Confirmation Modal -->
<div class="modal-overlay" id="confirmationModal">
<div class="confirmation-modal">
<div class="modal-title" id="modalTitle">Confirm Action</div>
<div class="modal-message" id="modalMessage">Are you sure you want to proceed?</div>
<div class="modal-buttons">
<button class="modal-btn cancel" onclick="closeModal()">Cancel</button>
<button class="modal-btn confirm" id="confirmBtn" onclick="confirmAction()">Confirm</button>
</div>
</div>
</div>
<script>
let pendingAction = null;
// Navigation functions
function viewTournament(filename) {
window.location.href = `/archive/tournament/${filename}`;
}
function viewLeague(filename) {
window.location.href = `/archive/league/${filename}`;
}
async function deleteArchive(type, filename) {
showModal(
'Delete Archive',
`Are you sure you want to delete this ${type}? This action cannot be undone.`,
async () => {
try {
const response = await fetch(`/api/archive/delete/${type}/${filename}`, {
method: 'POST'
});
const result = await response.json();
if (result.status === 'success') {
alert('Archive deleted successfully');
location.reload();
} else {
alert('Error deleting archive: ' + result.message);
}
} catch (error) {
alert('Error deleting archive: ' + error.message);
}
closeModal();
}
);
}
// Modal functions
function showModal(title, message, confirmCallback) {
document.getElementById('modalTitle').textContent = title;
document.getElementById('modalMessage').textContent = message;
pendingAction = confirmCallback;
document.getElementById('confirmationModal').classList.add('active');
}
function closeModal() {
document.getElementById('confirmationModal').classList.remove('active');
pendingAction = null;
}
function confirmAction() {
if (pendingAction) {
pendingAction();
}
}
// Click outside modal to close
document.getElementById('confirmationModal').addEventListener('click', function(e) {
if (e.target === this) {
closeModal();
}
});
// Initialize page
document.addEventListener('DOMContentLoaded', function() {
console.log('📚 Archive loaded');
console.log('🏆 Tournaments:', {{ tournaments|length if tournaments else 0 }});
console.log('🎖️ Leagues:', {{ leagues|length if leagues else 0 }});
});
</script>
</body>
</html>