app/views/admin/reports/alert_subscribers/index.html.erb
<% content_for :page_title, 'Report: Alert subscribers' %>
<h1>Alert subscribers</h1>
<p>These are all the users who have subscribed to recieve alert notifications.</p>
<div id="top" class="d-flex justify-content-between align-items-center">
<form action="" class="form">
<label for="admin-user-picker">See</label>
<select id="admin-user-picker" class="admin-user-picker">
<% @school_groups.each do |school_group| %>
<option value="#<%= school_group.name.parameterize %>"><%= school_group.name %></option>
<% end %>
</select>
</form>
</div>
<% @school_groups.each do |school_group| %>
<div class="row nav-anchor">
<div class="col">
<a name="<%= school_group.name.parameterize %>"> </a>
<h3><%= school_group.name %></h3>
</div>
</div>
<table class="table table-sorted">
<thead>
<tr>
<th>Name</th>
<th>School</th>
<th>Email</th>
<th>Phone number for SMS</th>
<th>User</th>
<th></th>
</tr>
</thead>
<tbody>
<% school_group.schools.by_name.each do |school| %>
<% if school.contacts.any? %>
<% school.contacts.each do |contact| %>
<tr>
<td><%= link_to contact.name, school_contacts_path(contact.school) %></td>
<td><%= link_to school.name, school_path(school) %></td>
<td><%= contact.email_address %></td>
<td><%= contact.mobile_phone_number %></td>
<td><%= link_to contact.user_id, edit_admin_user_path(id: contact.user_id) if contact.user_id %></td>
<td><%= link_to "Edit", edit_school_contact_path(contact.school, contact) , class: 'btn btn-success btn-sm' %></td>
</tr>
<% end %>
<% end %>
<% end %>
</tbody>
</table>
<% end %>