document-processor/app/templates/line_items/summary.html

94 lines
3.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Line Item Summary</title>
<link rel="stylesheet" href="/static/app.css">
</head>
<body>
<div class="app-shell" id="app-shell">
{% include "partials/sidebar.html" %}
<main class="main">
<div class="topbar">
<div>
<h1 class="page-title">Line Item Summary</h1>
<p class="page-subtitle">Aggregate prices and ratings across extracted line items</p>
</div>
</div>
<div class="card">
<form method="get" action="/line-items/summary">
<div class="form-grid">
<div class="form-field">
<label for="q">Item contains</label>
<input id="q" name="q" value="{{ q }}" placeholder="margarita">
</div>
</div>
<div class="button-row" style="margin-top: 1rem;">
<button class="primary" type="submit">Search</button>
<a class="button-link" href="/line-items/summary">Clear</a>
<a class="button-link" href="/line-items/?q={{ q }}">Detailed view</a>
</div>
</form>
</div>
<div class="card">
<h2 class="card-title">Summary Results</h2>
{% if rows %}
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Item</th>
<th>Count</th>
<th>Avg Price</th>
<th>Min Price</th>
<th>Max Price</th>
<th>Rated Count</th>
<th>Avg Rating</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
<td>{{ row.item }}</td>
<td>{{ row.count }}</td>
<td>{{ row.avg_price }}</td>
<td>{{ row.min_price }}</td>
<td>{{ row.max_price }}</td>
<td>{{ row.rated_count }}</td>
<td>{{ row.avg_rating }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="empty-state">No summary rows found for the current search.</p>
{% endif %}
</div>
</main>
</div>
<script>
(function () {
const appShell = document.getElementById("app-shell");
const menuToggle = document.getElementById("menu-toggle");
if (appShell && menuToggle) {
menuToggle.addEventListener("click", function () {
appShell.classList.toggle("nav-open");
});
menuToggle.addEventListener("keydown", function (e) {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
appShell.classList.toggle("nav-open");
}
});
}
})();
</script>
</body>
</html>