app/views/schools/contacts/index.html.erb
<% content_for :page_title do %>
<%= t('schools.contacts.index.title', school_name: @school.name) %>
<% end %>
<h1 property="name">
<%= t('schools.contacts.index.alert_contacts') %>
</h1>
<%= render 'shared/contact_explainer' %>
<p>
<%= t('schools.contacts.index.alert_contacts_message') %>
</p>
<h2>
<%= t('schools.contacts.index.account_contacts') %>
</h2>
<div class="table-responsive mt-2">
<table class="table table-striped">
<thead>
<tr>
<th><%= t('schools.contacts.index.name') %></th>
<th><%= t('schools.contacts.index.email_address') %></th>
<th><%= t('schools.contacts.index.mobile_phone_number') %></th>
<th><%= t('schools.contacts.index.receives_alerts') %></th>
<th><%= t('schools.contacts.index.role') %></th>
<th><%= t('schools.contacts.index.preferred_locale') %></th>
<th><%= t('schools.contacts.index.actions') %></th>
</tr>
</thead>
<tbody>
<% @account_contacts.each do |contact| %>
<tr scope="row">
<td><%= contact.name %></td>
<td><%= contact.email_address %></td>
<td><%= contact.mobile_phone_number %></td>
<td><%= y_n(true) %></td>
<td><%= contact.staff_role.try(:translated_title) %></td>
<td><%= I18n.t("languages.#{contact.preferred_locale}") %></td>
<td class="nowrap">
<div class="btn-group">
<%= link_to t('schools.contacts.edit.disable_alerts'), school_contact_path(@school, contact), method: :delete, data: { confirm: t('common.confirm') }, class: 'btn btn-danger', id: "disable_alerts_#{contact.id}" %>
<%= link_to t('schools.contacts.edit.edit_phone_number'), edit_school_contact_path(@school, contact) %>
</div>
</td>
</tr>
<% end %>
<% @accounts_without_contacts.each do |user| %>
<tr scope="row">
<td><%= user.name %></td>
<td><%= user.email %></td>
<td></td>
<td><%= y_n(false) %></td>
<td><%= user.staff_role.try(:translated_title) %></td>
<td><%= I18n.t("languages.#{user.preferred_locale}") %></td>
<td class="nowrap">
<div class="btn-group">
<%= link_to t('schools.contacts.edit.enable_alerts'), new_school_contact_path(@school, user_id: user.id), class: 'btn btn-warning', id: "enable_alerts_#{user.id}", class: 'btn btn-warning' %>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% if @standalone_contacts.any? %>
<h2><%= t('schools.contacts.index.standalone_contacts') %></h2>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th><%= t('schools.contacts.index.name') %></th>
<th><%= t('schools.contacts.index.email_address') %></th>
<th><%= t('schools.contacts.index.mobile_phone_number') %></th>
<th><%= t('schools.contacts.index.role') %></th>
<th><%= t('schools.contacts.index.actions') %></th>
</tr>
</thead>
<tbody>
<% @standalone_contacts.each do |contact| %>
<tr scope="row">
<td><%= contact.name %></td>
<td><%= contact.email_address %></td>
<td><%= contact.mobile_phone_number %></td>
<td><%= contact.staff_role.try(:translated_title) %></td>
<td>
<div class="btn-group">
<%= link_to t('common.labels.edit'), edit_school_contact_path(@school, contact), class: 'btn btn-warning' %>
<%= link_to t('common.labels.delete'), school_contact_path(@school, contact), method: :delete, data: { confirm: t('common.confirm') }, class: 'btn btn-danger' %>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>