<br>
<h2><%= _('Template Overview') %></h2>
<% phases.each do |phase| %>
<hr>
<div class="row">
<div class="col-md-12">
<div>
<h3>
<%= phase.title %>
<div class="pull-right">
<% if template.customization_of.present? && template.latest? %>
<%= link_to _('Customize phase'), org_admin_template_phase_path(template.id, phase.id), { class: "btn btn-default", role: 'button' } %>
<% elsif modifiable %>
<%= link_to _('Edit phase'), edit_org_admin_template_phase_path(template.id, phase.id), { class: "btn btn-default", role: 'button' } %>
<% else %>
<%= link_to _('Show phase'), org_admin_template_phase_path(template.id, phase.id), { class: "btn btn-default", role: 'button' } %>
<% end %>
<% if template.latest? && phase.modifiable %>
<%= link_to _('Delete phase'), org_admin_template_phase_path(template.id, phase.id),
data: { confirm: _("You are about to delete the '%{phase_title}' phase. This will remove all of the sections and questions listed below. Are you sure?") % { phase_title: phase.title },
length: 20, omission: _('... (continued)') }, method: :delete, class: 'btn btn-default', role: 'button' %>
<% end %>
</div>
</h3>
<p class="pull-left">
<%= raw phase.description %>
</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<% if phase.sections.length > 0 %>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th scope="col"><%= _('Sections')%></th>
<th scope="col"><%= _('Questions')%></th>
</tr>
</thead>
<tbody>
<% phase.sections.each do |section| %>
<tr>
<td><p><%= section.title %></p></td>
<td>
<% if section.questions.present? %>
<ul>
<% section.questions.each do |question| %>
<li>
<%= raw question.text %>
<% if question.question_options.length > 0 %>
<ul>
<% question.question_options.each do |option| %>
<li><%= option.text %></li>
<% end %>
</ul>
<% end %>
</li>
<% end %>
</ul>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>
</div>
</div>
<% end %>