diff --git a/public/scripts/manage.js b/public/scripts/manage.js index 19b700a..8958f1c 100644 --- a/public/scripts/manage.js +++ b/public/scripts/manage.js @@ -56,9 +56,9 @@ CATEGORIES.push(new Category( async function listSportHeaders() { const headerRow = document.createElement('tr'); - const yearsHeader = document.createElement('th'); - yearsHeader.textContent = "Name"; - headerRow.appendChild(yearsHeader); + const nameHeader = document.createElement('th'); + nameHeader.textContent = "Name"; + headerRow.appendChild(nameHeader); itemsListTable.appendChild(headerRow); }, @@ -67,6 +67,53 @@ CATEGORIES.push(new Category( nameCell.textContent = sport.name; row.appendChild(nameCell); }, + async function addSport() { + // + }, + async function submitSport() { + // + }, + async function editSport() { + + } +)); + +CATEGORIES.push(new Category( + "divisions", + async function getDivisions() { + return await Data.getDivisions(); + }, + async function listDivisionHeaders() { + const headerRow = document.createElement('tr'); + + const nameHeader = document.createElement('th'); + nameHeader.textContent = "Name"; + headerRow.appendChild(nameHeader); + + const genderHeader = document.createElement('th'); + headerRow.appendChild(genderHeader); + + const sportHeader = document.createElement('th'); + sportHeader.textContent = "Sport"; + headerRow.appendChild(sportHeader); + + itemsListTable.appendChild(headerRow); + }, + function listDivision(division, row) { + const nameCell = document.createElement('td'); + nameCell.textContent = division.name; + row.appendChild(nameCell); + + const genderCell = document.createElement('td'); + const gender = division.gender.name == "female" ? "F" : "M"; + genderCell.textContent = gender; + row.appendChild(genderCell); + + const sportCell = document.createElement('td'); + Data.getSportName(division.sportID) + .then(data => sportCell.textContent = data); + row.appendChild(sportCell); + }, async function addSeason() { // },