{"id":407,"date":"2026-04-17T04:54:19","date_gmt":"2026-04-17T04:54:19","guid":{"rendered":"https:\/\/mtnstep.com\/New\/?page_id=407"},"modified":"2026-06-12T23:57:49","modified_gmt":"2026-06-12T23:57:49","slug":"live-scorecard","status":"publish","type":"page","link":"https:\/\/mtnstep.com\/New\/live-scorecard\/","title":{"rendered":"Live Scorecard"},"content":{"rendered":"\r\n    <style>\r\n    \/* Hides the giant featured image and page titles, BUT LEAVES THE MAIN SITE MENU ALONE *\/\r\n    .post-thumbnail, .entry-thumbnail, .featured-media, \r\n    .featured-image, header.entry-header, .page-title-bar, \r\n    .page-header-bg, .entry-title, img.wp-post-image { \r\n        display: none !important; background-image: none !important;\r\n    }\r\n\r\n    \/* The Universal Menu Styles *\/\r\n    .golf-app-nav-container {\r\n        display: flex !important; flex-direction: row !important; flex-wrap: wrap !important;\r\n        justify-content: center !important; align-items: center !important; gap: 15px !important;\r\n        background: #111 !important; padding: 15px !important; border-radius: 8px !important;\r\n        border: 1px solid #333 !important; margin: 20px auto 40px auto !important; max-width: 1000px;\r\n    }\r\n    .golf-app-nav-container a.golf-nav-btn {\r\n        display: inline-flex !important; align-items: center !important; justify-content: center !important;\r\n        background: #222 !important; color: #4db8ff !important; text-decoration: none !important;\r\n        padding: 12px 20px !important; border-radius: 6px !important; font-weight: bold !important;\r\n        font-size: 16px !important; border: 1px solid #444 !important; white-space: nowrap !important;\r\n        margin: 0 !important; transition: 0.2s ease !important; line-height: 1 !important;\r\n    }\r\n    .golf-app-nav-container a.golf-nav-btn:hover { background: #4db8ff !important; color: #000 !important; }\r\n    <\/style>\r\n    \r\n    <div class=\"golf-app-nav-container\">\r\n        <a href=\"https:\/\/mtnstep.com\/New\/live-scorecard\/\" class=\"golf-nav-btn\">Live Scorecard<\/a>\r\n        <a href=\"https:\/\/mtnstep.com\/New\/leaders-and-course-records\/\" class=\"golf-nav-btn\">Course Records<\/a>\r\n        <a href=\"https:\/\/mtnstep.com\/New\/tour-leaders\/\" class=\"golf-nav-btn\">Tour Leaders<\/a>\r\n        <a href=\"https:\/\/mtnstep.com\/New\/mountain-step-national-golf-course\/\" class=\"golf-nav-btn\">MtnStep Ranch GC<\/a>\r\n    <\/div>\r\n    \n\n\n    <style>\r\n      .golf-app-container { font-family: sans-serif; max-width: 1000px; margin: 0 auto; padding: 10px; }\r\n      .course-link-container { text-align: center; margin-top: -10px; margin-bottom: 20px; }\r\n      .course-link { color: #4db8ff; font-size: 16px; font-weight: bold; text-decoration: none; transition: color 0.2s; }\r\n      .course-link:hover { color: #fff; text-decoration: underline; }\r\n      .event-setup-box { display: flex; gap: 15px; background: #1a1a1a; padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #444; }\r\n      .event-name-input { flex: 2; padding: 12px; font-size: 18px; font-weight: bold; background: #000; color: #fff; border: 1px solid #555; border-radius: 6px; text-align: center; }\r\n      .event-name-input::placeholder { color: #888; font-weight: normal; }\r\n      .event-mode-select { flex: 1; padding: 12px; font-size: 16px; font-weight: bold; background: #000; color: #4db8ff; border: 1px solid #555; border-radius: 6px; text-align: center; cursor: pointer; }\r\n      @media (max-width: 600px) { .event-setup-box { flex-direction: column; } }\r\n      .table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 20px; }\r\n      .scorecard-table { width: 100%; border-collapse: collapse; text-align: center; background: #111; color: #fff; white-space: nowrap; }\r\n      .scorecard-table th, .scorecard-table td { border: 1px solid #444; padding: 10px 8px; }\r\n      .scorecard-table th { background: #000; font-weight: bold; }\r\n      .hole-input { width: 45px; height: 35px; padding: 5px; text-align: center; font-size: 16px; font-weight: bold; background:#222; color:#fff; border: 1px solid #777; border-radius: 4px; }\r\n      .ai-score { font-size: 18px; font-weight: bold; color: #ccc; }\r\n      .score-red { color: #ff5252; font-weight: bold; } \r\n      .score-black { color: #ffb74d; font-weight: bold; } \r\n      .score-even { color: #64b5f6; font-weight: bold;} \r\n      .scorecard-table tr:not(.player-name-row) th:first-child, \r\n      .scorecard-table tr:not(.player-name-row) td:first-child { position: sticky; left: 0; background: #111; z-index: 2; border-right: 2px solid #777; font-weight: bold; width: 60px; }\r\n      .scorecard-table tr:not(.player-name-row) th:first-child { background: #000; z-index: 3; }\r\n      .player-name-row td { background: #2a2a2a !important; border-right: none !important; padding: 0 !important; }\r\n      .sticky-banner-content { position: sticky; left: 0; display: flex; align-items: center; width: max-content; padding: 8px 10px; z-index: 4; }\r\n      .pos-badge { background: #000; color: #fff; font-size: 14px; font-weight: bold; padding: 4px 8px; border-radius: 4px; border: 1px solid #555; margin-right: 12px; min-width: 32px; text-align: center; display: inline-block;}\r\n      .profile-photo { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #555; margin-right: 10px; }\r\n      .profile-link { color: #4db8ff; font-size: 16px; font-weight: bold; text-decoration: none; transition: color 0.2s; }\r\n      .profile-link:hover { color: #fff; text-decoration: underline; }\r\n      .banner-live-score { font-size: 16px; font-weight: bold; margin-left: 10px; }\r\n      tbody tr { transition: transform 0.3s ease; }\r\n      .playing-toggle-container { margin-left: 15px; display: flex; align-items: center; background: #111; padding: 2px 8px; border-radius: 4px; border: 1px solid #444;}\r\n      .playing-toggle-container label { font-size: 12px; color: #aaa; margin-left: 5px; cursor: pointer; font-weight: normal;}\r\n      .playing-toggle-container input { cursor: pointer; }\r\n      #submit-round-btn { display: none; width: 100%; background: #4CAF50; color: white; font-size: 20px; font-weight: bold; padding: 15px; border: none; border-radius: 8px; cursor: pointer; box-shadow: 0 4px 6px rgba(0,0,0,0.3); transition: background 0.3s; }\r\n      #submit-round-btn:active { background: #388E3C; }\r\n      #submit-round-btn:disabled { background: #555; color: #888; cursor: not-allowed; }\r\n    <\/style>\r\n\r\n    <div class=\"golf-app-container\">\r\n      <h2 style=\"text-align: center; margin-bottom: 10px;\">\u26f3 Live Tournament Scorecard<\/h2>\r\n      <div class=\"course-link-container\">\r\n          <a href=\"https:\/\/mtnstep.com\/New\/mountain-step-national-golf-course\/\" class=\"course-link\">\ud83d\udccd Mountain Step Ranch Golf Course<\/a>\r\n      <\/div>\r\n      <div class=\"event-setup-box\">\r\n          <input type=\"text\" id=\"event-name\" class=\"event-name-input\" placeholder=\"\ud83c\udfc6 Enter Event Name (e.g., The Masters)\">\r\n          <select id=\"course-mode-select\" class=\"event-mode-select\">\r\n              <option value=\"full\">Full Course (1-9)<\/option>\r\n              <option value=\"front5\">Front 5 (1-5)<\/option>\r\n              <option value=\"back4\">Back 4 (6-9)<\/option>\r\n          <\/select>\r\n      <\/div>\r\n      <div class=\"table-responsive\">\r\n        <table class=\"scorecard-table\" id=\"main-table\">\r\n          <thead>\r\n            <tr>\r\n              <th>Hole<\/th>\r\n              <th id=\"th-hole-0\">1<\/th><th id=\"th-hole-1\">2<\/th><th id=\"th-hole-2\">3<\/th><th id=\"th-hole-3\">4<\/th><th id=\"th-hole-4\">5<\/th>\r\n              <th id=\"th-hole-5\">6<\/th><th id=\"th-hole-6\">7<\/th><th id=\"th-hole-7\">8<\/th><th id=\"th-hole-8\">9<\/th>\r\n              <th>Total<\/th>\r\n            <\/tr>\r\n            <tr>\r\n              <td>Par<\/td>\r\n              <td id=\"td-par-0\">3<\/td><td id=\"td-par-1\">3<\/td><td id=\"td-par-2\">3<\/td><td id=\"td-par-3\">3<\/td><td id=\"td-par-4\">3<\/td>\r\n              <td id=\"td-par-5\">3<\/td><td id=\"td-par-6\">3<\/td><td id=\"td-par-7\">3<\/td><td id=\"td-par-8\">3<\/td>\r\n              <td id=\"td-par-total\">27<\/td>\r\n            <\/tr>\r\n            <tr>\r\n              <td>Yards<\/td>\r\n              <td id=\"td-yard-0\">78<\/td><td id=\"td-yard-1\">36<\/td><td id=\"td-yard-2\">53<\/td><td id=\"td-yard-3\">45<\/td><td id=\"td-yard-4\">65<\/td>\r\n              <td id=\"td-yard-5\">160<\/td><td id=\"td-yard-6\">90<\/td><td id=\"td-yard-7\">106<\/td><td id=\"td-yard-8\">28<\/td>\r\n              <td id=\"td-yard-total\">661<\/td>\r\n            <\/tr>\r\n          <\/thead>\r\n          <tbody id=\"players-body\">\r\n            <tr><td colspan=\"11\">Loading Tournament Field...<\/td><\/tr>\r\n          <\/tbody>\r\n        <\/table>\r\n      <\/div>\r\n      <button id=\"submit-round-btn\">\u2705 Finish & Submit Tournament<\/button>\r\n    <\/div>\r\n\r\n    <script>\r\n      (function() {\r\n        let tournamentData = []; \r\n        function getModeConfig() {\r\n            const val = document.getElementById('course-mode-select').value;\r\n            if(val === 'front5') return { start: 0, end: 4, count: 5 };\r\n            if(val === 'back4') return { start: 5, end: 8, count: 4 };\r\n            return { start: 0, end: 8, count: 9 };\r\n        }\r\n        function generateFakeScores() {\r\n            let fakeHoles = [];\r\n            let totalToDistribute = 27 + (Math.floor(Math.random() * 8) + 2); \r\n            let strokesLeft = totalToDistribute - 27; \r\n            for(let i=0; i<9; i++) fakeHoles.push(3); \r\n            while(strokesLeft > 0) {\r\n                let r = Math.floor(Math.random() * 9);\r\n                fakeHoles[r] += 1;\r\n                strokesLeft--;\r\n            }\r\n            return fakeHoles;\r\n        }\r\n        function startGolfAppEngine() {\r\n          try {\r\n              fetch('\/New\/wp-json\/golf\/v1\/start-round')\r\n                .then(response => {\r\n                    if(!response.ok) throw new Error(\"API Connection Failed (\" + response.status + \")\");\r\n                    return response.json();\r\n                })\r\n                .then(players => {\r\n                  if(!players || players.error) throw new Error(players ? players.error : \"No data returned\");\r\n                  tournamentData = players;\r\n                  const tbody = document.getElementById('players-body');\r\n                  if(!tbody) return;\r\n                  tbody.innerHTML = ''; \r\n                  \r\n                  players.forEach((player, index) => {\r\n                    player.pacingOffset = Math.floor(Math.random() * 5) - 2; \r\n                    player.isActuallyPlayingHuman = false;\r\n                    if(player.type === 'Human') { player.simulatedScoresIfAbsent = generateFakeScores(); }\r\n\r\n                    const nameTr = document.createElement('tr');\r\n                    nameTr.className = 'player-name-row';\r\n                    nameTr.id = `banner-row-${index}`;\r\n                    \r\n                    let toggleHTML = '';\r\n                    if(player.type === 'Human') {\r\n                        toggleHTML = `\r\n                        <div class=\"playing-toggle-container\">\r\n                            <input type=\"checkbox\" id=\"toggle-${index}\" class=\"human-playing-toggle\" data-row=\"${index}\">\r\n                            <label for=\"toggle-${index}\">Playing<\/label>\r\n                        <\/div>`;\r\n                    }\r\n\r\n                    nameTr.innerHTML = `\r\n                        <td colspan=\"11\" id=\"banner-cell-${index}\">\r\n                            <div class=\"sticky-banner-content\">\r\n                                <span class=\"pos-badge\" id=\"pos-badge-${index}\">-<\/span>\r\n                                <img decoding=\"async\" src=\"${player.photo}\" class=\"profile-photo\"> \r\n                                <a href=\"${player.link}\" class=\"profile-link\" target=\"_blank\">${player.name}<\/a>\r\n                                ${toggleHTML}\r\n                                <span class=\"banner-live-score score-even\" id=\"banner-score-${index}\">(E) Thru 0<\/span>\r\n                            <\/div>\r\n                        <\/td>`;\r\n                    tbody.appendChild(nameTr);\r\n\r\n                    const scoreTr = document.createElement('tr');\r\n                    scoreTr.id = `score-row-${index}`;\r\n                    let rowHTML = `<td>Score<\/td>`;\r\n                    for(let i = 0; i < 9; i++) {\r\n                        rowHTML += `\r\n                        <td id=\"cell-${index}-hole-${i}\">\r\n                            <input type=\"number\" class=\"hole-input human-score\" id=\"input-${index}-hole-${i}\" data-row=\"${index}\" min=\"1\" max=\"10\" style=\"display:none;\">\r\n                            <span class=\"ai-score\" id=\"ai-${index}-hole-${i}\"><\/span>\r\n                        <\/td>`;\r\n                    }\r\n                    rowHTML += `<td id=\"total-${index}\">0 <br><span class=\"score-even\">(E)<\/span><\/td>`;\r\n                    scoreTr.innerHTML = rowHTML;\r\n                    tbody.appendChild(scoreTr);\r\n                  });\r\n\r\n                  document.querySelectorAll('.human-score').forEach(input => { input.addEventListener('change', updateLiveBoard); });\r\n                  document.querySelectorAll('.human-playing-toggle').forEach(checkbox => {\r\n                      checkbox.addEventListener('change', function() {\r\n                          const rIdx = this.getAttribute('data-row');\r\n                          const isChecked = this.checked;\r\n                          tournamentData[rIdx].isActuallyPlayingHuman = isChecked;\r\n                          for(let i=0; i<9; i++) {\r\n                              const inputEl = document.getElementById(`input-${rIdx}-hole-${i}`);\r\n                              const spanEl = document.getElementById(`ai-${rIdx}-hole-${i}`);\r\n                              if (isChecked) { inputEl.style.display = 'inline-block'; spanEl.style.display = 'none'; } \r\n                              else { inputEl.style.display = 'none'; spanEl.style.display = 'inline-block'; }\r\n                          }\r\n                          updateLiveBoard();\r\n                      });\r\n                  });\r\n                  document.getElementById('course-mode-select').addEventListener('change', applyCourseMode);\r\n                  applyCourseMode();\r\n                })\r\n                .catch(error => {\r\n                    const el = document.getElementById('players-body');\r\n                    if(el) el.innerHTML = `<tr><td colspan=\"11\" style=\"color:#ff5252; padding: 20px; font-weight:bold;\">\ud83d\udea8 Connection Error: ${error.message}<\/td><\/tr>`;\r\n                });\r\n          } catch (criticalError) {\r\n              const el = document.getElementById('players-body');\r\n              if(el) el.innerHTML = `<tr><td colspan=\"11\" style=\"color:#ff5252; padding: 20px; font-weight:bold;\">\ud83d\udea8 System Crash: ${criticalError.message}<\/td><\/tr>`;\r\n          }\r\n        }\r\n\r\n        function applyCourseMode() {\r\n            const config = getModeConfig();\r\n            if (config.count === 5) { document.getElementById('td-par-total').innerText = '15'; document.getElementById('td-yard-total').innerText = '277'; } \r\n            else if (config.count === 4) { document.getElementById('td-par-total').innerText = '12'; document.getElementById('td-yard-total').innerText = '384'; } \r\n            else { document.getElementById('td-par-total').innerText = '27'; document.getElementById('td-yard-total').innerText = '661'; }\r\n\r\n            for(let i=0; i<9; i++) {\r\n                const show = (i >= config.start && i <= config.end);\r\n                const displayStyle = show ? '' : 'none';\r\n                document.getElementById(`th-hole-${i}`).style.display = displayStyle;\r\n                document.getElementById(`td-par-${i}`).style.display = displayStyle;\r\n                document.getElementById(`td-yard-${i}`).style.display = displayStyle;\r\n                tournamentData.forEach((p, rIdx) => {\r\n                    document.getElementById(`cell-${rIdx}-hole-${i}`).style.display = displayStyle;\r\n                    document.getElementById(`banner-cell-${rIdx}`).colSpan = config.count + 2; \r\n                });\r\n            }\r\n            updateLiveBoard();\r\n        }\r\n\r\n        function updateLiveBoard() {\r\n          const config = getModeConfig();\r\n          let humanHolesFinished = 0; let activeHumanFound = false;\r\n          const firstActiveHumanIndex = tournamentData.findIndex(p => p.type === 'Human' && p.isActuallyPlayingHuman);\r\n          if(firstActiveHumanIndex !== -1) {\r\n            activeHumanFound = true;\r\n            for(let i=config.start; i<=config.end; i++) {\r\n                const s = parseInt(document.getElementById(`input-${firstActiveHumanIndex}-hole-${i}`).value);\r\n                if(!isNaN(s) && s > 0) { humanHolesFinished++; }\r\n            }\r\n          }\r\n\r\n          tournamentData.forEach((player, rowIndex) => {\r\n            let totalStrokes = 0; let holesPlayed = 0;\r\n            let isParticipating = player.type === 'Simulated' || player.isActuallyPlayingHuman;\r\n\r\n            if (!isParticipating) {\r\n                for(let i = 0; i < 9; i++) { document.getElementById(`ai-${rowIndex}-hole-${i}`).innerText = '-'; }\r\n                player.currentToPar = 999; player.currentHolesPlayed = 0;\r\n                document.getElementById(`total-${rowIndex}`).innerHTML = '<span style=\"color:#888; font-weight:bold;\">DNP<\/span>';\r\n                const displayBanner = document.getElementById(`banner-score-${rowIndex}`);\r\n                if(displayBanner) { displayBanner.innerHTML = 'Not Playing'; displayBanner.className = 'banner-live-score'; }\r\n                document.getElementById(`pos-badge-${rowIndex}`).innerText = '-';\r\n                return; \r\n            }\r\n\r\n            if(player.type === 'Human' && player.isActuallyPlayingHuman) {\r\n              for(let i=config.start; i<=config.end; i++) {\r\n                 const s = parseInt(document.getElementById(`input-${rowIndex}-hole-${i}`).value);\r\n                 if(!isNaN(s) && s > 0) { totalStrokes += s; holesPlayed++; }\r\n              }\r\n            } else if (player.type === 'Simulated') {\r\n              let aiTargetHolesPlayed = config.count; \r\n              if (activeHumanFound) {\r\n                 if (humanHolesFinished === config.count) { aiTargetHolesPlayed = config.count; } \r\n                 else {\r\n                     aiTargetHolesPlayed = humanHolesFinished + player.pacingOffset;\r\n                     if (aiTargetHolesPlayed < 0) aiTargetHolesPlayed = 0;\r\n                     if (aiTargetHolesPlayed > config.count) aiTargetHolesPlayed = config.count;\r\n                 }\r\n              }\r\n              let holesPlayedThisMode = 0;\r\n              for(let i = 0; i < 9; i++) {\r\n                let cell = document.getElementById(`ai-${rowIndex}-hole-${i}`);\r\n                if (i >= config.start && i <= config.end) {\r\n                    if (holesPlayedThisMode < aiTargetHolesPlayed) {\r\n                       cell.innerText = player.scores[i]; totalStrokes += parseInt(player.scores[i]);\r\n                       holesPlayed++; holesPlayedThisMode++;\r\n                    } else { cell.innerText = ''; }\r\n                } else { cell.innerText = '-'; }\r\n              }\r\n            }\r\n            \r\n            let color = \"score-even\", text = \"E\"; let toPar = 0; \r\n            if(holesPlayed > 0) {\r\n                toPar = totalStrokes - (holesPlayed * 3);\r\n                if(toPar > 0) { color = \"score-black\"; text = \"+\" + toPar; } \r\n                else if(toPar < 0) { color = \"score-red\"; text = toPar; }\r\n            }\r\n            player.currentToPar = toPar; player.currentHolesPlayed = holesPlayed;\r\n            player.finalTotalStrokes = totalStrokes; player.finalToParString = text;\r\n\r\n            const displayColumn = document.getElementById(`total-${rowIndex}`);\r\n            if(displayColumn) {\r\n                if(holesPlayed === 0) { displayColumn.innerHTML = '0 <br><span class=\"score-even\">(E)<\/span>'; } \r\n                else { displayColumn.innerHTML = `${totalStrokes} <br><span class=\"${color}\">(${text})<\/span>`; }\r\n            }\r\n            const displayBanner = document.getElementById(`banner-score-${rowIndex}`);\r\n            if(displayBanner) { displayBanner.innerHTML = `(${text}) Thru ${holesPlayed}`; displayBanner.className = `banner-live-score ${color}`; }\r\n          });\r\n          \r\n          const tbody = document.getElementById('players-body');\r\n          if(!tbody) return;\r\n          let indices = tournamentData.map((_, i) => i);\r\n          \r\n          indices.sort((a, b) => {\r\n              let pA = tournamentData[a]; let pB = tournamentData[b];\r\n              let aActive = pA.type === 'Simulated' || pA.isActuallyPlayingHuman;\r\n              let bActive = pB.type === 'Simulated' || pB.isActuallyPlayingHuman;\r\n              if (aActive && !bActive) return -1;\r\n              if (!aActive && bActive) return 1;\r\n              if (pA.currentToPar !== pB.currentToPar) { return pA.currentToPar - pB.currentToPar; }\r\n              if (pB.currentHolesPlayed !== pA.currentHolesPlayed) { return pB.currentHolesPlayed - pA.currentHolesPlayed; }\r\n              return 0;\r\n          });\r\n          \r\n          indices.forEach(i => {\r\n              tbody.appendChild(document.getElementById(`banner-row-${i}`));\r\n              tbody.appendChild(document.getElementById(`score-row-${i}`));\r\n          });\r\n\r\n          let activeIndices = indices.filter(idx => tournamentData[idx].type === 'Simulated' || tournamentData[idx].isActuallyPlayingHuman);\r\n          let rankArr = activeIndices.map(idx => ({ idx: idx, toPar: tournamentData[idx].currentToPar }));\r\n          for(let i = 0; i < rankArr.length; i++) {\r\n              let rank = i + 1;\r\n              if(i > 0 && rankArr[i].toPar === rankArr[i-1].toPar) { rankArr[i].actualRank = rankArr[i-1].actualRank; } \r\n              else { rankArr[i].actualRank = rank; }\r\n          }\r\n          let rankCounts = {};\r\n          rankArr.forEach(r => { rankCounts[r.actualRank] = (rankCounts[r.actualRank] || 0) + 1; });\r\n          rankArr.forEach(r => {\r\n              let posStr = r.actualRank.toString();\r\n              if(rankCounts[r.actualRank] > 1) { posStr = 'T' + posStr; } \r\n              const badge = document.getElementById(`pos-badge-${r.idx}`);\r\n              if(badge) badge.innerText = posStr;\r\n          });\r\n\r\n          const submitBtn = document.getElementById('submit-round-btn');\r\n          if(submitBtn) {\r\n              if ((activeHumanFound && humanHolesFinished === config.count) || !activeHumanFound) {\r\n                  submitBtn.style.display = 'block';\r\n                  submitBtn.onclick = function() {\r\n                      const customEventName = document.getElementById('event-name').value;\r\n                      submitBtn.innerText = '\u23f3 Saving Tournament for Active Players...';\r\n                      submitBtn.disabled = true;\r\n                      const allPlayerResults = [];\r\n                      tournamentData.forEach((p, rowIndex) => {\r\n                          if (p.type === 'Simulated' || (p.type === 'Human' && p.isActuallyPlayingHuman)) {\r\n                              let finalHoles = [];\r\n                              for(let i=0; i<9; i++) {\r\n                                  if (i >= config.start && i <= config.end) {\r\n                                      if(p.type === 'Human') {\r\n                                          const val = document.getElementById(`input-${rowIndex}-hole-${i}`).value;\r\n                                          finalHoles.push(val ? parseInt(val) : 0);\r\n                                      } else { finalHoles.push(p.scores[i]); }\r\n                                  } else { finalHoles.push('-'); }\r\n                              }\r\n                              allPlayerResults.push({ id: p.id, total: p.finalTotalStrokes, to_par: p.finalToParString, holes: finalHoles });\r\n                          }\r\n                      });\r\n\r\n                      fetch('\/New\/wp-json\/golf\/v1\/submit-score', {\r\n                          method: 'POST',\r\n                          headers: { 'Content-Type': 'application\/json' },\r\n                          body: JSON.stringify({ event_name: customEventName, results: allPlayerResults })\r\n                      })\r\n                      .then(response => response.json())\r\n                      .then(data => {\r\n                          if(data.success) {\r\n                              submitBtn.innerText = '\u2705 Tournament Saved Successfully!';\r\n                              submitBtn.style.background = '#1976d2';\r\n                          }\r\n                      });\r\n                  };\r\n              } else { submitBtn.style.display = 'none'; }\r\n          }\r\n        }\r\n        if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', startGolfAppEngine); } \r\n        else { startGolfAppEngine(); }\r\n      })();\r\n    <\/script>\r\n    \n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-407","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/mtnstep.com\/New\/wp-json\/wp\/v2\/pages\/407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mtnstep.com\/New\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mtnstep.com\/New\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mtnstep.com\/New\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mtnstep.com\/New\/wp-json\/wp\/v2\/comments?post=407"}],"version-history":[{"count":30,"href":"https:\/\/mtnstep.com\/New\/wp-json\/wp\/v2\/pages\/407\/revisions"}],"predecessor-version":[{"id":576,"href":"https:\/\/mtnstep.com\/New\/wp-json\/wp\/v2\/pages\/407\/revisions\/576"}],"wp:attachment":[{"href":"https:\/\/mtnstep.com\/New\/wp-json\/wp\/v2\/media?parent=407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}