bing
parent
7b7d2bb2ae
commit
8f88bdbc4c
|
@ -3,6 +3,10 @@ const express = require('express');
|
||||||
const app = express();
|
const app = express();
|
||||||
const server = require('http').createServer(app);
|
const server = require('http').createServer(app);
|
||||||
const port = process.env.PORT || 3430;
|
const port = process.env.PORT || 3430;
|
||||||
|
const test = require('../testdatabase.json');
|
||||||
|
|
||||||
|
var site;
|
||||||
|
// TODO: Add stuff for MySQL
|
||||||
|
|
||||||
// Set the templates folder for the thingy
|
// Set the templates folder for the thingy
|
||||||
app.set('views', __dirname + '/../Templates');
|
app.set('views', __dirname + '/../Templates');
|
||||||
|
@ -13,7 +17,17 @@ app.use(express.static(__dirname + '/../Public'));
|
||||||
|
|
||||||
// Main page
|
// Main page
|
||||||
app.get('/', function(req, res){
|
app.get('/', function(req, res){
|
||||||
res.render('index');
|
console.log('🌐 Client requested ' + req.url);
|
||||||
|
res.render('index', { test, site: 1 });
|
||||||
|
console.log('✅ Client recieved ' + req.url);
|
||||||
|
// console.log(test.cars.Nissan[1].model)
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/inventory', function(req, res){
|
||||||
|
console.log('🌐 Client requested ' + req.url);
|
||||||
|
res.render('index', { test, site: 2 });
|
||||||
|
console.log('✅ Client recieved ' + req.url);
|
||||||
|
// console.log(test.cars.Nissan[1].model)
|
||||||
});
|
});
|
||||||
|
|
||||||
// Simple way to expose a function
|
// Simple way to expose a function
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
body {
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.mbNavTop {
|
||||||
|
background-color: var(--colour-navbar);
|
||||||
|
overflow: hidden;
|
||||||
|
height: 65;
|
||||||
|
padding: 0 .5rem;
|
||||||
|
width:100vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Logo {
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mbNavTop a {
|
||||||
|
float:left;
|
||||||
|
color:antiquewhite;
|
||||||
|
text-align: center;
|
||||||
|
padding: 14px 16px;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 17px;
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
console.log('✅ Done')
|
|
@ -1,3 +1,3 @@
|
||||||
#cssloaded {
|
:root {
|
||||||
color:deepskyblue;
|
--colour-navbar: #303030;
|
||||||
}
|
}
|
|
@ -11,7 +11,51 @@
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1 id="cssloaded">Hello world!</h1>
|
<nav class="navbar navbar-expand-lg bg-light">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand" href="#">MangoShelf early demo</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
|
||||||
|
<div class="navbar-nav">
|
||||||
|
<a class="nav-link active" aria-current="page" href="/">Dashboard</a>
|
||||||
|
<a class="nav-link" href="/inventory">Inventory</a>
|
||||||
|
<a class="nav-link" href="#"><%= site %></a>
|
||||||
|
<a class="nav-link disabled"><%= test.mangoshelf.Items[1].Location %></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<% if(site == 2) { %>
|
||||||
|
<h1>Inventory</h1>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">#</th>
|
||||||
|
<th scope="col">Name</th>
|
||||||
|
<th scope="col">Location</th>
|
||||||
|
<th scope="col">Amount</th>
|
||||||
|
<th scope="col">Tools</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% for (let i = 0; i < test.mangoshelf.Items.length; i++) { %>
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><%= i + 1 %></th>
|
||||||
|
<td><%= test.mangoshelf.Items[i].Name %></td>
|
||||||
|
<td><%= test.mangoshelf.Items[i].Location %></td>
|
||||||
|
<td><%= test.mangoshelf.Items[i].Amount %></td>
|
||||||
|
<td><button type="button" class="btn btn-warning">Edit</button> <button type="button" class="btn btn-danger">Delete</button></td>
|
||||||
|
</tr>
|
||||||
|
<% } %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% } %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -0,0 +1,101 @@
|
||||||
|
{
|
||||||
|
"mangoshelf": {
|
||||||
|
"Items": [
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Sentra", "Location":"3B","Amount":4},
|
||||||
|
{"Name":"Maxima", "Location":"1B","Amount":4},
|
||||||
|
{"Name":"Skyline", "Location":"3A", "Amount":2}
|
||||||
|
],
|
||||||
|
"Ford": [
|
||||||
|
{"model":"Taurus", "doors":4},
|
||||||
|
{"model":"Escort", "doors":4}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue