2023-05-10 23:05:55 +02:00
|
|
|
<%~ E.includeFile("../partials/head.eta.html", {"title": "Settings - Category"}) %> <%~ E.includeFile("../partials/controls.eta.html", {"active": "SETT_CAT"}) %>
|
2023-05-08 20:05:07 +02:00
|
|
|
|
|
|
|
<h1>All categories</h1>
|
|
|
|
<div class="container">
|
|
|
|
<!-- Create new category button -->
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-12">
|
2023-05-08 23:30:19 +02:00
|
|
|
<a href="/settings/category/new" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#createNewCategoryModal">Create new category</a>
|
|
|
|
</div>
|
2023-05-08 20:05:07 +02:00
|
|
|
</div>
|
2023-05-08 23:30:19 +02:00
|
|
|
|
|
|
|
<!-- Modal -->
|
|
|
|
<div class="modal fade" id="createNewCategoryModal" tabindex="-1" aria-labelledby="createNewCategoryModal" aria-hidden="true">
|
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<h1 class="modal-title fs-5" id="createNewCategoryModalLabel">Create a new category</h1>
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<form method="post">
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="createNewCategoryModalName" class="form-label">Name</label>
|
|
|
|
<input type="text" class="form-control" id="createNewCategoryModalName" name="name" required />
|
|
|
|
<div id="createNewCategoryModalNameText" class="form-text">This name should be unqiue.</div>
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="createNewCategoryModalDescription" class="form-label">Description</label>
|
|
|
|
<input type="text" class="form-control" id="createNewCategoryModalDescription" name="description" />
|
|
|
|
<div id="createNewCategoryModalDescText" class="form-text">Optional</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
|
|
|
<button type="submit" class="btn btn-primary">Save changes</button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2023-05-10 21:28:11 +02:00
|
|
|
<div class="modal fade" id="editCategoryModal" tabindex="-1" aria-labelledby="editCategoryModal" aria-hidden="true">
|
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<h1 class="modal-title fs-5" id="editCategoryModalLabel">Edit a category</h1>
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<form method="post">
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="editCategoryModalName" class="form-label">Name</label>
|
|
|
|
<input type="text" class="form-control" id="editCategoryModalName" name="name" required />
|
|
|
|
<div id="editCategoryModalNameText" class="form-text">This name should be unqiue.</div>
|
|
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
|
|
<label for="editCategoryModalDescription" class="form-label">Description</label>
|
|
|
|
<input type="text" class="form-control" id="editCategoryModalDescription" name="description" />
|
|
|
|
<div id="editCategoryModalDescText" class="form-text">Optional</div>
|
|
|
|
</div>
|
|
|
|
<input type="text" id="editCategoryModalIsEdit" name="editCategoryModalIsEdit" hidden value="isEdit"/>
|
|
|
|
<input type="text" id="editCategoryModalId" name="editCategoryModalId" hidden/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
|
|
|
<button type="submit" class="btn btn-primary">Save changes</button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2023-05-08 20:05:07 +02:00
|
|
|
<!-- Table with all categories -->
|
|
|
|
<table class="table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th scope="col">#</th>
|
|
|
|
<th scope="col">Name</th>
|
|
|
|
<th scope="col">Description</th>
|
2023-05-10 21:28:11 +02:00
|
|
|
<th scope="col">Action</th>
|
2023-05-08 20:05:07 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<% it.items.forEach(function(user){ %>
|
2023-05-10 21:28:11 +02:00
|
|
|
<tr id="listEntry-<%= user.id %>">
|
2023-05-08 20:05:07 +02:00
|
|
|
<th scope="row"><%= user.id %></th>
|
|
|
|
<td><%= user.name %></td>
|
2023-05-08 23:30:19 +02:00
|
|
|
<td><%= user.description %></td>
|
2023-05-10 21:28:11 +02:00
|
|
|
<td><button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#editCategoryModal" onclick="selectDataForEdit('<%= user.id %>')"><i class="bi bi-pencil"></i></button></td>
|
2023-05-08 23:30:19 +02:00
|
|
|
</tr>
|
2023-05-08 20:05:07 +02:00
|
|
|
<% }) %>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2023-05-10 21:28:11 +02:00
|
|
|
<script src="/js/editCategory.js"></script>
|
2023-05-08 20:05:07 +02:00
|
|
|
|
2023-05-10 23:05:55 +02:00
|
|
|
<%~ E.includeFile("../partials/controlsFoot.eta.html") %> <%~ E.includeFile("../partials/foot.eta.html") %>
|