{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}
{% import "macro_functions.phtml" as mf %}
{% block meta_title %}{{ product.title }}{% endblock %}

{% block content_before %}
{% include "partial_steps.phtml" with {'selected': 2} %}
{% endblock %}

{% block content %}

{% set periods = guest.system_periods %}
{% set pricing = product.pricing %}

<form method="post" action="" class="api_form" data-api-url="guest/cart/add_item" data-api-redirect="{{ 'cart'|link }}">
    <div class="h-block">
        <div class="h-block-header">
            <div class="icon"><span class="number">2</span></div>
            <h2>{% trans 'Configure' %}</h2>
            <p>{% trans 'The product/service you have chosen has the following configuration options for you to choose from.' %}</p>
        </div>
        <div class="block">
            <div class="grid_8 alpha">
                <div class="box">
                    <div class="block">
                        <h1>{{ product.title }}</h1>
                        {{ product.description|markdown }}
                    </div>
                </div>

                {# If we are ordering custom product with defined plugin "Steam" #}
                {# Plugin can be defined in custom product configuration page in admin area #}
                {% if product.plugin == 'Steam' %}
                    <div class="widget" style="margin: 10px 0 10px 10px;">
                        <div class="head">
                            <h2 class="dark-icon i-services">{% trans 'Steam server configuration' %}</h2>
                        </div>
                        <fieldset>
                            <p>
                                <label>{% trans 'Steam ID' %}:</label>
                                <input type="text" name="config[steam_id]" value="{{ request.steam_id }}"  style="width: 200px" placeholder="{% trans 'Enter your steam ID' %}" required="true">
                            </p>
                        </fieldset>
                    </div>
                {% endif %}

            </div>
            <div class="grid_4 omega">
                {% include 'partial_pricing.phtml' with {'product': product} %}
            </div>
            <div class="clear"></div>
        </div>
    </div>
    {% include 'partial_addons.phtml' with {'product': product} %}
    <input type="hidden" name="single" value="1" />
    <input type="hidden" name="id" value="{{ product.id }}" />
</form>
{% endblock %}

{% block sidebar2 %}
    {% include 'partial_currency.phtml' %}
{% endblock %}

{% block js %}
<script type="text/javascript">
$(function() {

    if($(".addons").length && $(".addons").is(':hidden')) {
        $('#order-button').one('click', function(){
            $(this).hide();
            $('.addons').slideDown('fast');
            return false;
        });
    }

    $('#period-selector').change(function(){
        $('.period').hide();
        $('.period.' + $(this).val()).show();
    }).trigger('change');

    $('.addon-period-selector').change(function(){
        var r = $(this).attr('rel');
        $('#' + r + ' span').hide();
        $('#' + r + ' span.' + $(this).val()).fadeIn();
    }).trigger('change');
});
</script>
{% endblock %}