{% load helpers %}
{% load static %}

<!-- Action Buttons -->
<div class="d-flex justify-content-between align-items-center mb-3">
    <h2>Interface Sync</h2>
    <div class="btn-list">
        <form method="post">
            {% csrf_token %}
            {% if has_librenms_id %}
                {% with model_name=object|meta:"model_name" %}
                    {% if model_name == "device" %}
                        <button hx-post="{% url 'plugins:netbox_librenms_plugin:device_interface_sync' pk=object.pk %}"
                                hx-target="#interface-sync-content"
                                hx-include="[name='interface_name_field']"
                                class="btn btn-outline-primary">
                            Refresh Interfaces
                        </button>
                    {% elif model_name == "virtualmachine" %}
                        <button hx-post="{% url 'plugins:netbox_librenms_plugin:vm_interface_sync' pk=object.pk %}"
                                hx-target="#interface-sync-content"
                                hx-include="[name='interface_name_field']"
                                class="btn btn-outline-primary">
                            Refresh Interfaces
                        </button>
                    {% endif %}
                {% endwith %}
            {% endif %}
        </form>
    </div>
</div>
<!-- End Action Buttons -->

<!-- Container for the interface sync content -->
<div id="interface-sync-content">
    {% include 'netbox_librenms_plugin/_interface_sync_content.html' %}
</div>
