extends ../layouts/main
block content

  div(uk-grid).uk-grid-small
    .uk-width-expand
      h1 Announcements
    .uk-width-auto
      a(href="/admin/announcement/create").uk-button.dtp-button-primary
        span
          i.fas.fa-plus
        span.uk-margin-small-left Create

  if Array.isArray(announcements) && (announcements.length > 0)
    ul.uk-list.uk-list-divider
      each announcement in announcements
        li
          div(uk-grid).uk-grid-small.uk-flex-middle
            .uk-width-expand
              a(href=`/admin/announcement/${announcement._id}`)
                span
                  i(class=`fas ${announcement.title.icon.class}`)
                span.uk-margin-small-left= announcement.title.content
            .uk-width-auto
              button(type="button", data-announcement-id= announcement._id, onclick="return dtp.adminApp.deleteAnnouncement(event);").uk-button.dtp-button-danger
                span
                  i.fas.fa-trash
  else
    div There are no announcements.