Files
weircon-front/templates/admin_iplabels.html
T

26 lines
1.8 KiB
HTML

{% extends "base.html" %}
{% block title %}Admin — IP-labels{% endblock %}
{% block body %}
<h1>IP → label &amp; land</h1>
<p class="wt-lead">Mærk kendte IP-adresser. Nøgle = præcis IP eller præfiks (fx <code>192.168.</code>). Land = ISO-kode (fx <code>dk</code>) der overstyrer geolokation. Gemmes live til NPMplus.</p>
{% if saved %}<div class="wt-flash">{{ saved }}</div>{% endif %}
<form method="post" action="/admin/ip-labels">
<table id="tbl" class="wt-table" style="margin-top:1rem">
<thead><tr><th style="width:40%">IP / præfiks</th><th>Label</th><th style="width:90px">Land</th><th style="width:40px"></th></tr></thead>
<tbody>
{% for r in rows %}
<tr><td><input name="ip" value="{{ r.ip }}"></td><td><input name="label" value="{{ r.label }}"></td><td><input name="country" value="{{ r.country }}"></td><td><button type="button" class="wt-btn" onclick="this.closest('tr').remove()">✕</button></td></tr>
{% endfor %}
<tr><td><input name="ip" placeholder="fx 192.168."></td><td><input name="label" placeholder="Hjemme"></td><td><input name="country" placeholder="dk"></td><td><button type="button" class="wt-btn" onclick="this.closest('tr').remove()">✕</button></td></tr>
</tbody>
</table>
<p style="margin-top:1rem;display:flex;gap:.6rem">
<button type="button" class="wt-btn" onclick="addRow()">+ Tilføj række</button>
<button type="submit" class="wt-btn wt-btn--primary">Gem</button>
</p>
</form>
<script>
function addRow(){var t=document.querySelector('#tbl tbody');var tr=document.createElement('tr');tr.innerHTML='<td><input name="ip"></td><td><input name="label"></td><td><input name="country"></td><td><button type="button" class="wt-btn" onclick="this.closest(\'tr\').remove()">✕</button></td>';t.appendChild(tr);}
</script>
{% endblock %}