.content-box.full-width.with-form
  sib-router(default-route='admin-project-list', hidden)
    sib-route(name='admin-project-list')
    sib-route(name='admin-project-create')
    sib-route(name='project-left')

  div.content-box__header.with-description
    h1.title-left.without-margin Administration

  #project-left(hidden)
    include ../project/page-project-left.pug

  #admin-project-list(hidden)
    include ../../templates/hd-user-avatar.pug

    div.content-box__info
      div.admin-header
        div.admin-header__title Projects
        sib-link(
          class='button text-bold text-uppercase reversed button-yellow bordered with-icon icon-plus'
          next='admin-project-create'
        ) Create a new project

      .table
        div.table-header.grey-color
          div Name
          div Admins
          div Captain
          div Leave

        sib-widget(name="admin-project-leave-button")
          template
            sib-delete(
              class='button text-bold text-uppercase reversed button-dark bordered with-icon icon-close'
              data-src="${src}"
              data-label='Leave'
            )

        sib-widget(name='project-captain')
          template
            sib-display(
              data-src='${await value}'
              fields='account.picture, sup(name), sub(username)'

              widget-account.picture='hd-user-avatar'
            )

        sib-widget(name='project-admins')
          template
            sib-display(
              data-src='${value}'
              fields='user'
              search-fields='isAdmin'
              search-value-isAdmin='true'
              search-widget-isAdmin='sib-form-hidden'
              widget-user='project-captain'
            )

        sib-widget(name="admin-project-buttons")
          template
            sib-display(
              data-src='${src}'
              nested-field='members'
              fields='relation'
              action-relation='relation'
              widget-relation='admin-project-leave-button'
              search-fields='user'
              search-widget-user='sib-form-hidden'
              search-value-user="-"
              hd-inherit-user-id="search-value-user"
            )

        sib-display(
          class='table-body'

          data-src=`${endpoints.projects || endpoints.get.projects}`
          fields='name, members, captain, buttons'

          class-name='w25 cell border cell-with-name hashtag'
          class-members='w25 cell border'
          class-captain='w25 cell border cell-with-id-card'
          class-buttons='w25 cell border cell-with-buttons'

          widget-buttons="admin-project-buttons"
          action-buttons="buttons"

          widget-captain='project-captain'
          widget-members='project-admins'
        )

  #admin-project-create(hidden)
    include page-admin-projects-create.pug