d0bbf7bdce
- calculator - result screens - some fixes
872 lines
24 KiB
HTML
872 lines
24 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title data-i18n="draft.tournament_draft">Tournament Draft</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="/static/css/base.css">
|
|
<link rel="stylesheet" href="/static/css/navbar.css">
|
|
<link rel="stylesheet" href="/static/css/buttons.css">
|
|
<link rel="stylesheet" href="/static/css/components.css">
|
|
<link rel="stylesheet" href="/static/css/responsive.css">
|
|
<style>
|
|
/* Draft-specific styles */
|
|
html, body {
|
|
margin: 0;
|
|
padding: 0;
|
|
background: #f5f5f5;
|
|
font-family: Arial, sans-serif;
|
|
height: 100vh;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.main-container {
|
|
height: calc(100vh - 70px);
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 0px;
|
|
gap: 15px;
|
|
}
|
|
|
|
.tournament-header {
|
|
background: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
padding: 15px 20px;
|
|
text-align: center;
|
|
flex-shrink: 0;
|
|
position: relative;
|
|
margin: 10px 15px 5px 15px;
|
|
}
|
|
|
|
.tournament-header .nav-btn {
|
|
position: absolute;
|
|
top: 10px;
|
|
right: 15px;
|
|
margin: 0;
|
|
}
|
|
|
|
.tournament-title {
|
|
font-size: 1.5rem;
|
|
font-weight: bold;
|
|
color: #333;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.tournament-stats {
|
|
color: #666;
|
|
font-size: 0.9rem;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.tournament-controls {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
gap: 15px;
|
|
}
|
|
|
|
.round-nav-btn {
|
|
background: #f8f9fa;
|
|
border: 2px solid #e9ecef;
|
|
cursor: pointer;
|
|
padding: 8px 14px;
|
|
border-radius: 8px;
|
|
transition: all 0.2s ease;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
color: #333;
|
|
font-weight: bold;
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
.round-nav-btn:hover {
|
|
background: #e9ecef;
|
|
border-color: #28a745;
|
|
color: #28a745;
|
|
}
|
|
|
|
.round-nav-btn:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
transform: none !important;
|
|
}
|
|
|
|
.current-round-display {
|
|
font-size: 1rem;
|
|
font-weight: bold;
|
|
color: #28a745;
|
|
margin: 0 15px;
|
|
min-width: 140px;
|
|
text-align: center;
|
|
}
|
|
|
|
/* Rounds Container - Vertical stack */
|
|
.rounds-container {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
min-height: 0;
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
padding: 15px;
|
|
background: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
margin: 5px 15px 15px 15px;
|
|
}
|
|
|
|
/* Custom scrollbar styling */
|
|
.rounds-container::-webkit-scrollbar {
|
|
width: 12px;
|
|
}
|
|
|
|
.rounds-container::-webkit-scrollbar-track {
|
|
background: #f5f5f5;
|
|
border-radius: 10px;
|
|
}
|
|
|
|
.rounds-container::-webkit-scrollbar-thumb {
|
|
background: #5a8fd1;
|
|
border-radius: 10px;
|
|
border: 2px solid #f5f5f5;
|
|
}
|
|
|
|
.rounds-container::-webkit-scrollbar-thumb:hover {
|
|
background: #4a7db8;
|
|
}
|
|
|
|
.round-row {
|
|
background: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
overflow: hidden;
|
|
transition: all 0.3s ease;
|
|
display: flex;
|
|
flex-direction: row;
|
|
flex-shrink: 0;
|
|
min-height: 0;
|
|
border: 2px solid #e9ecef;
|
|
border-left: 5px solid #9ca3af;
|
|
}
|
|
|
|
.round-row.current {
|
|
border-left: 5px solid #5a8fd1;
|
|
border-color: #5a8fd1;
|
|
box-shadow: 0 6px 24px rgba(90, 143, 209, 0.25);
|
|
}
|
|
|
|
.round-row.completed {
|
|
border-left: 5px solid #28a745;
|
|
border-color: #28a745;
|
|
opacity: 0.98;
|
|
box-shadow: 0 4px 16px rgba(40, 167, 69, 0.15);
|
|
}
|
|
|
|
.round-row.waiting {
|
|
opacity: 0.8;
|
|
border-color: #d1d5db;
|
|
}
|
|
|
|
.round-header {
|
|
background: linear-gradient(135deg, #f8f9fa 0%, #f0f1f3 100%);
|
|
border-right: 3px solid #e9ecef;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
padding: 14px 16px;
|
|
flex-shrink: 0;
|
|
text-align: center;
|
|
min-width: 130px;
|
|
}
|
|
|
|
.round-row.current .round-header {
|
|
background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
|
|
border-right-color: #5a8fd1;
|
|
}
|
|
|
|
.round-row.completed .round-header {
|
|
background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
|
|
border-right-color: #28a745;
|
|
}
|
|
|
|
.round-title {
|
|
font-size: 1.05rem;
|
|
font-weight: 700;
|
|
color: #333;
|
|
margin-bottom: 6px;
|
|
letter-spacing: 0.3px;
|
|
}
|
|
|
|
.round-badge {
|
|
padding: 4px 10px;
|
|
border-radius: 12px;
|
|
font-size: 0.7rem;
|
|
font-weight: 700;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
|
|
}
|
|
|
|
.current-badge {
|
|
background: #5a8fd1;
|
|
color: white;
|
|
box-shadow: 0 2px 8px rgba(90, 143, 209, 0.3);
|
|
}
|
|
|
|
.completed-badge {
|
|
background: #28a745;
|
|
color: white;
|
|
box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
|
|
}
|
|
|
|
.waiting-badge {
|
|
background: #9ca3af;
|
|
color: white;
|
|
box-shadow: 0 2px 6px rgba(156, 163, 175, 0.2);
|
|
}
|
|
|
|
.positions-container {
|
|
flex: 1;
|
|
display: grid;
|
|
grid-template-columns: repeat(6, 1fr);
|
|
gap: 8px;
|
|
padding: 12px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.position-card {
|
|
background: white;
|
|
border: 2px solid #9ca3af;
|
|
border-radius: 10px;
|
|
overflow: visible;
|
|
display: flex;
|
|
flex-direction: row;
|
|
transition: all 0.3s ease;
|
|
box-shadow: 0 2px 8px rgba(156, 163, 175, 0.18);
|
|
min-height: 80px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.position-card:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 3px 12px rgba(156, 163, 175, 0.28);
|
|
}
|
|
|
|
/* Current round - blue cards */
|
|
.round-row.current .position-card {
|
|
border-color: #5a8fd1;
|
|
box-shadow: 0 2px 8px rgba(90, 143, 209, 0.25);
|
|
}
|
|
|
|
.round-row.current .position-card:hover {
|
|
box-shadow: 0 3px 12px rgba(90, 143, 209, 0.35);
|
|
}
|
|
|
|
.round-row.current .position-card .position-header {
|
|
background: linear-gradient(135deg, #5a8fd1 0%, #4a7db8 100%);
|
|
}
|
|
|
|
/* Completed round - green cards */
|
|
.round-row.completed .position-card {
|
|
border-color: #28a745;
|
|
box-shadow: 0 2px 8px rgba(40, 167, 69, 0.25);
|
|
}
|
|
|
|
.round-row.completed .position-card:hover {
|
|
box-shadow: 0 3px 12px rgba(40, 167, 69, 0.35);
|
|
}
|
|
|
|
.round-row.completed .position-card .position-header {
|
|
background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
|
|
}
|
|
|
|
/* Waiting round - gray cards */
|
|
.round-row.waiting .position-card {
|
|
border-color: #9ca3af;
|
|
box-shadow: 0 2px 8px rgba(156, 163, 175, 0.2);
|
|
}
|
|
|
|
.round-row.waiting .position-card:hover {
|
|
box-shadow: 0 3px 10px rgba(156, 163, 175, 0.3);
|
|
}
|
|
|
|
.round-row.waiting .position-card .position-header {
|
|
background: linear-gradient(135deg, #9ca3af 0%, #8b929f 100%);
|
|
}
|
|
|
|
.position-header {
|
|
background: #9ca3af;
|
|
padding: 12px 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-shrink: 0;
|
|
min-width: 50px;
|
|
width: 50px;
|
|
min-height: 80px;
|
|
}
|
|
|
|
.position-card.empty .position-header {
|
|
background: #9ca3af;
|
|
}
|
|
|
|
.position-number {
|
|
font-size: 2rem;
|
|
font-weight: 700;
|
|
color: white;
|
|
line-height: 1;
|
|
}
|
|
|
|
.position-body {
|
|
padding: 12px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
flex: 1;
|
|
background: white;
|
|
border-radius: 0 8px 8px 0;
|
|
overflow: visible;
|
|
}
|
|
|
|
.position-card.empty .position-body {
|
|
background: #f8f9fa;
|
|
}
|
|
|
|
.player-name {
|
|
font-size: 1.15rem;
|
|
font-weight: 600;
|
|
color: #2c3e50;
|
|
line-height: 1.4;
|
|
word-wrap: break-word;
|
|
max-width: 100%;
|
|
text-align: center;
|
|
white-space: normal;
|
|
overflow: visible;
|
|
text-overflow: clip;
|
|
}
|
|
|
|
.position-card.empty .player-name {
|
|
color: #6c757d;
|
|
font-style: italic;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.player-id {
|
|
display: none;
|
|
}
|
|
|
|
/* No Tournament State */
|
|
.no-tournament {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
text-align: center;
|
|
color: #666;
|
|
}
|
|
|
|
.no-tournament h2 {
|
|
color: #333;
|
|
margin-bottom: 15px;
|
|
font-size: 1.5rem;
|
|
}
|
|
|
|
.no-tournament p {
|
|
margin-bottom: 20px;
|
|
font-size: 1.1rem;
|
|
}
|
|
|
|
/* PRINT STYLES */
|
|
@media print {
|
|
.navbar,
|
|
.tournament-controls {
|
|
display: none !important;
|
|
}
|
|
|
|
html, body {
|
|
height: auto !important;
|
|
overflow: visible !important;
|
|
background: white !important;
|
|
margin: 0;
|
|
padding: 20px;
|
|
}
|
|
|
|
.main-container {
|
|
height: auto !important;
|
|
padding: 0 !important;
|
|
}
|
|
|
|
.tournament-header {
|
|
background: white !important;
|
|
color: #333 !important;
|
|
box-shadow: none !important;
|
|
border: 2px solid #ddd !important;
|
|
padding: 20px;
|
|
margin-bottom: 20px;
|
|
page-break-inside: avoid;
|
|
}
|
|
|
|
.tournament-title {
|
|
font-size: 24pt !important;
|
|
font-weight: bold !important;
|
|
color: #333 !important;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.tournament-stats {
|
|
font-size: 12pt !important;
|
|
color: #666 !important;
|
|
margin-bottom: 0 !important;
|
|
}
|
|
|
|
.current-round-info {
|
|
display: none !important;
|
|
}
|
|
|
|
.rounds-container {
|
|
display: block !important;
|
|
overflow: visible !important;
|
|
padding: 0 !important;
|
|
}
|
|
|
|
.round-row {
|
|
background: white !important;
|
|
border: 1px solid #ddd !important;
|
|
border-radius: 0 !important;
|
|
box-shadow: none !important;
|
|
page-break-inside: avoid;
|
|
display: flex !important;
|
|
flex-direction: row !important;
|
|
margin-bottom: 15px;
|
|
flex-shrink: 0 !important;
|
|
}
|
|
|
|
.round-row.current,
|
|
.round-row.completed,
|
|
.round-row.waiting {
|
|
border-left: 2px solid #ddd !important;
|
|
opacity: 1 !important;
|
|
}
|
|
|
|
.round-header {
|
|
background: #f8f9fa !important;
|
|
border: none !important;
|
|
border-right: 1px solid #ddd !important;
|
|
display: flex !important;
|
|
flex-direction: column !important;
|
|
justify-content: center !important;
|
|
align-items: center !important;
|
|
padding: 10px 15px !important;
|
|
min-width: 130px !important;
|
|
}
|
|
|
|
.round-row.current .round-header,
|
|
.round-row.completed .round-header,
|
|
.round-row.waiting .round-header {
|
|
background: #f8f9fa !important;
|
|
}
|
|
|
|
.round-title {
|
|
font-size: 14pt !important;
|
|
font-weight: bold !important;
|
|
}
|
|
|
|
.round-badge {
|
|
display: none !important;
|
|
}
|
|
|
|
.round-print-info {
|
|
display: none !important;
|
|
}
|
|
|
|
.round-time-field {
|
|
display: flex !important;
|
|
align-items: center !important;
|
|
gap: 8px !important;
|
|
}
|
|
|
|
.round-time-label {
|
|
font-size: 11pt !important;
|
|
color: #666 !important;
|
|
font-weight: 500 !important;
|
|
}
|
|
|
|
.round-time-input {
|
|
border: 2px solid #333 !important;
|
|
border-radius: 4px !important;
|
|
padding: 6px 10px !important;
|
|
width: 100px !important;
|
|
height: 32px !important;
|
|
background: white !important;
|
|
}
|
|
|
|
.round-checkbox-field {
|
|
display: flex !important;
|
|
align-items: center !important;
|
|
gap: 10px !important;
|
|
}
|
|
|
|
.round-checkbox-label {
|
|
font-size: 11pt !important;
|
|
color: #666 !important;
|
|
font-weight: 500 !important;
|
|
}
|
|
|
|
.round-checkbox {
|
|
width: 24px !important;
|
|
height: 24px !important;
|
|
border: 2px solid #333 !important;
|
|
border-radius: 4px !important;
|
|
background: white !important;
|
|
display: inline-block !important;
|
|
}
|
|
|
|
.positions-container {
|
|
display: grid !important;
|
|
grid-template-columns: repeat(6, 1fr) !important;
|
|
gap: 8px !important;
|
|
padding: 15px !important;
|
|
overflow: visible !important;
|
|
}
|
|
|
|
.position-card {
|
|
border: 1px solid #5a8fd1 !important;
|
|
border-radius: 4px !important;
|
|
overflow: visible !important;
|
|
background: white !important;
|
|
box-shadow: none !important;
|
|
min-height: 70px !important;
|
|
page-break-inside: avoid;
|
|
display: flex !important;
|
|
flex-direction: row !important;
|
|
flex-shrink: 0 !important;
|
|
}
|
|
|
|
/* All cards in print have same blue color */
|
|
.round-row.current .position-card,
|
|
.round-row.completed .position-card,
|
|
.round-row.waiting .position-card {
|
|
border-color: #5a8fd1 !important;
|
|
}
|
|
|
|
.position-header {
|
|
background: #5a8fd1 !important;
|
|
padding: 10px 0 !important;
|
|
display: flex !important;
|
|
align-items: center !important;
|
|
justify-content: center !important;
|
|
flex-shrink: 0 !important;
|
|
min-width: 40px !important;
|
|
width: 40px !important;
|
|
min-height: 70px !important;
|
|
}
|
|
|
|
.position-number {
|
|
font-size: 12pt !important;
|
|
font-weight: bold !important;
|
|
color: white !important;
|
|
}
|
|
|
|
.position-body {
|
|
padding: 6px 10px !important;
|
|
display: flex !important;
|
|
flex-direction: column !important;
|
|
justify-content: center !important;
|
|
align-items: center !important;
|
|
flex: 1 !important;
|
|
background: white !important;
|
|
overflow: hidden !important;
|
|
}
|
|
|
|
.player-name {
|
|
font-size: 10pt !important;
|
|
font-weight: 600 !important;
|
|
color: #2c3e50 !important;
|
|
line-height: 1.2 !important;
|
|
white-space: nowrap !important;
|
|
overflow: hidden !important;
|
|
text-overflow: ellipsis !important;
|
|
max-width: 100% !important;
|
|
}
|
|
|
|
.round-row.current .position-card .position-header,
|
|
.round-row.completed .position-card .position-header,
|
|
.round-row.waiting .position-card .position-header {
|
|
background: #5a8fd1 !important;
|
|
}
|
|
|
|
.position-card.empty .position-header {
|
|
background: #9ca3af !important;
|
|
}
|
|
|
|
.position-number {
|
|
font-size: 14pt !important;
|
|
color: white !important;
|
|
}
|
|
|
|
.position-body {
|
|
padding: 10px !important;
|
|
background: white !important;
|
|
flex: 1 !important;
|
|
display: flex !important;
|
|
flex-direction: column !important;
|
|
justify-content: center !important;
|
|
align-items: center !important;
|
|
}
|
|
|
|
.position-card.empty .position-body {
|
|
background: #f8f9fa !important;
|
|
}
|
|
|
|
.player-name {
|
|
font-size: 10pt !important;
|
|
color: #2c3e50 !important;
|
|
white-space: normal !important;
|
|
overflow: visible !important;
|
|
}
|
|
|
|
.position-card.empty .player-name {
|
|
color: #6c757d !important;
|
|
}
|
|
|
|
.player-id {
|
|
display: none !important;
|
|
}
|
|
|
|
.no-tournament {
|
|
display: none !important;
|
|
}
|
|
|
|
/* Print header - show logo in tournament header */
|
|
.print-header {
|
|
display: none !important;
|
|
}
|
|
|
|
.tournament-header .print-logo {
|
|
display: block !important;
|
|
height: 60px !important;
|
|
max-width: 160px !important;
|
|
margin: 0 auto 10px auto !important;
|
|
}
|
|
}
|
|
|
|
/* Print-only elements - hidden on screen */
|
|
.print-header,
|
|
.round-print-info,
|
|
.tournament-header .print-logo {
|
|
display: none;
|
|
}
|
|
</style>
|
|
<script src="/static/js/i18n.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="navbar">
|
|
<div class="navbar-title">🏆 <span data-i18n="draft.tournament_draft">Tournament Draft</span></div>
|
|
<div class="navbar-controls">
|
|
<a href="/" class="nav-btn">📺 <span data-i18n="navigation.dashboard">Dashboard</span></a>
|
|
<a href="/tournament" class="nav-btn">🏆 <span data-i18n="navigation.tournament">Tournament</span></a>
|
|
<a href="/tournament/draft" class="nav-btn active">📋 <span data-i18n="tournament.view_draft">Draft</span></a>
|
|
<a href="/results/calculator" class="nav-btn">🎯 <span data-i18n="navigation.calculator">Results Calculator</span></a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Print-only header with logo -->
|
|
<div class="print-header">
|
|
<img src="/static/logo.png" alt="Logo" class="print-logo" onerror="this.style.display='none'" />
|
|
</div>
|
|
|
|
<div class="main-container">
|
|
{% if tournament %}
|
|
<div class="tournament-header">
|
|
<button class="nav-btn" onclick="printDraft()" title="Print Tournament Draft">🖨️ <span data-i18n="general.print">Print</span></button>
|
|
<img src="/static/logo.png" alt="Logo" class="print-logo" onerror="this.style.display='none'" />
|
|
<div class="tournament-title">🎯 <span data-i18n="draft.shooting_tournament">Shooting Tournament</span></div>
|
|
<div class="tournament-stats">
|
|
{{ tournament.total_players }} <span data-i18n="draft.players">players</span> • {{ tournament.total_rounds }} <span data-i18n="draft.rounds">rounds</span>
|
|
{% if tournament.current_round %}
|
|
<span class="current-round-info"><span data-i18n="draft.currently_on_round">Currently on Round</span> {{ tournament.current_round }}</span>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if tournament.current_round %}
|
|
<div class="tournament-controls">
|
|
<button class="round-nav-btn" id="prevRoundBtn" onclick="changeRound(-1)" title="Previous Round">
|
|
← <span data-i18n="draft.previous">Previous</span>
|
|
</button>
|
|
<span class="current-round-display"><span data-i18n="draft.round">Round</span> {{ tournament.current_round }} <span data-i18n="draft.of">of</span> {{ tournament.total_rounds }}</span>
|
|
<button class="round-nav-btn" id="nextRoundBtn" onclick="changeRound(1)" title="Next Round">
|
|
<span data-i18n="draft.next">Next</span> →
|
|
</button>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="rounds-container" data-total-rounds="{{ tournament.total_rounds }}">
|
|
{% for round in tournament.rounds %}
|
|
{% set is_current = tournament.current_round == round.round_number %}
|
|
{% set is_completed = tournament.current_round > round.round_number %}
|
|
<div class="round-row {{ 'current' if is_current else ('completed' if is_completed else 'waiting') }}">
|
|
<div class="round-header">
|
|
<div class="round-title"><span data-i18n="draft.round">Round</span> {{ round.round_number }}</div>
|
|
{% if is_current %}
|
|
<div class="round-badge current-badge" data-i18n="draft.current">Current</div>
|
|
{% elif is_completed %}
|
|
<div class="round-badge completed-badge" data-i18n="draft.done">Done</div>
|
|
{% else %}
|
|
<div class="round-badge waiting-badge" data-i18n="draft.wait">Wait</div>
|
|
{% endif %}
|
|
|
|
<!-- Print-only fields -->
|
|
<div class="round-print-info">
|
|
<div class="round-time-field">
|
|
<span class="round-time-label"><span data-i18n="draft.time">Time</span>:</span>
|
|
<div class="round-time-input"></div>
|
|
</div>
|
|
<div class="round-checkbox-field">
|
|
<span class="round-checkbox-label"><span data-i18n="draft.completed">Completed</span>:</span>
|
|
<div class="round-checkbox"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="positions-container">
|
|
{% for position in range(1, 7) %}
|
|
{% set player = round.players[position-1] if position <= round.players|length else none %}
|
|
<div class="position-card {{ 'filled' if player else 'empty' }}">
|
|
<div class="position-header">
|
|
<div class="position-number">{{ position }}</div>
|
|
</div>
|
|
<div class="position-body">
|
|
{% if player %}
|
|
<div class="player-name">{{ player.name }}</div>
|
|
<div class="player-id">ID: {{ player.id }}</div>
|
|
{% else %}
|
|
<div class="player-name" data-i18n="draft.empty">Empty</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% else %}
|
|
<div class="no-tournament">
|
|
<h2 data-i18n="draft.no_active_tournament">No Active Tournament</h2>
|
|
<p data-i18n="draft.setup_tournament_message">Go to Tournament Management to set up players and start a tournament.</p>
|
|
<a href="/tournament" class="nav-btn primary">🏆 <span data-i18n="draft.set_up_tournament">Set Up Tournament</span></a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<script>
|
|
// Tournament state
|
|
const tournamentActive = {{ 'true' if tournament else 'false' }};
|
|
let currentRound = {{ tournament.current_round if tournament else 1 }};
|
|
const totalRounds = {{ tournament.total_rounds if tournament else 1 }};
|
|
|
|
function updateRoundNavigation() {
|
|
if (tournamentActive) {
|
|
const prevBtn = document.getElementById('prevRoundBtn');
|
|
const nextBtn = document.getElementById('nextRoundBtn');
|
|
|
|
if (prevBtn) prevBtn.disabled = currentRound <= 1;
|
|
if (nextBtn) nextBtn.disabled = currentRound >= totalRounds;
|
|
}
|
|
}
|
|
|
|
// Change round function
|
|
async function changeRound(direction) {
|
|
if (!tournamentActive) return;
|
|
|
|
const newRound = currentRound + direction;
|
|
if (newRound < 1 || newRound > totalRounds) return;
|
|
|
|
// Disable buttons during request
|
|
const prevBtn = document.getElementById('prevRoundBtn');
|
|
const nextBtn = document.getElementById('nextRoundBtn');
|
|
|
|
if (prevBtn) prevBtn.disabled = true;
|
|
if (nextBtn) nextBtn.disabled = true;
|
|
|
|
try {
|
|
const response = await fetch(`/api/tournament/round/${newRound}`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
}
|
|
});
|
|
|
|
if (response.ok) {
|
|
currentRound = newRound;
|
|
updateRoundNavigation();
|
|
|
|
// Reload page to get new round players
|
|
setTimeout(() => {
|
|
window.location.reload();
|
|
}, 300);
|
|
} else {
|
|
console.error('Failed to change round');
|
|
alert('Failed to change round. Please try again.');
|
|
updateRoundNavigation();
|
|
}
|
|
} catch (error) {
|
|
console.error('Error changing round:', error);
|
|
alert('Error changing round. Please try again.');
|
|
updateRoundNavigation();
|
|
}
|
|
}
|
|
|
|
// Print function
|
|
function printDraft() {
|
|
window.print();
|
|
}
|
|
|
|
// Keyboard shortcuts
|
|
document.addEventListener('keydown', function(event) {
|
|
if (event.key === 'Escape') {
|
|
window.location.href = '/';
|
|
} else if (event.key === 'r' || event.key === 'R') {
|
|
event.preventDefault();
|
|
window.location.reload();
|
|
} else if (event.key === 'p' || event.key === 'P') {
|
|
event.preventDefault();
|
|
window.print();
|
|
} else if (tournamentActive) {
|
|
if (event.key === 'ArrowLeft') {
|
|
event.preventDefault();
|
|
changeRound(-1);
|
|
} else if (event.key === 'ArrowRight') {
|
|
event.preventDefault();
|
|
changeRound(1);
|
|
}
|
|
}
|
|
});
|
|
|
|
// Initialize
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
updateRoundNavigation();
|
|
|
|
// Scroll to current round
|
|
setTimeout(() => {
|
|
const currentRoundRow = document.querySelector('.round-row.current');
|
|
if (currentRoundRow) {
|
|
currentRoundRow.scrollIntoView({
|
|
behavior: 'smooth',
|
|
block: 'center'
|
|
});
|
|
}
|
|
}, 500);
|
|
|
|
console.log('🖥️ PC Tournament Draft (Vertical Rows) loaded');
|
|
console.log('🏆 Tournament active:', tournamentActive);
|
|
console.log(`📊 Displaying ${totalRounds} rounds in vertical layout`);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |