{% extends 'config/base.html.j2' %}

{% block config_base %}
{% if is_xhr is not defined %}
<div id="page-config" class="config-page">
	{% if interface_count < 1 %}
		{% include "config/_no_interface_warning.html.j2" %}
	{% elif interface_up_count < 1 %}
		{% include "config/_no_interface_up_warning.html.j2" %}
	{% endif %}
{% endif %}
    {% include '_messages.html.j2' %}
    <form id="main-form" class="config-form" action="{{ request.fullpath }}" method="post" autocomplete="off" novalidate>
        <p class="config-description">{{ description|safe }}</p>
        {% if form.errors %}
            <p>{{ form.render_errors()|safe }}</p>
        {% endif %}
        <input type="hidden" name="csrf_token" value="{{ get_csrf_token() }}">
        {% for field in form.active_fields %}
            {% include '_field.html.j2' %}
        {% endfor %}
        <div id="{{ 'form-%s-buttons' % form.name }}" class="form-buttons">
            <a href="{{ request.fullpath }}" class="button grayed">{% trans %}Discard changes{% endtrans %}</a>
            <button type="submit" name="send" class="button">{% trans %}Save{% endtrans %}</button>
        </div>
    </form>
{% if is_xhr is not defined %}
</div>
    {% if form.current_data["guest_dhcp_enabled"] %}
        {% include "config/_dhcp_clients_table.html.j2" %}
    {% endif %}
<script>
    Foris.addWsHanlder("networks", (msg) => Foris.clearNetworkWarnings("guest_turris", msg.data));
</script>
{% endif %}
{% endblock %}
