extends /layout

block pageSpecificScipts
  script(nonce=cspNonce src="/javascripts/admin.js")

block body
  section#fixed-top-section
    include /common/main-navigation
    +main-navigation(false)
  include /common/side-menu-mixin-admin
  - const d = { activeLvl1: 'dictionaries', activeLvl2: 'list' }
  +sideNavigation(d)

  include /utilities/dictionaries-main-panel-header
  - const c = { sideMenu: true, h2: t('Slovarji'), h1: t('Seznam slovarjev'), description: t('Seznam vseh slovarjev, ki jih uredniki, sicer registrirani uporabniki, urejajo na tem portalu.'), buttons: [{ type: 'link', content: t('Dodaj slovar'), url: '/slovarji/nov' }] }
  +mainHeader(c)
  .content-hold-prerequisites
    #offset-main.main-container.mt-3
      .d-flex.justify-content-end
        .d-flex
          include /utilities/pager
          +pager
        -
          const localeOptions = {
            day: '2-digit',
            month: '2-digit',
            year: 'numeric',
            hour: '2-digit',
            minute: '2-digit',
          }  

      .table-responsive
        table.styled-table
          thead
            tr#thead
              th= 'ID'
              th= t('NASLOV')
              th= t('STATUS')
              th= t('USTVARJEN')
              th= t('SPREMENJEN')
              th= ''
          tbody#page-results 
            each result in results
              tr
                td= result.id
                td= result.name
                if result.status === 'closed'
                  td= t('zaprt')
                else if result.status ==='reviewed'
                  td= t('v predogledu')
                else
                  td= t('odprt')
                - const dateC = new Date(result.timeCreated).toLocaleDateString('sl-SL', localeOptions)
                - const dateM = new Date(result.timeModified).toLocaleDateString('sl-SL', localeOptions)
                td= dateC
                td= dateM
                td
                  a.image-link(
                    type="link"
                    href=`/admin/slovarji/${result.id}/podatki`
                  )
                    img(src="/images/u_edit-alt.svg" alt=t('Uredi'))
                    span.normal-gray.ms-1= t('Uredi')

      include /common/footer
