extends ../layouts/main
block content

  .uk-margin
    h1(style="line-height: 1em;").uk-text-truncate.uk-margin-remove Newsletters
  
  .uk-margin
    if (Array.isArray(newsletters) && (newsletters.length > 0))
      ul.uk-list
        each newsletter in newsletters
          li(data-newsletter-id= newsletter._id)
            div(uk-grid).uk-grid-small.uk-flex-middle
              .uk-width-expand
                a(href=`/admin/newsletter/${newsletter._id}`).uk-display-block.uk-text-large.uk-text-truncate= newsletter.title

              .uk-width-auto
                div(uk-grid).uk-grid-small
                  .uk-width-auto
                    button(
                      type="button",
                      data-newsletter-id= newsletter._id,
                      data-newsletter-title= newsletter.title,
                      onclick="return dtp.adminApp.deleteNewsletter(event);",
                    ).uk-button.uk-button-danger
                      +renderButtonIcon('fa-trash', 'Delete')

                  .uk-width-auto
                    button(
                      type="button",
                      data-newsletter-id= newsletter._id,
                      data-newsletter-title= newsletter.title,
                      onclick="return dtp.adminApp.sendNewsletter(event);",
                    ).uk-button.uk-button-default
                      +renderButtonIcon('fa-paper-plane', 'Send')
    else
      div There are no newsletters at this time.