{"id":182,"date":"2026-04-24T08:46:08","date_gmt":"2026-04-24T08:46:08","guid":{"rendered":"https:\/\/louthlgfa.ie\/?page_id=182"},"modified":"2026-04-24T08:53:27","modified_gmt":"2026-04-24T08:53:27","slug":"front-page-v4","status":"publish","type":"page","link":"https:\/\/louthlgfa.ie\/","title":{"rendered":"Front Page V4"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><strong>Fixtures, Results &amp; Standings<\/strong><\/h3>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<button id=\"btnTodayFixtures\" \r\n    style=\"padding:10px 16px; font-size:16px; margin-bottom:15px;\">\r\n    Show Today&#8217;s Fixtures\r\n<\/button>\r\n\r\n<div id=\"todayFixturesOutput\"><\/div>\r\n\r\n<script>\r\ndocument.getElementById(\"btnTodayFixtures\").addEventListener(\"click\", async () => {\r\n\r\n    const out = document.getElementById(\"todayFixturesOutput\");\r\n    out.innerHTML = \"Loading today's fixtures\u2026\";\r\n\r\n    const apiKey = \"foir_prod_NDtiJNVWyQpxRRujIXMrCOZntNaqZfflFjihYbiLtqilV\";\r\n    const ownerId = \"0e2e84a8-2d94-dc94-d574-9d44d4c15395\";\r\n\r\n    \/\/ Today's date boundaries\r\n    const now = new Date();\r\n    const yyyy = now.getFullYear();\r\n    const mm = now.getMonth();\r\n    const dd = now.getDate();\r\n\r\n    const startOfDay = new Date(yyyy, mm, dd, 0, 0, 0);\r\n    const endOfDay   = new Date(yyyy, mm, dd, 23, 59, 59);\r\n\r\n    \/\/ Format date dd\/mm\/yyyy\r\n    const formattedDate = dd.toString().padStart(2, \"0\") + \"\/\" +\r\n                          (mm + 1).toString().padStart(2, \"0\") + \"\/\" +\r\n                          yyyy;\r\n\r\n    \/\/ Fetch fixtures\r\n    const res = await fetch(\r\n        \"https:\/\/api.foireann.ie\/open-data\/v1\/fixtures?size=500\",\r\n        { headers: { \"Authorization\": \"Bearer \" + apiKey } }\r\n    );\r\n\r\n    let fixtures = (await res.json()).data || [];\r\n\r\n    \/\/ Filter: owner, not archived, and today only\r\n    fixtures = fixtures.filter(f =>\r\n        !f.archived &&\r\n        f.owner?.id === ownerId &&\r\n        f.startDate &&\r\n        new Date(f.startDate) >= startOfDay &&\r\n        new Date(f.startDate) <= endOfDay\r\n    );\r\n\r\n    if (!fixtures.length) {\r\n        out.innerHTML = `<h3>Today's Fixtures (${formattedDate})<\/h3>\r\n                         <p>No fixtures scheduled for today.<\/p>`;\r\n        return;\r\n    }\r\n\r\n    \/\/ Group by competition\r\n    const comps = {};\r\n    fixtures.forEach(f => {\r\n        const id = f.competition?.id || \"unknown\";\r\n        if (!comps[id]) {\r\n            comps[id] = {\r\n                name: f.competition?.name || \"Unknown Competition\",\r\n                fixtures: []\r\n            };\r\n        }\r\n        comps[id].fixtures.push(f);\r\n    });\r\n\r\n    \/\/ Sort competitions alphabetically\r\n    const sortedCompIds = Object.keys(comps).sort((a, b) =>\r\n        comps[a].name.localeCompare(comps[b].name)\r\n    );\r\n\r\n    \/\/ Build HTML\r\n    let html = `<h3>Today's Fixtures (${formattedDate})<\/h3>`;\r\n\r\n    for (const compId of sortedCompIds) {\r\n        const comp = comps[compId];\r\n\r\n        html += `\r\n            <h4>${comp.name}<\/h4>\r\n            <table style=\"width:100%; border-collapse:collapse; margin-bottom:20px;\">\r\n                <thead>\r\n                    <tr>\r\n                        <th>Time<\/th>\r\n                        <th>Home<\/th>\r\n                        <th>Away<\/th>\r\n                        <th>Venue<\/th>\r\n                    <\/tr>\r\n                <\/thead>\r\n                <tbody>\r\n                    ${comp.fixtures.map(f => `\r\n                        <tr>\r\n                            <td>${new Date(f.startDate).toLocaleTimeString(\"en-GB\", { hour: \"2-digit\", minute: \"2-digit\" })}<\/td>\r\n                            <td>${f.homeTeam?.name || \"\"}<\/td>\r\n                            <td>${f.awayTeam?.name || \"\"}<\/td>\r\n                            <td>${f.place?.name || \"\"}<\/td>\r\n                        <\/tr>\r\n                    `).join(\"\")}\r\n                <\/tbody>\r\n            <\/table>\r\n        `;\r\n    }\r\n\r\n    out.innerHTML = html;\r\n});\r\n<\/script>\n\n\n\n<button id=\"btnClubFixtures\" \r\n    style=\"padding:10px 16px; font-size:16px; margin-bottom:15px;\">\r\n    Show Fixtures For My Club\r\n<\/button>\r\n\r\n<div id=\"clubFixturesContainer\"><\/div>\r\n\r\n<script>\r\ndocument.getElementById(\"btnClubFixtures\").addEventListener(\"click\", async () => {\r\n\r\n    const container = document.getElementById(\"clubFixturesContainer\");\r\n    container.innerHTML = \"Loading club list\u2026\";\r\n\r\n    const apiKey = \"foir_prod_NDtiJNVWyQpxRRujIXMrCOZntNaqZfflFjihYbiLtqilV\";\r\n    const ownerId = \"0e2e84a8-2d94-dc94-d574-9d44d4c15395\";\r\n\r\n    const res = await fetch(\r\n        \"https:\/\/api.foireann.ie\/open-data\/v1\/fixtures?size=500\",\r\n        { headers: { \"Authorization\": \"Bearer \" + apiKey } }\r\n    );\r\n\r\n    let fixtures = (await res.json()).data || [];\r\n\r\n    \/\/ Same logic as main dashboard\r\n    fixtures = fixtures.filter(f =>\r\n        !f.archived &&\r\n        f.owner?.id === ownerId &&\r\n        f.startDate &&\r\n        new Date(f.startDate).getFullYear() === 2026\r\n    );\r\n\r\n    \/\/ Build unique club list\r\n    const clubSet = new Set();\r\n    fixtures.forEach(f => {\r\n        if (f.homeTeam?.name) clubSet.add(f.homeTeam.name);\r\n        if (f.awayTeam?.name) clubSet.add(f.awayTeam.name);\r\n    });\r\n    const clubs = Array.from(clubSet).sort();\r\n\r\n    container.innerHTML = `\r\n        <input id=\"clubSearch\" type=\"text\" placeholder=\"Start typing a club name\u2026\"\r\n            style=\"width:100%; padding:10px; font-size:16px; border:1px solid #ccc; border-radius:4px; margin-bottom:10px;\">\r\n        <div id=\"clubSuggestions\" \r\n            style=\"border:1px solid #ccc; border-radius:4px; max-height:200px; overflow-y:auto; display:none;\"><\/div>\r\n        <div id=\"clubFixturesOutput\" style=\"margin-top:20px;\"><\/div>\r\n    `;\r\n\r\n    const searchInput = document.getElementById(\"clubSearch\");\r\n    const suggestions = document.getElementById(\"clubSuggestions\");\r\n    const output = document.getElementById(\"clubFixturesOutput\");\r\n\r\n    \/\/ Autocomplete\r\n    searchInput.addEventListener(\"input\", () => {\r\n        const term = searchInput.value.toLowerCase().trim();\r\n        suggestions.innerHTML = \"\";\r\n        if (!term) {\r\n            suggestions.style.display = \"none\";\r\n            return;\r\n        }\r\n\r\n        const matches = clubs.filter(c => c.toLowerCase().includes(term));\r\n\r\n        if (!matches.length) {\r\n            suggestions.style.display = \"none\";\r\n            return;\r\n        }\r\n\r\n        suggestions.style.display = \"block\";\r\n        suggestions.innerHTML = matches.map(c =>\r\n            `<div class=\"clubOption\" \r\n                style=\"padding:8px; cursor:pointer; border-bottom:1px solid #eee;\">\r\n                ${c}\r\n            <\/div>`\r\n        ).join(\"\");\r\n\r\n        document.querySelectorAll(\".clubOption\").forEach(opt => {\r\n            opt.onclick = () => {\r\n                const selected = opt.innerText.trim();\r\n                searchInput.value = selected;\r\n                suggestions.style.display = \"none\";\r\n                showClubFixtures(selected);\r\n            };\r\n        });\r\n    });\r\n\r\n    function showClubFixtures(clubName) {\r\n        output.innerHTML = \"Loading fixtures\u2026\";\r\n\r\n        const nameTerm = clubName.toLowerCase().trim();\r\n\r\n        \/\/ From today's date (00:00)\r\n        const today = new Date();\r\n        today.setHours(0, 0, 0, 0);\r\n\r\n        \/\/ Same matching logic as main dashboard (substring match)\r\n        const clubFixtures = fixtures.filter(f => {\r\n            const d = new Date(f.startDate);\r\n            if (d < today) return false;\r\n\r\n            const home = (f.homeTeam?.name || \"\").toLowerCase();\r\n            const away = (f.awayTeam?.name || \"\").toLowerCase();\r\n\r\n            return home.includes(nameTerm) || away.includes(nameTerm);\r\n        });\r\n\r\n        if (!clubFixtures.length) {\r\n            output.innerHTML = `<p>No upcoming fixtures for <strong>${clubName}<\/strong>.<\/p>`;\r\n            return;\r\n        }\r\n\r\n        \/\/ Group by competition\r\n        const comps = {};\r\n        clubFixtures.forEach(f => {\r\n            const id = f.competition?.id || \"unknown\";\r\n            if (!comps[id]) {\r\n                comps[id] = {\r\n                    name: f.competition?.name || \"Unknown Competition\",\r\n                    fixtures: []\r\n                };\r\n            }\r\n            comps[id].fixtures.push(f);\r\n        });\r\n\r\n        const sortedCompIds = Object.keys(comps).sort((a, b) =>\r\n            comps[a].name.localeCompare(comps[b].name)\r\n        );\r\n\r\n        let html = `<h3>Upcoming Fixtures for ${clubName}<\/h3>`;\r\n\r\n        for (const compId of sortedCompIds) {\r\n            const comp = comps[compId];\r\n\r\n            \/\/ \u2705 Sort fixtures by date ASC (nearest first)\r\n            comp.fixtures.sort((a, b) =>\r\n                new Date(a.startDate) - new Date(b.startDate)\r\n            );\r\n\r\n            html += `\r\n                <h4>${comp.name}<\/h4>\r\n                <table style=\"width:100%; border-collapse:collapse; margin-bottom:20px;\">\r\n                    <thead>\r\n                        <tr>\r\n                            <th>Date\/Time<\/th>\r\n                            <th>Home<\/th>\r\n                            <th>Away<\/th>\r\n                            <th>Venue<\/th>\r\n                        <\/tr>\r\n                    <\/thead>\r\n                    <tbody>\r\n                        ${comp.fixtures.map(f => {\r\n                            const home = f.homeTeam?.name || \"\";\r\n                            const away = f.awayTeam?.name || \"\";\r\n\r\n                            \/\/ \ud83d\udd25 Bold the selected club\r\n                            const homeHtml = home.toLowerCase().includes(nameTerm)\r\n                                ? `<strong>${home}<\/strong>`\r\n                                : home;\r\n\r\n                            const awayHtml = away.toLowerCase().includes(nameTerm)\r\n                                ? `<strong>${away}<\/strong>`\r\n                                : away;\r\n\r\n                            return `\r\n                                <tr>\r\n                                    <td>${new Date(f.startDate).toLocaleString(\"en-GB\", { \r\n                                        day: \"2-digit\", month: \"2-digit\", year: \"numeric\",\r\n                                        hour: \"2-digit\", minute: \"2-digit\"\r\n                                    })}<\/td>\r\n                                    <td>${homeHtml}<\/td>\r\n                                    <td>${awayHtml}<\/td>\r\n                                    <td>${f.place?.name || \"\"}<\/td>\r\n                                <\/tr>\r\n                            `;\r\n                        }).join(\"\")}\r\n                    <\/tbody>\r\n                <\/table>\r\n            `;\r\n        }\r\n\r\n        output.innerHTML = html;\r\n    }\r\n});\r\n<\/script>\n\n\n\n<button id=\"btnClubResults\" \r\n    style=\"padding:10px 16px; font-size:16px; margin-bottom:15px;\">\r\n    Show Results For My Club\r\n<\/button>\r\n\r\n<div id=\"clubResultsContainer\"><\/div>\r\n\r\n<script>\r\ndocument.getElementById(\"btnClubResults\").addEventListener(\"click\", async () => {\r\n\r\n    const container = document.getElementById(\"clubResultsContainer\");\r\n    container.innerHTML = \"Loading club list\u2026\";\r\n\r\n    const apiKey = \"foir_prod_NDtiJNVWyQpxRRujIXMrCOZntNaqZfflFjihYbiLtqilV\";\r\n    const ownerId = \"0e2e84a8-2d94-dc94-d574-9d44d4c15395\";\r\n\r\n    const res = await fetch(\r\n        \"https:\/\/api.foireann.ie\/open-data\/v1\/fixtures?size=500\",\r\n        { headers: { \"Authorization\": \"Bearer \" + apiKey } }\r\n    );\r\n\r\n    let fixtures = (await res.json()).data || [];\r\n\r\n    \/\/ Same logic as main dashboard\r\n    fixtures = fixtures.filter(f =>\r\n        !f.archived &&\r\n        f.owner?.id === ownerId &&\r\n        f.startDate &&\r\n        new Date(f.startDate).getFullYear() === 2026\r\n    );\r\n\r\n    \/\/ Extract club names\r\n    const clubSet = new Set();\r\n    fixtures.forEach(f => {\r\n        if (f.homeTeam?.name) clubSet.add(f.homeTeam.name);\r\n        if (f.awayTeam?.name) clubSet.add(f.awayTeam.name);\r\n    });\r\n    const clubs = Array.from(clubSet).sort();\r\n\r\n    container.innerHTML = `\r\n        <input id=\"clubSearchResults\" type=\"text\" placeholder=\"Start typing a club name\u2026\"\r\n            style=\"width:100%; padding:10px; font-size:16px; border:1px solid #ccc; border-radius:4px; margin-bottom:10px;\">\r\n        <div id=\"clubResultsSuggestions\" \r\n            style=\"border:1px solid #ccc; border-radius:4px; max-height:200px; overflow-y:auto; display:none;\"><\/div>\r\n        <div id=\"clubResultsOutput\" style=\"margin-top:20px;\"><\/div>\r\n    `;\r\n\r\n    const searchInput = document.getElementById(\"clubSearchResults\");\r\n    const suggestions = document.getElementById(\"clubResultsSuggestions\");\r\n    const output = document.getElementById(\"clubResultsOutput\");\r\n\r\n    \/\/ Autocomplete\r\n    searchInput.addEventListener(\"input\", () => {\r\n        const term = searchInput.value.toLowerCase().trim();\r\n        suggestions.innerHTML = \"\";\r\n        if (!term) {\r\n            suggestions.style.display = \"none\";\r\n            return;\r\n        }\r\n\r\n        const matches = clubs.filter(c => c.toLowerCase().includes(term));\r\n\r\n        if (!matches.length) {\r\n            suggestions.style.display = \"none\";\r\n            return;\r\n        }\r\n\r\n        suggestions.style.display = \"block\";\r\n        suggestions.innerHTML = matches.map(c =>\r\n            `<div class=\"clubOptionRes\" \r\n                style=\"padding:8px; cursor:pointer; border-bottom:1px solid #eee;\">\r\n                ${c}\r\n            <\/div>`\r\n        ).join(\"\");\r\n\r\n        document.querySelectorAll(\".clubOptionRes\").forEach(opt => {\r\n            opt.onclick = () => {\r\n                const selected = opt.innerText.trim();\r\n                searchInput.value = selected;\r\n                suggestions.style.display = \"none\";\r\n                showClubResults(selected);\r\n            };\r\n        });\r\n    });\r\n\r\n    function showClubResults(clubName) {\r\n        output.innerHTML = \"Loading results\u2026\";\r\n\r\n        const nameTerm = clubName.toLowerCase().trim();\r\n\r\n        \/\/ Identify results (same logic as main dashboard)\r\n        const results = fixtures.filter(f => {\r\n            const home = (f.homeTeam?.name || \"\").toLowerCase();\r\n            const away = (f.awayTeam?.name || \"\").toLowerCase();\r\n\r\n            const isResult =\r\n                f.isResult ||\r\n                f.homeTeam?.goals !== undefined ||\r\n                f.awayTeam?.goals !== undefined;\r\n\r\n            return isResult && (home.includes(nameTerm) || away.includes(nameTerm));\r\n        });\r\n\r\n        if (!results.length) {\r\n            output.innerHTML = `<p>No results found for <strong>${clubName}<\/strong>.<\/p>`;\r\n            return;\r\n        }\r\n\r\n        \/\/ Group by competition\r\n        const comps = {};\r\n        results.forEach(f => {\r\n            const id = f.competition?.id || \"unknown\";\r\n            if (!comps[id]) {\r\n                comps[id] = {\r\n                    name: f.competition?.name || \"Unknown Competition\",\r\n                    results: []\r\n                };\r\n            }\r\n            comps[id].results.push(f);\r\n        });\r\n\r\n        const sortedCompIds = Object.keys(comps).sort((a, b) =>\r\n            comps[a].name.localeCompare(comps[b].name)\r\n        );\r\n\r\n        let html = `<h3>Results for ${clubName}<\/h3>`;\r\n\r\n        for (const compId of sortedCompIds) {\r\n            const comp = comps[compId];\r\n\r\n            \/\/ Sort newest \u2192 oldest (same as main dashboard)\r\n            comp.results.sort((a, b) =>\r\n                new Date(b.startDate) - new Date(a.startDate)\r\n            );\r\n\r\n            html += `\r\n                <h4>${comp.name}<\/h4>\r\n                <table style=\"width:100%; border-collapse:collapse; margin-bottom:20px;\">\r\n                    <thead>\r\n                        <tr>\r\n                            <th>Date<\/th>\r\n                            <th>Home<\/th>\r\n                            <th>H<\/th>\r\n                            <th>Away<\/th>\r\n                            <th>A<\/th>\r\n                        <\/tr>\r\n                    <\/thead>\r\n                    <tbody>\r\n                        ${comp.results.map(f => {\r\n                            const home = f.homeTeam?.name || \"\";\r\n                            const away = f.awayTeam?.name || \"\";\r\n\r\n                            const homeHtml = home.toLowerCase().includes(nameTerm)\r\n                                ? `<strong>${home}<\/strong>`\r\n                                : home;\r\n\r\n                            const awayHtml = away.toLowerCase().includes(nameTerm)\r\n                                ? `<strong>${away}<\/strong>`\r\n                                : away;\r\n\r\n                            return `\r\n                                <tr>\r\n                                    <td>${new Date(f.startDate).toLocaleString(\"en-GB\")}<\/td>\r\n                                    <td>${homeHtml}<\/td>\r\n                                    <td>${(f.homeTeam?.goals ?? 0) + \"-\" + (f.homeTeam?.points ?? 0)}<\/td>\r\n                                    <td>${awayHtml}<\/td>\r\n                                    <td>${(f.awayTeam?.goals ?? 0) + \"-\" + (f.awayTeam?.points ?? 0)}<\/td>\r\n                                <\/tr>\r\n                            `;\r\n                        }).join(\"\")}\r\n                    <\/tbody>\r\n                <\/table>\r\n            `;\r\n        }\r\n\r\n        output.innerHTML = html;\r\n    }\r\n});\r\n<\/script>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div id=\"multiCompDashboard\">Loading competitions\u2026<\/div>\r\n\r\n<script>\r\nfunction waitForElement(id, callback) {\r\n    const el = document.getElementById(id);\r\n    if (el) callback(el);\r\n    else setTimeout(() => waitForElement(id, callback), 50);\r\n}\r\n\r\nwaitForElement(\"multiCompDashboard\", function (dashboardEl) {\r\n\r\n(async () => {\r\n\r\n    const apiKey = \"foir_prod_NDtiJNVWyQpxRRujIXMrCOZntNaqZfflFjihYbiLtqilV\";\r\n    const ownerId = \"0e2e84a8-2d94-dc94-d574-9d44d4c15395\";\r\n\r\n    const response = await fetch(\r\n        \"https:\/\/api.foireann.ie\/open-data\/v1\/fixtures?size=500\",\r\n        { headers: { \"Authorization\": \"Bearer \" + apiKey } }\r\n    );\r\n\r\n    let fixtures = (await response.json()).data || [];\r\n\r\n    fixtures = fixtures.filter(f =>\r\n        f.owner?.id === ownerId &&\r\n        f.startDate &&\r\n        new Date(f.startDate).getFullYear() === 2026\r\n    );\r\n\r\n    if (!fixtures.length) {\r\n        dashboardEl.innerHTML = \"<p>No competitions found for 2026.<\/p>\";\r\n        return;\r\n    }\r\n\r\n    const comps = {};\r\n    fixtures.forEach(f => {\r\n        const id = f.competition?.id || \"unknown\";\r\n        if (!comps[id]) {\r\n            comps[id] = {\r\n                name: f.competition?.name || \"Unknown Competition\",\r\n                fixtures: [],\r\n                tables: []\r\n            };\r\n        }\r\n        comps[id].fixtures.push(f);\r\n    });\r\n\r\n    async function fetchLeagueTables(compId) {\r\n        try {\r\n            const res = await fetch(\r\n                `https:\/\/api.foireann.ie\/open-data\/v1\/competitions?id=${compId}`,\r\n                { headers: { \"Authorization\": \"Bearer \" + apiKey } }\r\n            );\r\n            const comp = (await res.json()).data?.[0];\r\n            if (!comp?.divisions) return [];\r\n\r\n            const tables = [];\r\n            comp.divisions.forEach(div => {\r\n                div.leagues?.forEach(lg => {\r\n                    if (lg.teams?.length) {\r\n                        tables.push({\r\n                            divisionName: div.name,\r\n                            leagueName: lg.name,\r\n                            teams: lg.teams\r\n                        });\r\n                    }\r\n                });\r\n            });\r\n            return tables;\r\n        } catch {\r\n            return [];\r\n        }\r\n    }\r\n\r\n    const compIds = Object.keys(comps);\r\n    const tableResults = await Promise.all(compIds.map(fetchLeagueTables));\r\n    compIds.forEach((id, i) => comps[id].tables = tableResults[i]);\r\n\r\n    const sortedCompIds = compIds.sort((a, b) =>\r\n        comps[a].name.localeCompare(comps[b].name)\r\n    );\r\n\r\n    let html = `<h2>All Competitions (2026)<\/h2>`;\r\n\r\n    for (const compId of sortedCompIds) {\r\n        const comp = comps[compId];\r\n\r\n        const results = comp.fixtures.filter(f =>\r\n            f.isResult ||\r\n            f.homeTeam?.goals !== undefined ||\r\n            f.awayTeam?.goals !== undefined\r\n        );\r\n\r\n        const upcoming = comp.fixtures.filter(f => !results.includes(f));\r\n\r\n        results.sort((a, b) => new Date(b.startDate) - new Date(a.startDate));\r\n        upcoming.sort((a, b) => new Date(a.startDate) - new Date(b.startDate));\r\n\r\n        const resultsHtml = results.length === 0 ? \"<p>No results available.<\/p>\" : `\r\n            <table style=\"width:100%; border-collapse:collapse;\">\r\n                <thead>\r\n                    <tr>\r\n                        <th>Date<\/th><th>Home<\/th><th>H<\/th><th>Away<\/th><th>A<\/th>\r\n                    <\/tr>\r\n                <\/thead>\r\n                <tbody>\r\n                    ${results.map(f => `\r\n                        <tr class=\"rowItem\">\r\n                            <td>${new Date(f.startDate).toLocaleString(\"en-GB\")}<\/td>\r\n                            <td>${f.homeTeam?.name || \"\"}<\/td>\r\n                            <td>${f.homeTeam?.goals ?? 0}-${f.homeTeam?.points ?? 0}<\/td>\r\n                            <td>${f.awayTeam?.name || \"\"}<\/td>\r\n                            <td>${f.awayTeam?.goals ?? 0}-${f.awayTeam?.points ?? 0}<\/td>\r\n                        <\/tr>\r\n                    `).join(\"\")}\r\n                <\/tbody>\r\n            <\/table>\r\n        `;\r\n\r\n        const fixturesHtml = upcoming.length === 0 ? \"<p>No upcoming fixtures.<\/p>\" : `\r\n            <table style=\"width:100%; border-collapse:collapse;\">\r\n                <thead>\r\n                    <tr>\r\n                        <th>Date<\/th>\r\n                        <th>Home<\/th>\r\n                        <th>Away<\/th>\r\n                        <th>Venue<\/th>\r\n                        <th>Referee<\/th>\r\n                        <th>Round<\/th>\r\n                    <\/tr>\r\n                <\/thead>\r\n                <tbody>\r\n                    ${upcoming.map(f => `\r\n                        <tr class=\"rowItem\">\r\n                            <td>${new Date(f.startDate).toLocaleString(\"en-GB\")}<\/td>\r\n                            <td>${f.homeTeam?.name || \"\"}<\/td>\r\n                            <td>${f.awayTeam?.name || \"\"}<\/td>\r\n                            <td>${f.place?.name || \"\"}<\/td>\r\n                            <td>${f.refereeName || f.referee?.name || \"\"}<\/td>\r\n                            <td>${f.round || \"\"}<\/td>\r\n                        <\/tr>\r\n                    `).join(\"\")}\r\n                <\/tbody>\r\n            <\/table>\r\n        `;\r\n\r\n        const standingsHtml = comp.tables.length === 0 ? \"<p>No standings available.<\/p>\" : `\r\n            ${comp.tables.map(tbl => `\r\n                <h4>${tbl.divisionName} \u2013 ${tbl.leagueName}<\/h4>\r\n                <table style=\"width:100%; border-collapse:collapse;\">\r\n                    <thead>\r\n                        <tr>\r\n                            <th>R<\/th><th>Team<\/th><th>P<\/th><th>W<\/th><th>D<\/th><th>L<\/th>\r\n                            <th>PF<\/th><th>PA<\/th><th>PD<\/th><th>Pts<\/th>\r\n                        <\/tr>\r\n                    <\/thead>\r\n                    <tbody>\r\n                        ${tbl.teams.map(t => `\r\n                            <tr>\r\n                                <td>${t.rank}<\/td>\r\n                                <td>${t.name}<\/td>\r\n                                <td>${t.played}<\/td>\r\n                                <td>${t.won}<\/td>\r\n                                <td>${t.drawn}<\/td>\r\n                                <td>${t.lost}<\/td>\r\n                                <td>${t.pointsFor}<\/td>\r\n                                <td>${t.pointsAgainst}<\/td>\r\n                                <td>${t.pointsDifference}<\/td>\r\n                                <td>${t.totalPoints}<\/td>\r\n                            <\/tr>\r\n                        `).join(\"\")}\r\n                    <\/tbody>\r\n                <\/table>\r\n            `).join(\"\")}\r\n        `;\r\n\r\n        html += `\r\n            <details class=\"compBlock\">\r\n                <summary>${comp.name}<\/summary>\r\n                <p class=\"toggleHint\">Click to show \/ hide<\/p>\r\n                <button class=\"btnShow\" data-target=\"r-${compId}\">Results<\/button>\r\n                <button class=\"btnShow\" data-target=\"f-${compId}\">Fixtures<\/button>\r\n                <button class=\"btnShow\" data-target=\"s-${compId}\">Standings<\/button>\r\n                <div id=\"r-${compId}\" style=\"display:none\">${resultsHtml}<\/div>\r\n                <div id=\"f-${compId}\" style=\"display:none\">${fixturesHtml}<\/div>\r\n                <div id=\"s-${compId}\" style=\"display:none\">${standingsHtml}<\/div>\r\n            <\/details>\r\n        `;\r\n    }\r\n\r\n    dashboardEl.innerHTML = html;\r\n\r\n    document.querySelectorAll(\".btnShow\").forEach(btn => {\r\n        btn.onclick = () => {\r\n            const el = document.getElementById(btn.dataset.target);\r\n            el.style.display = el.style.display === \"none\" ? \"block\" : \"none\";\r\n        };\r\n    });\r\n\r\n})();\r\n});\r\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>Fixtures, Results &amp; Standings Show Today&#8217;s Fixtures Show Fixtures For My Club Show Results For My Club Loading competitions\u2026<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-182","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=\/wp\/v2\/pages\/182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=182"}],"version-history":[{"count":5,"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=\/wp\/v2\/pages\/182\/revisions"}],"predecessor-version":[{"id":188,"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=\/wp\/v2\/pages\/182\/revisions\/188"}],"wp:attachment":[{"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}