extends ../layouts/main
block content

  include ../../components/pagination-bar

  .uk-margin
    form(method="GET", action="/admin/user").uk-form
      div(uk-grid).uk-grid-collapse
        .uk-width-expand
          input(id="username", name="u", placeholder="Enter username", value= query && query.u ? query.u : undefined).uk-input
        .uk-width-auto
          button(type="submit").uk-button.uk-button-secondary.uk-light Search

  .uk-overflow-auto
    table.uk-table.uk-table-divider.uk-table-small.uk-table-justify
      thead
        th Username
        th Display Name
        th Created
        th User ID
      tbody
        each userAccount in userAccounts
          tr
            td
              a(href=`/admin/user/${userAccount._id}`)= userAccount.username
            td
              if userAccount.displayName
                a(href=`/admin/user/${userAccount._id}`)= userAccount.displayName
              else
                .uk-text-muted N/A
            td= moment(userAccount.created).format('YYYY-MM-DD hh:mm a')
            td= userAccount._id

  .uk-margin
    +renderPaginationBar("/admin/user", totalUserCount)
