<!-- edit template details A template is passed as an argument-->
<%= form_for(template, url: admin_update_template_path(template), html: { method: :put }) do |f| %>
  <div class="form-group col-xs-8">
    <%= f.label(:title, _('Title'), class: "control-label") %>
    <%= f.text_field(:title, class: "form-control", "aria-required": false, 'data-toggle': 'tooltip', title: _('Please enter a title for your template.')) %>
  </div>
  
  <div class="form-group col-xs-8">
    <%= f.label(:description, _('Description'), class: "control-label") %>
    <div data-toggle="tooltip" title="<%= _('Enter a description that helps you to differentiate between templates e.g. if you have ones for different audiences') %>">
      <%= text_area_tag("template-desc", template.description, { class: 'template', "aria-required": false }) %>
    </div>
  </div>

  <div class="form-group col-xs-8">
    <%= label_tag(:status, _('Status'), class: "control-label") %>
      <p class="form-control-static">
        <% if template_hash[:live].nil? %>
          <%= _('Unpublished') %>
        <% elsif template_hash[:current].dirty? %>
          <%= _('You have un-published changes') %>
        <% else %>
          <%= _('Published') %>
        <% end %>
      </p>
  </div>

  <div class="form-group col-xs-8">
    <%= label_tag(:created_at, _('Created at'), class: "control-label") %>
    <p class="form-control-static">
      <%= l template.created_at.to_date, formats: :short %>
    </p>
  </div>

  <div class="form-group col-xs-8">
    <%= label_tag(:updated, _('Last updated'), class: "control-label") %>
    <p class="form-control-static">
      <%= l template.updated_at.to_date, formats: :short %>
    </p>
  </div>

  <% if template.org.funder? %>
    <div class="form-group col-xs-8">
      <%= render(partial: '/shared/links',
      locals: { 
        context: 'funder',
        title: _('Funder Links'),
        links: template.links['funder'],
        max_number_links: MAX_NUMBER_LINKS_FUNDER,
        tooltip: _('Add links to funder websites that provide additional information about the requirements for this template') }) %>
    </div>
    <div class="form-group col-xs-8">
      <%= render(partial: '/shared/links',
      locals: { 
        context: 'sample_plan',
        title: _('Sample Plan Links'),
        links: template.links['sample_plan'],
        max_number_links: MAX_NUMBER_LINKS_SAMPLE_PLAN,
        tooltip: _('Add links to sample plans if provided by the funder.') }) %>
    </div>
    <%= hidden_field_tag('template-links', value: template.links) %>
  <% end %>

  <div class="form-group col-xs-8">
    <%= f.button(_('Save'), class: 'btn btn-default', type: "submit") %>
    <%= link_to(_('Cancel'), '#', { class: 'btn btn-default template_show_link', role: "button" }) %>
  </div>
<% end %>