{% extends "layout.html.jinja" %}
{% set title = "Helix Calculator" %}
{% block contents %}
    {% if context['site_data_available'] %}
        <div class="form_section">
            <h3>Summary <small>({{ context['project_name'] }})</small></h3>
            {% for warning in context['warning_messages'] %}
                <div class="summary_warning">{{ warning.value }}</div>
            {% endfor %}

            <table class="summary_table" id="summary_table">
                <tr>
                    <td colspan="2" class="table_meta_headers">OUTPUTS</td>
                    <td colspan="{{ context['wind_zones']|length }}" class="table_meta_headers">WIND ZONES</td>
                </tr>
                <tr>
                    <th>PANEL TYPES</th>
                    <th>ATTRIBUTES</th>
                    {% for wind_zone in context['wind_zones'] %}
                        <th>{{ wind_zone }}</th>
                    {% endfor %}
                </tr>
                {% for panel_type in context['summary_table'] %}
                    {% set td_class = 'table_horizontal_borders' %}
                    <tr class="alternating_row_color">
                        <td class="table_horizontal_borders {{ panel_type.snake_case() }}_border" rowspan="3">{{ panel_type.number() }}</td>
                        <td class="left_text_cell">Ballast Block(s)</td>
                        {% for id, count in enum(context['summary_table'][panel_type]['ballast blocks']) %}
                            {% set ballast_block_class = td_class + ' warning' if context['summary_table'][panel_type]['warnings'][id]|length > 0 else td_class %}
                            <td class="{{ ballast_block_class }}">{{ count }}</td>
                        {% endfor %}
                    </tr>
                    <tr class="alternating_row_color">
                        <td class="left_text_cell">Wind Anchor(s)</td>
                        {% for id, count in enum(context['summary_table'][panel_type]['anchors']) %}
                            {% set anchors_class = td_class + ' warning' if context['summary_table'][panel_type]['warnings'][id]|length > 0 else td_class %}
                            <td class="{{ anchors_class }}">{{ count }}</td>
                        {% endfor %}
                    </tr>
                    <tr class="alternating_row_color">
                        <td class="left_text_cell">Pressure (psf)</td>
                        {% for id, count in enum(context['summary_table'][panel_type]['pressure']) %}
                            {% set pressure_class = td_class + ' warning' if context['summary_table'][panel_type]['warnings'][id]|length > 0 else td_class %}
                            <td class="{{ pressure_class }}">{{ count }}</td>
                        {% endfor %}
                    </tr>
                {% endfor %}
                <tr class="alternating_row_color">
                    <td colspan="2" class="right_border_cell left_text_cell">Minimum Array Size by Zone{{ " (Tents)" if context['system_type']|is_dual_tilt }}</td>
                    {% for minimum_array_size in context['minimum_array_sizes'] %}
                        <td class="table_horizontal_borders">{{ minimum_array_size }}</td>
                    {% endfor %}
                </tr>
            </table>

            <div class="image_container sample_images">
                {% if context['system_type']|is_dual_tilt %}
                    <a href="#" class="image_button back" data-featherlight={{ url_for('static', filename='images/panel_types_dual_tilt@2x.png') }}>Example Dual Tilt Array</a>

                    <a href="#"  class="image_button back" data-featherlight={{ url_for('static', filename='images/wind_zones_dual_tilt@2x.png') }}>Example Wind Zone Diagram</a>
                {% else %}
                    <a href="#" class="image_button back" data-featherlight={{ url_for('static', filename='images/panel_types_single_tilt@2x.png') }}>Example Single Tilt Array</a>

                    <a href="#"  class="image_button back" data-featherlight={{ url_for('static', filename='images/wind_zones_single_tilt_north@2x.png') }}> Example Northern Wind Zones</a>

                    <a href="#" class="image_button back" data-featherlight={{ url_for('static', filename='images/wind_zones_single_tilt_south@2x.png') }}>Example Southern Wind Zones</a>
                {% endif %}
            </div>

            <h3>Summary Values</h3>
            <table class="summary_table" id="summary_values_table">
                <tr>
                    <th>L<sub>B</sub> - Building Scaling Factor (feet)</th>
                    <th>K<sub>Z</sub> - Site Wind Pressure Factor</th>
                    <th>q<sub>z</sub> - Site Wind Pressure (psf)</th>
                </tr>
                <tr>
                    <td>{{ context['l_b']|format_number }}</td>
                    <td>{{ context['k_z']|format_number }}</td>
                    <td>{{ context['q_z']|format_number }}</td>
                </tr>
            </table>


        </div>


    {% endif %}
    {% include "navigation_buttons.html.jinja" %}
    {% if 'SFID' in session %}
        <small><i>Sales Force project</i> (<a href="/sales_force_logout">Logout</a>)</small>
    {% endif %}
{% endblock %}
