current state
This commit is contained in:
		@@ -1,5 +1,23 @@
 | 
			
		||||
<%~ E.includeFile("../partials/head.eta.html", {"title": "Settings - Category"}) %> <%~ E.includeFile("../partials/controls.eta.html", {"active": "SETT_CAT"}) %>
 | 
			
		||||
 | 
			
		||||
<!-- Modal -->
 | 
			
		||||
<!-- Modal -->
 | 
			
		||||
<div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
 | 
			
		||||
	<div class="modal-dialog">
 | 
			
		||||
		<div class="modal-content">
 | 
			
		||||
			<div class="modal-header">
 | 
			
		||||
				<h1 class="modal-title fs-5" id="staticBackdropLabel">Do you really want to delete <strong id="deleteNamePlaceholder">Placeholder</strong>?</h1>
 | 
			
		||||
				<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="modal-body">This will permanently delete the category and all its associated data.<br />Items will be kept but will be unassigned from this category.</div>
 | 
			
		||||
			<div class="modal-footer">
 | 
			
		||||
				<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancle</button>
 | 
			
		||||
				<button type="button" class="btn btn-danger" id="deleteActionBtn"><i class="bi bi-trash"></i> Yes, delete.</button>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<h1>Categories</h1>
 | 
			
		||||
<div class="container">
 | 
			
		||||
	<!-- Create new category button -->
 | 
			
		||||
@@ -17,8 +35,8 @@
 | 
			
		||||
					<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">
 | 
			
		||||
				<form class="frontendForm" method="post" data-target="/api/v1/categories">
 | 
			
		||||
					<div class="modal-body">
 | 
			
		||||
						<div class="mb-3">
 | 
			
		||||
							<label for="createNewCategoryModalName" class="form-label">Name</label>
 | 
			
		||||
							<input type="text" class="form-control" id="createNewCategoryModalName" name="name" required />
 | 
			
		||||
@@ -29,13 +47,20 @@
 | 
			
		||||
							<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 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>
 | 
			
		||||
					<!-- loader overlay -->
 | 
			
		||||
					<div class="loader-overlay">
 | 
			
		||||
						<div class="loader">
 | 
			
		||||
							<div class="spinner-border text-primary" role="status">
 | 
			
		||||
								<span class="visually-hidden">Loading...</span>
 | 
			
		||||
							</div>
 | 
			
		||||
						</div>
 | 
			
		||||
					</div>
 | 
			
		||||
				</form>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
@@ -47,8 +72,8 @@
 | 
			
		||||
					<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">
 | 
			
		||||
				<form class="frontendForm" method="patch" data-target="/api/v1/categories">
 | 
			
		||||
					<div class="modal-body">
 | 
			
		||||
						<div class="mb-3">
 | 
			
		||||
							<label for="editCategoryModalName" class="form-label">Name</label>
 | 
			
		||||
							<input type="text" class="form-control" id="editCategoryModalName" name="name" required />
 | 
			
		||||
@@ -59,25 +84,22 @@
 | 
			
		||||
							<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>
 | 
			
		||||
						<input type="text" id="editCategoryModalId" name="id" 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>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	<!-- Table with all categories -->
 | 
			
		||||
	<table class="table">
 | 
			
		||||
		<thead>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<th scope="col">#</th>
 | 
			
		||||
				<!-- <th scope="col">#</th> -->
 | 
			
		||||
				<th scope="col">Name</th>
 | 
			
		||||
				<th scope="col">Description</th>
 | 
			
		||||
				<th scope="col">Action</th>
 | 
			
		||||
@@ -86,10 +108,12 @@
 | 
			
		||||
		<tbody>
 | 
			
		||||
			<% it.items.forEach(function(user){ %>
 | 
			
		||||
			<tr id="listEntry-<%= user.id %>">
 | 
			
		||||
				<th scope="row"><%= user.id %></th>
 | 
			
		||||
				<td><%= user.name %></td>
 | 
			
		||||
				<td scope="row" data-bs-toggle="tooltip" data-bs-placement="left" data-bs-title="ID: <%= user.id %>"><%= user.name %></td>
 | 
			
		||||
				<td><%= user.description %></td>
 | 
			
		||||
				<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>
 | 
			
		||||
				<td>
 | 
			
		||||
					<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#editCategoryModal" onclick="getDataForEdit('<%= user.name %>')"><i class="bi bi-pencil"></i></button>
 | 
			
		||||
					<button class="btn btn-danger" onclick="preFillDeleteModal('<%= user.name %>')" data-bs-toggle="modal" data-bs-target="#staticBackdrop"><i class="bi bi-trash"></i></button>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<% }) %>
 | 
			
		||||
		</tbody>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								src/frontend/manage/imports/jsonImport.eta.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/frontend/manage/imports/jsonImport.eta.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
<%~ E.includeFile("../../partials/head.eta.html", {"title": "Importer - JSON" }) %> <%~ E.includeFile("../../partials/controls.eta.html", {"active": "SETT_IMPORT_JSON" }) %>
 | 
			
		||||
 | 
			
		||||
<h1>JSON Import</h1>
 | 
			
		||||
Upload a JSON file to import into the database. The JSON file must have the following columns:
 | 
			
		||||
<ul>
 | 
			
		||||
	<li>name</li>
 | 
			
		||||
	<li>amount</li>
 | 
			
		||||
	<li>manufacturer</li>
 | 
			
		||||
	<li>category</li>
 | 
			
		||||
</ul>
 | 
			
		||||
The following columns are optional:
 | 
			
		||||
<ul>
 | 
			
		||||
	<li>sku</li>
 | 
			
		||||
	<li>comment</li>
 | 
			
		||||
	<li>StorageLocation (import currently not supported)</li>
 | 
			
		||||
</ul>
 | 
			
		||||
It should be formated as a list of objects, like this:
 | 
			
		||||
<pre>
 | 
			
		||||
[
 | 
			
		||||
	{
 | 
			
		||||
		"name": "Item 1",
 | 
			
		||||
		"amount": 1,
 | 
			
		||||
		"manufacturer": "Manufacturer 1",
 | 
			
		||||
		"category": "Category 1",
 | 
			
		||||
		"sku": "SKU 1",
 | 
			
		||||
		"comment": "Comment 1"
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		"name": "Item 2",
 | 
			
		||||
		"amount": 2,
 | 
			
		||||
		"manufacturer": "Manufacturer 2",
 | 
			
		||||
		"category": "Category 2",
 | 
			
		||||
		"sku": "SKU 2",
 | 
			
		||||
		"comment": "Comment 2"
 | 
			
		||||
	}
 | 
			
		||||
]
 | 
			
		||||
</pre>
 | 
			
		||||
<form method="post" enctype="multipart/form-data">
 | 
			
		||||
	<label for="formFile" class="form-label">JSON Inventory File Upload</label>
 | 
			
		||||
	<input class="form-control" type="file" id="formFile" name="formFile" /><br />
 | 
			
		||||
 | 
			
		||||
	<input type="submit" value="Run import" class="btn btn-primary" />
 | 
			
		||||
</form>
 | 
			
		||||
 | 
			
		||||
<%~ E.includeFile("../../partials/controlsFoot.eta.html") %> <%~ E.includeFile("../../partials/foot.eta.html") %>
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<%~ E.includeFile("../partials/head.eta.html", {"title": "Settings"}) %> <%~ E.includeFile("../partials/controls.eta.html", {"active": "SETT"}) %>
 | 
			
		||||
 | 
			
		||||
<h1>Manage your AssetFlow instance</h1>
 | 
			
		||||
 | 
			
		||||
<div class="alert alert-success" role="alert">A new version is available. <a href="#" class="alert-link">Click here to update</a></div>
 | 
			
		||||
<div class="container text-center">
 | 
			
		||||
	<div class="row">
 | 
			
		||||
		<a class="card col m-2" href="/manage/categories">
 | 
			
		||||
@@ -15,12 +15,19 @@
 | 
			
		||||
				<h1 class="card-title"><i class="bi bi-box-seam"></i></h1>
 | 
			
		||||
				<p class="card-text">Manage storages</p>
 | 
			
		||||
			</div>
 | 
			
		||||
		</a><a class="card col m-2" href="/manage/import/csv">
 | 
			
		||||
		</a>
 | 
			
		||||
		<a class="card col m-2" href="/manage/import/csv">
 | 
			
		||||
			<div class="card-body">
 | 
			
		||||
				<h1 class="card-title"><i class="bi bi-filetype-csv"></i></h1>
 | 
			
		||||
				<p class="card-text">Import data via CSV</p>
 | 
			
		||||
			</div>
 | 
			
		||||
		</a>
 | 
			
		||||
		<a class="card col m-2" href="/manage/import/json">
 | 
			
		||||
			<div class="card-body">
 | 
			
		||||
				<h1 class="card-title"><i class="bi bi-filetype-json"></i></h1>
 | 
			
		||||
				<p class="card-text">Import data via JSON</p>
 | 
			
		||||
			</div>
 | 
			
		||||
		</a>
 | 
			
		||||
	</div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user