{% extends "base.html.j2" %}
{% from 'bootstrap5/form.html' import render_form %}
{% from "tables.html.j2" import alarms_table, bridges_table, countries_table, proxies_table %}

{% block content %}
    <h1 class="h2 mt-3">Origins</h1>
    <h2 class="h3">
        {{ origin.group.group_name }}: {{ origin.domain_name }}
        <a href="{{ origin.domain_name }}" class="btn btn-secondary btn-sm" target="_bypass"
           rel="noopener noreferer">⎋</a>
    </h2>

    <div style="border: 1px solid #666;" class="p-3">
        {{ render_form(form) }}
    </div>

    <h3>Countries</h3>
    <p><a href="{{ url_for("portal.origin.origin_country_add", origin_id=origin.id) }}" class="btn btn-sm btn-success">Add Country</a></p>
    {{ countries_table(origin.countries, origin) }}

    {% if origin.alarms %}
    <h3>Alarms</h3>
    {{ alarms_table(origin.alarms) }}
    {% endif %}

    {% if origin.proxies %}
    <h3>Proxies</h3>
    {{ proxies_table(origin.proxies) }}
    {% endif %}

{% endblock %}
