{% extends 'generic/object.html' %}
{% load helpers %}
{% load plugins %}
{% load i18n %}

{% block content %}
<div class="row mb-3">
    <div class="col col-md-6">
        <div class="card">
            <h5 class="card-header">{% trans "Fiber Circuit" %}</h5>
            <table class="table table-hover attr-table">
                <tr>
                    <th scope="row">{% trans "Name" %}</th>
                    <td>{{ object.name }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Circuit ID" %}</th>
                    <td>{% if object.cid %}{{ object.cid }}{% else %}&mdash;{% endif %}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Status" %}</th>
                    <td>{{ object.get_status_display }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Strand Count" %}</th>
                    <td>{{ object.strand_count }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Tenant" %}</th>
                    <td>{% if object.tenant %}{{ object.tenant|linkify }}{% else %}&mdash;{% endif %}</td>
                </tr>
            </table>
        </div>
    </div>
    <div class="col col-md-6">
        {% if object.description %}
        <div class="card">
            <h5 class="card-header">{% trans "Description" %}</h5>
            <div class="card-body">{{ object.description|markdown }}</div>
        </div>
        {% endif %}
        {% include 'inc/panels/comments.html' %}
    </div>
</div>
<div class="row mb-3">
    <div class="col col-md-12">
        <div class="card">
            <h5 class="card-header">{% trans "Paths" %}</h5>
            <div class="card-body">
                {% if paths %}
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>{% trans "Position" %}</th>
                            <th>{% trans "Origin" %}</th>
                            <th>{% trans "Destination" %}</th>
                            <th>{% trans "Complete" %}</th>
                            <th>{% trans "Calculated Loss (dB)" %}</th>
                            <th>{% trans "Actual Loss (dB)" %}</th>
                            <th>{% trans "Wavelength (nm)" %}</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for path in paths %}
                        <tr>
                            <td>{{ path.position }}</td>
                            <td>{{ path.origin|linkify }}</td>
                            <td>{% if path.destination %}{{ path.destination|linkify }}{% else %}&mdash;{% endif %}</td>
                            <td>{{ path.is_complete|yesno }}</td>
                            <td>{% if path.calculated_loss_db is not None %}{{ path.calculated_loss_db }}{% else %}&mdash;{% endif %}</td>
                            <td>{% if path.actual_loss_db is not None %}{{ path.actual_loss_db }}{% else %}&mdash;{% endif %}</td>
                            <td>{% if path.wavelength_nm %}{{ path.wavelength_nm }}{% else %}&mdash;{% endif %}</td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
                {% else %}
                <p class="text-muted">{% trans "No paths defined." %}</p>
                {% endif %}
            </div>
        </div>
    </div>
</div>
{% plugin_full_width_page object %}
{% endblock %}
