Files
flask_ipam/app/templates/panel/_table-alloc.html
T
2026-09-16 15:22:36 +02:00

71 lines
3.3 KiB
HTML

{% for allocation in allocations %}
{% if session['hide_dhcp'] and allocation.is_dhcp %}
{% else %}
<tr>
<td id="{{allocation.ipv4}}"><b>{{allocation.ipv4}}</b></td>
<td>{{allocation.hostname}}</td>
<td>{{allocation.hostname_full}}</td>
<td>{{allocation.description}}</td>
<td>
{% if Inventory.query.filter_by(id=allocation.device_id).first() %}
<button
hx-get="{{ url_for('inventory.item_view_modal',item_id=allocation.device_id) }}"
hx-trigger="click"
hx-target="#modal-view"
data-bs-toggle="modal"
data-bs-target="#modal-view"
class="btn btn-sm btn-outline-primary"
style="padding-top:1px;padding-bottom:1px"
> Details
</button>
{% else %}
N/A
{% endif %}
</td>
<td>{% if allocation.is_dhcp %}<span class="badge text-bg-secondary" style="margin-right: 0.5rem;">DHCP</span>{% endif %}{% if allocation.is_gateway %}<span class="badge text-bg-primary" style="margin-right: 0.5rem;">GATEWAY</span>{% endif %}{% if allocation.is_decom %}<span class="badge text-bg-warning" style="margin-right: 0.5rem;">DECOM</span>{% endif %}</td>
{% if current_user.is_reado == False %}
<td>
{% if allocation.is_used %}
<button
hx-get="{{ url_for('network.allocation_edit_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}&item={{allocation.ipv4}}"
hx-trigger="click"
hx-target="#modal-edit"
data-bs-toggle="modal"
data-bs-target="#modal-edit"
class="btn btn-sm btn-outline-info"
style="padding-top:1px;padding-bottom:1px"
> Edit
</button>
{% if allocation.is_decom %}
<a href="{{ url_for('network.allocation_decom',action=2,net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}&item={{allocation.ipv4}}" class="btn btn-sm btn-outline-primary" style="padding-top:1px;padding-bottom:1px">Undecom</a>
{% else %}
<a href="{{ url_for('network.allocation_decom',action=1,net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}&item={{allocation.ipv4}}" class="btn btn-sm btn-outline-warning" style="padding-top:1px;padding-bottom:1px">Decom</a>
{% endif %}
<button
hx-get="{{ url_for('network.allocation_del_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}&item={{allocation.ipv4}}"
hx-trigger="click"
hx-target="#modal-del"
data-bs-toggle="modal"
data-bs-target="#modal-del"
class="btn btn-sm btn-outline-danger"
style="padding-top:1px;padding-bottom:1px"
> Unallocate
</button>
{% else %}
<button
hx-get="{{ url_for('network.allocation_edit_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}&item={{allocation.ipv4}}"
hx-trigger="click"
hx-target="#modal-edit"
data-bs-toggle="modal"
data-bs-target="#modal-edit"
class="btn btn-sm btn-outline-success"
style="padding-top:1px;padding-bottom:1px"
> Allocate
</button>
{% endif %}
</td>
{% endif %}
</tr>
{% endif %}
{% endfor %}