From 6fdbaedc791db514e5f61ab9318690c952fd0976 Mon Sep 17 00:00:00 2001 From: sudoer777 <78781902+sudoer777@users.noreply.github.com> Date: Mon, 22 Nov 2021 15:48:30 -0700 Subject: [PATCH] Add functionality to list teams on manage page --- public/scripts/manage.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/public/scripts/manage.js b/public/scripts/manage.js index 8958f1c..f6bcda6 100644 --- a/public/scripts/manage.js +++ b/public/scripts/manage.js @@ -125,6 +125,45 @@ CATEGORIES.push(new Category( } )); +CATEGORIES.push(new Category( + "teams", + async function getTeams() { + return await Data.getTeams(); + }, + async function listTeamHeaders() { + const headerRow = document.createElement('tr'); + + const nameHeader = document.createElement('th'); + nameHeader.textContent = "Name"; + headerRow.appendChild(nameHeader); + + const sportHeader = document.createElement('th'); + sportHeader.textContent = "Sport"; + headerRow.appendChild(sportHeader); + + itemsListTable.appendChild(headerRow); + }, + function listTeam(team, row) { + const nameCell = document.createElement('td'); + nameCell.textContent = team.name; + row.appendChild(nameCell); + + const sportCell = document.createElement('td'); + Data.getSportName(team.sportID) + .then(data => sportCell.textContent = data); + row.appendChild(sportCell); + }, + async function addSeason() { + // + }, + async function submitSeason() { + // + }, + async function editSeason() { + + } +)); + async function listItems(category) {