{% extends "product/product.html" %}
{% load i18n %}
{% load thumbnail %}
{% load satchmo_price %}
{% load satchmo_currency satchmo_category%}
{% load satchmo_util %}
{% load app_plugins %}

{% block productdetail %}
<h4>{% blocktrans with product.translated_name as name %}Subscription product {{ name }}{% endblocktrans %}</h4>
<p>{% autoescape off %}{{ product.translated_description }}{% endautoescape %}</p>
<h4>{% trans "Only " %}{{product.subscriptionproduct.recurring_times}} {% trans "easy payments of:" %}</h4>
<h3 id="price">{{ product.subscriptionproduct.recurring_price|currency }} </h3>

{% for pic in product.productimage_set.all %}
    {% thumbnail pic.picture 280x280 as image %}
    <img src="{{ image }}" width="{{ image.width }}" height="{{ image.height }}" />
{% endfor %}
 {% for trial in product.subscriptionproduct.get_trial_terms %}
    {% if forloop.first %} <p> {% blocktrans %}This product has trial subscription pricing {% endblocktrans %}</p><ul> {% endif %}
    <li>{% if trial.price %}{{trial.price|currency}}{% else %}{% trans 'Free' %} {% endif %}{% blocktrans %}for trial period of {% endblocktrans %}{{trial.expire_length}} {% ifequal product.subscriptionproduct.expire_unit "DAY" %}{% trans "days" %}{% else %}{% trans "months" %}{% endifequal %}</li>
    {% if forloop.last %} </ul> {% endif %}
 {% endfor %}

{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
<form id="options" action="{% url satchmo_smart_add %}" method="post">

{% for option_group in options %}
 {{ option_group.name}}
    <select name="{{ option_group.id }}" id="{{option_group.id}}" class="priced">
    {% for choice in option_group.items %}
     <option value="{{ choice.value }}" {% if choice.selected %}selected="selected"{% endif %}>{{ choice.translated_name }}
        {% if choice.price_change %}
            {% option_price choice %}
        {% endif %}
     </option>
    {% endfor %}
      </select><br/>
{% endfor %}

{% trans "Quantity" %} <input type="text", size="2", name="quantity" id="quantity" value="1" class="priced" />
<input type="hidden" name="productname" id="productname" value="{{product.slug}}" />
<input type="submit" name="addcart" value="{% trans "Add to cart" %}" /> 
{% plugin_point "product_add_buttons" %}
{% plugin_point "product_form" %}
</form>
{% endblock %}
