app/views/volunteers/_notes.html.erb
<div class="notes">
<h1 class="pt-5 mb-2">Notes</h1>
<div class="card card-container">
<div class="card-body">
<% if @volunteer.notes != [] %>
<h3 class="mb-4">Notes About This Volunteer</h3>
<div class="table-wrapper table-responsive">
<table class="table">
<thead>
<tr>
<th>Note</th>
<th>Creator</th>
<th>Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @volunteer.notes.each do |note| %>
<tr>
<td class="min-width"><%= note.content %></td>
<td class="min-width"><%= note.creator.display_name %></td>
<td class="min-width"><%= l(note.created_at, format: :standard) %></td>
<td class="min-width">
<%= link_to edit_volunteer_note_path(@volunteer, note), class: "main-btn primary-btn btn-hover btn-sm" do %>
<i class="lni lni-pencil-alt mr-5"></i> Edit
<% end %>
<%= link_to volunteer_note_path(@volunteer, note), class: "main-btn danger-btn btn-hover btn-sm", method: :delete do %>
<i class="lni lni-trash-can mr-5"></i> Delete
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>
<br>
<%= form_with(model: @volunteer.notes.new, local: true, url: volunteer_notes_path(@volunteer),
id: "volunteer-note-form") do |form| %>
<h3 class="mb-3">Create a New Note</h3>
<div class="input-style-1">
<%= form.text_area :content, :rows => 5, placeholder: "Enter a note regarding the volunteer. These notes are only visible to CASA administrators and supervisors.",
class: "form-control" %>
</div>
<div class="actions">
<%= button_tag(
type: "submit",
class: "main-btn primary-btn btn-hover btn-sm",
id: "note-submit"
) do %>
<i class="lni lni-save mr-5"></i> Save Note
<% end %>
</div>
<% end %>
</div>
</div>
</div>