app/views/schools/times/edit.html.erb
<h1><%= t('schools.times.edit.title') %></h1>
<div class="alert alert-warning">
<%= t('schools.times.edit.introduction_message') %>
</div>
<%= form_for(@school, url: school_times_path(@school)) do |f| %>
<%= render 'schools/times/form', f: f %>
<div class="actions">
<%= f.submit t('schools.times.edit.save_school_times'), class: 'btn btn-primary' %>
</div>
<% end %>
<div class="row pt-3">
<div class="col">
<h1 id="community-use-section"><%= t('schools.times.edit.community_use.title') %></h1>
</div>
</div>
<div class="row">
<div class="col">
<p>
<%= t('schools.times.edit.community_use.school_premises_message') %>.
</p>
<p>
<%= t('schools.times.edit.community_use.use_the_form_message') %>.
</p>
<p>
<%= t('schools.times.edit.community_use.breakfast_and_after_school_clubs') %>.
</p>
<p>
<%= t('schools.times.edit.community_use.twenty_four_hour_format_message') %>.
</p>
</div>
</div>
<div class="row pt-2">
<div class="col-md-3 mb-3">
<label for="day"><strong><%= t('schools.times.edit.community_use.day') %></strong></label>
</div>
<div class="col-md-2 mb-3">
<label for="opening-time"><strong><%= t('schools.times.edit.community_use.opening_time') %></strong></label>
</div>
<div class="col-md-2 mb-3">
<label for="closing-time"><strong><%= t('schools.times.edit.community_use.closing_time') %></strong></label>
</div>
<div class="col-md-3 mb-3">
<label for="term-only"><strong><%= t('schools.times.edit.community_use.time_of_year') %></strong></label>
</div>
</div>
<%= form_for(@school, url: school_times_path(@school), html: { id: :community_use_form }) do |f| %>
<div id="school-times">
<%= f.simple_fields_for(:school_times,
f.object.school_times.select { |t| t.usage_type == 'community_use' }
.sort_by { |time| time.day ? SchoolTime.days[time.day] : 99 }) do |school_time| %>
<%= render 'schools/times/school_time_fields', f: school_time %>
<% end %>
<div class="links mt-2">
<%= link_to_add_association t('schools.times.edit.community_use.add_time'), f,
:school_times,
partial: 'schools/times/school_time_fields',
wrap_object: proc { |time|
time.usage_type = :community_use
time.community_use_defaults!
time
}, class: 'btn' %>
<%= f.submit t('schools.times.edit.community_use.save_community_use_times'), class: 'btn btn-primary' %>
</div>
</div>
<% end %>