From d63bd857994dfc3aab89f77bc2b42e61894c0fa7 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Wed, 24 Sep 2025 12:46:41 +0000 Subject: [PATCH] 1.0 --- add_score.php | 94 +++++++++++++++++++ assets/css/custom.css | 47 ++++++++++ assets/js/main.js | 85 ++++++++++++++++++ index.php | 203 ++++++++++++++++-------------------------- 4 files changed, 303 insertions(+), 126 deletions(-) create mode 100644 add_score.php create mode 100644 assets/css/custom.css create mode 100644 assets/js/main.js diff --git a/add_score.php b/add_score.php new file mode 100644 index 0000000..896bf70 --- /dev/null +++ b/add_score.php @@ -0,0 +1,94 @@ + + + + + + + Enter Golf Score + + + + + + + + + + +
+
+

Enter Round Score

+ +
+ + +
+ +
+
+ + + + + + + + + + + + + +
HoleScorePuttsPenaltiesSand Lie
+
+
+ +
+
+
+
+ +
+

Round Totals

+
+
Score: 0
+
Putts: 0
+
Penalties: 0
+
Sand Lies: 0
+
+
+ +
+ +
+ + + + + + diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..a3f798d --- /dev/null +++ b/assets/css/custom.css @@ -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; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..d1f9474 --- /dev/null +++ b/assets/js/main.js @@ -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 += ` + + ${i} + + + +
+ + `; + } + 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(); +}); diff --git a/index.php b/index.php index 6f7ffab..a12f676 100644 --- a/index.php +++ b/index.php @@ -1,131 +1,82 @@ - - + - - - New Style - - - - + + + GolfTracker - Home + + + + + + -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

-
-
- + + + +
+
+

Track Your Golf Season

+

An interactive golf tournament calculator that tracks stroke averages and number of putts per round for a golf team.

+ Enter a New Score +
+
+ +
+
+
+
+ A focused golfer taking a shot. +

Enter Scores Easily

+

A simple form lets you enter scores, putts, penalties, and more for every hole.

+
+
+ A tablet showing golf analytics. +

Instant Analysis

+

Get real-time totals for your round as you enter data, helping you track performance instantly.

+
+
+ A golf team celebrating. +

Track Your Team

+

All statistics are tracked for the entire season, giving coaches and players valuable insights.

+
+
+
+
+ + + + - + \ No newline at end of file