Create page to add season

main
sudoer777 2021-11-22 18:04:36 -07:00
parent 7c5c059e09
commit 4133758bba
3 changed files with 31 additions and 0 deletions

View File

View File

@ -2,6 +2,7 @@ var express = require('express');
var router = express.Router(); var router = express.Router();
var genders = require('../database/scores/genders'); var genders = require('../database/scores/genders');
var games = require('../database/scores/games'); var games = require('../database/scores/games');
var seasons = require('../database/scores/seasons');
router.get('/', function(req, res, next) { router.get('/', function(req, res, next) {
@ -27,4 +28,15 @@ router.post('/submitgame', function(req, res, next) {
.then(res.send("SUCCESS")); .then(res.send("SUCCESS"));
}); });
router.get('/addseason', function(req, res, next) {
res.render('manage/addseason', { title: 'Add season', currentYear : (new Date()).getFullYear() });
});
router.post('/submitseason', function(req, res, next) {
const year = req.body['year'];
seasons.add(year)
.then(res.send("SUCCESS"));
});
module.exports = router; module.exports = router;

View File

@ -0,0 +1,19 @@
extends layout
block stylesheets
link(rel='stylesheet', href='/stylesheets/submit.css')
link(rel='stylesheet', href='/stylesheets/form.css')
block content
div#mobile-view
h1 Add Season
form(action='./submitseason', method='POST')
span(class='form-section')
label Ending year
span(class='form-section-input')
input(type="number", name="year", value=currentYear)
span(class='form-section')
button#submit-button(type="submit") Submit
block scripts
script(src='/scripts/season.js' type="module")