Add functionality to list divisions in management page

main
sudoer777 2021-11-22 15:32:44 -07:00
parent b6f8b6bdaa
commit 18f840183f
1 changed files with 50 additions and 3 deletions

View File

@ -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() {
//
},