| 1 |
{%- import "partials/_ui.html" as ui -%} |
| 2 |
<div id="license-keys-list"> |
| 3 |
{% if license_keys.is_empty() %} |
| 4 |
{% call ui::empty_state("", "No license keys generated yet.") %} |
| 5 |
{% else %} |
| 6 |
<table class="data-table"> |
| 7 |
<thead> |
| 8 |
<tr> |
| 9 |
<th>Key Code</th> |
| 10 |
<th>Activations</th> |
| 11 |
<th>Status</th> |
| 12 |
<th>Created</th> |
| 13 |
<th></th> |
| 14 |
</tr> |
| 15 |
</thead> |
| 16 |
<tbody> |
| 17 |
{% for key in license_keys %} |
| 18 |
<tr> |
| 19 |
<td> |
| 20 |
<code class="key-code" title="Click to copy" onclick="navigator.clipboard.writeText('{{ key.key_code }}')"> |
| 21 |
{{ key.key_code }} |
| 22 |
</code> |
| 23 |
</td> |
| 24 |
<td> |
| 25 |
{{ key.activation_count }}{% if let Some(max) = key.max_activations %} / {{ max }}{% else %} / ∞{% endif %} |
| 26 |
</td> |
| 27 |
<td> |
| 28 |
{% if key.is_revoked %} |
| 29 |
<span class="badge badge-error">Revoked</span> |
| 30 |
{% else %} |
| 31 |
<span class="badge badge-success">Active</span> |
| 32 |
{% endif %} |
| 33 |
</td> |
| 34 |
<td>{{ key.created_at }}</td> |
| 35 |
<td> |
| 36 |
{% if !key.is_revoked %} |
| 37 |
<button class="btn btn-sm btn-danger" |
| 38 |
hx-post="/api/keys/{{ key.id }}/revoke" |
| 39 |
hx-target="#license-keys-list" |
| 40 |
hx-swap="outerHTML" |
| 41 |
hx-confirm="Revoke this license key? All activations will be deactivated."> |
| 42 |
Revoke |
| 43 |
</button> |
| 44 |
{% endif %} |
| 45 |
</td> |
| 46 |
</tr> |
| 47 |
{% endfor %} |
| 48 |
</tbody> |
| 49 |
</table> |
| 50 |
{% endif %} |
| 51 |
</div> |
| 52 |
|