diff --git a/routes/index.js b/routes/index.js index 7ee17af..0918aad 100644 --- a/routes/index.js +++ b/routes/index.js @@ -231,6 +231,25 @@ router.get("/payment", (_req, res) => { res.redirect("/"); }); +router.get("/transaction", (req, res) => { + auth.session_converter(req.cookies.session_token).then((key) => { + if (key != null) { + controller.transaction(key).then((data) => { + if (data[0] == 200) { + res.render("pages/transaction", { + data: data[1], + loggedIn: 'true' + }); + } else { + res.redirect("/"); + } + }); + } else { + res.redirect("/login"); + } + }); +}); + router.get("/about-us", (req, res) => { auth.session_converter(req.cookies.session_token).then((key) => { if (key != null) { diff --git a/views/pages/transaction.ejs b/views/pages/transaction.ejs new file mode 100644 index 0000000..bacae13 --- /dev/null +++ b/views/pages/transaction.ejs @@ -0,0 +1,36 @@ + + +<%- include('../layouts/header.ejs', {title: 'Transaction List', state: 'transaction'}); %> + + + + <%- include('../layouts/navbar.ejs', {types: 'v1', state: 'transaction'}); %> + +
+ + + + + + + + + + + <% for(let i=0; i < data.length; i++) { %> + + + + + + + <% } %> + +
Order IDNameLogisticStatus
<%= data[i].id %><%= data[i].firstName + ' ' + data[i].lastName %><%= data[i].logistic %><%= data[i].status %>
+
+ + <%- include('../layouts/footer.ejs', {state: 'transaction'}); %> + + + + \ No newline at end of file