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

{% block app_content %}
    <br>
    <h1> {{ title }} <i>{{ mdb.prop.handle}}</i> </h1>
    {% if display == 'detail'  %}
    <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>
    <br><br>
    <div class="container-fluid">
      <div class="row">
        <div class="col-lg-6">
          
          <h3> Property Details </h3>
          <div id="propertyDetail" name="propertyDetail" style="margin:20px; padding:20x">
            <table class="table table-striped">
              <tr>
                <th scope="row" style="width:100px"> Handle </th> 
                <th scope="row" style="width:250px"> <a href="{{url_for( 'main.entities', entities=subtype, id=mdb.prop['nanoid'] ) }}"> {{mdb.prop['handle']}} </a>  </th>
                
              </tr>
              <tr>
                <td> Id </td> <td>{{mdb.prop['nanoid']}} </td> 
              </tr>
              <tr>
                <td> Model </td> <td>{{mdb.model}} </td> 
              </tr>
              <tr>
                <td> Version </td> <td>{{mdb.version}} </td>
              </tr>
	      
              {% if mdb.node.handle %}
                <tr>
                  <td> For Node </td> <td><a href="{{url_for('main.entities', entities='nodes',id=mdb.node.nanoid)}}"> {{mdb.node.handle}} </a> </td>
                  
                </tr>
              {% endif %}
	      
            </table>
          </div>

          <h3> Terms Annotating </h3>
          <div id="termsAnnotating" name="termsAnnotating" style="margin:20px; padding:20x">
            <table class="table table-striped">
              <tr>
                <th scope="row" style="width:200px"> Value </th> 
                <th scope="row" style="width:100px"> Origin </th>
              </tr>
              {% for term in mdb.has_annots %}
                <tr>
                  <td> <a href={{term.link}}>{{term.value}} </td>
                  <td>{{term.origin}}</td>
                </tr>
	      {% endfor %}
            </table>
          </div>
          
        </div>     <!-- end col-->
	
	
        <div class="col-lg-6">
	  
          <h3> Property Attributes </h3>
          <div id="propertyDetail" name="propertyDetail" style="margin:20px; padding:20x">
            <table class="table table-striped">
	      
              <tbody>                               
                <tr>
                  <th scope="row">Value Domain</th>
                  <td>
                      {{ mdb.prop["value_domain"] }}
                  </td>
                </tr> 
		
                <tr>
                  <td>Required</td>
                  <td>
		    {{ mdb.prop["is_required"] if mdb.prop["is_required"] else 'false' }}
                  </td>
                  {% if mdb.prop["units"] %}
                  <tr>
                    <td>Units</td>
                    <td> {{mdb.prop["units"]}} </td>
                  </tr>
		  {% endif %}
                <tr>
                  <td>Description</td>
                  <td>
		    {{ mdb.prop["desc"] }}
                  </td>
                </tr>  
              </tbody>
            </table>
          </div>
        </div>    <!-- end col--> 
      </div> <!-- end row-->
    </div> <!-- end container-->
    
    
    <br>    <br>
    
    <div>
      {% if mdb.has_terms %}
        <h3> Terms in Value Set</h3>
        
        <div id="termList" name="termList" style="margin:20px; padding:20x">
	  
          <table class="table-striped" >
            <tr> 
              <th style="width:300px"> Term </th>
	      <th style="width:250px"> Origin </th>
              <th style="width:300px"> Id </th>  
            </tr>    
            {% for term_item in mdb.has_terms %}
              <tr>
                <td> <a href="{{url_for( 'main.entities', entities='terms', id=term_item.id ) }}"> {{ term_item.value }}</a> </td>
		<td> {{ term_item.origin }} </td>
                <td> {{ term_item.id }} </td>
              </tr>
            {% endfor %}
          </table>
        </div>
	
      {% endif %}
    </div>
    
  {% endif %}
  
{% endblock %}
