{% load static %}

<div class="col col-md-6">
    <div class="card">
        <h2 class="card-header">NetBox</h2>
        <div class="p-1" id="netbox-connection-error-{{ object.pk }}"></div>
        <div class="d-flex flex-row justify-content-center align-items-center p-3 m-2 mt-1">
            <div class="d-flex mx-auto position-absolute p-2">
                <a href="{{ object.get_absolute_url }}">
                    <img src="{% static 'netbox_proxbox/logo_netbox_dark_teal.svg' %}" alt="NetBox Logo" width="200">
                </a>
            </div>
            <div class="d-flex ms-auto" style="margin: 0 40px 0 0">
                <span
                    id="netbox-status-badge-{{ object.pk }}"
                    class="badge p-1"
                    data-service-status-url="{% url 'plugins:netbox_proxbox:keepalive_status' 'netbox' object.pk %}"
                >Unknown</span>
            </div>
        </div>

        <div class="card-body">
            <table class="table table-hover attr-table">
                <tr>
                    <th scope="row"><strong>Name</strong></th>
                    <td>{% if object.name %}<a href="{{ object.get_absolute_url }}">{{ object.name }}</a>{% else %}<span class="badge text-bg-grey">Empty</span>{% endif %}</td>
                </tr>
                {% if object.domain %}
                    <tr><th scope="row"><strong>Domain</strong></th><td>{{ object.domain }}</td></tr>
                {% endif %}
                {% if object.ip_address %}
                    <tr><th scope="row"><strong>IP Address</strong></th><td><a href="{{ object.ip_address.get_absolute_url }}">{{ object.ip_address }}</a></td></tr>
                {% endif %}
                <tr><th scope="row"><strong>HTTP Port</strong></th><td>{{ object.port }}</td></tr>
                <tr><th scope="row"><strong>Token Version</strong></th><td>{{ object.token_version_label }}</td></tr>
                <tr><th scope="row"><strong>Token</strong></th><td>{% if object.has_configured_token %}<span class="badge text-bg-gray">Token will not show here for security.</span>{% else %}<span class="badge text-bg-grey">Not configured</span>{% endif %}</td></tr>
                <tr><th scope="row"><strong>SSL</strong></th><td>{% if object.verify_ssl %}<span class="text-success"><i class="mdi mdi-check-bold"></i></span>{% else %}<span class="text-danger"><i class="mdi mdi-close-thick"></i></span>{% endif %}</td></tr>
            </table>
            <div align="right">
                <a
                    class="btn btn-outline-primary"
                    target="_blank"
                    href="https://github.com/netdevopsbr/netbox-proxbox/blob/develop/netbox_proxbox/__init__.py"
                >Show Example</a>
            </div>
        </div>
    </div>
</div>
