<%# locals: { legend, person, person_id, fragment_name, person_list, tooltip } %>
<% tooltip ||= ""%>
<fieldset class="project-details">
  <legend class="project-details" title="<%= tooltip %>"><%= legend %></legend>
  <div class="form-group">
    <div class="col-md-12">
      <%= f.label "#{fragment_name}_person_list", _('Please choose a person from the list or create a new one.'), class: 'control-label' %>
    </div>
    <div class="col-md-10">
      <%= select_tag "#{fragment_name}_person_list",
                    options_for_select(
                      person_list.map { |p| [
                        p.to_s, p.id, 
                        { "data-url" => get_fragment_madmp_fragments_path(p.id, plan_id: plan.id) } 
                      ] }, 
                      selected: person_id),
                    class: "form-control generic-fragment-picker",
                    :disabled => person_list.empty?  %>
    </div>
  </div>
  <div class="form-group"><!-- person_surname -->
    <%= create_text_field(
          f, 
          person ? person["lastName"] : nil, 
          "#{fragment_name}[lastName]", 
          _('Surname'),
          html_class: "person_lastName"
        ) 
    %>
  </div>
  <div class="form-group"><!-- person_firstname -->
    <%= create_text_field(
          f, 
          person ? person["firstName"] : nil, 
          "#{fragment_name}[firstName]", 
          _('Firstname'),
          html_class: "person_firstName"
        ) 
    %>
  </div>
  <div class="form-group"><!-- person_email -->
    <%= create_email_field(
          f, 
          person ? person["mbox"] : nil, 
          "#{fragment_name}[mbox]", 
          _('Email'),
          html_class: "person_mbox"
        ) 
    %>
  </div>
  <div class="form-group"><!-- person_identifier -->
    <%= create_text_field(
          f, 
          person ? person["identifier"] : nil, 
          "#{fragment_name}[identifier]", 
          _('Identifier'),
          html_class: "person_identifier"
        ) 
    %>
  </div>
</fieldset>