<% if preview %>
  <h1>PREVIEW ONLY</h1>
<% end %>

<p class="heading"><strong><u><%= t ".heading" %></u></strong></p>
<p><%= t ".instructions", releasable_name: "#{releasable.model_name.name.titleize}" %></p>

<% # Signer information %>
<dl>
  <% # Only guardian signs if talent is a minor %>
  <% unless releasable.minor? %>
    <dt><%= AppearanceRelease.human_attribute_name(:signature) %>:</dt>
    <dd>
    <% if preview %>
        <%= image_tag dummy_signature %>
    <% elsif releasable.signature.attached? %>
        <%= image_tag releasable.signature.variant(auto_orient: true, resize: "200x200") %>
    <% end %>
    </dd>
  <% end %>
  <%= description_list_pair_for releasable, :name, append: ":" %>
  <%= description_list_pair "Contact Address:", releasable.contact_person.address %>
  <%= description_list_pair "Contact Phone:", releasable.contact_person.phone %>
  <%= description_list_pair "Contact Email:", releasable.contact_person.email %>
  <% if releasable.model_name == "AppearanceRelease" %>
    <%= description_list_pair "Person Date of Birth:", releasable&.person_date_of_birth&.strftime("%D") %>
  <% end %>
  <%= description_list_pair_for releasable, :signed_on, append: ":" %>
  <% if releasable.model_name == "LocationRelease" %>
    <%= description_list_pair "Filming Started On:", releasable&.filming_started_on&.strftime("%D") %>
    <%= description_list_pair "Filming Ended On:", releasable&.filming_ended_on&.strftime("%D") %>
    <%= description_list_pair "Filming Hours:", releasable&.filming_hours %>
  <% end %>
  <% if contract_template.fee? %>
    <%= description_list_pair "Fee:", number_to_currency(contract_template.fee) %>
  <% end %>
  <% if releasable.model_name == "MaterialRelease" %>
    <%= description_list_pair "Description:", releasable.description %>
  <% end %>
</dl>

<% if releasable.model_name == "MedicalRelease" %>
  <% (1..10).each do |n| %>
    <% if contract_template.public_send("question_#{n}_text").present? %>
      <p><strong><%= contract_template.public_send("question_#{n}_text") %></strong></p>
      <p><%= releasable.public_send("question_#{n}_answer") %></p>
    <% end %>
  <% end %>
<% end %>

<% if releasable.minor? %>
  <br/>
  <p class="text-left"><strong>Guardian Information</strong></p>

  <% # Guardian information %>
  <dl>
    <dt><%= AppearanceRelease.human_attribute_name(:signature) %>:</dt>
    <dd>
      <% if preview %>
        <%= image_tag dummy_signature %>
      <% elsif releasable.signature.attached? %>
        <%= image_tag releasable.signature.variant(auto_orient: true, resize: "200x200") %>
      <% end %>
    </dd>
    <%= description_list_pair_for releasable, :guardian_name, append: ":" %>
    <%= description_list_pair_for releasable, :guardian_address, append: ":" %>
    <%= description_list_pair_for releasable, :guardian_phone, append: ":" %>
    <%= description_list_pair_for releasable, :guardian_email, append: ":" %>
    <%= description_list_pair_for releasable, :signed_on, append: ":" %>
  </dl>

<% end %>
