{% extends 'layouts/main.html' %}
{% block title %}{{ table_name }}{% endblock %}
{% block content %}

<div class="page-header">
    {% from 'macros/render_form.html' import render_form %}
    <h2> <a href={{url}}>{{table_name}}</a> <h2>
    <h5></h5>
    <div id="accordion">
      <div class="card">
        <div class="card-header" id="headingOne">
          <h5 class="mb-0">
            <button class="btn btn-outline-primary collapsed" data-toggle="collapse" data-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
              Relations
            </button>
          </h5>
        </div>

        <div id="collapseOne" class="collapse" aria-labelledby="headingOne" data-parent="#accordion">
          <div class="card-body">
              Click on a table to expand it.
              <div class="post-tabs">
                  <object data="{{ url_for('tmpfile', filename=filename) }}" type="image/svg+xml"
                          class="Svg" target="_top">
                  </object>
              </div>
          </div>
        </div>
      </div>
      <div class="card">
        <div class="card-header" id="headingTwo">
          <h5 class="mb-0">
            <button class="btn btn-outline-primary collapsed {{enter_show[0]}}" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="{{enter_show[1]}}" aria-controls="collapseTwo">
              Enter
            </button>
          </h5>
        </div>
        <div id="collapseTwo" class="collapse {{enter_show[0]}}" aria-labelledby="headingTwo" data-parent="#accordion">
          <div class="card-body">
              {{ render_form(form, readonly=readonly) }}
          </div>
        </div>
      </div>
      <div class="card">
        <div class="card-header" id="headingThree">
          <h5 class="mb-0">
            <button class="btn btn-outline-primary collapsed" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
              Table
            </button>
          </h5>
        </div>
        <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordion">
          <div class="card-body">
              {% with data=data, toggle_off_keys=toggle_off_keys%}
                  {% include 'macros/tables.html' %}
              {% endwith %}
          </div>
        </div>
      </div>
    </div>
</div>

{% endblock %}
