1.0
This commit is contained in:
parent
e12406d033
commit
d63bd85799
94
add_score.php
Normal file
94
add_score.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Enter Golf Score</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">GolfTracker</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="index.php">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="add_score.php">Enter Score</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="container my-5">
|
||||||
|
<div class="card p-4">
|
||||||
|
<h1 class="text-center mb-4">Enter Round Score</h1>
|
||||||
|
|
||||||
|
<div class="form-check form-switch mb-4 d-flex justify-content-center">
|
||||||
|
<input class="form-check-input" type="checkbox" id="holesToggle">
|
||||||
|
<label class="form-check-label ms-2" for="holesToggle">Toggle for 18 Holes (9 by default)</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form id="scoreForm">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Hole</th>
|
||||||
|
<th scope="col">Score</th>
|
||||||
|
<th scope="col">Putts</th>
|
||||||
|
<th scope="col">Penalties</th>
|
||||||
|
<th scope="col">Sand Lie</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="scoreTable">
|
||||||
|
<!-- JS will render rows here -->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="text-center mt-4">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg">Submit Score</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div class="card totals-card bg-light p-3">
|
||||||
|
<h4 class="text-center">Round Totals</h4>
|
||||||
|
<div class="row text-center">
|
||||||
|
<div class="col"><strong>Score:</strong> <span id="totalScore">0</span></div>
|
||||||
|
<div class="col"><strong>Putts:</strong> <span id="totalPutts">0</span></div>
|
||||||
|
<div class="col"><strong>Penalties:</strong> <span id="totalPenalties">0</span></div>
|
||||||
|
<div class="col"><strong>Sand Lies:</strong> <span id="totalSandLies">0</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
|
||||||
|
<div id="successToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
|
<div class="toast-header text-white" style="background-color: #0D47A1;">
|
||||||
|
<strong class="me-auto">Success</strong>
|
||||||
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="toast-body">
|
||||||
|
Your score has been submitted successfully! (Client-side demo)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
47
assets/css/custom.css
Normal file
47
assets/css/custom.css
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
background-color: #F5F5F5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #0D47A1 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background-color: #0D47A1;
|
||||||
|
border-color: #0D47A1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #0a3a82;
|
||||||
|
border-color: #0a3a82;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger {
|
||||||
|
background-color: #D32F2F;
|
||||||
|
border-color: #D32F2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger:hover {
|
||||||
|
background-color: #a32424;
|
||||||
|
border-color: #a32424;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check-input:checked {
|
||||||
|
background-color: #0D47A1;
|
||||||
|
border-color: #0D47A1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals-card {
|
||||||
|
position: sticky;
|
||||||
|
bottom: 1rem;
|
||||||
|
z-index: 1020;
|
||||||
|
}
|
||||||
85
assets/js/main.js
Normal file
85
assets/js/main.js
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
const holesToggle = document.getElementById('holesToggle');
|
||||||
|
const scoreTable = document.getElementById('scoreTable');
|
||||||
|
const form = document.getElementById('scoreForm');
|
||||||
|
|
||||||
|
if (!holesToggle || !scoreTable || !form) return;
|
||||||
|
|
||||||
|
const updateTotal = () => {
|
||||||
|
let totalScore = 0;
|
||||||
|
let totalPutts = 0;
|
||||||
|
let totalPenalties = 0;
|
||||||
|
let totalSandLies = 0;
|
||||||
|
|
||||||
|
const holes = holesToggle.checked ? 18 : 9;
|
||||||
|
|
||||||
|
for (let i = 1; i <= holes; i++) {
|
||||||
|
const score = parseInt(document.getElementById(`hole${i}_score`).value) || 0;
|
||||||
|
const putts = parseInt(document.getElementById(`hole${i}_putts`).value) || 0;
|
||||||
|
const penalties = parseInt(document.getElementById(`hole${i}_penalties`).value) || 0;
|
||||||
|
const sandLie = document.getElementById(`hole${i}_sand`).checked;
|
||||||
|
|
||||||
|
totalScore += score;
|
||||||
|
totalPutts += putts;
|
||||||
|
totalPenalties += penalties;
|
||||||
|
if (sandLie) totalSandLies++;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('totalScore').textContent = totalScore;
|
||||||
|
document.getElementById('totalPutts').textContent = totalPutts;
|
||||||
|
document.getElementById('totalPenalties').textContent = totalPenalties;
|
||||||
|
document.getElementById('totalSandLies').textContent = totalSandLies;
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderTable = () => {
|
||||||
|
const holes = holesToggle.checked ? 18 : 9;
|
||||||
|
let html = '';
|
||||||
|
for (let i = 1; i <= 18; i++) {
|
||||||
|
const hidden = i > holes ? ' style="display: none;"' : '';
|
||||||
|
html += `
|
||||||
|
<tr id="hole_row_${i}" ${hidden}>
|
||||||
|
<th scope="row">${i}</th>
|
||||||
|
<td><input type="number" class="form-control" id="hole${i}_score" min="1"></td>
|
||||||
|
<td><input type="number" class="form-control" id="hole${i}_putts" min="0"></td>
|
||||||
|
<td><input type="number" class="form-control" id="hole${i}_penalties" min="0"></td>
|
||||||
|
<td><div class="form-check form-switch"><input class="form-check-input" type="checkbox" id="hole${i}_sand"></div></td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
scoreTable.innerHTML = html;
|
||||||
|
attachInputListeners();
|
||||||
|
};
|
||||||
|
|
||||||
|
const attachInputListeners = () => {
|
||||||
|
form.querySelectorAll('input').forEach(input => {
|
||||||
|
input.addEventListener('input', updateTotal);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
holesToggle.addEventListener('change', () => {
|
||||||
|
const holes = holesToggle.checked ? 18 : 9;
|
||||||
|
for (let i = 1; i <= 18; i++) {
|
||||||
|
const row = document.getElementById(`hole_row_${i}`);
|
||||||
|
if (row) {
|
||||||
|
row.style.display = i > holes ? 'none' : 'table-row';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateTotal();
|
||||||
|
});
|
||||||
|
|
||||||
|
form.addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const successToast = document.getElementById('successToast');
|
||||||
|
if (successToast) {
|
||||||
|
const toast = new bootstrap.Toast(successToast);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
form.reset();
|
||||||
|
renderTable();
|
||||||
|
updateTotal();
|
||||||
|
});
|
||||||
|
|
||||||
|
renderTable();
|
||||||
|
updateTotal();
|
||||||
|
});
|
||||||
183
index.php
183
index.php
@ -1,131 +1,82 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
declare(strict_types=1);
|
|
||||||
@ini_set('display_errors', '1');
|
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
<title>GolfTracker - Home</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
<style>
|
<style>
|
||||||
:root {
|
.hero {
|
||||||
--bg-color-start: #6a11cb;
|
background: linear-gradient(rgba(13, 71, 161, 0.7), rgba(13, 71, 161, 0.7)), url('https://picsum.photos/seed/golf/1600/900');
|
||||||
--bg-color-end: #2575fc;
|
background-size: cover;
|
||||||
--text-color: #ffffff;
|
background-position: center;
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
color: white;
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
padding: 8rem 0;
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
|
||||||
<div class="card">
|
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<div class="container">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<a class="navbar-brand" href="#">GolfTracker</a>
|
||||||
<span class="sr-only">Loading…</span>
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="index.php">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="add_score.php">Enter Score</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWiZZy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</nav>
|
||||||
<footer>
|
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<header class="hero">
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="display-4 fw-bold">Track Your Golf Season</h1>
|
||||||
|
<p class="lead">An interactive golf tournament calculator that tracks stroke averages and number of putts per round for a golf team.</p>
|
||||||
|
<a href="add_score.php" class="btn btn-danger btn-lg mt-3">Enter a New Score</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="py-5">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row text-center">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<img src="https://picsum.photos/seed/golfer/400/300" class="img-fluid rounded-circle mb-3" alt="A focused golfer taking a shot.">
|
||||||
|
<h3>Enter Scores Easily</h3>
|
||||||
|
<p>A simple form lets you enter scores, putts, penalties, and more for every hole.</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<img src="https://picsum.photos/seed/analysis/400/300" class="img-fluid rounded-circle mb-3" alt="A tablet showing golf analytics.">
|
||||||
|
<h3>Instant Analysis</h3>
|
||||||
|
<p>Get real-time totals for your round as you enter data, helping you track performance instantly.</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<img src="https://picsum.photos/seed/team/400/300" class="img-fluid rounded-circle mb-3" alt="A golf team celebrating.">
|
||||||
|
<h3>Track Your Team</h3>
|
||||||
|
<p>All statistics are tracked for the entire season, giving coaches and players valuable insights.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<footer class="py-4 bg-light text-center">
|
||||||
|
<div class="container">
|
||||||
|
<p class="mb-0">© <?php echo date("Y"); ?> GolfTracker. All Rights Reserved.</p>
|
||||||
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user