<!-- Project title = default title is the template title plus date of creation -->
<div class="dmp_details_body">
<!--
we have two div for the plan details
one is for editing and one is for viewing
one is always hidden and we switch between them with javascript in application.js
-->
<!-- the editing div -->
<div class="edit-plan-details <%= unless @editing then "project-hide" end %>">
<!-- edit pro ject button -->
<div class="div_left">
<p>
<%= raw t('helpers.project.project_details_editing_text_html')%>
</p>
</div>
<div class="div_right">
<a href='#' class='btn btn-primary show-edit-toggle'><%= t("helpers.links.cancel") %></a>
</div>
<div class="div_clear"> </div>
<%= semantic_form_for @plan, :url => {:controller => :plans, :action => :update }, :html=>{:method=>:put} do |f| %>
<%= f.inputs do %>
<div class="dmp_details">
<!-- If not first time login in or editing project details -->
<table class="dmp_details_table">
<tr>
<td class="first"><%= t('helpers.project.project_name') %></td>
<td>
<%= f.text_field :title, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.project_name_help_text') %>
</td>
</tr>
<tr>
<td class="first"><%= t('helpers.project.project_identifier') %></td>
<td>
<%= f.text_field :identifier, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.project_identifier_help_text') %>
</td>
</tr>
<tr>
<td class="first"><%= t('helpers.project.grant_title') %></td>
<td>
<%= f.text_field :grant_number, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.grant_help_text') %>
</td>
</tr>
<tr>
<td class="first"><%= t('helpers.project.principal_investigator') %></td>
<td>
<%= f.text_field :principal_investigator, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.principal_investigator_help_text') %>
</td>
</tr>
<tr>
<td class="first"><%= t('helpers.project.principal_investigator_id') %></td>
<td>
<%= f.text_field :principal_investigator_identifier, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.principal_investigator_id_help_text') %>
</td>
</tr>
<tr>
<td class="first"><%= t('helpers.project.project_data_contact') %></td>
<td>
<%= f.text_field :data_contact, :class => 'text_field has-tooltip', 'data-toggle' => "tooltip", 'title' => t('helpers.project.project_data_contact_help_text') %>
</td>
</tr>
<tr>
<td class="first"><%= t('helpers.desc') %></td>
<td>
<%= f.text_area :description, { :rows => 7, :class => 'text_area has-tooltip', 'data-toggle' => "tooltip", 'data-html' => "true", 'title'=> t('helpers.project.project_desc_help_text_html')} %>
</td>
</tr>
</table>
</div>
<% end %>
<!-- submit buttons -->
<%= f.actions do %>
<div class="move_2_right">
<%= f.submit t("helpers.submit.save"), :class => 'btn btn-primary' %>
<a href='#' class='btn btn-primary show-edit-toggle'><%= t("helpers.links.cancel") %></a>
</div>
<%end%>
<%end%>
</div>
<!-- the viewing div -->
<div class="show-plan-details <%= if @editing then "project-hide" end %> ">
<div class="div_left">
<p> <%= t('helpers.project.project_details_text_html')%> </p>
</div>
<!-- edit plan button -->
<div class="div_right">
<a href='#' class='btn btn-primary show-edit-toggle'><%= t("helpers.project.edit") %></a>
</div>
<!-- display plan details -->
<div class="dmp_details">
<table class="dmp_details_table">
<tr>
<td class="first"><%= t('helpers.project.project_name') %></td>
<td><%= @plan.title %></td>
</tr>
<tr>
<td class="first"><%= t('helpers.project.project_identifier') %></td>
<td>
<% if !@plan.identifier.nil? && @plan.identifier != "" then %>
<%= @plan.identifier %>
<%else%>
-
<%end%>
</td>
</tr>
<tr>
<td class="first"><%= t('helpers.project.grant_title') %></td>
<td>
<% if !@plan.grant_number.nil? && @plan.grant_number!= "" then %>
<%= @plan.grant_number %>
<%else%>
-
<%end%>
</td>
</tr>
<tr>
<td class="first"><%= t('helpers.project.principal_investigator') %></td>
<td><% if !@plan.principal_investigator.nil? && @plan.principal_investigator != "" then %>
<%= @plan.principal_investigator %>
<%else%>
-
<%end%>
</td>
</tr>
<% if !@plan.principal_investigator_identifier.nil? && @plan.principal_investigator_identifier != "" then %>
<tr>
<td class="first"><%= t('helpers.project.principal_investigator_id') %></td>
<td>
<%= @plan.principal_investigator_identifier %>
</td>
</tr>
<%end%>
<tr>
<td class="first"><%= t('helpers.project.project_data_contact') %></td>
<td><% if !@plan.data_contact.nil? && @plan.data_contact != "" then%>
<%= @plan.data_contact %>
<%else%>
-
<%end%>
</td>
</tr>
<tr>
<td class="first"><%= t('helpers.desc') %></td>
<td><% if !@plan.description.nil? && @plan.description != "" then%>
<%= @plan.description %>
<%else%>
-
<%end%>
</td>
</tr>
</table>
</div>
</div>
<!-- Selection of guidance groups -->
<div class="accordion" id="plan-guidance-accordion">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#plan-guidance-accordion" href="#guidance-choices">
<h3>Guidance Choices<span class="plus-laranja"> </span></h3>
</a>
</div>
<div id="guidance-choices" class="accordion-project collapse">
<div class="accordion-inner">
<%= semantic_form_for @plan, :url => {:controller => :plans, :action => :update_guidance_choices }, :html=>{:method=>:put}, :remote => true do |f| %>
<%= f.inputs do %>
<%= f.input :plan_guidance_groups,
:as => :check_boxes,
:collection => selected_guidance_groups %>
<% end %>
<!-- submit buttons -->
<%= f.actions do %>
<div class="move_2_right">
<%= f.submit t("helpers.submit.save"), :class => 'btn btn-primary' %>
<a href='#' class='btn btn-primary show-edit-toggle'><%= t("helpers.links.cancel") %></a>
</div>
<%end%>
<%end%>
</div>
</div>
</div>
</div>
<div class="div_clear"></div>
<h3><%= t('helpers.project.project_static_info')%></h3>
<table class="dmp_details_table">
<!-- get the funder name if there is one -->
<%if @plan_data["template"]["org"]["name"].present? %>
<tr>
<td class="first"><%= constant("organisation_types.funder") %></td>
<td><%= @plan_data["template"]["org"]["name"] %></td>
</tr>
<%end%>
<%if @plan_data["template"]["customization_of"].present? %>
<%= " (Customised from " + @plan_data["template"]["customization_of"]["org"]["name"] + ")" %>
<%end%>
</table>
<div class="div_clear"></div>
<!-- If project has phases-->
<% phases = @plan_data["template"]["phases"] %>
<% if phases.any? %>
<% if phases.count == 1 then %>
<% phases.each do |phase| %>
<div class="move_2_right">
<%= link_to t('helpers.answer_questions'), edit_plan_path(plan), :class => 'btn btn-primary' %>
<a href="#<%= plan.id %>-export-dialog" data-toggle="modal" class='btn btn-primary'><%= t('helpers.export') %></a>
</div>
<%= render :partial => "plans/export", locals: {plan: plan, plan_data: plan_data} %>
<div class="div_clear"></div>
<p><%= raw phase["description"] %></p>
<% if phase["sections"].any? %>
<table class="dmp_table">
<thead>
<tr>
<th class="dmp_th_medium"><%= t('helpers.sections_label')%></th>
<th class="dmp_th_big"><%= t('helpers.questions_label')%></th>
</tr>
</thead>
<tbody>
<% phase["sections"].each do |section| %>
<tr >
<th class="dmp_th_border" >
<p><%= section["title"] %></p>
</th>
<td class="dmp_td_border" >
<% if section["questions"].any? %>
<ul class="question_ul">
<% section["questions"].each do |ques|%>
<li>
<%= raw ques["text"] %>
</li>
<%end%>
</ul>
<%end%>
</td>
</tr>
<%end%>
</tbody>
</table>
<%end%>
<%end%>
<%else%> <!-- phases.count > 1 -->
<div class="project_description">
<%= raw plan_data["template"]["description"] %>
</div>
<% phases.each do |phase| %>
<div class="accordion" id="project-accordion">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#project-accordion" href="#<%= phase["id"] %>">
<h3><%= phase["title"] %><span class="plus-laranja"> </span>
</h3>
</a>
</div>
<div id="<%= phase["id"] %>" class="accordion-project collapse">
<div class="accordion-inner">
<div class="div_right">
<%= link_to t('helpers.answer_questions'), edit_plan_path(plan), :class => 'btn btn-primary' %>
<a href="#<%= phase["id"] %>-export-dialog" data-toggle="modal" class='btn btn-primary'><%= t('helpers.export') %></a>
</div>
<%= render :partial => "plans/export", locals: {plan: plan, plan_data: plan_data} %>
<div class="div_clear"></div>
<p><%= raw phase["description"] %>
</p>
<% if phase["sections"].any? %>
<table class="dmp_table">
<thead>
<tr>
<th class="dmp_th_medium"><%= t('helpers.sections_label')%></th>
<th class="dmp_th_big"><%= t('helpers.questions_label')%></th>
</tr>
</thead>
<tbody>
<% phase["sections"].each do |section| %>
<tr >
<th class="dmp_th_border" >
<p><%= section["title"] %></p>
</th>
<td class="dmp_td_border" >
<% if section["questions"].any? %>
<ul class="question_ul">
<% section["questions"].each do |ques|%>
<li>
- <%= raw ques["text"] %>
</li>
<%end%>
</ul>
<%end%>
</td>
</tr>
<%end%>
</tbody>
</table>
<%end%>
</div>
</div>
</div>
</div>
<%end%>
<%end%>
<%end%>
</div>