Link database on index page generation for sandwichs & sandwichs
This commit is contained in:
parent
519e020831
commit
9c0c14a34b
2 changed files with 12 additions and 12 deletions
|
@ -1,9 +1,11 @@
|
||||||
let express = require("express");
|
let express = require("express");
|
||||||
let router = express.Router();
|
let router = express.Router();
|
||||||
|
let models = require("../models");
|
||||||
|
|
||||||
/* GET home page. */
|
router.get("/", async (req, res) => {
|
||||||
router.get("/", (req, res) => {
|
let departments = await models.Department.findAll();
|
||||||
res.render("index", { title: "SOD" });
|
let sandwichs = await models.Sandwich.findAll();
|
||||||
|
res.render("index", { title: "SOD", departments: departments, sandwichs: sandwichs });
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -6,14 +6,11 @@ block content
|
||||||
p Welcome to Sandwiches Order Doua
|
p Welcome to Sandwiches Order Doua
|
||||||
form#command(action="/command" method="POST")
|
form#command(action="/command" method="POST")
|
||||||
div.field
|
div.field
|
||||||
label(for="department") Department:
|
label(for="sandwich") Department:
|
||||||
input#department(type="list" list="department-list" name="department" required)
|
input#department(type="list" list="department-list" name="department" required)
|
||||||
datalist#department-list
|
datalist#department-list
|
||||||
option(value="Info")
|
each department in departments
|
||||||
option(value="Bio")
|
option(value=department.name)
|
||||||
option(value="Chimi")
|
|
||||||
option(value="GC")
|
|
||||||
option(value="GEA")
|
|
||||||
|
|
||||||
div.field
|
div.field
|
||||||
label(for="firstname") First name:
|
label(for="firstname") First name:
|
||||||
|
@ -39,13 +36,14 @@ block content
|
||||||
input#send(type="submit" value="Pay")
|
input#send(type="submit" value="Pay")
|
||||||
|
|
||||||
datalist#sandwich-list
|
datalist#sandwich-list
|
||||||
option(value="Jambon beurre")
|
each sandwich in sandwichs
|
||||||
|
option(value=sandwich.name)
|
||||||
datalist#date-list
|
datalist#date-list
|
||||||
option(value="14/08/2020")
|
option(value="14/08/2020")
|
||||||
|
|
||||||
div#more
|
div#more
|
||||||
a(href="#about") About
|
a About
|
||||||
a(href="#contact") Contact
|
a Contact
|
||||||
|
|
||||||
div#dark.hide
|
div#dark.hide
|
||||||
div#about.card.hide
|
div#about.card.hide
|
||||||
|
|
Reference in a new issue