Archived
1
0
Fork 0

Merge pull request #15 from flifloo/materialize

Materialize
This commit is contained in:
Ethanell 2020-09-29 16:21:51 +02:00
commit 9ccc57820b
43 changed files with 778 additions and 899 deletions

2
app.js
View file

@ -20,6 +20,7 @@ let profileRouter = require("./routes/profile");
let checkRouter = require("./routes/check"); let checkRouter = require("./routes/check");
let adminRouter = require("./routes/admin"); let adminRouter = require("./routes/admin");
let contactRouter = require("./routes/contact"); let contactRouter = require("./routes/contact");
let aboutRouter = require("./routes/about");
let app = express(); let app = express();
let sess = { let sess = {
@ -76,6 +77,7 @@ app.use("/profile", profileRouter);
app.use("/check", checkRouter); app.use("/check", checkRouter);
app.use("/admin", adminRouter); app.use("/admin", adminRouter);
app.use("/contact", contactRouter); app.use("/contact", contactRouter);
app.use("/about", aboutRouter);
// catch 404 and forward to error handler // catch 404 and forward to error handler
app.use((req, res) => { app.use((req, res) => {

View file

@ -24,14 +24,17 @@
"question": "Practical question", "question": "Practical question",
"profile": "My profile", "profile": "My profile",
"other": "Another question", "other": "Another question",
"powered": "Powered by" "powered": "Powered by",
"links": "Links",
"chooseSubject": "Choose a subject"
}, },
"index": { "index": {
"welcome": "Welcome to Sandwiches Order Doua", "welcome": "Welcome to Sandwiches Order Doua",
"day": "Day", "day": "Day",
"pay": "Pay", "pay": "Pay",
"payment": "Payment method", "payment": "Payment method",
"creditCard": "Credit card" "creditCard": "Credit card",
"chooseSandwich": "Choose your sandwich"
}, },
"login": { "login": {
"title": "Login", "title": "Login",
@ -70,9 +73,11 @@
"firstDate": "First date", "firstDate": "First date",
"lastDate": "Last date", "lastDate": "Last date",
"paid": "Paid", "paid": "Paid",
"given": "Given" "given": "Given",
"chooseUser": "Choose an user"
}, },
"payment": { "payment": {
"payment": "Payment",
"successful": "Payment successful !", "successful": "Payment successful !",
"canceled": "Payment canceled", "canceled": "Payment canceled",
"error": "An error occurred with the payment", "error": "An error occurred with the payment",
@ -92,5 +97,6 @@
"sandwich": "Sandwich", "sandwich": "Sandwich",
"contact": "Contact", "contact": "Contact",
"messageSend": "The message has been sent", "messageSend": "The message has been sent",
"forgetPassword": "Forgot your password" "forgetPassword": "Forgot your password",
"chooseDepartment": "Choose your department"
} }

View file

@ -24,14 +24,17 @@
"question": "Question Pratique", "question": "Question Pratique",
"profile": "Mon profil", "profile": "Mon profil",
"other": "Autre question", "other": "Autre question",
"powered": "Propulsé par" "powered": "Propulsé par",
"links": "Liens",
"chooseSubject": "Choisissez un sujet"
}, },
"index": { "index": {
"welcome": "Bienvenue sur Sandwiches Order Doua", "welcome": "Bienvenue sur Sandwiches Order Doua",
"day": "Jour", "day": "Jour",
"pay": "Payer", "pay": "Payer",
"payment": "Mode de paiement", "payment": "Mode de paiement",
"creditCard": "CB" "creditCard": "CB",
"chooseSandwich": "Choisissez votre sandwiche"
}, },
"login": { "login": {
"title": "Se connecter", "title": "Se connecter",
@ -70,9 +73,11 @@
"firstDate": "Première date", "firstDate": "Première date",
"lastDate": "Dernière date", "lastDate": "Dernière date",
"paid": "Payé", "paid": "Payé",
"given": "Donné" "given": "Donné",
"chooseUser": "Choisissez un utilisateur"
}, },
"payment": { "payment": {
"payment": "Paiement",
"successful": "Paiement réussi !", "successful": "Paiement réussi !",
"canceled": "Paiement annulé", "canceled": "Paiement annulé",
"error": "Une erreur est survenue lors du paiement", "error": "Une erreur est survenue lors du paiement",
@ -93,5 +98,6 @@
"contact": "Contact", "contact": "Contact",
"messageSend": "Le message a bien été envoyé", "messageSend": "Le message a bien été envoyé",
"forgetPassword": "Mot de passe oublié", "forgetPassword": "Mot de passe oublié",
"send": "send" "send": "send",
"chooseDepartment": "Choisissez votre département"
} }

View file

@ -1,4 +1,4 @@
document.querySelectorAll("a.remove") document.querySelectorAll(".delete")
.forEach(e => e.addEventListener("click", ev => { .forEach(e => e.addEventListener("click", ev => {
if (!confirm("Do you really want to remove this department ?")) if (!confirm("Do you really want to remove this department ?"))
ev.preventDefault(); ev.preventDefault();

View file

@ -1,40 +1,59 @@
const orderAction = document.getElementById("order-action"); const orders = document.getElementById("orders");
const rmButton = document.getElementById("remove-order"); const sandwich = document.getElementById("sandwich");
const day = document.getElementById("day");
const locals = { const locals = {
order: document.querySelector("#order1>h2").innerHTML.replace(" 1", ""), sandwich: document.querySelector("#oderCreator label").innerHTML,
sandwich: document.querySelector("label[for='sandwich1']").innerHTML, day: document.querySelector("label[for=day]").innerText,
day: document.querySelector("label[for='day1']").innerHTML give: document.querySelector("p label span").innerText
}; };
function lastOrderId() { function lastOrderId() {
let list = document.querySelectorAll("div.order h2"); if (orders.lastChild)
return parseInt(list[list.length-1].innerText.replace(locals.order+" ", "")); return parseInt(orders.lastChild.id.replace("order", ""));
return 0;
} }
document.getElementById("add-order").addEventListener("click", () => { document.getElementById("addOrder").addEventListener("click", () => {
if (!sandwich.value || !day.value)
return;
let id = lastOrderId() + 1; let id = lastOrderId() + 1;
orderAction.insertAdjacentHTML("beforebegin", `<div id="order${id}" class="order">
<h2>${locals.order} ${id}</h2> orders.insertAdjacentHTML("beforeend", `<div id="order${id}" class="row">
<div class="field"> <div class="input-field col s6">
<input id="sandwich${id}" type="text" name="sandwiches[${id}]" value="${sandwich.value}" readonly required>
<label for="sandwich${id}">${locals.sandwich}</label> <label for="sandwich${id}">${locals.sandwich}</label>
<span class="list_arrow"><input id="sandwich${id}" type="list" list="sandwich-list" name="sandwiches[${id}]" autocomplete="off" required></span>
</div> </div>
<div class="field"> <div class="input-field col s6">
<label for="day${id}">${locals.day}</label> <input id="date${id}" type="date" name="dates[${id}]" value="${day.value}" readonly required>
<input id="day${id}" type="date" name="dates[${id}]" required> <label for="date${id}">${locals.day}</label>
</div> </div>
<div class="field"> <div class="input-field col s12 center">
<label for="give${id}">${locals.day}</label> <p>
<input id="give${id}" type="checkbox" name="give[${id}]"> <label>
<input type="checkbox" name="give[${id}]">
<span>${locals.give}</span>
</label>
</p>
</div> </div>
<a class="btn-floating btn-large waves-effect waves-light red"><i class="material-icons">remove</i></a>
</div>`); </div>`);
document.getElementById("order"+lastOrderId()).scrollIntoView({behavior: "smooth"});
rmButton.classList.remove("hide"); sandwich.selectedIndex = 0;
day.value = "";
let order = document.getElementById("order"+id);
order.querySelector("a").addEventListener("click", () => {
order.remove();
if (lastOrderId() === 0) {
sandwich.required = true;
day.required = true;
}
});
document.getElementById("order"+id).scrollIntoView({behavior: "smooth"});
}); });
rmButton.addEventListener("click", () => { document.querySelector("form").addEventListener("submit", () => {
let id = lastOrderId(); return lastOrderId();
document.getElementById("order"+id).remove();
if (id === 2)
rmButton.classList.add("hide");
}); });

View file

@ -0,0 +1,3 @@
for (let e of document.getElementById("orders").children) {
e.querySelector("a").addEventListener("click", () => e.remove());
}

View file

@ -1,5 +1,4 @@
document.querySelectorAll(".order form") document.querySelectorAll(".delete").forEach(e => e.addEventListener("click", ev => {
.forEach(e => e.addEventListener("submit", ev => {
if (!confirm("Do you really want to remove this ?")) if (!confirm("Do you really want to remove this ?"))
ev.preventDefault(); ev.preventDefault();
})); }));

View file

@ -1,4 +1,4 @@
document.querySelectorAll("a.remove") document.querySelectorAll(".delete")
.forEach(e => e.addEventListener("click", ev => { .forEach(e => e.addEventListener("click", ev => {
if (!confirm("Do you really want to remove this sandwich ?")) if (!confirm("Do you really want to remove this sandwich ?"))
ev.preventDefault(); ev.preventDefault();

View file

@ -1,4 +1,4 @@
document.querySelectorAll("a.remove") document.querySelectorAll(".delete")
.forEach(e => e.addEventListener("click", ev => { .forEach(e => e.addEventListener("click", ev => {
if (!confirm("Do you really want to remove this user ?")) if (!confirm("Do you really want to remove this user ?"))
ev.preventDefault(); ev.preventDefault();

View file

@ -1,37 +1,50 @@
const orderAction = document.getElementById("order-action"); const orders = document.getElementById("orders");
const rmButton = document.getElementById("remove-order"); const sandwich = document.getElementById("sandwich");
const day = document.getElementById("day");
const locals = { const locals = {
order: document.querySelector("#order1>h2").innerHTML.replace(" 1", ""), sandwich: document.querySelector("#oderCreator label").innerHTML,
sandwich: document.querySelector("label[for='sandwich1']").innerHTML, day: document.querySelector("label[for=day]").innerText
day: document.querySelector("label[for='day1']").innerHTML
}; };
const [min, max] = [document.getElementById("day1").min, document.getElementById("day1").max];
function lastOrderId() { function lastOrderId() {
let list = document.querySelectorAll("div.order h2"); if (orders.lastChild)
return parseInt(list[list.length-1].innerText.replace(locals.order+" ", "")); return parseInt(orders.lastChild.id.replace("order", ""));
return 0;
} }
document.getElementById("add-order").addEventListener("click", () => { document.getElementById("addOrder").addEventListener("click", () => {
if (!sandwich.value || !day.value)
return;
let id = lastOrderId() + 1; let id = lastOrderId() + 1;
orderAction.insertAdjacentHTML("beforebegin", `<div id="order${id}" class="order">
<h2>${locals.order} ${id}</h2> orders.insertAdjacentHTML("beforeend", `<div id="order${id}" class="row">
<div class="field"> <div class="input-field col s6">
<input id="sandwich${id}" type="text" name="sandwiches[${id}]" value="${sandwich.value}" readonly required>
<label for="sandwich${id}">${locals.sandwich}</label> <label for="sandwich${id}">${locals.sandwich}</label>
<span class="list_arrow"><input id="sandwich${id}" type="list" list="sandwich-list" name="sandwiches[${id}]" autocomplete="off" required></span>
</div> </div>
<div class="field"> <div class="input-field col s6">
<label for="day${id}">${locals.day}</label> <input id="date${id}" type="date" name="dates[${id}]" value="${day.value}" readonly required>
<input id="da${id}y" type="date" min="${min}" max="${max}" name="dates[${id}]" required> <label for="date${id}">${locals.day}</label>
</div> </div>
<a class="btn-floating btn-large waves-effect waves-light red"><i class="material-icons">remove</i></a>
</div>`); </div>`);
document.getElementById("order"+lastOrderId()).scrollIntoView({behavior: "smooth"});
rmButton.classList.remove("hide"); sandwich.selectedIndex = 0;
day.value = "";
let order = document.getElementById("order"+id);
order.querySelector("a").addEventListener("click", () => {
order.remove();
if (lastOrderId() === 0) {
sandwich.required = true;
day.required = true;
}
});
document.getElementById("order"+id).scrollIntoView({behavior: "smooth"});
}); });
rmButton.addEventListener("click", () => { document.querySelector("form").addEventListener("submit", () => {
let id = lastOrderId(); return lastOrderId();
document.getElementById("order"+id).remove();
if (id === 2)
rmButton.classList.add("hide");
}); });

View file

@ -1,25 +1,6 @@
const more = document.getElementById("more"); document.addEventListener("DOMContentLoaded", function() {
const dark = document.getElementById("dark"); M.AutoInit();
const about = document.getElementById("about"); M.updateTextFields;
const contact = document.getElementById("contact");
more.firstChild.addEventListener("click", () => {
dark.classList.remove("hide");
about.classList.remove("hide");
});
more.lastChild.addEventListener("click", () => {
dark.classList.remove("hide");
contact.classList.remove("hide")
});
dark.addEventListener("click", () => {
dark.classList.add("hide");
if (! about.classList.contains("hide"))
about.classList.add("hide");
else
contact.classList.add("hide");
}); });
function cb(token) { function cb(token) {

View file

@ -1,25 +1,17 @@
const date = document.getElementById("date"); const date = document.getElementById("date");
document.querySelectorAll("h4").forEach((e) => {
function collapse(e, subDiv) {
e.addEventListener("click", ev => { e.addEventListener("click", ev => {
ev.stopPropagation(); ev.stopPropagation();
let action; let action;
if (e.classList.contains("collapse")) if (e.classList.contains("collapsed"))
action = "remove"; action = "remove";
else else
action = "add"; action = "add";
e.querySelectorAll("."+subDiv).forEach(e => e.classList[action]("hide")); e.parentElement.querySelectorAll(".collection").forEach(c => c.classList[action]("hide"));
e.classList[action]("collapse"); e.classList[action]("collapsed");
}) })
} });
document.querySelectorAll(".department").forEach(e => collapse(e, "user"));
document.querySelectorAll(".user").forEach(e => collapse(e, "order"));
document.querySelectorAll(".order").forEach(e => collapse(e, "sandwich"));
date.addEventListener("change", () => window.location.href = "?date="+date.value); date.addEventListener("change", () => window.location.href = "?date="+date.value);

View file

@ -1,271 +1,9 @@
html, body {
margin: 0;
height: 100%;
}
body { body {
display: flex; display: flex;
align-items: center; min-height: 100vh;
font: large "Lucida Grande", Helvetica, Arial, sans-serif; flex-direction: column;
background-color: #db970a;
background-image: linear-gradient(white 2px, transparent 2px),
linear-gradient(90deg, white 2px, transparent 2px),
linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),
linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);
background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;
} }
.card { main {
display: flex; flex: 1 0 auto;
flex-direction: column;
width: max-content;
height: auto;
padding: 1em;
margin: auto;
background-color: white;
box-shadow: 0.5em 0.5em 0.5em rgba(0, 0, 255, .2);
}
h1, h2, h3, p, label {
display: block;
text-align: center;
}
a {
color: #00B7FF;
cursor: pointer;
text-decoration: none;
}
#order {
margin: auto;
display: flex;
flex-direction: column;
}
.field {
margin: 1em auto auto auto;
width: 90%;
}
.field input {
box-shadow: 0.5em 0.5em 0.5em rgba(0, 0, 255, .2);
margin: auto;
width: 100%;
font-size: 100%;
height: 2.5vh;
border-top: none;
border-left: none;
border-right: none;
border-bottom: 1px gray solid;
}
.field input[type="radio"], .field input[type="checkbox"] {
box-shadow: none;
}
.field input[type="submit"] {
height: 4vh;
border: none;
}
#order-action {
display: flex;
justify-content: space-around;
}
#add-order, #remove-order {
font-weight: bold;
font-size: 2em;
margin: auto auto 1em auto;
}
.hide {
display: none;
}
#more {
display: flex;
position: fixed;
bottom: 0;
left: 0;
padding: 0.3em;
background-color: white;
box-shadow: 0.5em 0.5em 0.5em rgba(0, 0, 255, .2);
border-radius: 0.5em 0.5em 0 0;
}
#more a {
margin: 0.1em;
color: black;
text-decoration: underline;
}
#contact .cont {
display: flex;
justify-content: space-between;
}
#contact .cont .field {
margin: 0.5em;
}
.field.message {
width: max-content;
height: max-content;
}
.message>textarea {
width: 60vw;
height: 30vh;
overflow: auto;
resize: none;
font-size: large;
}
.popup {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
height: max-content;
width: max-content;
max-height: 100%;
max-width: 90%;
}
.images {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
overflow-y: auto;
}
.images>div {
display: flex;
align-items: center;
flex-direction: column;
margin: 1em;
}
.images img {
height: 5em;
}
p.before-link a::before {
content: " ";
}
#dark {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(52, 55, 55, .4);
}
#date-selector {
position: fixed;
top: 0;
left: 0;
border-radius: 0 0 0.5em 0.5em;
}
.department {
box-shadow: 0.3em 0.3em 0.3em rgba(0, 0, 255, .2);
}
.sandwich {
display: flex;
margin-left: 1em;
}
.buttons {
display: flex;
justify-content: space-around;
}
#user {
position: fixed;
top: 0;
right: 0;
display: flex;
padding: 0.3em;
background-color: white;
border-radius: 0 0 0.3em 0.3em;
box-shadow: 0.5em 0.5em 0.5em rgba(0, 0, 255, .2);
}
#user>p, #user>a {
margin: 0.1em;
}
#user>a {
text-decoration: underline;
color: black;
}
#userOrderList {
max-height: 90%;
overflow-y: auto;
}
#ordersManagement, #sandwichesManagement {
max-height: 90%;
}
#ordersManagement h2 {
margin: 0.2em 0 0 0;
}
#ordersManagement>div, #sandwichesManagement>div {
overflow-y: auto;
}
#ordersManagement .order {
box-shadow: 0.5em 0.5em 0.5em rgba(0, 0, 255, .2);
}
#ordersManagement .order .title, #ordersManagement .sandwich {
display: flex;
justify-content: center;
}
#ordersManagement input[value="x"] {
border: none;
background-color: unset;
cursor: pointer;
}
#sandwichesManagement>a>button, #departmentsManagement>a>button, #usersManagement>a>button, #ordersManagement>a>button {
width: 100%;
}
.give {
height: min-content;
width: min-content;
}
input[type="list"]::-webkit-calendar-picker-indicator {
display: none;/* remove default arrow */
}
.list_arrow:after {
content: url(https://i.stack.imgur.com/i9WFO.png);
margin-left: -20px;
padding: .1em;
pointer-events:none;
}
@media (hover: none) and (pointer: coarse) {
body {
font-size: xx-large;
}
.message>textarea {
font-size: xx-large;
}
} }

9
routes/about.js Normal file
View file

@ -0,0 +1,9 @@
let express = require("express");
let router = express.Router();
router.get("/", async (req, res) => {
res.render("about", {title: "SOD - About"});
});
module.exports = router;

View file

@ -5,7 +5,9 @@ let reCaptcha = require("../middlewares/reCaptcha");
let Message = require("emailjs").Message; let Message = require("emailjs").Message;
router.post("/", reCaptcha, async (req, res) => { router.get("/", async (req, res) => {
res.render("contact", {title: "SOD - Contact", send: req.query.send});
}).post("/", reCaptcha, async (req, res) => {
if (!req.body.firstName || !req.body.lastName || !req.body.email || !req.body.subject || ! req.body.message) if (!req.body.firstName || !req.body.lastName || !req.body.email || !req.body.subject || ! req.body.message)
return error(req, res, "Invalid contact form !", 400, "Missing arg"); return error(req, res, "Invalid contact form !", 400, "Missing arg");
@ -25,7 +27,7 @@ ${req.body.message}`,
return error(req, res, "Fail to send message !", 500, return error(req, res, "Fail to send message !", 500,
req.app.get("env") !== "production" ? err : undefined); req.app.get("env") !== "production" ? err : undefined);
else else
res.render("contact", {title: "SOD - Contact"}); res.redirect("/contact?send=1");
}); });
}); });

View file

@ -30,11 +30,11 @@ router.get("/", sessionCheck(2), async (req, res) => {
orders[o.DepartmentName][name][o.id] = o.Sandwiches; orders[o.DepartmentName][name][o.id] = o.Sandwiches;
} }
res.render("orders", {title: "SOD - Orders", orders: orders, date: date}); res.render("orders", {title: "SOD - Orders", orders: orders, date: date});
}).post("/give", sessionCheck(2), async (req, res) => { }).get("/give", sessionCheck(2), async (req, res) => {
if (!req.body.id) if (!req.query.id)
return error(req, res, "Missing arg !", 400); return error(req, res, "Missing arg !", 400);
let order = await models.SandwichOrder.findByPk(req.body.id, {where: {give: false}}); let order = await models.SandwichOrder.findByPk(req.query.id, {where: {give: false}});
if (!order) if (!order)
return error(req, res, "Invalid order id !", 400); return error(req, res, "Invalid order id !", 400);

35
views/about.pug Normal file
View file

@ -0,0 +1,35 @@
extends layout
block content
div.container.center
h1=__("layout.about")
h6=__("layout.aboutDescription")
div.row
div.col.s4.m4
div.card
div.card-image
img(src="/images/logoBio.png")
div.card-content=__("layout.bio")
div.col.s4.m4
div.card
div.card-image
img(src="/images/logoChimie.png")
div.card-content=__("layout.chemistry")
div.col.s4.m4
div.card
div.card-image
img(src="/images/logoGCGP.png")
div.card-content=__("layout.GCPD")
div.row
div.col.s4.m4
div.card
div.card-image
img(src="/images/logoGEA.png")
div.card-content=__("layout.GEA")
div.col.s4.m4
div.card
div.card-image
img(src="/images/logoInfo.png")
div.card-content=__("layout.IT")
p.before-link
a(href="" target="_blank")

View file

@ -1,11 +1,14 @@
extends ../../layout extends ../../layout
block content block content
div.card#departmentsManagement div.container
h1=__("admin.new")+" "+__("department") h1=__("admin.new")+" "+__("department")
form(action="/admin/departments/add" method="POST") div.row
div.field form(action="/admin/departments/add" method="POST")
label(for="name")=__("admin.name")+":" div.row
input#name(type="text" name="name" required) div.input-field.col.s12
div.field label(for="name")=__("admin.name")+":"
input(type="submit" value=__("admin.add")) input#name(type="text" name="name" required)
div.row.center
div.input-field.col.s12
+submit(__("admin.add"))

View file

@ -1,12 +1,15 @@
extends ../../layout extends ../../layout
block content block content
div.card#departmentsManagement div.container
h1=__("admin.edit")+" "+department.name h1=__("admin.edit")+" "+department.name
form(action="/admin/departments/edit" method="POST") div.row
input.hide(type="text" name="name" value=department.name required) form(action="/admin/departments/edit" method="POST")
div.field input.hide(type="text" name="name" value=department.name required)
label(for="name")=__("admin.name")+":" div.row
input#name(type="text" name="newName" value=department.name required) div.input-field.col.s12
div.field label(for="name")=__("admin.name")+":"
input(type="submit" value=__("save")) input#name(type="text" name="newName" value=department.name required)
div.row.center
div.input-field.col.s12
+submit(__("save"))

View file

@ -1,18 +1,20 @@
extends ../../layout extends ../../layout
block content block content
div.card#departmentsManagement div.container
h1=__("admin.departmentsManagement") h1=__("admin.departmentsManagement")
a.add(href="/admin/departments/add") ul.collection
button=__("admin.add")
div
each department in departments each department in departments
div.department li.collection-item
h2=department.name div=department.name
div.buttons div.secondary-content
a.edit(href="/admin/departments/edit?name="+department.name) a(href="/admin/departments/edit?name="+department.name)
button=__("admin.edit") i.material-icons edit
a.remove(href="/admin/departments/delete?name="+department.name) a.delete(href="/admin/departments/delete?name="+department.name)
button=__("admin.remove") i.material-icons remove
div.fixed-action-btn
a.btn-floating.btn-large.blue(href="/admin/departments/add")
i.large.material-icons add
script(src="/javascripts/admin/departments.js") script(src="/javascripts/admin/departments.js")

View file

@ -1,30 +1,36 @@
extends ../layout extends ../layout
block content block content
div.card div.container
h1=__("admin.title") h4=__("admin.title")
div div.row.center
h2=__("admin.ordersManagement") div.col
div.buttons div.card.blue-grey
a(href="/admin/orders/date") div.card-content.white-text
button=__("admin.ordersDate") span.card-title=__("admin.ordersManagement")
a(href="/admin/orders") p
button=__("admin.manageOrders") div.card-action
a(href="/admin/orders/date")=__("admin.ordersDate")
a(href="/admin/orders")=__("admin.manageOrders")
div div.col
h2=__("admin.sandwichManagement") div.card.blue-grey
div.buttons div.card-content.white-text
a(href="/admin/sandwiches") span.card-title=__("admin.sandwichManagement")
button=__("admin.manageSandwiches") p
div.card-action
div a(href="/admin/sandwiches")=__("admin.manageSandwiches")
h2=__("admin.departmentsManagement") div.col
div.buttons div.card.blue-grey
a(href="/admin/departments") div.card-content.white-text
button=__("admin.manageDepartments") span.card-title=__("admin.departmentsManagement")
p
div div.card-action
h2=__("admin.userManagement") a(href="/admin/departments")=__("admin.manageDepartments")
div.buttons div.col
a(href="/admin/users") div.card.blue-grey
button=__("admin.manageUsers") div.card-content.white-text
span.card-title=__("admin.userManagement")
p
div.card-action
a(href="/admin/users")=__("admin.manageUsers")

View file

@ -1,56 +1,59 @@
extends ../../layout extends ../../layout
block content block content
div.card span#dummy.hide=__("admin.given")
div.container
h1=__("admin.ordersManagement") h1=__("admin.ordersManagement")
form#order(method="POST") div.row
div.field form#order.col.s12(method="POST")
label(for="department")=__("department") + ":" div.row
+list("department", "department-list", "department", "", "off", true) div.input-field.col.s12
datalist#department-list select(name="department" required)
each department in departments option(value="" disabled selected hidden)=__("chooseDepartment")
option(value=department.name) each department in departments
option(value=department.name)=department.name
label=__("department") + ":"
div.field div.row
label(for="firstname")=__("firstName") + ":" div.input-field.col.s12
input#firstname(type="text" name="firstName" required) select(name="username")
div.field option(value="" disabled selected hidden)=__("admin.chooseUser")
label(for="lastname")=__("lastName") + ":" each user in users
input#lastname(type="text" name="lastName" required) option(value=user.username)=user.username
label=__("username") + ":"
div.field div.row
label(for="username")=__("username") div.input-field.col.s6
+list("username", "usernames", "username", "", "off") input#firstname(type="text" name="firstName" required)
label(for="firstname")=__("firstName") + ":"
div.input-field.col.s6
input#lastname(type="text" name="lastName" required)
label(for="lastname")=__("lastName") + ":"
div#order1.order div#oderCreator.row
h2=__("order") + " 1" h5=__("order")
div.field div.input-field.col.s6
label(for="sandwich1")=__("sandwich") + ":" select#sandwich
+list("sandwich1", "sandwich-list", "sandwiches[1]", "", "off", true) option(value="" disabled selected hidden)=__("index.chooseSandwich")
div.field each sandwich in sandwiches
label(for="day1")=__("index.day") + ":" option(value=sandwich.name)=sandwich.name
input#day1(type="date" name="dates[1]" required) label=__("sandwich") + ":"
div.field div.input-field.col.s6
label(for="given1")=__("admin.given") input#day(type="date")
input#given1(type="checkbox" name="give[1]") label(for="day")=__("index.day") + ":"
a#addOrder.btn-floating.btn-large.waves-effect.waves-light.blue: i.material-icons add
div#order-action div#orders
a#add-order +
a#remove-order.hide -
div.field div.row.center
label(for="paid")=__("admin.paid") div.input-field.col.s12
input#paid(type="checkbox" name="paid") p
label(for="paid")
div.field input#paid(type="checkbox" name="paid")
input#send(type="submit" value=__("admin.add")) span=__("admin.paid")
datalist#sandwich-list
each sandwich in sandwiches
option(value=sandwich.name)
datalist#usernames
each user in users
option(value=user.username)
div.row.center
div.input-field.col.s12
+submit(__("admin.add"))
script(src="/javascripts/admin/orders/add.js") script(src="/javascripts/admin/orders/add.js")

View file

@ -1,14 +1,17 @@
extends ../../layout extends ../../layout
block content block content
div.card#ordersManagement div.container
h1=__("admin.ordersDate") h1=__("admin.ordersDate")
form(action="/admin/orders/date" method="POST") div.row
div.field form(action="/admin/orders/date" method="POST")
label(for="firstDate")=__("admin.firstDate") div.row
input#firstDate(type="date" name="firstDate" value=date? date.firstDate: "" required) div.input-field.col.s6
div.field label(for="firstDate")=__("admin.firstDate")
label(for="lastDate")=__("admin.lastDate") input#firstDate(type="date" name="firstDate" value=date? date.firstDate: "" required)
input#lastDate(type="date" name="lastDate" value=date? date.lastDate: "" required) div.input-field.col.s6
div.field label(for="lastDate")=__("admin.lastDate")
input(type="submit" value=__("save")) input#lastDate(type="date" name="lastDate" value=date? date.lastDate: "" required)
div.row
div.input-field.col.s12
+submit(__("save"))

View file

@ -1,63 +1,75 @@
extends ../../layout extends ../../layout
block content block content
div.card div.container
h1=__("admin.ordersManagement") h1=__("admin.ordersManagement")
form#order(method="POST") div.row
input(type="hidden" name="id" value=order.id) form#order.col.s12(method="POST")
div.field input(type="hidden" name="id" value=order.id)
label(for="department")=__("department") + ":" div.row
+list("department", "department-list", "department", order.Department.name, "off", true) div.input-field.col.s12
datalist#department-list select(name="department" required)
each department in departments each department in departments
option(value=department.name) option(value=department.name selected=order.Department.name === department.name)=department.name
label=__("department") + ":"
div.field div.row
label(for="firstname")=__("firstName") + ":" div.input-field.col.s12
input#firstname(type="text" name="firstName" value=order.firstName required) select(name="username")
div.field each user in users
label(for="lastname")=__("lastName") + ":" option(value=user.username selected=order.User && order.User.username === user.username)=user.username
input#lastname(type="text" name="lastName" value=order.lastName required) label=__("username") + ":"
div.field div.row
label(for="username")=__("username") div.input-field.col.s6
+list("username", "usernames", "username", order.User ? order.User.username : "", "off") input#firstname(type="text" name="firstName" value=order.firstName required)
label(for="firstname")=__("firstName") + ":"
div.input-field.col.s6
input#lastname(type="text" name="lastName" value=order.lastName required)
label(for="lastname")=__("lastName") + ":"
- i = 0; div#oderCreator.row
each sandwich in order.Sandwiches h5=__("order")
- i++; div.input-field.col.s6
div.order(id="order"+i) select#sandwich
h2=__("order") + " " + i option(value="" disabled selected hidden)=__("index.chooseSandwich")
div.field each sandwich in sandwiches
label(for="sandwich"+i)=__("sandwich") + ":" option(value=sandwich.name)=sandwich.name
+list("#sandwich"+i, "sandwich-list", "sandwiches["+i+"]", sandwich.name, "off", true) label=__("sandwich") + ":"
div.field div.input-field.col.s6
label(for="day"+i)=__("index.day") + ":" input#day(type="date")
input(id="#day"+i type="date" name="dates["+i+"]" value=sandwich.SandwichOrder.date required) label(for="day")=__("index.day") + ":"
div.field a#addOrder.btn-floating.btn-large.waves-effect.waves-light.blue: i.material-icons add
label(for="given"+i)=__("admin.given")
input(id="given"+i type="checkbox" name="give["+i+"]" checked=sandwich.SandwichOrder.give)
div#order-action div#orders
a#add-order + - i = 0;
if i > 1 each sandwich in order.Sandwiches
a#remove-order - - i++;
else div.row(id="order"+i)
a#remove-order.hide - div.input-field.col.s6
input(id="sandwich"+i type="text" name="sandwiches[#{i}]" value=sandwich.name readonly required)
label(for="sandwich"+i)=__("sandwich")
div.input-field.col.s6
input(id="date"+i type="date" name="dates[#{i}]" value=sandwich.SandwichOrder.date readonly required)
label(for="date"+i)=__("index.day")
div.input-field.col.s12.center
p
label
input(type="checkbox" name="give[#{i}]" checked=sandwich.SandwichOrder.give)
span=__("admin.given")
a.btn-floating.btn-large.waves-effect.waves-light.red
i.material-icons remove
div.field div.row.center
label(for="paid")=__("admin.paid") div.input-field.col.s12
input#paid(type="checkbox" name="paid" checked=order.paid) p
label(for="paid")
div.field input#paid(type="checkbox" name="paid" checked=order.paid)
input#send(type="submit" value=__("save")) span=__("admin.paid")
datalist#sandwich-list
each sandwich in sandwiches
option(value=sandwich.name)
datalist#usernames
each user in users
option(value=user.username)
div.row.center
div.input-field.col.s12
+submit(__("save"))
script(src="/javascripts/admin/orders/add.js") script(src="/javascripts/admin/orders/add.js")
script(src="/javascripts/admin/orders/edit.js")

View file

@ -1,23 +1,23 @@
extends ../../layout extends ../../layout
block content block content
div.card#ordersManagement div.container
h1=__("admin.ordersManagement") h1=__("admin.ordersManagement")
a.add(href="/admin/orders/add") ul.collection
button=__("admin.add")
div
each order in orders each order in orders
div.order li.collection-item
div.title div #{order.id} | #{order.firstName} #{order.lastName} - #{order.price}€
h2=order.id div.secondary-content
h3 #{order.firstName} #{order.lastName} - #{order.price}€ a(href="/admin/orders/edit?id=" + order.id)
each sandwich in order.Sandwiches i.material-icons edit
div.sandwich a.delete(href="/admin/orders/delete?id=" + order.id)
i.material-icons remove
each sandwich in order.Sandwiches
p #{sandwich.name} - #{sandwich.SandwichOrder.date} p #{sandwich.name} - #{sandwich.SandwichOrder.date}
div.buttons
a.edit(href="/admin/orders/edit?id=" + order.id)
button=__("admin.edit") div.fixed-action-btn
a.remove(href="/admin/orders/delete?id=" + order.id) a.btn-floating.btn-large.blue(href="/admin/orders/add")
button=__("admin.remove") i.large.material-icons add
script(src="/javascripts/admin/orders/index.js") script(src="/javascripts/admin/orders/index.js")

View file

@ -1,14 +1,18 @@
extends ../../layout extends ../../layout
block content block content
div.card#sandwichesManagement div.container
h1=__("admin.new")+" "+__("sandwich") h1=__("admin.new")+" "+__("sandwich")
form(action="/admin/sandwiches/add" method="POST") div.row
div.field form(action="/admin/sandwiches/add" method="POST")
label(for="name")=__("admin.name")+":" div.row
input#name(type="text" name="name" required) div.input-field.col.s12
div.field label(for="name")=__("admin.name")+":"
label(for="price")=__("admin.price") + ":" input#name(type="text" name="name" required)
input#price(type="number" min="0" step="any" name="price" value="0" required) div.row
div.field div.input-field.col.s12
input(type="submit" value=__("admin.add")) label(for="price")=__("admin.price") + ":"
input#price(type="number" min="0" step="any" name="price" value="0" required)
div.row.center
div.input-field.col.s12
+submit(__("admin.add"))

View file

@ -1,15 +1,19 @@
extends ../../layout extends ../../layout
block content block content
div.card#sandwichesManagement div.container
h1=__("admin.edit")+" "+sandwich.name h1=__("admin.edit")+" "+sandwich.name
form(action="/admin/sandwiches/edit" method="POST") div.row
input.hide(type="text" name="name" value=sandwich.name required) form(action="/admin/sandwiches/edit" method="POST")
div.field input.hide(type="text" name="name" value=sandwich.name required)
label(for="name")=__("admin.name")+":" div.row
input#name(type="text" name="newName" value=sandwich.name required) div.input-field.col.s12
div.field label(for="name")=__("admin.name")+":"
label(for="price")=__("admin.price") + ":" input#name(type="text" name="newName" value=sandwich.name required)
input#price(type="number" min="0" step="any" name="price" value=sandwich.price required) div.row
div.field div.input-field.col.s12
input(type="submit" value=__("save")) label(for="price")=__("admin.price") + ":"
input#price(type="number" min="0" step="any" name="price" value=sandwich.price required)
div.row.center
div.input-field.col.s12
+submit(__("save"))

View file

@ -1,18 +1,20 @@
extends ../../layout extends ../../layout
block content block content
div.card#sandwichesManagement div.container
h1=__("admin.sandwichManagement") h1=__("admin.sandwichManagement")
a.add(href="/admin/sandwiches/add") ul.collection
button=__("admin.add")
div
each sandwich in sandwiches each sandwich in sandwiches
div.sandwich li.collection-item
h2=sandwich.name div=sandwich.name
div.buttons div.secondary-content
a.edit(href="/admin/sandwiches/edit?name="+sandwich.name) a(href="/admin/sandwiches/edit?name="+sandwich.name)
button=__("admin.edit") i.material-icons edit
a.remove(href="/admin/sandwiches/delete?name="+sandwich.name) a.delete(href="/admin/sandwiches/delete?name="+sandwich.name)
button=__("admin.remove") i.material-icons remove
div.fixed-action-btn
a.btn-floating.btn-large.blue(href="/admin/sandwiches/add")
i.large.material-icons add
script(src="/javascripts/admin/sandwiches.js") script(src="/javascripts/admin/sandwiches.js")

View file

@ -1,34 +1,41 @@
extends ../../layout extends ../../layout
block content block content
div.card#usersManagement div.container
h1=__("admin.new")+" "+__("admin.user") h1=__("admin.new")+" "+__("admin.user")
form(action="/admin/users/add" method="POST") div.row
h1=__("register.title") form(action="/admin/users/add" method="POST")
div.field h1=__("register.title")
label(for="username")=__("username") + ":" div.row
input#username(type="text" name="username" required) div.input-field.col.s12
div.field input#username(type="text" name="username" required)
label(for="email")=__("email") + ":" label(for="username")=__("username") + ":"
input#email(type="email" name="email" required) div.row
div.field div.input-field.col.s12
label(for="firstName")=__("firstName") + ":" input#email(type="email" name="email" required)
input#firstName(type="text" name="firstName" required) label(for="email")=__("email") + ":"
div.field div.row
label(for="lastName")=__("lastName") + ":" div.input-field.col.s6
input#lastName(type="text" name="lastName" required) input#firstName(type="text" name="firstName" required)
div.field label(for="firstName")=__("firstName") + ":"
label(for="department")=__("department") + ":" div.input-field.col.s6
+list("department", "department-list", "department", "", "off", true) input#lastName(type="text" name="lastName" required)
div.field label(for="lastName")=__("lastName") + ":"
label(for="password")=__("password") + ":" div.row
input#password(type="password" name="password" required) div.input-field.col.s12
div.field select(name="department" required)
label(for="permissions")=__("admin.permissions") option(value="" disabled selected hidden)=__("chooseDepartment")
input#permissions(type="number" min="0" max="3" value="0" name="permissions") each department in departments
div.field option(value=department.name)=department.name
input(type="submit" value=__("register.submit")) label=__("department") + ":"
div.row
datalist#department-list div.input-field.col.s12
each department in departments input#password(type="password" name="password" required)
option(value=department.name) label(for="password")=__("password") + ":"
div.row
div.input-field.col.s12
input#permissions(type="number" min="0" max="3" value="0" name="permissions")
label(for="permissions")=__("admin.permissions")
div.row.center
div.input-field.col.s12
+submit(__("register.submit"))

View file

@ -1,35 +1,41 @@
extends ../../layout extends ../../layout
block content block content
div.card#sandwichesManagement div.container
h1=__("admin.edit")+" "+targetUser.username h1=__("admin.edit")+" "+targetUser.username
form(action="/admin/users/edit" method="POST") div.row
h2=__("profile.infos") form(action="/admin/users/edit" method="POST")
input.hide(type="text" name="oldUsername" value=targetUser.username required) h2=__("profile.infos")
div.field input.hide(type="text" name="oldUsername" value=targetUser.username required)
label(for="username")=__("username") + ":" div.row
input#username(type="text" name="username" value=targetUser.username required) div.input-field.col.s12
div.field input#username(type="text" name="username" value=targetUser.username required)
label(for="email")=__("email") + ":" label(for="username")=__("username") + ":"
input#email(type="email" name="email" value=targetUser.email required) div.row
div.field div.input-field.col.s12
label(for="firstName")=__("firstName") + ":" input#email(type="email" name="email" value=targetUser.email required)
input#firstName(type="text" name="firstName" value=targetUser.firstName required) label(for="email")=__("email") + ":"
div.field div.row
label(for="lastName")=__("lastName") + ":" div.input-field.col.s6
input#lastName(type="text" name="lastName" value=targetUser.lastName required) input#firstName(type="text" name="firstName" value=targetUser.firstName required)
div.field label(for="firstName")=__("firstName") + ":"
label(for="department")=__("department") + ":" div.input-field.col.s6
+list("department", "department-list", "department", targetUser.DepartmentName, "off", true) input#lastName(type="text" name="lastName" value=targetUser.lastName required)
div.field label(for="lastName")=__("lastName") + ":"
label(for="password")=__("password") + ":" div.row
input#password(type="password" name="password") div.input-field.col.s12
div.field select(name="department" required=)
label(for="permissions")=__("admin.permissions") each department in departments
input#permissions(type="number" min="0" max="3" value=targetUser.permissions name="permissions") option(value=department.name selected=department.name === targetUser.DepartmentName)=department.name
div.field label=__("department") + ":"
input(type="submit" value=__("save")) div.row
div.input-field.col.s12
datalist#department-list input#password(type="password" name="password")
each department in departments label(for="password")=__("password") + ":"
option(value=department.name) div.row
div.input-field.col.s12
input#permissions(type="number" min="0" max="3" value=targetUser.permissions name="permissions")
label(for="permissions")=__("admin.permissions")
div.row.center
div.input-field.col.s12
+submit(__("save"))

View file

@ -1,18 +1,20 @@
extends ../../layout extends ../../layout
block content block content
div.card#usersManagement div.container
h1=__("admin.userManagement") h1=__("admin.userManagement")
a.add(href="/admin/users/add") ul.collection
button=__("admin.add")
div
each user in users each user in users
div.user li.collection-item
h2=user.username div=user.username
div.buttons div.secondary-content
a.edit(href="/admin/users/edit?name="+user.username) a(href="/admin/users/edit?name="+user.username)
button=__("admin.edit") i.material-icons edit
a.remove(href="/admin/users/delete?name="+user.username) a.delete(href="/admin/users/delete?name="+user.username)
button=__("admin.remove") i.material-icons remove
div.fixed-action-btn
a.btn-floating.btn-large.blue(href="/admin/users/add")
i.large.material-icons add
script(src="/javascripts/admin/users.js") script(src="/javascripts/admin/users.js")

View file

@ -1,6 +1,43 @@
extends layout extends layout
block content block content
div.card div.container
h1=__("contact") h1=__("contact")
p=__("messageSend") if !send
div.row
form(method="POST")
div.row
div.input-field.col.s6
input#firstNameContact(type="text" name="firstName" value=user ? user.firstName : "" required)
label(for="firstNameContact")="* " + __("firstName")
div.input-field.col.s6
input#lastNameContact(type="text" name="lastName" value=user ? user.lastName : "" required)
label(for="lastNameContact")="* " + __("lastName")
div.row
div.input-field.col.s6
input#emailContact(type="email" name="email" value=user ? user.email : "" required)
label(for="emailContact")="* " + __("email")
div.input-field.col.s6
input#phoneNumberContact(type="tel" name="phoneNumber")
label(for="phoneNumberContact")=__("layout.phoneNumber")
div.row
div.input-field.col.s12
select(name="subject" required)
option(value="" selected disabled)=__("layout.chooseSubject")
option(value=__("layout.commandEdit"))=__("layout.commandEdit")
option(value=__("layout.commandRemove"))=__("layout.commandRemove")
option(value=__("layout.question"))=__("layout.question")
option(value=__("layout.profile"))=__("layout.profile")
option(value=__("layout.other"))=__("layout.other")
label="* " + __("layout.subject")
p.center: strong=__("layout.warnMessage")
div.row
div.input-field.col.s12
textarea#messageContact.materialize-textarea(name="message" required)
label(for="messageContact")=__("layout.message")
div.row.center
div.input-field.col.s12
+submit(__("send"))
else
h5=__("messageSend")

View file

@ -1,7 +1,7 @@
extends layout extends layout
block content block content
div.card div.container.center
h1= message h1=message
h2= error.status h3=error.status
pre #{error.stack} h5=error.stack

View file

@ -1,20 +1,26 @@
extends layout extends layout
block content block content
div.card div.container
h1=__("forgetPassword") div.row
if (!token) h3=__("forgetPassword")
form(action="/forget" method="POST") if (!token)
div.field form(action="/forget" method="POST")
label(for="email")=__("email") div.row
input#email(type="email" name="email" required) div.input-field.col.s12
div.field input#email(type="email" name="email" required)
+submit(value=__("send")) label(for="email")=__("email")
else div.row
form(action="/forget" method="POST") div.input-field.col.s12
input(type="hidden" name="token" value=token) +submit(__("send"))
div.field else
label(for="password")=__("password") form(action="/forget" method="POST")
input#password(type="password" name="password" required) div.row
div.field input(type="hidden" name="token" value=token)
+submit(value=__("send")) div.row
div.input-field.col.s12
input#password(type="password" name="password" required)
label(for="password")=__("password")
div.row
div.input-field.col.s12
+submit(__("send"))

View file

@ -1,49 +1,55 @@
extends layout extends layout
block content block content
div.card div.container
h1= title h4.center=__("index.welcome")
p=__("index.welcome") div.row
form#order(action="/order" method="POST") form#order.col.s12(action="/order" method="POST")
div.field div.row
label(for="department")=__("department")+":" div.input-field.col.s12
+list("department", "department-list", "department", user ? user.DepartmentName : "", "off", true) select(name="department" required)
datalist#department-list option(value="" disabled selected hidden)=__("chooseDepartment")
each department in departments each department in departments
option(value=department.name) option(value=department.name selected=user && user.DepartmentName===department.name)=department.name
label=__("department")+":"
div.field div.row
label(for="firstname")=__("firstName")+":" div.input-field.col.s6
input#firstname(type="text" name="firstName" value=user ? user.firstName : "" required) input#firstname(type="text" name="firstName" value=user ? user.firstName : "" required)
div.field label(for="firstname")=__("firstName")+":"
label(for="lastname")=__("lastName")+":" div.input-field.col.s6
input#lastname(type="text" name="lastName" value=user ? user.lastName : "" required) input#lastname(type="text" name="lastName" value=user ? user.lastName : "" required)
label(for="lastname")=__("lastName")+":"
div#order1.order div#oderCreator.row
h2=__("order")+" 1" h5=__("order")
div.field div.input-field.col.s6
label(for="sandwich1")=__("sandwich")+":" select#sandwich
+list("sandwich1", "sandwich-list", "sandwiches[1]", "", "off", true) option(value="" disabled selected hidden)=__("index.chooseSandwich")
div.field each sandwich in sandwiches
label(for="day1")=__("index.day")+":" option(value=sandwich.name)=sandwich.name
input#day1(type="date" min=date.firstDate ? date.firstDate : "" max=date.lastDate ? date.lastDate : "" name="dates[1]" required) label=__("sandwich")+":"
div.input-field.col.s6
input#day(type="date" min=date.firstDate ? date.firstDate : "" max=date.lastDate ? date.lastDate : "")
label(for="day")=__("index.day")+":"
a#addOrder.btn-floating.btn-large.waves-effect.waves-light.blue: i.material-icons add
div#order-action div#orders
a#add-order +
a#remove-order.hide -
h3=__("index.payment") div.row
div.field.buttons h5=__("index.payment")
label(for="lyf_pay") LyfPay div.col.s12
input#lyf_pay(type="radio" name="payment" value="lyfPay" checked) p
label(for="credit_card")=__("index.creditCard") label
input#credit_card(type="radio" name="payment" value="creditCard") input(type="radio" name="payment" value="lyfPay" checked)
span LyfPay
p
label
input(type="radio" name="payment" value="creditCard")
span=__("index.creditCard")
div.field div.row.center
+submit(value=__("index.pay")) div.input-field.col.s12
+submit(__("index.pay"))
datalist#sandwich-list
each sandwich in sandwiches
option(value=sandwich.name)
script(src="/javascripts/index.js") script(src="/javascripts/index.js")

View file

@ -4,94 +4,50 @@ doctype html
html html
head head
title= title title= title
link(rel="stylesheet", href="/stylesheets/style.css") link(rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons")
link(rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css")
link(rel="stylesheet" href="/stylesheets/style.css")
meta(name="viewport" content="width=device-width, initial-scale=1.0")
body body
block content mixin nav
div#user
a(href="/")=__("layout.home")
if user if user
if user.permissions >= 1 if user.permissions >= 1
p - li: a(href="/sandwiches")=__("sandwiches")
a(href="/sandwiches")=__("sandwiches")
if user.permissions >= 2 if user.permissions >= 2
p - li: a(href="/orders")=__("orders")
a(href="/orders")=__("orders")
if user.permissions >= 3 if user.permissions >= 3
p - li: a(href="/admin")=__("admin.title")
a(href="/admin")=__("admin.title") li: a(href="/profile")=user.username
p | li: a(href="/logout")=__("layout.logout")
if user
a(href="/profile")=user.username
a(href="/logout")=__("layout.logout")
else else
a(href="/login")=__("layout.login") li: a(href="/login")=__("layout.login")
a(href="/register")=__("layout.register") li: a(href="/register")=__("layout.register")
nav.orange(role="navigation")
div.nav-wrapper.container
a.brand-logo(href="/") SOD
a.sidenav-trigger(href="#" data-target="mobile-nav"): i.material-icons menu
ul.right.hide-on-med-and-down
+nav
ul#mobile-nav.sidenav
+nav
main
block content
div#more
a=__("layout.about")
a=__("contact")
div#dark.hide
div#about.popup.card.hide
h1=__("layout.about")
p=__("layout.aboutDescription")
div.images
div
img(src="/images/logoBio.png")
p=__("layout.bio")
div
img(src="/images/logoChimie.png")
p=__("layout.chemistry")
div
img(src="/images/logoGC.png")
p=__("layout.GC")
div
img(src="/images/logoGCGP.png")
p=__("layout.GCPD")
div
img(src="/images/logoGEA.png")
p=__("layout.GEA")
div
img(src="/images/logoInfo.png")
p=__("layout.IT")
p.before-link=__("layout.made")
a(href="https://www.linkedin.com/in/florian-charlaix" target="_blank") Florian Charlaix
p.before-link=__("layout.powered")
a(href="https://sapinet.fr" target="_blank") Sapinet
div#contact.popup.card.hide
h1=__("contact")
form(action="/contact" method="POST")
div.cont
div.field
label(for="firstNameContact")="* "+__("firstName")
input#firstNameContact(type="text" name="firstName" value=user?user.firstName:"" required)
div.field
label(for="lastNameContact")="* "+__("lastName")
input#lastNameContact(type="text" name="lastName" value=user ? user.lastName : "" required)
div.cont
div.field
label(for="emailContact")="* "+__("email")
input#emailContact(type="email" name="email" value=user ? user.email : "" required)
div.field
label(for="phoneNumberContact")=__("layout.phoneNumber")
input#phoneNumberContact(type="tel" name="phoneNumber")
div.field
label(for="subjectContact")="* "+__("layout.subject")
+list("subjectContact", "subjectContactList", "subject", "", "off", true)
datalist#subjectContactList
option(value=__("layout.commandEdit"))
option(value=__("layout.commandRemove"))
option(value=__("layout.question"))
option(value=__("layout.profile"))
option(value=__("layout.other"))
p=__("layout.warnMessage")
div.field.message
label(for="messageContact")=__("layout.message")
textarea#messageContact(name="message" required)
div.field
+submit(value=__("send"))
script(src="/javascripts/layout.js")
if !test if !test
p !{captcha} p !{captcha}
footer.page-footer
div.container
div.row
div.col.l6.s12
h5.white-text=__("layout.links")
ul
li: a.grey-text.text-lighten-3(href="/about")=__("layout.about")
li: a.grey-text.text-lighten-3(href="/contact")=__("contact")
div.footer-copyright
div.container
a.grey-text.text-lighten-4(href="https://sapinet.fr" target="_blank")=__("layout.powered") + " Sapinet"
a.grey-text.text-lighten-4.right(href="https://www.linkedin.com/in/florian-charlaix" target="_blank")=__("layout.made") + " Florian Charlaix"
script(src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js")
script(src="/javascripts/layout.js")

View file

@ -1,18 +1,22 @@
extends layout extends layout
block content block content
div.card div.container
form(action="/login" method="POST") div.row
h1=__("login.title") form(action="/login" method="POST")
div.field h3=__("login.title")
label(for="username")=__("username")+":" div.row
input#username(type="text" name="username" required) div.input-field.col.s12
div.field input#username(type="text" name="username" required)
label(for="password")=__("password")+":" label(for="username")=__("username")+":"
input#password(type="password" name="password" required) div.row
div.field div.input-field.col.s12
+submit(value=__("login.submit")) input#password(type="password" name="password" required)
label(for="password")=__("password")+":"
div.row.center
div.input-field.col.s12
+submit(__("login.submit"))
div.field div.row.center
a(href="/forget") div.input-field.col.s12
input(type="button" value=__("forgetPassword")) a.btn.waves-effect.waves-light.red(href="/forget")=__("forgetPassword")

View file

@ -1,7 +1,4 @@
mixin submit(value) mixin submit(value)
div.recaptcha.recaptcha-cb div.recaptcha.recaptcha-cb
input(type="submit" value!=value) button.btn.waves-effect.waves-light(type="submit" name="action")=value
i.material-icons.right send
mixin list(id, list, name, value="", autocomplete="on", required=false)
span.list_arrow
input(id=id type="list" list=list name=name value=value autocomplete=autocomplete required=required)

View file

@ -1,14 +1,13 @@
extends layout extends layout
block content block content
div.card div.container.center
h1 Payment h1=__("payment.payment")
if (state === "success") if (state === "success")
h2=__("payment.successful") h4=__("payment.successful")
else if (state === "cancel") else if (state === "cancel")
h2=__("payment.canceled") h4=__("payment.canceled")
else if (state === "error") else if (state === "error")
h2=__("payment.error") h4=__("payment.error")
if (state !== "success") if (state !== "success")
a(href="/order/retry") a.waves-effect.waves-teal.btn(href="/order/retry")=__("payment.retry")
button=__("payment.retry")

View file

@ -1,25 +1,22 @@
extends layout extends layout
block content block content
div#date-selector.card div.container
label(for="date")=__("date") label(for="date")=__("date")
input#date(type="date" value=date) input#date(type="date" value=date)
div#orders.card div.container
h1=__("orders") h1=__("orders")
each user, department in orders each user, department in orders
div.department div.container
h2= department h4=department
each orders, name in user each orders, name in user
div.user each order, id in orders
h3= name ul.collection.with-header
each order, id in orders li.collection-header: h5 #{name} - #{__("order")} N°#{id}
div.order each sandwich in order
h4 #{__("order")} N°#{id} li.collection-item
each sandwich in order div=sandwich.name
div.sandwich a.secondary-content(href="/orders/give?id="+sandwich.SandwichOrder.id)
form.give(method="POST" action="/orders/give") i.material-icons check
input(type="hidden" name="id" value=sandwich.SandwichOrder.id)
input.give(type="submit" value="v")
h4= sandwich.name
script(src="/javascripts/orders.js") script(src="/javascripts/orders.js")

View file

@ -1,44 +1,51 @@
extends layout extends layout
block content block content
div.card div.container
h1=__("profile.title") div.row
form(action="/profile" method="POST") h4=__("profile.title")
h2=__("profile.infos") form(action="/profile" method="POST")
div.field h2=__("profile.infos")
label(for="username")=__("username")+":" div.row
input#username(type="text" name="username" value=user.username disabled required) div.input-field.col.s6
div.field input#username(type="text" name="username" value=user.username disabled required)
label(for="email")=__("email")+":" label(for="username")=__("username")+":"
input#email(type="email" name="email" value=user.email required) div.input-field.col.s6
div.field input#email(type="email" name="email" value=user.email required)
label(for="firstName")=__("firstName")+":" label(for="email")=__("email")+":"
input#firstName(type="text" name="firstName" value=user.firstName required) div.row
div.field div.input-field.col.s6
label(for="lastName")=__("lastName")+":" input#firstName(type="text" name="firstName" value=user.firstName required)
input#lastName(type="text" name="lastName" value=user.lastName required) label(for="firstName")=__("firstName")+":"
div.field div.input-field.col.s6
label(for="department")=__("department")+":" input#lastName(type="text" name="lastName" value=user.lastName required)
+list("department", "department-list", "department", user.DepartmentName, "off", true) label(for="lastName")=__("lastName")+":"
div.field div.row
label(for="password")=__("password")+":" div.input-field.col.s12
input#password(type="password" name="password") select(name="department" required)
div.field each department in departments
input(type="submit" value=__("save")) option(value=department.name selected=department.name===user.DepartmentName)=department.name
label=__("department")+":"
div.row
div.input-field.col.s12
label(for="password")=__("password")+":"
input#password(type="password" name="password")
div.row.center
div.input-field.col.s12
+submit(__("save"))
datalist#department-list if (!user.emailVerified)
each department in departments div.row.center
option(value=department.name) div.input-field.col.s12
a.btn.waves-effect.waves-light.yellow.darken-4(href="/profile/resend")=__("profile.emailCheck")
if (!user.emailVerified) div.container.valign-wrapper
div.field div.row.center
a(href="/profile/resend") h4=__("orders")
input(type="button" value=__("profile.emailCheck")) each order in orders
div.col
div.card#userOrderList div.card.blue-grey
h1=__("orders") div.card-content.white-text
each order in orders span.card-title=order.id
div each sandwich in order.Sandwiches
h2=order.id p #{sandwich.name} - #{sandwich.SandwichOrder.date}
each sandwich in order.Sandwiches
p #{sandwich.name} - #{sandwich.SandwichOrder.date}

View file

@ -1,29 +1,35 @@
extends layout extends layout
block content block content
form.card(action="/register" method="POST") div.container
h1=__("register.title") div.row
div.field form(action="/register" method="POST")
label(for="username")=__("username")+":" h3=__("register.title")
input#username(type="text" name="username" required) div.row
div.field div.input-field.col.s6
label(for="email")=__("email")+":" input#username(type="text" name="username" required)
input#email(type="email" name="email" required) label(for="username")=__("username")+":"
div.field div.input-field.col.s6
label(for="firstName")=__("firstName")+":" input#email(type="email" name="email" required)
input#firstName(type="text" name="firstName" required) label(for="email")=__("email")+":"
div.field div.row
label(for="lastName")=__("lastName")+":" div.input-field.col.s6
input#lastName(type="text" name="lastName" required) input#firstName(type="text" name="firstName" required)
div.field label(for="firstName")=__("firstName")+":"
label(for="department")=__("department")+":" div.input-field.col.s6
+list("department", "department-list", "department", "", "off", true) input#lastName(type="text" name="lastName" required)
div.field label(for="lastName")=__("lastName")+":"
label(for="password")=__("password")+":" div.row
input#password(type="password" name="password" required) div.input-field.col.s12
div.field select(name="department" required)
+submit(value=__("register.submit")) option(value="" disabled selected hidden)=__("chooseDepartment")
each department in departments
datalist#department-list option(value=department.name)=department.name
each department in departments label=__("department")+":"
option(value=department.name) div.row
div.input-field.col.s12
input#password(type="password" name="password" required)
label(for="password")=__("password")+":"
div.row.center
div.input-field.col.s12
+submit(__("register.submit"))

View file

@ -1,13 +1,15 @@
extends layout extends layout
block content block content
div#date-selector.card div.container
label(for="date")=__("date") label(for="date")=__("date")
input#date(type="date" value=date) input#date(type="date" value=date)
div.card div.container
h1=__("sandwiches") h1=__("sandwiches")
each sandwich in sandwiches ul.collection
div.sandwich each sandwich in sandwiches
h2 #{sandwich.name}: #{sandwich.dataValues.number} li.collection-item
div=sandwich.name
a.secondary-content=sandwich.dataValues.number
script(src="/javascripts/sandwiches.js") script(src="/javascripts/sandwiches.js")