<div class="row formulaic-row">
  <div class="col-xs-8 preview-column">
    <h2>View Submissions</h2>

    {{#if hasSubmissions}}
      <nav class="navbar navbar-default formulaic-navbar">
        <div class="container-fluid">
          <div class="nav navbar-nav navbar-right formulaic-next-prev">
            {{#if previousPage}}
              <button type="button" class="btn btn-default navbar-btn" {{action "gotoPreviousPage" model}}>Previous</button>
            {{/if}}
            {{#if nextPage}}
              <button type="button" class="btn btn-default navbar-btn" {{action "gotoNextPage" model}}>Next</button>
            {{/if}}
          </div>
          <p class="nav navbar-text navbar-right">Page {{currentPage}} of {{pageCount}} (<em>{{count}} submissions</em>) </p>
          <div class="nav navbar-nav navbar-left formulaic-filters">
            {{#if sources}}
              <span class="glyphicon glyphicon-filter" aria-hidden="true"></span>
              {{#x-select value=selectedSource action="changeSource" as |xs|}}
                <option>Select `source` to filter...</option>
                {{#each sources as |source|}}
                  {{#xs.option value=source.id}}{{source.id}}{{/xs.option}}
                {{/each}}
              {{/x-select}}
            {{/if}}
          </div>
        </div>
      </nav>

      <table class="table table-striped table-hover">
        <thead>
          <tr>
            {{#each columnHeaders as |header|}}
              <th>{{header}}</th>
            {{/each}}
          </tr>
        </thead>
        <tbody>
          {{#each submissionDataList as |row|}}
            <tr>
              {{#each row as |column|}}
                <td>{{column}}</td>
              {{/each}}
            </tr>
          {{/each}}
        </tbody>
      </table>

      <nav class="navbar navbar-default formulaic-navbar">
        <div class="container-fluid">
          <div class="nav navbar-nav navbar-right formulaic-next-prev">
            {{#if previousPage}}
              <button type="button" class="btn btn-default navbar-btn" {{action "gotoPreviousPage" model}}>Previous</button>
            {{/if}}
            {{#if nextPage}}
              <button type="button" class="btn btn-default navbar-btn" {{action "gotoNextPage" model}}>Next</button>
            {{/if}}
          </div>
          <p class="nav navbar-text navbar-right">Page {{currentPage}} of {{pageCount}} (<em>{{count}} submissions</em>) </p>
        </div>
      </nav>
    {{else}}
      <p>No submissions found</p>
    {{/if}}

    <button class="btn btn-danger" type="submit" {{action "closeSubmissions"}}>Close</button>

  </div>
</div>
