{% extends "formunculous/base.html" %}

{% load i18n %}
{% block css %}
<link href="{{ MEDIA_URL }}formunculous/css/formunculous.css" rel="stylesheet" type="text/css" />
{% endblock %}

{% block title %}{{ ad.name}} {% trans "Submission Confirmation" %}{% endblock %}
{% block content_title %}{{ ad.name}} {% trans "Submission Confirmation" %}{% endblock %}
{% block content %}

<p>
  {% blocktrans with ad.name as appname %}
   Thank you for completing <i>{{ appname }}</i>.
  {% endblocktrans %}
</p>
<p>
   {% blocktrans with ad.owner as email %}
      Below is the information that you have submitted.  If there any problems, or
      some of the information is incorrect please contact 
      <a href="mailto:{{ email }}">{{ email }}</a> to make any corrections.
   {% endblocktrans %}
</p>
<div class="formunculous_container">
  <div class="fl" style="margin-top: 1em;">
	<a href="javascript:window.print()" class="formunculous_printlink">{% trans "Print" %}</a>
  </div>
  <ul class="formunculous_form_info">
	{% for field in fields %}
	   <li>
	      <span class="formunculous_field_label">{{ field.label }}:</span>
		  <span class="formunculous_field_data">
			{% ifequal field.type "BooleanField" %}
			  <span class="
				{{ field.data|yesno:"formunculous_yes\">Yes, formunculous_no\">No"|safe }}
			  </span>
			{% else %}

			  {% if field.data %}

			    {% if field.data.url %}
			      {% if not ad.email_only %}
			        <a target="_blank" href="{{ field.data.url }}">
			      {% endif %}
			    {% endif %}

			    {{ field.data }}

			    {% if field.data.url %}
			      {% if not ad.email_only %}
			        </a>
			      {% endif %}
			    {% endif %}

			  {% endif %}

          {% endifequal %}
		  </span>
	   </li>
    {% endfor %}
  </ul>
  {% if sub_apps %}
  {% for sub_app_group in sub_apps %}
    <h3 class="formunculous_sub_ad_title">{{ sub_app_group.sub_ad.name }}</h3>
	{% for sub_app in sub_app_group.sub_apps %}
	  <ul class="formunculous_form_info formunculous_sub_form_info">
		{% for field in sub_app.fields %}
		  <li>
			<span class="formunculous_field_label">{{ field.label }}:</span>
			<span class="formunculous_field_data">
			  {% if field.data.url %}
			  {% if not ad.email_only %}
			  <a target="_blank" href="{{ field.data.url }}">
				{% endif %}
				{% endif %}
				{{ field.data }}
				{% if field.data.url %}
			  </a>
			  {% endif %}
			</span>
		  </li>
		{% endfor %}
	  </ul>
	{% endfor %}
  {% endfor %}
  {% endif %}

</div>

{% endblock %}
