<%- model_class = Plan -%>
<% javascript('views/plans/export_configure.js') %>
<!-- render the project title -->
<h1><%= @plan.title %></h1>
<div class="content">
<div class="tabbed-area">
<!-- render navigation tabs for the project-->
<!-- Should this section live in a partial? -->
<ul class="tabs" role="tablist">
<li id="details-tab" role="tab" aria-controls="details-panel">
<a href="<%= plan_path(@plan) %>" aria-selected="false"><%= _('Project Details') %></a>
</li>
<% @plan.template.phases.each do |phase| %>
<li id="phase-#<%= phase.id %>-tab" role="tab" aria-controls="phase-#<%= phase.id %>-panel">
<a href="<%= edit_plan_phase_path(@plan, phase) %>" aria-selected="false"><%= (@plan.template.phases.length > 1 ? phase.title : _('Write Plan')) %></a>
</li>
<% end %>
<li id="share-tab" role="tab" aria-controls="share-panel">
<a href="<%= share_plan_path(@plan) %>" aria-selected="false"><%= _('Share') %></a>
</li>
<li id="download-tab" role="tab" aria-controls="download-panel" class="active">
<a href="#download-panel" aria-selected="true"><%= _('Download') %></a>
</li>
</ul>
<!-- project details -->
<div class="tab-panels" role="tabpanel">
<!-- main info to export -->
<div class="tab-panel active" aria-hidden="false">
<!--Text describing page content-->
<h2><%= _("Download Settings") %></h2>
<fieldset>
<%= form_tag( export_plan_path(@plan), method: :get, html: {class: "roadmap-form"}) do |f| %>
<% if @phase_options.length > 1 %>
<p><legend><strong><%= _("Select Phase to Download") %></strong></legend></p>
<div class="form-input">
<%= label_tag(:phase_id, _("Phase")) %>
<%= select_tag(:phase_id, options_for_select(@phase_options, @phase_options[0])) %>
</div>
<% else %>
<%= hidden_field_tag(:phase_id, @phase_options[0][1]) %>
<% end %>
<p><legend><strong><%= _("Optional plan components") %></strong></legend></p>
<div class="form-input">
<%= check_box_tag 'export[project_details]', true, false %>
<%= label_tag 'export[project_details]', _('project details coversheet'), class: 'checkbox-label' %>
</div>
<div class="form-input">
<%= check_box_tag 'export[question_headings]', true, true, class: 'question-headings'%>
<%= label_tag 'export[question_headings]', _('questions as headings'), class: 'checkbox-label' %>
</div>
<div class="form-input">
<%= check_box_tag 'export[unanswered_questions]', true, true, class: 'unanswered-questions' %>
<%= label_tag 'export[unanswered_questions]', _('unanswered questions'), class: 'checkbox-label' %>
</div>
<% if @plan.template.customization_of.present? %>
<div class="form-input">
<%= check_box_tag 'export[custom_sections]', true, false %>
<%= label_tag 'export[custom_sections]', _('supplimental section(s) not requested by funding organisation'), class: 'checkbox-label' %>
</div>
<% end %>
<!-- drop down box for formatting -->
<div></div>
<div class="form-input">
<%= label_tag(:format, _('Format')) %>
<%= select_tag(:format, options_for_select(ExportedPlan::VALID_FORMATS, :pdf), class: 'export-format-selection') %>
</div>
<!-- PDF formatting section -->
<div id="pdf-format-options">
<div class="form-separator"></div>
<h3><%= _('PDF Formatting') %></h3>
<fieldset class="font">
<legend><%= _('Font') -%></legend>
<div>
<%= label_tag("export[formatting][font_face]", _('Face')) %>
<%= select_tag("export[formatting][font_face]", options_for_select(Settings::Template::VALID_FONT_FACES, @export_settings.formatting[:font_face]), { "data-default" => @plan.template.settings(:export).formatting[:font_face] }) %>
</div>
<div>
<%= label_tag("export[formatting][font_size]", _('Size') + " (pt)") %>
<%= select_tag("export[formatting][font_size]", options_for_select(Settings::Template::VALID_FONT_SIZE_RANGE.to_a, @export_settings.formatting[:font_size]), { "data-default" => @plan.template.settings(:export).formatting[:font_size] }) %>
</div>
</fieldset>
<fieldset class="margins">
<legend><%= _('Margin') -%> (mm)</legend>
<div>
<%= label_tag("export[formatting][margin][top]", _('Top')) %>
<%= select_tag("export[formatting][margin][top]", options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, @export_settings.formatting[:margin][:top]), { "data-default" => @plan.template.settings(:export).formatting[:margin][:top] }) %>
</div>
<div>
<%= label_tag("export[formatting][margin][bottom]", _('Bottom')) %>
<%= select_tag("export[formatting][margin][bottom]", options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, @export_settings.formatting[:margin][:bottom]), { "data-default" => @plan.template.settings(:export).formatting[:margin][:bottom] }) %>
</div>
<div>
<%= label_tag("export[formatting][margin][left]", _('Left')) %>
<%= select_tag("export[formatting][margin][left]", options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, @export_settings.formatting[:margin][:left]), { "data-default" => @plan.template.settings(:export).formatting[:margin][:left] }) %>
</div>
<div>
<%= label_tag("export[formatting][margin][right]", _('Right')) %>
<%= select_tag("export[formatting][margin][right]", options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, @export_settings.formatting[:margin][:right]), { "data-default" => @plan.template.settings(:export).formatting[:margin][:rigth] }) %>
</div>
</fieldset>
</div>
<div class='form-input'>
<div class="button-spacer"> </div>
<%= submit_tag _('Download Plan'), class: 'btn btn-primary', role: 'button' %>
</div>
<!-- save button -->
<% end %>
</fieldset>
</div>
</div>
</div>
</div>