83 lines
4.5 KiB
Plaintext
83 lines
4.5 KiB
Plaintext
<div class="page-header mb-4">
|
|
<h1>📦 Producten</h1>
|
|
</div>
|
|
|
|
<div class="card mb-4">
|
|
<div class="card-header"><h3 class="card-title">Nieuw product</h3></div>
|
|
<div class="card-body">
|
|
<form method="post" action="/products" class="row g-3 align-items-end">
|
|
<div class="col-md-5">
|
|
<label class="form-label" for="product-name">Productnaam</label>
|
|
<input id="product-name" class="form-control" type="text" name="name" placeholder="bijv. Melk" maxlength="120" required>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label" for="category-id">Categorie</label>
|
|
<select id="category-id" class="form-select" name="category_id">
|
|
<option value="">Geen categorie</option>
|
|
<% (categories || []).forEach(category => { %>
|
|
<option value="<%= category.id %>"><%= category.icon || "" %> <%= category.name %></option>
|
|
<% }); %>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-3"><button class="btn btn-primary w-100" type="submit">Product toevoegen</button></div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="row g-3 mb-4" data-product-filter>
|
|
<div class="col-md-8">
|
|
<label class="form-label" for="product-search">Zoek op naam</label>
|
|
<input id="product-search" class="form-control" type="search" placeholder="Bijv. melk" data-product-search>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label" for="product-category-filter">Filter op categorie</label>
|
|
<select id="product-category-filter" class="form-select" data-product-category>
|
|
<option value="">Alle categorieën</option>
|
|
<% (categories || []).forEach(category => { %>
|
|
<option value="<%= category.id %>"><%= category.icon || "" %> <%= category.name %></option>
|
|
<% }); %>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<% if (products.length === 0) { %>
|
|
<p class="text-secondary">Nog geen producten.</p>
|
|
<% } else { %>
|
|
<div class="list-group" data-product-list>
|
|
<% products.forEach(product => { %>
|
|
<div class="list-group-item" data-product-row data-product-name="<%= product.name.toLowerCase() %>" data-product-category="<%= product.category_id || '' %>">
|
|
<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>
|
|
<div class="d-flex align-items-center gap-2">
|
|
<form method="post" action="/products/<%= product.id %>/favorite">
|
|
<button class="btn btn-sm <%= product.is_favorite ? 'btn-danger' : 'btn-outline-secondary' %>" type="submit" aria-label="<%= product.is_favorite ? 'Verwijder uit favorieten' : 'Toevoegen aan favorieten' %>"><%= product.is_favorite ? '♥' : '♡' %></button>
|
|
</form>
|
|
<a class="btn btn-sm btn-outline-primary" href="/products/<%= product.id %>/edit">Wijzigen</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% }); %>
|
|
</div>
|
|
<p class="text-secondary mt-3 d-none" data-product-empty>Geen producten gevonden.</p>
|
|
<% } %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card mt-4">
|
|
<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" class="row g-3 align-items-end">
|
|
<div class="col-md-9">
|
|
<label class="form-label" for="product-import-file">CSV-bestand</label>
|
|
<input id="product-import-file" class="form-control" type="file" name="file" accept=".csv,text/csv" required>
|
|
</div>
|
|
<div class="col-md-3"><button class="btn btn-outline-primary w-100" type="submit">CSV importeren</button></div>
|
|
</form>
|
|
<div class="text-secondary small mt-2">Kolommen: name, category, barcode. Alleen name is verplicht.</div>
|
|
</div>
|
|
</div>
|