extends ../../../layouts/admin

block head
  title Manage Administrators

block neck
  link(rel='stylesheet', href='/views/admin/administrators/index.min.css?#{cacheBreaker}')

block feet
  script(src='/views/admin/administrators/index.min.js?#{cacheBreaker}')

block body
  div.row
    div.col-xs-12
      div#header
      div#filters
      div#results-table
      div#results-paging

  script(type='text/template', id='tmpl-header')
    div.page-header
      form.form-inline.pull-right
        div.input-group
          input.form-control(name='name', type='text', placeholder='enter a name', value!='<%= name.full %>')
          button.btn.btn-primary.btn-add(type='button') Add New
      h1 Administrators

  script(type='text/template', id='tmpl-filters')
    form.filters
      div.row
        div.col-sm-3
          label Name Search
          input.form-control(name='search', type='text')
        div.col-sm-3
          label Sort By
          select.form-control(name='sort')
            option(value='_id') id &#9650;
            option(value='-_id') id &#9660;
            option(value='name') name &#9650;
            option(value='-name') name &#9660;
        div.col-sm-3
          label Limit
          select.form-control(name='limit')
            option(value='10') 10 items
            option(value='20', selected='selected') 20 items
            option(value='50') 50 items
            option(value='100') 100 items

  script(type='text/template', id='tmpl-results-table')
    table.table.table-striped
      thead
        tr
          th
          th.stretch name
          th id
      tbody#results-rows

  script(type='text/template', id='tmpl-results-row')
    td
      input.btn.btn-default.btn-sm.btn-details(type='button', value='Edit')
    td.nowrap <%- name.full %>
    td <%= _id %>

  script(type='text/template', id='tmpl-results-empty-row')
    tr
      td(colspan='3') no documents matched

  script(type='text/template', id='tmpl-results-paging')
    div.well
      div.btn-group.pull-left
        button.btn.btn-default(disabled=true) Page <%= pages.current %> of <%= pages.total %>
        button.btn.btn-default(disabled=true) Rows <%= items.begin %> - <%= items.end %> of <%= items.total %>
      div.btn-group.pull-right
        button.btn.btn-default.btn-page.btn-prev(data-page!='<%= pages.prev %>') Prev
        button.btn.btn-default.btn-page.btn-next(data-page!='<%= pages.next %>')  Next
      div.clearfix

  script(type='text/template', id='data-results') !{data.results}
