{"id":75,"date":"2026-04-09T16:57:51","date_gmt":"2026-04-09T16:57:51","guid":{"rendered":"https:\/\/louthlgfa.ie\/?page_id=75"},"modified":"2026-04-09T17:01:49","modified_gmt":"2026-04-09T17:01:49","slug":"front-page","status":"publish","type":"page","link":"https:\/\/louthlgfa.ie\/","title":{"rendered":"Front Page"},"content":{"rendered":"\n<p class=\"has-text-align-left has-large-font-size\"><strong>Fixtures &amp; Results<\/strong><\/p>\n\n\n\n<div style=\"margin-bottom:15px;\">\r\n    <input \r\n        id=\"teamSearch\" \r\n        type=\"text\" \r\n        placeholder=\"Search by team name\u2026\" \r\n        style=\"width:100%; padding:10px; font-size:16px; border:1px solid #ccc; border-radius:4px;\"\r\n    >\r\n<\/div>\r\n\r\n<div id=\"multiCompDashboard\">Loading competitions\u2026<\/div>\r\n\r\n<script>\r\n(async () => {\r\n    const apiKey = \"foir_prod_NDtiJNVWyQpxRRujIXMrCOZntNaqZfflFjihYbiLtqilV\";\r\n    const ownerId = \"0e2e84a8-2d94-dc94-d574-9d44d4c15395\";\r\n\r\n    const url = `https:\/\/api.foireann.ie\/open-data\/v1\/fixtures?size=500`;\r\n\r\n    const response = await fetch(url, {\r\n        headers: {\r\n            \"Authorization\": \"Bearer \" + apiKey,\r\n            \"Accept\": \"application\/json\"\r\n        }\r\n    });\r\n\r\n    const json = await response.json();\r\n    let fixtures = json.data || [];\r\n\r\n    \/\/ Restrict to this owner ID\r\n    fixtures = fixtures.filter(f => f.owner?.id === ownerId);\r\n\r\n    \/\/ Restrict to 2026 only\r\n    fixtures = fixtures.filter(f => {\r\n        if (!f.startDate) return false;\r\n        return new Date(f.startDate).getFullYear() === 2026;\r\n    });\r\n\r\n    if (fixtures.length === 0) {\r\n        document.getElementById(\"multiCompDashboard\").innerHTML =\r\n            \"<p>No competitions found for 2026.<\/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 compId = f.competition?.id || \"unknown\";\r\n        const compName = f.competition?.name || \"Unknown Competition\";\r\n\r\n        if (!comps[compId]) {\r\n            comps[compId] = {\r\n                name: compName,\r\n                fixtures: []\r\n            };\r\n        }\r\n        comps[compId].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    let html = `<h2>Louth LGFA Competitions (2026)<\/h2>`;\r\n\r\n    \/\/ Build dropdowns\r\n    for (const compId of sortedCompIds) {\r\n        const comp = comps[compId];\r\n\r\n        \/\/ Correct result detection\r\n        const results = comp.fixtures.filter(f => {\r\n            return (\r\n                f.isResult === true ||\r\n                f.homeTeam?.goals !== undefined ||\r\n                f.homeTeam?.points !== undefined ||\r\n                f.awayTeam?.goals !== undefined ||\r\n                f.awayTeam?.points !== undefined\r\n            );\r\n        });\r\n\r\n        \/\/ Fixtures = no score recorded\r\n        const upcoming = comp.fixtures.filter(f => {\r\n            return !(\r\n                f.isResult === true ||\r\n                f.homeTeam?.goals !== undefined ||\r\n                f.homeTeam?.points !== undefined ||\r\n                f.awayTeam?.goals !== undefined ||\r\n                f.awayTeam?.points !== undefined\r\n            );\r\n        });\r\n\r\n        \/\/ Sort results newest \u2192 oldest\r\n        results.sort((a, b) => new Date(b.startDate) - new Date(a.startDate));\r\n\r\n        \/\/ Sort fixtures oldest \u2192 newest\r\n        upcoming.sort((a, b) => new Date(a.startDate) - new Date(b.startDate));\r\n\r\n        html += `\r\n            <details class=\"compBlock\" style=\"margin-bottom:20px;\">\r\n                <summary style=\"cursor:pointer; font-size:18px; font-weight:bold;\">\r\n                    ${comp.name}\r\n                <\/summary>\r\n\r\n                <div style=\"margin-top:10px;\">\r\n                    <h4>Results<\/h4>\r\n                    ${results.length === 0 ? \"<p>No results available.<\/p>\" : `\r\n                        <table class=\"fixtureTable\" style=\"width:100%; border-collapse:collapse; margin-bottom:20px;\">\r\n                            <thead>\r\n                                <tr>\r\n                                    <th style=\"border:1px solid #ccc; padding:6px;\">Date<\/th>\r\n                                    <th style=\"border:1px solid #ccc; padding:6px;\">Home<\/th>\r\n                                    <th style=\"border:1px solid #ccc; padding:6px;\">H Score<\/th>\r\n                                    <th style=\"border:1px solid #ccc; padding:6px;\">Away<\/th>\r\n                                    <th style=\"border:1px solid #ccc; padding:6px;\">A Score<\/th>\r\n                                <\/tr>\r\n                            <\/thead>\r\n                            <tbody>\r\n                                ${results.map(f => {\r\n                                    const dt = new Date(f.startDate);\r\n                                    const formatted = dt.toLocaleString(\"en-GB\", {\r\n                                        day: \"2-digit\",\r\n                                        month: \"2-digit\",\r\n                                        year: \"2-digit\",\r\n                                        hour: \"2-digit\",\r\n                                        minute: \"2-digit\"\r\n                                    });\r\n\r\n                                    const homeScore = `${f.homeTeam?.goals ?? 0}-${f.homeTeam?.points ?? 0}`;\r\n                                    const awayScore = `${f.awayTeam?.goals ?? 0}-${f.awayTeam?.points ?? 0}`;\r\n\r\n                                    return `\r\n                                        <tr class=\"rowItem\">\r\n                                            <td style=\"border:1px solid #ccc; padding:6px;\">${formatted}<\/td>\r\n                                            <td style=\"border:1px solid #ccc; padding:6px;\">${f.homeTeam?.name || \"\"}<\/td>\r\n                                            <td style=\"border:1px solid #ccc; padding:6px;\">${homeScore}<\/td>\r\n                                            <td style=\"border:1px solid #ccc; padding:6px;\">${f.awayTeam?.name || \"\"}<\/td>\r\n                                            <td style=\"border:1px solid #ccc; padding:6px;\">${awayScore}<\/td>\r\n                                        <\/tr>\r\n                                    `;\r\n                                }).join(\"\")}\r\n                            <\/tbody>\r\n                        <\/table>\r\n                    `}\r\n\r\n                    <h4>Fixtures<\/h4>\r\n                    ${upcoming.length === 0 ? \"<p>No upcoming fixtures.<\/p>\" : `\r\n                        <table class=\"fixtureTable\" style=\"width:100%; border-collapse:collapse;\">\r\n                            <thead>\r\n                                <tr>\r\n                                    <th style=\"border:1px solid #ccc; padding:6px;\">Date<\/th>\r\n                                    <th style=\"border:1px solid #ccc; padding:6px;\">Home<\/th>\r\n                                    <th style=\"border:1px solid #ccc; padding:6px;\">Away<\/th>\r\n                                <\/tr>\r\n                            <\/thead>\r\n                            <tbody>\r\n                                ${upcoming.map(f => {\r\n                                    const dt = new Date(f.startDate);\r\n                                    const formatted = dt.toLocaleString(\"en-GB\", {\r\n                                        day: \"2-digit\",\r\n                                        month: \"2-digit\",\r\n                                        year: \"2-digit\",\r\n                                        hour: \"2-digit\",\r\n                                        minute: \"2-digit\"\r\n                                    });\r\n\r\n                                    return `\r\n                                        <tr class=\"rowItem\">\r\n                                            <td style=\"border:1px solid #ccc; padding:6px;\">${formatted}<\/td>\r\n                                            <td style=\"border:1px solid #ccc; padding:6px;\">${f.homeTeam?.name || \"\"}<\/td>\r\n                                            <td style=\"border:1px solid #ccc; padding:6px;\">${f.awayTeam?.name || \"\"}<\/td>\r\n                                        <\/tr>\r\n                                    `;\r\n                                }).join(\"\")}\r\n                            <\/tbody>\r\n                        <\/table>\r\n                    `}\r\n                <\/div>\r\n            <\/details>\r\n        `;\r\n    }\r\n\r\n    document.getElementById(\"multiCompDashboard\").innerHTML = html;\r\n\r\n    \/\/ SEARCH FILTER\r\n    const searchInput = document.getElementById(\"teamSearch\");\r\n    searchInput.addEventListener(\"input\", function () {\r\n        const term = this.value.toLowerCase();\r\n\r\n        document.querySelectorAll(\".compBlock\").forEach(block => {\r\n            let match = false;\r\n\r\n            block.querySelectorAll(\".rowItem\").forEach(row => {\r\n                const text = row.innerText.toLowerCase();\r\n                if (text.includes(term)) {\r\n                    row.style.display = \"\";\r\n                    match = true;\r\n                } else {\r\n                    row.style.display = \"none\";\r\n                }\r\n            });\r\n\r\n            block.style.display = match ? \"\" : \"none\";\r\n        });\r\n    });\r\n\r\n})();\r\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>Fixtures &amp; Results 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-75","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=\/wp\/v2\/pages\/75","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=75"}],"version-history":[{"count":3,"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=\/wp\/v2\/pages\/75\/revisions"}],"predecessor-version":[{"id":79,"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=\/wp\/v2\/pages\/75\/revisions\/79"}],"wp:attachment":[{"href":"https:\/\/louthlgfa.ie\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}