{% extends "caravel/basic.html" %}


{% block body %}
<div class="container-fluid">
  <div class="sqlcontent" style="display: none;">
    <h3>db: [{{ db }}]</h3>
    <div class="row interactions">
      <div class="col-xs-7">
        <input type="hidden" id="database_id" value="{{ db.id }}">
        <button class="btn btn-primary" id="run">Run!</button>
        <button class="btn btn-default" id="create_view">Create View</button>
      </div>
      <div class="col-xs-5">
        <select id="dbtable">
          {% for t in tables %}
            <option value="{{ t }}"
                {{ "selected" if t == table_name else '' }}>
              {{ t }}
            </option>
          {% endfor %}
        </select>
        <button class="btn btn-default" id="select_star">SELECT *</button>
      </div>
    </div>
    <div class="topsql row">
      <div class="col-xs-7 fillheight">
        <textarea id="sql" class="fillup"></textarea>
      </div>
      <div class="col-xs-5 fillheight">
        <div class="metadata fillup bordered"></div>
      </div>
    </div>
    <div id="interactive">
    </div>
    <div id="results_section">
      <hr/>
      <img id="loading" width="25" style="display: none;" src="/static/assets/images/loading.gif">
    </div>
    <div>
      <div id="results" class="bordered" style="display: none;"></div>
    </div>
  </div>
</div>
{% endblock %}

{% block tail_js %}
{{ super() }}
<script src="/static/assets/javascripts/dist/sql.entry.js"></script>
{% endblock %}
