diff --git a/locales/en.json b/locales/en.json index fd68cd6..a04f4af 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1,22 +1,32 @@ { - "layout": { - "home": "Home", - "sandwiches": "Sandwiches", - "commands": "Commands", - "administration": "Administration", - "logout": "Logout", - "login": "Login", - "register": "Register", - "about": "About", - "aboutDescription": "This software respond to the COVID-19 health crisis for the following students' offices food supply", - "bio": "Bio student office", - "chemistry": "Chemistry student office", - "GC": "Civil engineering student office", - "GCPD": "Chemical and process engineering student office", - "GEA": "Management of companies and administrations student office", - "IT": "IT student office", - "made": "Made with ❤️ by", - "contact": "Contact", - "orderIssue": "Order issue" - } + "layout": { + "home": "Home", + "sandwiches": "Sandwiches", + "commands": "Commands", + "administration": "Administration", + "logout": "Logout", + "login": "Login", + "register": "Register", + "about": "About", + "aboutDescription": "This software respond to the COVID-19 health crisis for the following students' offices food supply", + "bio": "Bio student office", + "chemistry": "Chemistry student office", + "GC": "Civil engineering student office", + "GCPD": "Chemical and process engineering student office", + "GEA": "Management of companies and administrations student office", + "IT": "IT student office", + "made": "Made with ❤️ by", + "contact": "Contact", + "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" + } } diff --git a/public/javascripts/index.js b/public/javascripts/index.js index 4d73b50..fcc8f2a 100644 --- a/public/javascripts/index.js +++ b/public/javascripts/index.js @@ -1,5 +1,10 @@ const commandAction = document.getElementById("command-action"); 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() { let list = document.querySelectorAll("div.command h2"); @@ -9,14 +14,14 @@ function lastCommandId() { document.getElementById("add-command").addEventListener("click", () => { let id = lastCommandId() + 1; commandAction.insertAdjacentHTML("beforebegin", `
-

Command ${id}

+

${locals.command} ${id}

- - + +
- - + +
`); document.getElementById("command"+lastCommandId()).scrollIntoView({behavior: "smooth"}); diff --git a/views/index.pug b/views/index.pug index 7735242..1202921 100644 --- a/views/index.pug +++ b/views/index.pug @@ -3,37 +3,37 @@ extends layout block content div.card h1= title - p Welcome to Sandwiches Order Doua + p=__("index.welcome") form#command(action="/command" method="POST") 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) datalist#department-list each department in departments option(value=department.name) div.field - label(for="firstname") First name: + label(for="firstname")=__("index.firstName")+":" input#firstname(type="text" name="firstName" value=user ? user.firstName : "" required) div.field - label(for="lastname") Last name: + label(for="lastname")=__("index.lastName")+":" input#lastname(type="text" name="lastName" value=user ? user.lastName : "" required) div#command1.command - h2 Command 1 + h2=__("index.command")+" 1" div.field - label(for="sandwich") Sandwich: - input#sandwich(type="list" list="sandwich-list" name="sandwich1" autocomplete="off" required) + label(for="sandwich1")=__("index.sandwich")+":" + input#sandwich1(type="list" list="sandwich-list" name="sandwich1" autocomplete="off" required) div.field - label(for="day") Day: - input#day(type="date" name="date1" required) + label(for="day1")=__("index.day")+":" + input#day1(type="date" name="date1" required) div#command-action a#add-command + a#remove-command.hide - div.field - input#send(type="submit" value="Pay") + input#send(type="submit" value=__("index.pay")) datalist#sandwich-list each sandwich in sandwiches