{% extends "admin/change_form.html" %}
{% load static i18n admin_extras %}

{% block after_related_objects %}
  {% if original.pk %}  
  <h2>{% trans "Bayesian Network" %}: {{ original.name }}</h2>
  <p>
    {% if original.image %}
      <img src="{{ original.image.url }}" />
    {% endif %}
  </p>
  {% if original.is_inferred %}
  <h2>{% trans "Inference" %}</h2>
  {% for node in original.nodes.all %}
    {% if node.image %}
      <p>
        <img src="{{ node.image.url }}" />
      </p>
    {% endif %}
  {% endfor %}
    {% if original.network_type == original.TYPE_CLUSTERING %}
      <ul class="cm_tables">
        <li>
          <h3>Clusters Means (Current)</h3>
          {% include "./snippets/cm_table.html" with clusters_means=original.metadata.clusters_means clusters_sizes=original.metadata.clusters_sizes %}
        </li>
        {% if original.metadata.prev_clusters_means %}
        <li>
          <h3>Clusters Means (Previous Inference)</h3>
          {% include "./snippets/cm_table.html" with clusters_means=original.metadata.prev_clusters_means clusters_sizes=original.metadata.prev_clusters_sizes %}
        </li>
        {% endif %}
      </ul>
    {% endif %}
  {% endif %}
  {% ai_actions %}
  {% endif %}
{% endblock %}

{% block admin_change_form_document_ready %}
{{ block.super }}
<script type="text/javascript" src="{% static 'js/admin/bayesian_networks.js' %}"></script>
{% endblock %}
