% layout 'admin';
% title 'Feedback';
% content_for javascript => begin
% end
% if ( my $error = flash 'error' ) {
  <div class="alert alert-danger" role="alert">
    <strong>Error!</strong> <%= $error %>
  </div>
% } elsif ( my $success = flash 'success' ) {
  <div class="alert alert-success" role="alert">
    <strong>Success!</strong> <%= $success %>
  </div>
% }
<div class="row">
  % for my $feedback ( $feedback_rs->all ) {
  <div class="col col-md-4 mb-3">
    <div class="card">
      <div class="card-header<%= $feedback->actioned ? '' : ' text-white bg-danger' %>">
        <span class="font-bold"><%= $feedback->id %></span>
        %= $feedback->user->email;
      </div>
      <div class="card-body">
        <h6 class="card-title">
          %= format_human_datetime $feedback->submitted_at;
        </h6>
        <pre class="card-text feedback-text"><%= truncate_text $feedback->feedbacktext => 50; %></pre>
      </div>
      <div class="card-footer text-right">
        <a href="<%= url_for . '/' . $feedback->id %>" class="card-link">
          More info
        </a>
      </div>
    </div>
  </div>
  % }
</div>
<div class="row">
  <div class="col">
      %= bootstrap_pagination( $c->param('page') || 1, $feedback_rs->pager->last_page, { class => 'justify-content-center' } );
  </div>
</div>
