<!-- -*-jinja2-*- -->
{% extends "base.html" %}

{% block app_content %}
    <br>
    <h1> {{ title }} <i>{{mdb.handle}}</i> </h1>
    {% if display == 'detail'  %}
      <div class="float-right">
	<div class="float-right">
          <a href="{{url_for('main.entities', entities=subtype, id=mdb.id, format='json' ) }}" class="btn btn-outline-primary btn-sm"> Export JSON </a>
	</div>
  
      </div>
      <br><br>
      <div>
	<h3> Node Details </h3>
	<div id="detailNode" name="detailNode" style="margin:20px; padding:20x">
	  <table class="table-striped">
            <tr>
              <th style="width:300px"> Name </th> 
              <th style="width:300px"> <a href="{{url_for( 'main.entities', entities=subtype, id=mdb.id ) }}"> {{mdb.handle}} </a>  </th>
	    </tr>
            <tr>
              <td> Id </td> <td>{{mdb.id}} </td>
            </tr>
            <tr>
              <td> Model </td> <td>{{mdb.model}} </td>
	    </tr>
            <tr>
              <td> Version </td> <td>{{mdb.version}} </td>
            </tr>
      </table>
	</div>
      </div>
      {% block edit_functions %}
      {% endblock edit_functions %}
      <br><br>
      <div>
	{% if mdb.has_properties %}
	  <h4> Node Properties</h4>
	  <div id="nodeProperties" name="nodeProperties" style="margin:20px; padding:20x">
            <table class="table-striped" >
              <tr> 
		<th style="width:300px"> Property </th>   
		<th style="width:300px"> Id </th>
              <th style="width:300px"> Value Domain </th>
              </tr>
              
              {% for property_item in mdb.has_properties %}
		<tr>
              <td> <a href="{{url_for( 'main.entities', entities='properties', id=property_item.id ) }}"> {{property_item.handle }}</a> </td>
              <td> {{ property_item.id }} </td> 
              <td> {{ property_item.value_domain }}</td>
		</tr>
          {% endfor %}
            </table>
	  </div>    
      <br>
    {% endif %}
      </div>
      <br>
      
      <div>
        {% if mdb.has_relationship_from_nodes %}
          <h3> From Nodes </h3>
          <div id="fromNodes" name="fromNodes" style="margin:20px; padding:20x">
            <table class="table-striped" >
              <tr> 
		<th style="width:300px"> Node Name </th>  
		<th style="width:300px"> Id </th>  
		<th style="width:300px"> With Relationship </th>  
              </tr>
	      
              {% for node_item in mdb.has_relationship_from_nodes %}
		<tr>
                 <td> <a href="{{url_for( 'main.entities', entities=subtype, id=node_item.id ) }}"> {{node_item.handle }}</a> </td>
                 <td> {{ node_item.id }} </td>
                 <td> {{ node_item.relationship.handle }}</td>
		</tr>
            {% endfor %}  
            </table>
          </div>    
        {% endif %}
      </div>
      
      <br>
      <br>
      
      
      <div>
        {% if mdb.has_relationship_to_nodes %}
          <h3> To Nodes </h3>
          <div id="toNodes" name="toNodes" style="margin:20px; padding:20x">
            <table class="table-striped" >
              <tr> 
		<th style="width:300px"> Node Name </th>  
		<th style="width:300px"> Id </th>  
		<th style="width:300px"> With Relationship </th>  
              </tr>
              
              {% for node_item in mdb.has_relationship_to_nodes %}
		<tr>
                  <td> <a href="{{url_for( 'main.entities', entities=subtype, id=node_item.id ) }}"> {{node_item.handle }}</a> </th>
<td> {{ node_item.id }} </td>
<td> {{node_item.relationship.handle }}</td>
</tr>
{% endfor %}
</table>
</div>    
{% endif %}
</div>

{% endif %}
{% endblock %}
