Latest updates to use postgres
This commit is contained in:
@@ -0,0 +1,186 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin Dashboard - HKFC Men's C Team MOTM System</title>
|
||||
<link rel="stylesheet" media="screen" href="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
<style>
|
||||
.admin-section {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.section-header {
|
||||
background-color: #f5f5f5;
|
||||
padding: 15px;
|
||||
border-left: 4px solid #337ab7;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.card-custom {
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
.card-custom:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="page-header">
|
||||
<h1>HKFC Men's C Team - Admin Dashboard</h1>
|
||||
<p class="lead">Central hub for all administrative functions</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<a href="/" class="btn btn-default">Back to Main Page</a>
|
||||
</div>
|
||||
|
||||
<!-- Data Management Section -->
|
||||
<div class="admin-section">
|
||||
<div class="section-header">
|
||||
<h3>Data Management</h3>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/players" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Player Management</h4>
|
||||
<p class="list-group-item-text">Add, edit, and manage players</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/clubs" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Club Management</h4>
|
||||
<p class="list-group-item-text">Manage hockey clubs</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/teams" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Team Management</h4>
|
||||
<p class="list-group-item-text">Manage hockey teams</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/import" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Data Import</h4>
|
||||
<p class="list-group-item-text">Import clubs and teams</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Match Management Section -->
|
||||
<div class="admin-section">
|
||||
<div class="section-header">
|
||||
<h3>Match Management</h3>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/squad" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Squad Selection</h4>
|
||||
<p class="list-group-item-text">Select match squad</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/squad/list" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">View Squad</h4>
|
||||
<p class="list-group-item-text">View current squad</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/squad/reset" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Reset Squad</h4>
|
||||
<p class="list-group-item-text">Reset for new match</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/stats" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Goals & Assists</h4>
|
||||
<p class="list-group-item-text">Record statistics</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MOTM Management Section -->
|
||||
<div class="admin-section">
|
||||
<div class="section-header">
|
||||
<h3>MOTM Management</h3>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/motm" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">MOTM Admin</h4>
|
||||
<p class="list-group-item-text">Manage match settings and activate voting</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/voting" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Voting Results</h4>
|
||||
<p class="list-group-item-text">View current match results</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/poty" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Player of the Year</h4>
|
||||
<p class="list-group-item-text">View season standings</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- System Management Section -->
|
||||
<div class="admin-section">
|
||||
<div class="section-header">
|
||||
<h3>System Management</h3>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/database-setup" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Database Setup</h4>
|
||||
<p class="list-group-item-text">Configure and initialize database</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="list-group card-custom">
|
||||
<a href="/admin/database-status" class="list-group-item">
|
||||
<h4 class="list-group-item-heading">Database Status</h4>
|
||||
<p class="list-group-item-text">View database configuration</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -15,9 +15,45 @@
|
||||
|
||||
<div class="mb-3">
|
||||
<a href="/admin/clubs/add" class="btn btn-primary">Add New Club</a>
|
||||
<button type="button" class="btn btn-info" id="importClubsBtn" onclick="importClubs()">
|
||||
<span class="spinner-border spinner-border-sm d-none" id="importSpinner"></span>
|
||||
Import from Hockey HK
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-info" id="previewClubsBtn" onclick="previewClubs()">
|
||||
Preview Clubs
|
||||
</button>
|
||||
<a href="/admin" class="btn btn-secondary">Back to Admin</a>
|
||||
</div>
|
||||
|
||||
<!-- Import Status -->
|
||||
<div id="importStatus" class="alert d-none" role="alert"></div>
|
||||
|
||||
<!-- Preview Modal -->
|
||||
<div class="modal fade" id="previewModal" tabindex="-1" aria-labelledby="previewModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="previewModalLabel">Clubs from Hockey Hong Kong</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="previewContent">
|
||||
<div class="text-center">
|
||||
<div class="spinner-border" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<p>Loading clubs...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="confirmImportBtn" onclick="confirmImport()">Import All</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
@@ -79,5 +115,192 @@
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
<script>
|
||||
let previewClubs = [];
|
||||
|
||||
function showStatus(message, type = 'info') {
|
||||
const statusDiv = document.getElementById('importStatus');
|
||||
statusDiv.className = `alert alert-${type}`;
|
||||
statusDiv.textContent = message;
|
||||
statusDiv.classList.remove('d-none');
|
||||
|
||||
// Auto-hide after 5 seconds
|
||||
setTimeout(() => {
|
||||
statusDiv.classList.add('d-none');
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
function previewClubs() {
|
||||
const modal = new bootstrap.Modal(document.getElementById('previewModal'));
|
||||
const content = document.getElementById('previewContent');
|
||||
|
||||
// Show loading state
|
||||
content.innerHTML = `
|
||||
<div class="text-center">
|
||||
<div class="spinner-border" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<p>Loading clubs from Hockey Hong Kong...</p>
|
||||
</div>
|
||||
`;
|
||||
|
||||
modal.show();
|
||||
|
||||
// Fetch clubs
|
||||
fetch('/admin/api/clubs')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
previewClubs = data.clubs;
|
||||
displayPreviewClubs(data.clubs);
|
||||
} else {
|
||||
content.innerHTML = `
|
||||
<div class="alert alert-warning">
|
||||
<h6>Unable to fetch clubs</h6>
|
||||
<p>${data.message}</p>
|
||||
<p><small>This might be due to website structure changes or network issues.</small></p>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
content.innerHTML = `
|
||||
<div class="alert alert-danger">
|
||||
<h6>Error loading clubs</h6>
|
||||
<p>There was an error fetching clubs from the Hockey Hong Kong website.</p>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
}
|
||||
|
||||
function displayPreviewClubs(clubs) {
|
||||
const content = document.getElementById('previewContent');
|
||||
|
||||
if (clubs.length === 0) {
|
||||
content.innerHTML = `
|
||||
<div class="alert alert-info">
|
||||
<h6>No clubs found</h6>
|
||||
<p>The website structure may have changed or no clubs are currently listed.</p>
|
||||
</div>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
||||
let html = `
|
||||
<div class="alert alert-info">
|
||||
<h6>Found ${clubs.length} clubs</h6>
|
||||
<p>These clubs will be imported with their full names and abbreviations.</p>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Club Name</th>
|
||||
<th>Abbreviation</th>
|
||||
<th>Teams</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`;
|
||||
|
||||
clubs.forEach(club => {
|
||||
const teams = club.teams ? club.teams.join(', ') : 'N/A';
|
||||
html += `
|
||||
<tr>
|
||||
<td>${club.name}</td>
|
||||
<td><span class="badge bg-secondary">${club.abbreviation || 'N/A'}</span></td>
|
||||
<td>${teams}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
html += `
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
`;
|
||||
|
||||
content.innerHTML = html;
|
||||
}
|
||||
|
||||
function confirmImport() {
|
||||
const importBtn = document.getElementById('confirmImportBtn');
|
||||
const spinner = document.getElementById('importSpinner');
|
||||
|
||||
// Show loading state
|
||||
importBtn.disabled = true;
|
||||
importBtn.innerHTML = '<span class="spinner-border spinner-border-sm"></span> Importing...';
|
||||
|
||||
// Import clubs
|
||||
fetch('/admin/api/import-clubs', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
showStatus(data.message, 'success');
|
||||
// Close modal
|
||||
const modal = bootstrap.Modal.getInstance(document.getElementById('previewModal'));
|
||||
modal.hide();
|
||||
// Reload page to show updated clubs
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
showStatus(data.message, 'danger');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
showStatus('Error importing clubs', 'danger');
|
||||
})
|
||||
.finally(() => {
|
||||
importBtn.disabled = false;
|
||||
importBtn.innerHTML = 'Import All';
|
||||
});
|
||||
}
|
||||
|
||||
function importClubs() {
|
||||
const importBtn = document.getElementById('importClubsBtn');
|
||||
const spinner = document.getElementById('importSpinner');
|
||||
|
||||
// Show loading state
|
||||
importBtn.disabled = true;
|
||||
spinner.classList.remove('d-none');
|
||||
|
||||
// Import clubs directly
|
||||
fetch('/admin/api/import-clubs', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
showStatus(data.message, 'success');
|
||||
// Reload page to show updated clubs
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
showStatus(data.message, 'danger');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
showStatus('Error importing clubs', 'danger');
|
||||
})
|
||||
.finally(() => {
|
||||
importBtn.disabled = false;
|
||||
spinner.classList.add('d-none');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h1>Error</h1>
|
||||
<p>Invalid voting URL. Please check the link and try again.</p>
|
||||
<p>{{ message or "Invalid voting URL. Please check the link and try again." }}</p>
|
||||
<a class="btn btn-primary" href="/" role="button">Home</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -41,11 +41,11 @@
|
||||
{% for player in players %}
|
||||
<div class="col-md-4 mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="playerNumber" value="{{ player.playerNumber }}" id="player{{ player.playerNumber }}">
|
||||
<label class="form-check-label" for="player{{ player.playerNumber }}">
|
||||
<strong>#{{ player.playerNumber }}</strong> {{ player.playerForenames }} {{ player.playerSurname }}
|
||||
<input class="form-check-input" type="checkbox" name="playerNumber" value="{{ player.playernumber }}" id="player{{ player.playernumber }}">
|
||||
<label class="form-check-label" for="player{{ player.playernumber }}">
|
||||
<strong>#{{ player.playernumber }}</strong> {{ player.playerforenames }} {{ player.playersurname }}
|
||||
<br>
|
||||
<small class="text-muted">{{ player.playerNickname }} - {{ player.playerTeam }}</small>
|
||||
<small class="text-muted">{{ player.playernickname }} - {{ player.playerteam }}</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,17 +8,33 @@
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h3>Match Squad</h3>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3>Match Squad</h3>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ 'danger' if category == 'error' else 'success' if category == 'success' else 'info' }} alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<div class="mb-3">
|
||||
<a class="btn btn-primary" href="/admin/squad" role="button">Add More Players</a>
|
||||
<a class="btn btn-info" href="/admin/squad/list" role="button">View Squad List</a>
|
||||
<a class="btn btn-warning" href="/admin/squad/reset" role="button">Reset Squad</a>
|
||||
<a class="btn btn-secondary" href="/admin" role="button">Back to Admin</a>
|
||||
<a class="btn btn-danger" href="/" role="button">Cancel</a>
|
||||
</div>
|
||||
|
||||
{{ table }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn btn-primary" href="/admin/squad" role="button">Add More Players</a>
|
||||
<a class="btn btn-info" href="/admin/squad/list" role="button">View Squad List</a>
|
||||
<a class="btn btn-warning" href="/admin/squad/reset" role="button">Reset Squad</a>
|
||||
<a class="btn btn-danger" href="/" role="button">Cancel</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<h2>HKFC Men's C Team MotM and DotD online vote admin page</h2>
|
||||
<div style="margin-bottom: 15px;">
|
||||
<a href="/admin" class="btn btn-default btn-sm">
|
||||
<span class="glyphicon glyphicon-arrow-left"></span> Back to Admin Dashboard
|
||||
</a>
|
||||
</div>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
@@ -28,11 +33,27 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<form class="col-sm-6" method="post" action="/admin/motm">
|
||||
<!-- Load Next Fixture Button -->
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="alert alert-info" style="margin-bottom: 15px;">
|
||||
<button type="button" class="btn btn-info btn-sm" id="loadFixtureBtn" onclick="loadNextFixture()">
|
||||
<span class="glyphicon glyphicon-download-alt"></span> Load Next HKFC C Fixture
|
||||
</button>
|
||||
<a href="https://hockey.org.hk/MenFixture.asp" target="_blank" class="btn btn-default btn-sm" style="margin-left: 5px;">
|
||||
<span class="glyphicon glyphicon-new-window"></span> View HK Hockey Fixtures
|
||||
</a>
|
||||
<span id="fixtureStatus" style="margin-left: 10px;"></span>
|
||||
<div id="fixtureInfo" style="margin-top: 10px; display: none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class = "row">
|
||||
<div class = "col-sm-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Date:</span>
|
||||
{{ form.nextMatchDate(class_="form-control") }}
|
||||
{{ form.nextMatchDate(class_="form-control", id="nextMatchDate") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -41,7 +62,7 @@
|
||||
<div class = "col-sm-9">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="basic-addon1">Opposition</span>
|
||||
{{ form.nextOppoTeam(class_="form-control") }}
|
||||
{{ form.nextOppoTeam(class_="form-control", id="nextOppoTeam") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -59,6 +80,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if not form.currMotM.choices or form.currMotM.choices|length == 0 %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="alert alert-warning" style="margin-top: 10px;">
|
||||
<small><strong>Note:</strong> No players available for previous MOTM/DotD. This is normal if you haven't set up a match squad yet. You can still save the match details.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<p>
|
||||
{{ form.saveButton(class_="btn btn-success") }}
|
||||
{{ form.activateButton(class_="btn btn-primary") }}
|
||||
@@ -74,8 +104,73 @@
|
||||
</dl>
|
||||
|
||||
<script>
|
||||
// Date input functionality - no longer needed to fetch fixture data
|
||||
// The date input will be handled by the browser's native date picker
|
||||
function loadNextFixture() {
|
||||
// Show loading status
|
||||
var statusElement = document.getElementById('fixtureStatus');
|
||||
var infoElement = document.getElementById('fixtureInfo');
|
||||
var loadBtn = document.getElementById('loadFixtureBtn');
|
||||
|
||||
statusElement.innerHTML = '<span class="text-info">Loading...</span>';
|
||||
loadBtn.disabled = true;
|
||||
|
||||
// Fetch the next fixture from the API
|
||||
fetch('/admin/api/next-fixture')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
// Update the form fields
|
||||
document.getElementById('nextMatchDate').value = data.date;
|
||||
document.getElementById('nextOppoTeam').value = data.opponent;
|
||||
|
||||
// Show fixture information
|
||||
let clubInfo = '';
|
||||
if (data.opponent_club_info) {
|
||||
const club = data.opponent_club_info;
|
||||
const confidence = club.match_result ? club.match_result.confidence : 'unknown';
|
||||
const matchType = club.match_result ? club.match_result.match_type : 'unknown';
|
||||
|
||||
clubInfo = '<br><small class="text-muted">';
|
||||
clubInfo += 'Club: ' + club.club_name;
|
||||
if (club.logo_url) {
|
||||
clubInfo += ' | <a href="' + club.logo_url + '" target="_blank">Logo</a>';
|
||||
}
|
||||
clubInfo += ' | Match: ' + matchType + ' (' + confidence + ')';
|
||||
clubInfo += '</small>';
|
||||
}
|
||||
|
||||
infoElement.innerHTML = '<strong>Next Match:</strong> ' +
|
||||
data.date_formatted + ' vs ' + data.opponent +
|
||||
' (' + (data.is_home ? 'Home' : 'Away') + ' - ' + data.venue + ')' +
|
||||
'<br><small>Division: ' + data.division + ' | Time: ' + data.time + '</small>' +
|
||||
clubInfo;
|
||||
infoElement.style.display = 'block';
|
||||
|
||||
statusElement.innerHTML = '<span class="text-success">✓ Fixture loaded!</span>';
|
||||
|
||||
// Clear status message after 3 seconds
|
||||
setTimeout(function() {
|
||||
statusElement.innerHTML = '';
|
||||
}, 3000);
|
||||
} else {
|
||||
statusElement.innerHTML = '<span class="text-danger">✗ ' + data.message + '</span>';
|
||||
infoElement.style.display = 'none';
|
||||
}
|
||||
loadBtn.disabled = false;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
statusElement.innerHTML = '<span class="text-danger">✗ Error loading fixture</span>';
|
||||
infoElement.style.display = 'none';
|
||||
loadBtn.disabled = false;
|
||||
});
|
||||
}
|
||||
|
||||
// Auto-load fixture on page load
|
||||
function myFunction() {
|
||||
// Optional: Auto-load the next fixture when the page loads
|
||||
// Uncomment the next line if you want this behavior
|
||||
// loadNextFixture();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -50,18 +50,18 @@
|
||||
<tbody>
|
||||
{% for player in players %}
|
||||
<tr>
|
||||
<td>{{ player.playerNumber }}</td>
|
||||
<td>{{ player.playerForenames }}</td>
|
||||
<td>{{ player.playerSurname }}</td>
|
||||
<td>{{ player.playerNickname }}</td>
|
||||
<td>{{ player.playernumber }}</td>
|
||||
<td>{{ player.playerforenames }}</td>
|
||||
<td>{{ player.playersurname }}</td>
|
||||
<td>{{ player.playernickname }}</td>
|
||||
<td>
|
||||
<span class="badge bg-{{ 'primary' if player.playerTeam == 'HKFC C' else 'secondary' }}">
|
||||
{{ player.playerTeam }}
|
||||
<span class="badge bg-{{ 'primary' if player.playerteam == 'HKFC C' else 'secondary' }}">
|
||||
{{ player.playerteam }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/admin/players/edit/{{ player.playerNumber }}" class="btn btn-sm btn-outline-primary">Edit</a>
|
||||
<form method="POST" action="/admin/players/delete/{{ player.playerNumber }}" style="display: inline;" onsubmit="return confirm('Are you sure you want to delete this player?')">
|
||||
<a href="/admin/players/edit/{{ player.playernumber }}" class="btn btn-sm btn-outline-primary">Edit</a>
|
||||
<form method="POST" action="/admin/players/delete/{{ player.playernumber }}" style="display: inline;" onsubmit="return confirm('Are you sure you want to delete this player?')">
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user