{% extends "generic/object.html" %}
{% load buttons %}
{% load custom_links %}
{% load helpers %}
{% load perms %}
{% load plugins %}
{% load tabs %}
{% load i18n %}


{% block breadcrumbs %}
  {% include 'sop_phone/tools/breadcrumbs.html' with object=object name="Deliveries" %}
{% endblock %}


{% block control-buttons %}
  {% if perms.extras.add_bookmark and object.bookmarks %}
    {% bookmark_button object %}
  {% endif %}
  {% if perms.extras.add_subscription and object.subscriptions %}
    {% subscribe_button object %}
  {% endif %}
  {% if request.user|can_change:object %}
    {% edit_button object %}
  {% endif %}
  {% if request.user|can_delete:object %}
    {% delete_button object %}
  {% endif %}
{% endblock control-buttons %}


{% block title %}{{object|bettertitle}}{% endblock %}


{% block content %}
<div class="row">
	<div class="col col-md-6">
    <div class="card">

      <h5 class="card-header">{{object|meta:"verbose_name"|bettertitle}}</h5>
      <table class="table table-hover attr-table">

        <tr>
          <th scope="row">{% trans "Delivery Method" %}</th>
          <td>
            {{ object.delivery }}
          </td>
        </tr>

        <tr>
          <th scope="row">{% trans "Provider" %}</th>
          <td>
            {{object.provider|linkify}}
          </td>
        </tr>

        <tr>
          <th scope="row">{% trans "Status" %}</th>
          <td>
            {% badge object.get_status_display bg_color=object.get_status_color %}
          </td>
        </tr>

        <tr>
          <th scope="row">{% trans "Channel Count" %}</th>
          <td>
            {% if object.channel_count %}{{object.channel_count}}{% else %}{% include 'sop_phone/tools/badge.html' %}{% endif %}
          </td>
        </tr>

        <tr>
          <th scope="row">{% trans "MBN / NDI" %}</th>
          <td>
            {% if object.ndi %}{{ndi}}{% else %}{% include 'sop_phone/tools/badge.html' %}{% endif %}
          </td>
        </tr>

        <tr>
          <th scope="row">{% trans "DTO" %}</th>
          <td>
            {% if object.dto %}{{dto}}{% else %}{% include 'sop_phone/tools/badge.html' %}{% endif %}
          </td>
        </tr>

        <tr>
          <th scope="row">{% trans "Description" %}</th>
          <td>
            {{object.description|placeholder}}
          </td>
        </tr>

        <tr>
          <th scope="row">{% trans "Delivers" %}</th>
            <td>{{num_range}} {% trans "ranges "%}({{num_did}} {% trans "numbers" %})</td>
        </tr>

      </table>
    </div>
  </div>

<!--_______________________
    additional informations
-->
  <div class="col col-md-6">
    {% include 'inc/panels/related_objects.html' with related_models=related_models filter_name='maintainer_id' %}
    {% include 'sop_phone/tools/site.html' with object=object maintainer=maintainer %}
  </div>

  <div class="col col-md-6">
    {% include 'inc/panels/comments.html' %}
  </div>

  <div class="col col-md-12">
    <div class="card">

      <h2 class="card-header">
        <a href="{% url did_range|viewname:"list" %}?delivery_id={{object.pk}}">{{did_range|meta:"verbose_name_plural"|bettertitle}}</a>
      </h2>

      {% htmx_table did_range|viewname:"list" delivery_id=object.pk %}
    </div>

  </div>

</div>
{% endblock content %}
