MangoShelf/Templates/index.ejs

140 lines
6.5 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello world!</title>
<!-- Links -->
<link href="style.css" rel="stylesheet" type="text/css">
<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>
<body>
<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 disabled" aria-current="page" href="/dashboard">Dashboard</a>
<a class="nav-link active" href="/stock">Stock</a>
<a class="nav-link disabled" href="/parts">Parts</a>
<a class="nav-link disabled" href="/assets">Assets</a>
<a class="nav-link disabled" href="/orders">Ordes</a>
<a class="nav-link disabled" href="/admin">Admin</a>
<a class="nav-link disabled"> Logged in as: Demo</a>
</div>
</div>
</div>
</nav>
<div class="container-fluid">
<% if(site == 21) { %>
<h1>New item in stock</h1>
<br>
<form action="/api/live/inventory/add" method="post">
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" name="name">
<div id="nameHelp" class="form-text">Name for the item.</div>
</div>
<div class="mb-3">
<label for="desc" class="form-label">Description</label>
<input type="text" class="form-control" id="desc" name="desc">
<div id="descHelp" class="form-text">Description for the item.</div>
</div>
<div class="mb-3">
<label for="status" class="form-label">Status</label>
<select id="status" class="form-select" name="status">
<option value="0">No more left (0)</option>
<option value="1">Waiting for order (1)</option>
<option value="2">Damaged (2)</option>
<option value="3">OK (3)</option>
</select>
</div>
<div class="mb-3">
<label for="category" class="form-label">Category</label>
<select id="category" class="form-select" name="category">
<option value="0">No category (0)</option>
<option value="1">Furniture (1)</option>
<option value="2">Digital only (2)</option>
<option value="3">Electronics (3)</option>
<option value="4">Gaming equipment (4)</option>
<option value="5">Audio equipment (5)</option>
<option value="6">???? (6)</option>
</select>
</div>
<div class="mb-3">
<label for="amount" class="form-label">Amount</label>
<input type="text" class="form-control" id="amount" name="amount">
<div id="amountHelp" class="form-text">Amount of this item.</div>
</div>
<div class="mb-3">
<label for="location" class="form-label">Location</label>
<select id="location" class="form-select" name="location">
<option value="0">Home (0)</option>
<option value="1">Office in the middle of nowhere (1)</option>
</select>
</div>
<div class="mb-3">
<label for="orderid" class="form-label">Order ID</label>
<input type="text" class="form-control" id="orderid" name="orderid">
<div id="orderidHelp" class="form-text">Amount of this item.</div>
</div>
<div class="mb-3">
<label for="notes" class="form-label">Notes</label>
<input type="text" class="form-control" id="notes" name="notes">
<div id="noteHelp" class="form-text">Write a note for the item.</div>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<% } %>
<% if(site == 2) { %>
<h1>Inventory</h1>
<br>
<button type="button" class="btn btn-primary" onclick='location.href="/stock/new"'>New Item</button>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Description</th>
<th scope="col">Status</th>
<th scope="col">Category</th>
<th scope="col">Amount</th>
<th scope="col">Location</th>
<th scope="col">Expiry date</th>
<th scope="col">Last updated</th>
<th scope="col">Order id</th>
<th scope="col">Notes</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
<% for (let i = 0; i < results.length; i++) { %>
<tr>
<th scope="row"><%= i + 1 %></th>
<td><%= results[i].name %></td>
<td><%= results[i].description %></td>
<td><%= results[i].status %></td>
<td><%= results[i].category %></td>
<td><%= results[i].amount %></td>
<td><%= results[i].location %></td>
<td><%= results[i].expiry %></td>
<td><%= results[i].lastupdate %></td>
<td><%= results[i].orderid %></td>
<td><%= results[i].notes %></td>
<td> <button type="button" class="btn btn-danger" onclick='location.href="/api/live/inventory/delete/<%= results[i].id %>"'>Delete</button></td>
</tr>
<% } %>
</tbody>
</table>
<% } %>
</div>
<script src="script.js"></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>
</html>