Archived
1
0
Fork 0

Add locales to index

This commit is contained in:
Ethanell 2020-08-18 16:48:09 +02:00
parent a9f2b6c7a8
commit 13f2d6558f
3 changed files with 50 additions and 35 deletions

View file

@ -1,22 +1,32 @@
{ {
"layout": { "layout": {
"home": "Home", "home": "Home",
"sandwiches": "Sandwiches", "sandwiches": "Sandwiches",
"commands": "Commands", "commands": "Commands",
"administration": "Administration", "administration": "Administration",
"logout": "Logout", "logout": "Logout",
"login": "Login", "login": "Login",
"register": "Register", "register": "Register",
"about": "About", "about": "About",
"aboutDescription": "This software respond to the COVID-19 health crisis for the following students' offices food supply", "aboutDescription": "This software respond to the COVID-19 health crisis for the following students' offices food supply",
"bio": "Bio student office", "bio": "Bio student office",
"chemistry": "Chemistry student office", "chemistry": "Chemistry student office",
"GC": "Civil engineering student office", "GC": "Civil engineering student office",
"GCPD": "Chemical and process engineering student office", "GCPD": "Chemical and process engineering student office",
"GEA": "Management of companies and administrations student office", "GEA": "Management of companies and administrations student office",
"IT": "IT student office", "IT": "IT student office",
"made": "Made with ❤️ by", "made": "Made with ❤️ by",
"contact": "Contact", "contact": "Contact",
"orderIssue": "Order issue" "orderIssue": "Order issue"
} },
"index": {
"welcome": "Welcome to Sandwiches Order Doua",
"department": "Department",
"firstName": "First name",
"lastName": "Last name",
"command": "Command",
"sandwich": "Sandwich",
"day": "Day",
"pay": "Pay"
}
} }

View file

@ -1,5 +1,10 @@
const commandAction = document.getElementById("command-action"); const commandAction = document.getElementById("command-action");
const rmButton = document.getElementById("remove-command"); const rmButton = document.getElementById("remove-command");
const locals = {
command: document.querySelector("#command1>h2").innerHTML.replace(" 1", ""),
sandwich: document.querySelector("label[for='sandwich1']").innerHTML,
day: document.querySelector("label[for='day1']").innerHTML
};
function lastCommandId() { function lastCommandId() {
let list = document.querySelectorAll("div.command h2"); let list = document.querySelectorAll("div.command h2");
@ -9,14 +14,14 @@ function lastCommandId() {
document.getElementById("add-command").addEventListener("click", () => { document.getElementById("add-command").addEventListener("click", () => {
let id = lastCommandId() + 1; let id = lastCommandId() + 1;
commandAction.insertAdjacentHTML("beforebegin", `<div id="command${id}" class="command"> commandAction.insertAdjacentHTML("beforebegin", `<div id="command${id}" class="command">
<h2>Command ${id}</h2> <h2>${locals.command} ${id}</h2>
<div class="field"> <div class="field">
<label for="sandwich">Sandwich:</label> <label for="sandwich${id}">${locals.sandwich}</label>
<input id="sandwich" type="list" list="sandwich-list" name="sandwich${id}" autocomplete="off" required> <input id="sandwich${id}" type="list" list="sandwich-list" name="sandwich${id}" autocomplete="off" required>
</div> </div>
<div class="field"> <div class="field">
<label for="day">Day:</label> <label for="day${id}">${locals.day}</label>
<input id="day" type="date" name="date${id}" required> <input id="da${id}y" type="date" name="date${id}" required>
</div> </div>
</div>`); </div>`);
document.getElementById("command"+lastCommandId()).scrollIntoView({behavior: "smooth"}); document.getElementById("command"+lastCommandId()).scrollIntoView({behavior: "smooth"});

View file

@ -3,37 +3,37 @@ extends layout
block content block content
div.card div.card
h1= title h1= title
p Welcome to Sandwiches Order Doua p=__("index.welcome")
form#command(action="/command" method="POST") form#command(action="/command" method="POST")
div.field div.field
label(for="department") Department: label(for="department")=__("index.department")+":"
input#department(type="list" list="department-list" name="department" value=user ? user.DepartmentName : "" autocomplete="off" required) input#department(type="list" list="department-list" name="department" value=user ? user.DepartmentName : "" autocomplete="off" required)
datalist#department-list datalist#department-list
each department in departments each department in departments
option(value=department.name) option(value=department.name)
div.field div.field
label(for="firstname") First name: label(for="firstname")=__("index.firstName")+":"
input#firstname(type="text" name="firstName" value=user ? user.firstName : "" required) input#firstname(type="text" name="firstName" value=user ? user.firstName : "" required)
div.field div.field
label(for="lastname") Last name: label(for="lastname")=__("index.lastName")+":"
input#lastname(type="text" name="lastName" value=user ? user.lastName : "" required) input#lastname(type="text" name="lastName" value=user ? user.lastName : "" required)
div#command1.command div#command1.command
h2 Command 1 h2=__("index.command")+" 1"
div.field div.field
label(for="sandwich") Sandwich: label(for="sandwich1")=__("index.sandwich")+":"
input#sandwich(type="list" list="sandwich-list" name="sandwich1" autocomplete="off" required) input#sandwich1(type="list" list="sandwich-list" name="sandwich1" autocomplete="off" required)
div.field div.field
label(for="day") Day: label(for="day1")=__("index.day")+":"
input#day(type="date" name="date1" required) input#day1(type="date" name="date1" required)
div#command-action div#command-action
a#add-command + a#add-command +
a#remove-command.hide - a#remove-command.hide -
div.field div.field
input#send(type="submit" value="Pay") input#send(type="submit" value=__("index.pay"))
datalist#sandwich-list datalist#sandwich-list
each sandwich in sandwiches each sandwich in sandwiches