
<% persons = @plan.json_fragment().persons %>
<% meta_fragment = @plan.json_fragment().meta%>
<% project_fragment = @plan.json_fragment().project%>
<div class="row">
  <%= form_for plan, html: {method: :put, class: 'form-horizontal edit_plan' } do |f| %>
    <div class="col-md-12 plan-details">
      <!-- Tabs content -->
      <div class="tab-content">
        <!-- "Plan Metadata" tab -->
        <div id="plan_metadata" class="tab-pane in active madmp-fragment fragment-<%= meta_fragment.id %>">
          <h2><%= _("Plan Metadata") %></h2>
          <div class="meta-form">
            <%= render(partial: 'shared/dynamic_form/form', locals: { 
                  f: f,
                  fragment: meta_fragment, 
                  schema: MadmpSchema.find_by(name: "MetaStandard"),
                  question_id: nil,
                  readonly: false,
                  classname: "meta",
                  fragment_id: meta_fragment.id,
                  template_locale: @plan.template.locale,
                  form_prefix: "meta"
                }) %>
          </div>
          <%= f.button(_('Save'), class: "btn btn-default", type: "submit") %>
        </div>
        <!-- "Project Details" tab -->
        <div id="plan_project" class="tab-pane madmp-fragment fragment-<%= project_fragment.id %>">
          <h2><%= _("Project Details") %></h2>
          <div class="project-form">
            <%= render(partial: 'shared/dynamic_form/form', locals: { 
                  f: f,
                  fragment: project_fragment, 
                  schema: MadmpSchema.find_by(name: "ProjectStandard"),
                  question_id: nil,
                  readonly: false,
                  classname: "project",
                  fragment_id: project_fragment.id,
                  template_locale: @plan.template.locale,
                  form_prefix: "project"
                }) %>
          </div>
          <%= f.button(_('Save'), class: "btn btn-default", type: "submit") %>
        </div>
        <!-- "Guidance Configuration" tab -->
        <div id="guidance_configuration" class="tab-pane">
          <%= render(partial: 'plans/guidance_configuration', locals: { f: f } ) %>
        </div>
      </div>
      <ul class="nav nav-tabs form-tabs">
        <li class="active">
          <span data-toggle="tab" data-target="#plan_metadata"><i class="fa fa-arrow-left"></i> <%= _("Plan Metadata") %></span>
        </li>
        <li>
          <span data-toggle="tab" data-target="#plan_project"><i class="fa fa-arrow-left"></i> <%= _("Project Details") %></span>
        </li>
        <li>
          <span data-toggle="tab" data-target="#guidance_configuration"><i class="fa fa-arrow-left"></i> <%= _("Guidance Configuration") %></span>
        </li>
      </ul>
    </div>
  <% end %>
</div>
<div class="modal fade" id="modal-window" tabindex="-1" role="dialog" aria-labelledby="linkedInformationsModal" aria-hidden="true"></div>