diff --git a/src/frontend/itemInfo.eta.html b/src/frontend/itemInfo.eta.html
new file mode 100644
index 0000000..a600ecc
--- /dev/null
+++ b/src/frontend/itemInfo.eta.html
@@ -0,0 +1,22 @@
+<%~ E.includeFile("partials/head.eta.html", {"title": "Item Info"}) %> <%~ E.includeFile("partials/controls.eta.html", {"active": "ItemInfo"}) %> <%~ E.includeFile("./partials/deleteModal.eta.html") %>
+
+
+
<%= it.name %>
+
+
Comment: <%= it.comment %>
+
Category: <%= it.category.name %>
+
Amount: <%= it.amount %>
+
SKU: <%= it.SKU %>
+
Status: <% if(it.status == "normal") { %>
+
+<%= it.status %>
+ <% } else if(it.status == "stolen") { %>
+ <%= it.status %>
+ <% } else if(it.status == "lost") { %>
+ <%= it.status %>
+ <% } else if(it.status == "borrowed") { %>
+ <%= it.status %>
+ <% } %>
+
+
+<%~ E.includeFile("partials/controlsFoot.eta.html") %> <%~ E.includeFile("partials/foot.eta.html") %>
diff --git a/src/routes/frontend/index.ts b/src/routes/frontend/index.ts
index fef2f6c..45f12b1 100644
--- a/src/routes/frontend/index.ts
+++ b/src/routes/frontend/index.ts
@@ -2,6 +2,7 @@ import express from 'express';
// Route imports
import skuRoute from './:id.js';
+import skuRouteDash from './itemInfo.js'
import testRoute from './test.js';
import dashboardRoute from './dashboard.js';
import itemsRoute from './items.js';
@@ -14,6 +15,7 @@ Router.route('/test').get(testRoute.get);
Router.route('/items').get(itemsRoute.get);
Router.route('/:id(\\w{8})').get(skuRoute.get);
+Router.route('/s/:id').get(skuRouteDash.get);
Router.use('/manage', manage_routes);
diff --git a/src/routes/frontend/itemInfo.ts b/src/routes/frontend/itemInfo.ts
new file mode 100644
index 0000000..1b257e5
--- /dev/null
+++ b/src/routes/frontend/itemInfo.ts
@@ -0,0 +1,37 @@
+import { Request, Response } from 'express';
+import { prisma, __path } from '../../index.js';
+import * as Eta from 'eta';
+
+function get(req: Request, res: Response) {
+ // Get data from database using sku from url.
+ prisma.item
+ .findFirst({
+ where: {
+ SKU: req.params.id
+ },
+ select: {
+ SKU: true,
+ name: true,
+ comment: true,
+ amount: true,
+ status: true,
+ // Get category name from relation.
+ category: {
+ select: {
+ name: true
+ }
+ }
+ }
+ })
+ .then((item) => {
+ if (item) {
+ Eta.renderFile(__path + '/src/frontend/itemInfo.eta.html', item).then((html) => {
+ res.send(html);
+ });
+ } else {
+ res.send('Item not found');
+ }
+ });
+}
+
+export default { get };
diff --git a/static/js/searchBox.js b/static/js/searchBox.js
index 1b2f26d..635fca1 100644
--- a/static/js/searchBox.js
+++ b/static/js/searchBox.js
@@ -72,7 +72,7 @@ function handleSearchChange(e) {
let htmlResult = ""
result.forEach(element => {
console.log(element);
- htmlResult += `${element.name}
`
+ htmlResult += `${element.name}
`
});
autocompleteBox.innerHTML = htmlResult;