diff --git a/static/app.js b/static/app.js
index 24c4322..375612e 100644
--- a/static/app.js
+++ b/static/app.js
@@ -10,13 +10,10 @@ async function request(url, options = {}) {
}
async function load() {
- const query = new URLSearchParams({ q: $('#searchInput').value, type: $('#typeFilter').value, status: $('#statusFilter').value });
+ const query = new URLSearchParams({ q: $('#searchInput').value, type: $('#typeFilter').value });
const [items, summary] = await Promise.all([request(`/api/items?${query}`), request('/api/summary')]);
state.items = items;
$('#totalCount').textContent = summary.total;
- $('#availableCount').textContent = summary.available;
- $('#trashedCount').textContent = summary.trashed;
- $('#soldCount').textContent = summary.sold;
$('#resultCount').textContent = `${items.length} ${items.length === 1 ? 'item' : 'items'}`;
renderItems(items);
}
@@ -24,7 +21,7 @@ async function load() {
function renderItems(items) {
const body = $('#inventoryBody');
$('#emptyState').style.display = items.length ? 'none' : 'block';
- body.innerHTML = items.map((item) => `
${item.images?.length ? ` }) ${item.images.length > 1 ? ` +${item.images.length - 1}` : ''}` : ' ◌ '} ${escapeHtml(item.name)}${escapeHtml([item.brand, item.model].filter(Boolean).join(' · ') || 'No manufacturer details')} | ${escapeHtml(item.item_type)} | ${escapeHtml(item.serial_number || 'No serial')}${escapeHtml(item.asset_tag || 'No asset tag')} | ${escapeHtml(item.location || 'Unassigned')}${escapeHtml(item.destination ? `Went to: ${item.destination}` : '')} | ${escapeHtml(item.status)}${item.price != null ? escapeHtml(Number(item.price).toFixed(2)) : ''} | |
`).join('');
+ body.innerHTML = items.map((item) => `${item.images?.length ? ` }) ${item.images.length > 1 ? ` +${item.images.length - 1}` : ''}` : ' ◌ '} ${escapeHtml(item.name)}${escapeHtml([item.brand, item.model].filter(Boolean).join(' · ') || 'No manufacturer details')} | ${escapeHtml(item.item_type)} | ${escapeHtml(item.serial_number || 'No serial')}${escapeHtml(item.asset_tag || 'No asset tag')} | ${escapeHtml(item.location || 'Unassigned')} | |
`).join('');
}
function escapeHtml(value) { return String(value).replace(/[&<>'"]/g, (char) => ({ '&': '&', '<': '<', '>': '>', "'": ''', '"': '"' }[char])); }
@@ -43,7 +40,7 @@ $('#emptyAddButton').addEventListener('click', () => openModal());
$('#closeModal').addEventListener('click', closeModal);
$('#cancelButton').addEventListener('click', closeModal);
$('#modal').addEventListener('click', (event) => { if (event.target === $('#modal')) closeModal(); });
-['searchInput', 'typeFilter', 'statusFilter'].forEach((id) => $(`#${id}`).addEventListener(id === 'searchInput' ? 'input' : 'change', load));
+['searchInput', 'typeFilter'].forEach((id) => $(`#${id}`).addEventListener(id === 'searchInput' ? 'input' : 'change', load));
ensureImageControls();
$('#imageInput').addEventListener('change', () => { const files = [...$('#imageInput').files]; $('#imageName').textContent = files.length ? `${files.length} new picture${files.length === 1 ? '' : 's'} selected` : 'Up to 5 pictures'; });
$('#itemForm').addEventListener('submit', async (event) => { event.preventDefault(); const formData = new FormData(event.target); if (!$('#imageInput').files.length) formData.delete('images'); try { await request(state.editingId ? `/api/items/${state.editingId}` : '/api/items', { method: state.editingId ? 'PUT' : 'POST', body: formData }); closeModal(); toast(state.editingId ? 'Item updated.' : 'Item added to inventory.'); await load(); } catch (error) { toast(error.message); } });
diff --git a/templates/index.html b/templates/index.html
index ac116ac..db1bfab 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -20,14 +20,11 @@
Operations / Stockroom
Inventory
Total assets ◉
0Across all categories
- Available ●
0Ready to use
- Trashed ●
0Removed from stock
- Sold ●
0Transferred or sold
All inventory
Search, filter, and manage every item in your stockroom.
0 items
-
- | Item | Type | Identifiers | Location | Status | Actions |
|---|
⌁
No items found
Adjust your search or add the first item to your inventory.
+
+ | Item | Type | Identifiers | Location | Actions |
|---|
⌁
No items found
Adjust your search or add the first item to your inventory.