Add UI console and spare forecast naming

This commit is contained in:
2026-02-06 00:01:52 +03:00
parent 5af1462645
commit ee46a093d3
21 changed files with 1573 additions and 207 deletions

View File

@@ -0,0 +1,89 @@
{{define "index"}}
<!DOCTYPE html>
<html lang="en">
{{template "head" .}}
<body>
{{template "topbar" .}}
<main class="container">
<section class="card">
<h2>Registry Snapshot</h2>
<div class="stats">
<div class="stat"><span>Customers</span><strong>{{.CustomerCount}}</strong></div>
<div class="stat"><span>Projects</span><strong>{{.ProjectCount}}</strong></div>
<div class="stat"><span>Assets</span><strong>{{.AssetCount}}</strong></div>
<div class="stat"><span>Components</span><strong>{{.ComponentCount}}</strong></div>
</div>
</section>
<section class="card">
<h2>Latest Assets</h2>
{{if .Assets}}
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Vendor Serial</th>
<th>Project</th>
<th>Location</th>
<th>Created</th>
</tr>
</thead>
<tbody>
{{range $i, $item := .Assets}}
{{if lt $i 5}}
<tr>
<td><a href="/ui/assets/{{$item.ID}}">{{$item.ID}}</a></td>
<td>{{$item.Name}}</td>
<td>{{$item.VendorSerial}}</td>
<td>{{$item.ProjectID}}</td>
<td>{{if $item.LocationID}}{{$item.LocationID}}{{else}}—{{end}}</td>
<td>{{formatTime $item.CreatedAt}}</td>
</tr>
{{end}}
{{end}}
</tbody>
</table>
{{else}}
<div class="meta">No assets yet.</div>
{{end}}
<div class="meta"><a href="/ui/assets">View all assets</a></div>
</section>
<section class="card">
<h2>Latest Components</h2>
{{if .Components}}
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Vendor Serial</th>
<th>Lot</th>
<th>First Seen</th>
<th>Created</th>
</tr>
</thead>
<tbody>
{{range $i, $item := .Components}}
{{if lt $i 5}}
<tr>
<td><a href="/ui/components/{{$item.ID}}">{{$item.ID}}</a></td>
<td>{{$item.VendorSerial}}</td>
<td>{{if $item.LotID}}{{$item.LotID}}{{else}}—{{end}}</td>
<td>{{formatTimePtr $item.FirstSeenAt}}</td>
<td>{{formatTime $item.CreatedAt}}</td>
</tr>
{{end}}
{{end}}
</tbody>
</table>
{{else}}
<div class="meta">No components yet.</div>
{{end}}
<div class="meta"><a href="/ui/components">View all components</a></div>
</section>
</main>
</body>
</html>
{{end}}