All checks were successful
continuous-integration/drone/push Build is passing
87 lines
2.5 KiB
Plaintext
87 lines
2.5 KiB
Plaintext
package views
|
|
|
|
import (
|
|
"vctp/components/core"
|
|
)
|
|
|
|
type SnapshotEntry struct {
|
|
Label string
|
|
Link string
|
|
Count int64
|
|
Group string
|
|
}
|
|
|
|
templ SnapshotHourlyList(entries []SnapshotEntry) {
|
|
@SnapshotListPage("Hourly Inventory Snapshots", "inventory snapshots captured hourly", entries)
|
|
}
|
|
|
|
templ SnapshotDailyList(entries []SnapshotEntry) {
|
|
@SnapshotListPage("Daily Inventory Snapshots", "daily summaries of hourly inventory snapshots", entries)
|
|
}
|
|
|
|
templ SnapshotMonthlyList(entries []SnapshotEntry) {
|
|
@SnapshotListPage("Monthly Inventory Snapshots", "monthly summary aggregated from daily snapshots", entries)
|
|
}
|
|
|
|
templ SnapshotListPage(title string, subtitle string, entries []SnapshotEntry) {
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
@core.Header()
|
|
<body class="flex flex-col min-h-screen web2-bg">
|
|
<main class="flex-grow web2-shell space-y-8">
|
|
<section class="web2-header">
|
|
<div class="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">
|
|
<div>
|
|
<div class="web2-pill">Snapshot Library</div>
|
|
<h1 class="mt-3 text-4xl font-bold">{title}</h1>
|
|
<p class="mt-2 text-sm text-slate-600">{subtitle}</p>
|
|
</div>
|
|
<a class="web2-button" href="/">Back to Dashboard</a>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="web2-card">
|
|
<div class="flex items-center justify-between gap-3 mb-4 flex-wrap">
|
|
<h2 class="text-lg font-semibold">Available Exports</h2>
|
|
<span class="web2-badge">{len(entries)} files</span>
|
|
</div>
|
|
<div class="overflow-hidden border border-slate-200 rounded">
|
|
<table class="web2-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Snapshot</th>
|
|
<th>Records</th>
|
|
<th class="text-right">Download</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
for i, entry := range entries {
|
|
if entry.Group != "" && (i == 0 || entries[i-1].Group != entry.Group) {
|
|
<tr class="web2-group-row">
|
|
<td colspan="3" class="font-semibold text-slate-700">{entry.Group}</td>
|
|
</tr>
|
|
}
|
|
<tr>
|
|
<td>
|
|
<div class="flex flex-col">
|
|
<span class="text-sm font-semibold text-slate-700">{entry.Label}</span>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<span class="web2-badge">{entry.Count} records</span>
|
|
</td>
|
|
<td class="text-right">
|
|
<a class="web2-link" href={entry.Link}>Download XLSX</a>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
</body>
|
|
@core.Footer()
|
|
</html>
|
|
}
|