{% extends 'base.html' %}

{% load i18n %}

{% load subtemplates_tags %}

{% block title %} :: {% with 'true' as read_only %}{% include 'calculate_form_title.html' %}{% endwith %}{% endblock %}

{% block sidebar %}
    {% for subtemplate in sidebar_subtemplates %}
        <div class="generic_subform">
            {% include subtemplate %}
        </div>
    {% endfor %}

    {% for subtemplate in sidebar_subtemplates_list %}
        {% with 'true' as side_bar %}
            {% if subtemplate.form %}
                {% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
                {% with "true" as read_only %}
                    <div class="generic_subform">
                        {{ rendered_subtemplate }}
                    </div>
                {% endwith %}
            {% else %}
                {% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
                {{ rendered_subtemplate }}
            {% endif %}
                </div>
                {% if subtemplate.grid_clear or not subtemplate.grid %}
                    <div class=""></div>
            {% endif %}
        {% endwith %}
    {% endfor %}
{% endblock %}

{% block stylesheets %}
    <style type="text/css">
        #subform form  textarea,
        #subform form  select option,
        #subform form  input,
        #subform form  select,
        #subform form  input { background: none; color: black; border: none; }
    </style>
{% endblock %}

{% block content %}
    {% if form %}
        {% with 'true' as read_only %}
            <div class="">
                <div class="generic_subform">
                    {% include 'generic_form_subtemplate.html' %}
                </div>
            </div>
            {% if grid_clear or not grid %}
                <div class=""></div>
            {% endif %}
        {% endwith %}
    {% endif %}

    <div class="container_12">
        {% for subtemplate in subtemplates_list %}
            <div class="grid_{{ subtemplate.grid|default:12 }}">
                {% with "true" as read_only %}
                    {% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
                    <div class="generic_subform">
                        {{ rendered_subtemplate }}
                    </div>
                {% endwith %}
            </div>
            {% if subtemplate.grid_clear or not subtemplate.grid %}
                <div class="clear"></div>
            {% endif %}
         {% endfor %}
    </div>
{% endblock %}

