<div class="row">
  <div class="col-12">
    <h2>Recent Notes (last 10)</h2>

    <% unless @notes.load.empty? %>
      <% @notes.each do |note| %>
        <p>
          <em>
            <%= note.created_at.strftime("%d %B %Y %H:%M UTC") %> by <%= User.find(note.author_id).username if note.author_id.present? %>
          </em> - 
          <% unless note.reason.blank? %>
            <strong><%= note.reason %>:</strong>
          <% end %>
          <%= note.content %>
        </p>
      <% end %>
    <% else %>
      <p><em>No notes yet!</em></p>
    <% end %>
    <%= form_with model: @user, url: internal_user_path(@user), method: :patch, html: { class: "mb-2" }, local: true  do |f| %>
      <div class="form-group">
        <%= f.label "Add new note: ", class: "d-block" %>
        <%= f.text_area :new_note, class: "form-control" %>
      </div>
      <%= f.submit "Submit Note", class: "btn btn-primary float-right" %>
    <% end %>
  </div>
</div>
