{% extends './dhcpserver/base.html' %}
{% load i18n %}
{% load netbox_dhcp %}
{% load plugins %}

{% block content %}
    <div class="row">
        <div class="col col-md-6">
            <div class="card">
                <h5 class="card-header">{% trans "DHCP Server" %}</h5>
                <table class="table table-hover attr-table">
                    {% include './inc/name_description_fields.html' %}
                    <tr>
                        <th scope="row">{% trans "Status" %}</th>
                        <td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
                    </tr>
                    {% if object.dhcp_cluster %}
                        <tr>
                            <th scope="row">{% trans "DHCP Cluster" %}</th>
                            <td>{{ object.dhcp_cluster|linkify|placeholder }}</td>
                        </tr>
                    {% endif %}
                    {% if object.device %}
                        <tr>
                            <th scope="row">{% trans "Device" %}</th>
                            <td>{{ object.device|linkify|placeholder }}</td>
                        </tr>
                        <tr>
                            <th scope="row">{% trans "Interfaces" %}</th>
                            <td>
                                <table>
                                    {% for interface in object.device_interfaces.all %}
                                        <tr><td>{{ interface|linkify }}</td></tr>
                                    {% endfor %}
                                </table>
                            </td>
                        </tr>
                    {% elif object.virtual_machine %}
                        <tr>
                            <th scope="row">{% trans "Virtual Machine" %}</th>
                            <td>{{ object.virtual_machine|linkify|placeholder }}</td>
                        </tr>
                        <tr>
                            <th scope="row">{% trans "Interfaces" %}</th>
                            <td>
                                <table>
                                    {% for interface in object.virtual_machine_interfaces.all %}
                                        <tr><td>{{ interface|linkify }}</td></tr>
                                    {% endfor %}
                                </table>
                            </td>
                        </tr>
                    {% endif %}
                </table>
            </div>
            <div class="card">
                <h5 class="card-header">{% trans "Configuration" %}</h5>
                <table class="table table-hover attr-table">
                    <tr>
                        <th scope="row">{% trans "Server DUID" %}</th>
                        <td>{{ object.server_id|placeholder }}</td>
                    </tr>
                    <tr>
                        <th scope="row">{% trans "Host Reservation Identifiers" %}</th>
                        <td>
                            {% for identifier in object.host_reservation_identifiers %}
                                {{ identifier }}{{ "&nbsp;" }}
                            {% endfor %}
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">{% trans "Echo Client ID" %}</th>
                        <td>{% null_checkmark object.echo_client_id %}</td>
                    </tr>
                    <tr>
                        <th scope="row">{% trans "Relay Supplied Options" %}</th>
                        <td>
                            {% for option in object.relay_supplied_options %}
                                {{ option }}{{ "&nbsp;" }}
                            {% endfor %}
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">{% trans "Decline Probation Period" %}</th>
                        <td>{{ object.decline_probation_period|placeholder }}</td>
                    </tr>
                </table>
            </div>
            {% include './inc/bootp_card.html' %}
            {% include './inc/lifetime_card.html' %}
            {% include 'inc/panels/custom_fields.html' %}
            {% include 'inc/panels/comments.html' %}
            {% plugin_left_page object %}
        </div>
        <div class="col col-md-6">
            {% include './inc/lease_card.html' %}
            {% include './inc/ddns_update_card.html' %}
            {% include 'inc/panels/tags.html' %}
            {% plugin_right_page object %}
        </div>
    </div>
    <div class="row">
        <div class="col col-md-12">
            {% plugin_full_width_page object %}
        </div>
    </div>
{% endblock %}
