{% extends "advanced_layout.html" %}
{% set active_page = "advanced.matrix" %}
{% block body %}
<div class="card">
    <div class="card-header" id="matrixViewPage">
        <h1>
            Matrix View
        </h1>
    </div>
    <div class="card-body">
        <table class="table table-striped table-bordered table-sm table-hover" id="matrixDataTable">
          <caption>Select data file(s) to use</caption>
          <thead>
            <tr>
                <th scope="col">Evaluator</th>
                <th scope="col">Eval note</th>
                <th scope="col">TimeFrame</th>
                <th scope="col">Symbol</th>
                <th scope="col">Exchange</th>
            </tr>
          </thead>
          <tbody>
            {% for symbol, matrix_symbol in matrix_list.items() %}
                {% for exchange, matrix_exchange in matrix_symbol.items() %}
                    {% for type, matrix_type in matrix_exchange.get_matrix().items() %}
                        {% for evaluator, matrix_evaluator in matrix_type.items() %}
                            {% if matrix_evaluator is iterable and matrix_evaluator is not string %}
                                {% for time_frame, eval_note in matrix_evaluator.items() %}
                                 <tr>
                                    <td>{{evaluator}}</td>
                                    <td>{{eval_note}}</td>
                                    <td>{{time_frame.name}}</td>
                                    <td>{{symbol}}</td>
                                    <td>{{exchange}}</td>
                                 </tr>
                                {% endfor %}
                            {% else %}
                                <tr>
                                    <td>{{evaluator}}</td>
                                    <td>{{matrix_evaluator}}</td>
                                    <td></td>
                                    <td>{{symbol}}</td>
                                    <td>{{exchange}}</td>
                                </tr>
                            {% endif %}
                        {% endfor %}
                    {% endfor %}
                {% endfor %}
            {% endfor %}
          </tbody>
        </table>
    </div>
</div>

{% endblock %}

{% block additional_scripts %}
<script>$('#matrixDataTable').DataTable();</script>
{% endblock additional_scripts %}
