73 lines
3.2 KiB
Plaintext
73 lines
3.2 KiB
Plaintext
<div class="page-header mb-4">
|
|
|
|
<h1>
|
|
|
|
📦 Producten
|
|
|
|
</h1>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-8">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<% if (products.length === 0) { %>
|
|
<p class="text-secondary">Nog geen producten.</p>
|
|
<% } else { %>
|
|
<div class="list-group">
|
|
<% products.forEach(product => { %>
|
|
<div class="list-group-item">
|
|
<div class="d-flex align-items-start justify-content-between gap-3">
|
|
<div>
|
|
<strong><%= product.category_icon || "" %> <%= product.name %></strong>
|
|
<div class="text-secondary"><%= product.category_name || "Geen categorie" %></div>
|
|
</div>
|
|
<a class="btn btn-sm btn-outline-primary" href="/products/<%= product.id %>/edit">
|
|
Wijzigen
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<% }); %>
|
|
</div>
|
|
<% } %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<div class="card">
|
|
<div class="card-header"><h3 class="card-title">Nieuw product</h3></div>
|
|
<div class="card-body">
|
|
<form method="post" action="/products">
|
|
<label class="form-label" for="product-name">Productnaam</label>
|
|
<input id="product-name" class="form-control mb-3" type="text" name="name"
|
|
placeholder="bijv. Melk" maxlength="120" required>
|
|
|
|
<label class="form-label" for="category-id">Categorie</label>
|
|
<select id="category-id" class="form-select mb-3" name="category_id">
|
|
<option value="">Geen categorie</option>
|
|
<% (categories || []).forEach(category => { %>
|
|
<option value="<%= category.id %>"><%= category.icon || "" %> <%= category.name %></option>
|
|
<% }); %>
|
|
</select>
|
|
|
|
<button class="btn btn-primary w-100" type="submit">Product toevoegen</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card mt-3">
|
|
<div class="card-header"><h3 class="card-title">Producten in bulk laden</h3></div>
|
|
<div class="card-body">
|
|
<form method="post" action="/products/import" enctype="multipart/form-data">
|
|
<label class="form-label" for="product-import-file">CSV-bestand</label>
|
|
<input id="product-import-file" class="form-control mb-3" type="file" name="file"
|
|
accept=".csv,text/csv" required>
|
|
<div class="text-secondary small mb-3">Kolommen: name, category, barcode. Alleen name is verplicht.</div>
|
|
<button class="btn btn-outline-primary w-100" type="submit">CSV importeren</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div> |