Files
2026-05-05 08:44:55 +00:00

56 lines
1.8 KiB
HTML

{{define "license_row.html"}}
<tr data-key="{{.ID}}"
data-search="{{.SearchText}}"
data-status="{{if .Active}}active{{else}}revoked{{end}}"
data-type="{{.Type}}">
<td data-sort="{{.Key}}">
<span class="license-key">{{.Key}}</span>
</td>
<td data-sort="{{.CustomerName}}">
<div style="font-weight:500">{{.CustomerName}}</div>
<div style="color:var(--muted);font-size:11px">{{.CustomerEmail}}</div>
</td>
<td data-sort="{{.ProductName}}" style="color:var(--muted)">{{.ProductName}}</td>
<td data-sort="{{.Type}}">
{{if eq .Type "expiry"}}
<span class="badge badge-expiry">Expiry</span>
{{else}}
<span class="badge badge-usage">Usage</span>
{{end}}
</td>
<td data-sort="{{if .Active}}active{{else}}revoked{{end}}">
{{if .Active}}
<span class="badge badge-active">Active</span>
{{else}}
<span class="badge badge-revoked">Revoked</span>
{{end}}
</td>
<td data-sort="{{if eq .Type "expiry"}}{{if .ExpiresAt}}{{.ExpiresAt.Format "2006-01-02"}}{{else}}9999{{end}}{{else}}{{.UsedCount}}{{end}}"
style="font-family:var(--mono);font-size:12px;color:var(--muted)">
{{if eq .Type "expiry"}}
{{if .ExpiresAt}}{{.ExpiresAt.Format "2006-01-02"}}{{else}}—{{end}}
{{else}}
{{.UsedCount}}{{if .MaxUses}} / {{.MaxUses}}{{end}} uses
{{end}}
</td>
<td>
{{if .Active}}
<button class="btn btn-danger btn-sm"
hx-delete="/licenses/{{.ID}}/revoke"
hx-confirm="Revoke this license?"
hx-target="closest tr"
hx-swap="outerHTML">
Revoke
</button>
{{else}}
<button class="btn btn-ghost btn-sm"
hx-post="/licenses/{{.ID}}/reinstate"
hx-confirm="Reinstate this license?"
hx-target="closest tr"
hx-swap="outerHTML">
Reinstate
</button>
{{end}}
</td>
</tr>
{{end}}