<commit_before><!--
This file is part of Lod4stat.

Copyright (c) 2014 Provincia autonoma di Trento


This program is free software: you can #a1284cistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

{% load i18n %}
{% load jsonify %}
{% load dictionary_extras %}
{% load unicode_extras %}

<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="/static/js/jquery-ui.js"></script>
    <script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
    <script type="text/javascript" src="/static/js/spin.min.js"></script>
    <script type="text/javascript" src="/static/js/bootbox.min.js"></script>
    <script type="text/javascript" src="/static/js/bootbox.conf.js"></script>
    <link href="/static/css/drag_and_drop.css" rel="stylesheet">
    <script type="text/javascript" src="/static/js/query_editor_customize.js"></script>
    <script type="text/javascript" src="/static/js/ajax_csfrtoken.js"></script>
    <script>
    $(document).ready(function(){
        initToken();
    });
    </script>
</head>

<body style="cursor: auto;">
<table border="1" class="table">
    <tr>
        <th>{% trans "Choose the fields to display by dragging them to the row and column" %}</th>
    </tr>
    <tr>

        <td style="background-color:#a1284c" class="pvtAxisContainer pvtUnused pvtHorizList ui-sortable drag_ul"
            id="unselectedFields">
            {% for field in fields %}
            {% if not field in obs_values %}
            {% if not field in columns.values %}
            {% if not field in rows.values %}
            {% if not forloop.counter0|to_unicode in hidden_fields  %}
            <li class="dropdown">
                <span id="{{ field }}"
                      name = "{{ column_description|lookup_unicode:forloop.counter0|lookup:"description" }}"
                      class="pvtAttr btn btn-default dropdown-toggle"
                      data-toggle="dropdown">{{ column_description|lookup_unicode:forloop.counter0|lookup:"description" }}
                      <span style="display:None">{{ field }}</span>
                      <span class="caret"></span>
                </span>
                <span id="drop" class="dropdown-menu" role="menu">
                {% for agg in aggregations %}
                {% if agg == column_description|lookup_unicode:forloop.parentloop.counter0|lookup:"description" %}
                <script>colour('{{ field }}');</script>
                    {% trans "Show" %} 
                    <div class="radio" id="radio_{{field}}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field }}', '{{ values|lookup:field|jsonify|escapejs }}', false, true);"
                                   type="radio"
                                   name="unused"
                                   checked="checked"
                                   value="{{ agg }}">
                            </input>
                            {{ agg }}
                        </label>
                    </div>
                    {% for ag in aggregations|lookup:agg %}
                    <div class="radio" id="radio_agg_{{ag}}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field }}', '{{ agg_values|lookup:ag|jsonify|escapejs }}', true, true);"
                                   type="radio"
                                   name="unused"
                                   id="{{ ag }}"
                            {% if ag in sel_aggregation %}
                                   checked="checked"
                            {% endif %}
                                   value="{{aggregations|lookup:agg|lookup:ag}}">
                            </input>
                            {{aggregations|lookup:agg|lookup:ag}}
                        </label>
                    </div>
                    {% endfor %}
                {% endif %}
                {% endfor %}
                {% trans "Select" %}
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', true)">
                            {% trans "All" %}
                    </button>
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', false)">
                            {% trans "None" %}
                    </button>
                    <div id="select_{{field}}"  name="select_{{field}}" class="radio_container">
                    {% for val in values|lookup:field %}
                        <input type="checkbox"
                               name="input_{{ field }}"
                               {% if field in ref_periods %}
                               ref_period="true"
                               {% endif %}
                               id="{{ field }}_input_{{val.0}}"
                               value="{{val.0}}">{{val.1}}<br>
                    {% endfor %}
                    </div>
                </span>
            </li>
            {% endif %}
            {% endif %}
            {% endif %}
            {% endif %}
            {% endfor %}
        </td>
    </tr>
</table>
<table>
<tr>
<td>
<div id="legend" style="BACKGROUND-COLOR: #5bc0de; BORDER: #1F556F thin solid; HEIGHT: 20px; WIDTH: 20px"></div>
</td>
<td>
{% trans "The values ​​of the fields of this color can be grouped" %}
</td>
</tr>
</table>
<br>

<table border="1" class="table">
    <tr>
        <td></td>
        <th style="color:#ffffff; background-color:#a1284c">{% trans "Column" %}</th>
    </tr>
    <tr>
        <th style="color:#ffffff; background-color:#a1284c">{% trans "Row" %}</th>
        <td style="background-color:#a1284c" class="pvtAxisContainer pvtHorizList pvtCols ui-sortable drag_ul"
            id="columnFields">
            {% for f in columns %}
            {% with columns|lookup:f as field %}
            {% if field in fields %}
            <li class="dropdown">
                <span id="{{ field}}"
                      name = "{{ column_description|lookup_unicode:f|lookup:"description" }}"
                      class="pvtAttr btn btn-default dropdown-toggle"
                      data-toggle="dropdown">{{ column_description|lookup_unicode:f|lookup:"description" }}
                      <span style="display:None">{{ field  }}</span>
                      <span class="caret"></span>
                </span>
                <span class="dropdown-menu" role="menu">
                {% for agg in aggregations %}
                {% if agg == column_description|lookup_unicode:f|lookup:"description" %}
                <script>colour('{{ field }}');</script>
                    {% trans "Show" %} 
                    <div class="radio" id="radio_{{columns|lookup:f }}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field  }}', '{{ values|lookup:field|jsonify|escapejs }}', false, true);"
                                   type="radio"
                                   name="columns"
                                   checked="checked"
                                   value="{{ agg }}">
                            </input>
                            {{ agg }}
                        </label>
                    </div>
                    {% for ag in aggregations|lookup:agg %}
                    <div class="radio" id="radio_agg_{{ag}}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field }}', '{{ agg_values|lookup:ag|jsonify|escapejs }}', true, true);"
                                   type="radio"
                                   name="columns"
                                   id="{{ ag }}"
                            {% if ag in sel_aggregation %}
                                   checked="checked"
                            {% endif %}
                                   value="{{aggregations|lookup:agg|lookup:ag}}">
                            </input>
                            {{aggregations|lookup:agg|lookup:ag}}
                        </label>
                    </div>
                    {% endfor %}
                {% endif %}
                {% endfor %}
                {% trans "Select" %}
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', true)">
                            {% trans "All" %}
                    </button>
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', false)">
                            {% trans "None" %}
                    </button>
                    <div id="select_{{field}}"  name="select_{{field}}" class="radio_container">
                    {% for val in values|lookup:field %}
                        <input type="checkbox"
                               {% if field in ref_periods %}
                               ref_period="true"
                               {% endif %}
                               name="input_{{ field }}"
                               id="{{ columns|lookup:f }}_input_{{val.0}}"
                               value="{{val.0}}">{{val.1}}<br>
                    {% endfor %}
                    </div>
                </span>
            </li>
            {% endif %}
            {% endwith %}
            {% endfor %}
        </td>
    </tr>
    <tr style="height:200px">
        <td style="width:80;background-color:#a1284c" valign="top"
            class="pvtAxisContainer pvtRows ui-sortable drag_ul"
            id="rowFields">
            {% for f in rows %}
            {% with rows|lookup:f as field %}
            {% if field in fields %}
            <li class="dropdown">
                <span id="{{ field }}"
                      name = "{{ column_description|lookup_unicode:f|lookup:"description" }}"
                      class="pvtAttr btn btn-default dropdown-toggle"
                      data-toggle="dropdown">{{ column_description|lookup_unicode:f|lookup:"description" }}
                    <span style="display:None">{{ field }}</span>
                    <span class="caret"></span>
                </span>
                <span class="dropdown-menu" role="menu">
                {% for agg in aggregations %}
                {% if agg == column_description|lookup_unicode:f|lookup:"description" %}
                <script>colour('{{ field }}');</script>
                    {% trans "Show" %} 
                    <div class="radio" id="radio_{{field}}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field }}', '{{ values|lookup:field|jsonify|escapejs }}', false, true);"
                                   type="radio"
                                   name="rows"
                                   checked="checked"
                                   value="{{ agg }}">
                            </input>
                            {{ agg }}
                        </label>
                    </div>
                    {% for ag in aggregations|lookup:agg %}
                    <div class="radio" id="radio_agg_{{ag}}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field }}', '{{ agg_values|lookup:ag|jsonify|escapejs }}', true, true);"
                                   type="radio"
                                   name="rows"
                                   id="{{ ag }}"
                            {% if ag in sel_aggregation %}
                                   checked="checked"
                            {% endif %}
                                   value="{{aggregations|lookup:agg|lookup:ag}}">
                            </input>
                            {{aggregations|lookup:agg|lookup:ag}}
                        </label>
                    </div>
                    {% endfor %}
                {% endif %}
                {% endfor %}
                {% trans "Select" %}
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', true)">
                            {% trans "All" %}
                    </button>
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', false)">
                            {% trans "None" %}
                    </button>
                    <div id="select_{{field}}"  name="select_{{field}}" class="radio_container">
                    {% for val in values|lookup:field %}
                        <input type="checkbox"
                               {% if field.1 in ref_periods %}
                               ref_period="true"
                               {% endif %}
                               name="input_{{ field }}"
                               id="{{ field }}_input_{{val.0}}"
                               value="{{val.0}}">{{val.1}}<br>
                    {% endfor %}
                    </div>
                </span>
            </li>
            {% endif %}
            {% endwith %}
            {% endfor %}
        </td>
        <td>
            <table style="width:100%;height:200;background-color:#a1284cmarine" border="1" class="table">
                <th>{% trans "Data" %}</th>
                <tr>
                    <td style="width:150px;height:100%" valign="top"
                        class="pvtAxisContainer"
                        id="valueFields">
                        <!-- The data values -->
                        {% for field in fields %}
                        {% if field in obs_values %}
                        <li>
                           <input type="checkbox"
                                   id="obs_{{ field }}"
                                   {% if field in selected_obs_values %}
                                   checked="checked"
                                   {% endif %}/>
                            <span class="pvtAttr btn btn-default dropdown-toggle">
                                {{ column_description|lookup_unicode:forloop.counter0|lookup:"description" }}
                                <span style="display:None">{{ field }}</span>
                            </span>
                         </li>
                        {% endif %}
                        {% endfor %}
                    </td>
                </tr>
            </table>
        </td>

    </tr>
</table>

<script>select_filters('{{ filters|jsonify|escapejs }}');</script>
{% for field in fields %}
    {% for agg in aggregations %}
        {% if agg == column_description|lookup_unicode:forloop.parentloop.counter0|lookup:"description" %}
            {% for ag in aggregations|lookup:agg %}
                {% if ag in sel_aggregation %}
                    <script>setFieldLabel('{{ ag }}', '{{ field }}', '{{ agg_values|lookup:ag|jsonify|escapejs }}')</script>
                {% endif %}
            {% endfor %}
        {% endif %}
    {% endfor %}
{% endfor %}
<script>select_agg_filters('{{ agg_filters|jsonify|escapejs }}');</script>
<table style="width:100%">
    <tr align="center">
        {% if request.user.is_staff %}
        <td>
            <input type="checkbox"
                   id="visible"/>
            <label class="control-label">
                {% trans "View all" %}
            </label>
        </td>
        <script>
            var visible = localStorage.getItem('visible');
            if (visible != null && visible=="true") {
               var vis = document.getElementById('visible');
               vis.checked = "checked"
            }
        </script>
        <td>
            <input type="checkbox"
                   id="debug"
            {% if debug %}
            checked="checked"
            {% endif %} />
            <label class="control-label">
                {% trans "Debug" %}
            </label>
        </td>
        {% endif %}
        <td>
            <input type="checkbox"
                   id="include_code"
            {% if include_code %}
            checked="checked"
            {% endif %} />
            <label class="control-label">
                {% trans "Include code" %}
            </label>
        </td>
    </tr>
    <tr style="width:100%">
        <td colspan=2 align="center">
            <input type="submit"
                   class="btn btn-default"
                   name="btn_close"
                   id="btn_close"
                   onclick="submit_popup('{{ obs_values|jsonify|escapejs }}',
                            '{{ values|jsonify|escapejs }}',
                            '{{ agg_values|jsonify|escapejs }}',
                            '{{ table_name }}',
                            '{% trans "The table must have at least one field in row" %}',
                            '{% trans "The table must have at least one field in column" %}',
                            '{% trans "The table must have at least one field in value" %}',
                            '{% trans "you can select only one unless you drag it in line or column" %}');"
                   value="{% trans "Submit" %}"/>
            <button class="btn btn-default" onclick="$('#popup').modal('hide');">
                {% trans "Cancel" %}
            </button>
        </td>
    </tr>
</table>
</body><commit_msg>Center buttons in the query customization popup<commit_after><!--
This file is part of Lod4stat.

Copyright (c) 2014 Provincia autonoma di Trento


This program is free software: you can #a1284cistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

{% load i18n %}
{% load jsonify %}
{% load dictionary_extras %}
{% load unicode_extras %}

<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="/static/js/jquery-ui.js"></script>
    <script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
    <script type="text/javascript" src="/static/js/spin.min.js"></script>
    <script type="text/javascript" src="/static/js/bootbox.min.js"></script>
    <script type="text/javascript" src="/static/js/bootbox.conf.js"></script>
    <link href="/static/css/drag_and_drop.css" rel="stylesheet">
    <script type="text/javascript" src="/static/js/query_editor_customize.js"></script>
    <script type="text/javascript" src="/static/js/ajax_csfrtoken.js"></script>
    <script>
    $(document).ready(function(){
        initToken();
    });
    </script>
</head>

<body style="cursor: auto;">
<table border="1" class="table">
    <tr>
        <th>{% trans "Choose the fields to display by dragging them to the row and column" %}</th>
    </tr>
    <tr>

        <td style="background-color:#a1284c" class="pvtAxisContainer pvtUnused pvtHorizList ui-sortable drag_ul"
            id="unselectedFields">
            {% for field in fields %}
            {% if not field in obs_values %}
            {% if not field in columns.values %}
            {% if not field in rows.values %}
            {% if not forloop.counter0|to_unicode in hidden_fields  %}
            <li class="dropdown">
                <span id="{{ field }}"
                      name = "{{ column_description|lookup_unicode:forloop.counter0|lookup:"description" }}"
                      class="pvtAttr btn btn-default dropdown-toggle"
                      data-toggle="dropdown">{{ column_description|lookup_unicode:forloop.counter0|lookup:"description" }}
                      <span style="display:None">{{ field }}</span>
                      <span class="caret"></span>
                </span>
                <span id="drop" class="dropdown-menu" role="menu">
                {% for agg in aggregations %}
                {% if agg == column_description|lookup_unicode:forloop.parentloop.counter0|lookup:"description" %}
                <script>colour('{{ field }}');</script>
                    {% trans "Show" %} 
                    <div class="radio" id="radio_{{field}}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field }}', '{{ values|lookup:field|jsonify|escapejs }}', false, true);"
                                   type="radio"
                                   name="unused"
                                   checked="checked"
                                   value="{{ agg }}">
                            </input>
                            {{ agg }}
                        </label>
                    </div>
                    {% for ag in aggregations|lookup:agg %}
                    <div class="radio" id="radio_agg_{{ag}}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field }}', '{{ agg_values|lookup:ag|jsonify|escapejs }}', true, true);"
                                   type="radio"
                                   name="unused"
                                   id="{{ ag }}"
                            {% if ag in sel_aggregation %}
                                   checked="checked"
                            {% endif %}
                                   value="{{aggregations|lookup:agg|lookup:ag}}">
                            </input>
                            {{aggregations|lookup:agg|lookup:ag}}
                        </label>
                    </div>
                    {% endfor %}
                {% endif %}
                {% endfor %}
                {% trans "Select" %}
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', true)">
                            {% trans "All" %}
                    </button>
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', false)">
                            {% trans "None" %}
                    </button>
                    <div id="select_{{field}}"  name="select_{{field}}" class="radio_container">
                    {% for val in values|lookup:field %}
                        <input type="checkbox"
                               name="input_{{ field }}"
                               {% if field in ref_periods %}
                               ref_period="true"
                               {% endif %}
                               id="{{ field }}_input_{{val.0}}"
                               value="{{val.0}}">{{val.1}}<br>
                    {% endfor %}
                    </div>
                </span>
            </li>
            {% endif %}
            {% endif %}
            {% endif %}
            {% endif %}
            {% endfor %}
        </td>
    </tr>
</table>
<table>
<tr>
<td>
<div id="legend" style="BACKGROUND-COLOR: #5bc0de; BORDER: #1F556F thin solid; HEIGHT: 20px; WIDTH: 20px"></div>
</td>
<td>
{% trans "The values ​​of the fields of this color can be grouped" %}
</td>
</tr>
</table>
<br>

<table border="1" class="table">
    <tr>
        <td></td>
        <th style="color:#ffffff; background-color:#a1284c">{% trans "Column" %}</th>
    </tr>
    <tr>
        <th style="color:#ffffff; background-color:#a1284c">{% trans "Row" %}</th>
        <td style="background-color:#a1284c" class="pvtAxisContainer pvtHorizList pvtCols ui-sortable drag_ul"
            id="columnFields">
            {% for f in columns %}
            {% with columns|lookup:f as field %}
            {% if field in fields %}
            <li class="dropdown">
                <span id="{{ field}}"
                      name = "{{ column_description|lookup_unicode:f|lookup:"description" }}"
                      class="pvtAttr btn btn-default dropdown-toggle"
                      data-toggle="dropdown">{{ column_description|lookup_unicode:f|lookup:"description" }}
                      <span style="display:None">{{ field  }}</span>
                      <span class="caret"></span>
                </span>
                <span class="dropdown-menu" role="menu">
                {% for agg in aggregations %}
                {% if agg == column_description|lookup_unicode:f|lookup:"description" %}
                <script>colour('{{ field }}');</script>
                    {% trans "Show" %} 
                    <div class="radio" id="radio_{{columns|lookup:f }}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field  }}', '{{ values|lookup:field|jsonify|escapejs }}', false, true);"
                                   type="radio"
                                   name="columns"
                                   checked="checked"
                                   value="{{ agg }}">
                            </input>
                            {{ agg }}
                        </label>
                    </div>
                    {% for ag in aggregations|lookup:agg %}
                    <div class="radio" id="radio_agg_{{ag}}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field }}', '{{ agg_values|lookup:ag|jsonify|escapejs }}', true, true);"
                                   type="radio"
                                   name="columns"
                                   id="{{ ag }}"
                            {% if ag in sel_aggregation %}
                                   checked="checked"
                            {% endif %}
                                   value="{{aggregations|lookup:agg|lookup:ag}}">
                            </input>
                            {{aggregations|lookup:agg|lookup:ag}}
                        </label>
                    </div>
                    {% endfor %}
                {% endif %}
                {% endfor %}
                {% trans "Select" %}
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', true)">
                            {% trans "All" %}
                    </button>
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', false)">
                            {% trans "None" %}
                    </button>
                    <div id="select_{{field}}"  name="select_{{field}}" class="radio_container">
                    {% for val in values|lookup:field %}
                        <input type="checkbox"
                               {% if field in ref_periods %}
                               ref_period="true"
                               {% endif %}
                               name="input_{{ field }}"
                               id="{{ columns|lookup:f }}_input_{{val.0}}"
                               value="{{val.0}}">{{val.1}}<br>
                    {% endfor %}
                    </div>
                </span>
            </li>
            {% endif %}
            {% endwith %}
            {% endfor %}
        </td>
    </tr>
    <tr style="height:200px">
        <td style="width:80;background-color:#a1284c" valign="top"
            class="pvtAxisContainer pvtRows ui-sortable drag_ul"
            id="rowFields">
            {% for f in rows %}
            {% with rows|lookup:f as field %}
            {% if field in fields %}
            <li class="dropdown">
                <span id="{{ field }}"
                      name = "{{ column_description|lookup_unicode:f|lookup:"description" }}"
                      class="pvtAttr btn btn-default dropdown-toggle"
                      data-toggle="dropdown">{{ column_description|lookup_unicode:f|lookup:"description" }}
                    <span style="display:None">{{ field }}</span>
                    <span class="caret"></span>
                </span>
                <span class="dropdown-menu" role="menu">
                {% for agg in aggregations %}
                {% if agg == column_description|lookup_unicode:f|lookup:"description" %}
                <script>colour('{{ field }}');</script>
                    {% trans "Show" %} 
                    <div class="radio" id="radio_{{field}}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field }}', '{{ values|lookup:field|jsonify|escapejs }}', false, true);"
                                   type="radio"
                                   name="rows"
                                   checked="checked"
                                   value="{{ agg }}">
                            </input>
                            {{ agg }}
                        </label>
                    </div>
                    {% for ag in aggregations|lookup:agg %}
                    <div class="radio" id="radio_agg_{{ag}}">
                        <label>
                            <input onclick="handleRadio(this, '{{ field }}', '{{ agg_values|lookup:ag|jsonify|escapejs }}', true, true);"
                                   type="radio"
                                   name="rows"
                                   id="{{ ag }}"
                            {% if ag in sel_aggregation %}
                                   checked="checked"
                            {% endif %}
                                   value="{{aggregations|lookup:agg|lookup:ag}}">
                            </input>
                            {{aggregations|lookup:agg|lookup:ag}}
                        </label>
                    </div>
                    {% endfor %}
                {% endif %}
                {% endfor %}
                {% trans "Select" %}
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', true)">
                            {% trans "All" %}
                    </button>
                    <button type="button"
                            class="btn btn-default"
                            onclick="checkByParent('select_{{field}}', false)">
                            {% trans "None" %}
                    </button>
                    <div id="select_{{field}}"  name="select_{{field}}" class="radio_container">
                    {% for val in values|lookup:field %}
                        <input type="checkbox"
                               {% if field.1 in ref_periods %}
                               ref_period="true"
                               {% endif %}
                               name="input_{{ field }}"
                               id="{{ field }}_input_{{val.0}}"
                               value="{{val.0}}">{{val.1}}<br>
                    {% endfor %}
                    </div>
                </span>
            </li>
            {% endif %}
            {% endwith %}
            {% endfor %}
        </td>
        <td>
            <table style="width:100%;height:200;background-color:#a1284cmarine" border="1" class="table">
                <th>{% trans "Data" %}</th>
                <tr>
                    <td style="width:150px;height:100%" valign="top"
                        class="pvtAxisContainer"
                        id="valueFields">
                        <!-- The data values -->
                        {% for field in fields %}
                        {% if field in obs_values %}
                        <li>
                           <input type="checkbox"
                                   id="obs_{{ field }}"
                                   {% if field in selected_obs_values %}
                                   checked="checked"
                                   {% endif %}/>
                            <span class="pvtAttr btn btn-default dropdown-toggle">
                                {{ column_description|lookup_unicode:forloop.counter0|lookup:"description" }}
                                <span style="display:None">{{ field }}</span>
                            </span>
                         </li>
                        {% endif %}
                        {% endfor %}
                    </td>
                </tr>
            </table>
        </td>

    </tr>
</table>

<script>select_filters('{{ filters|jsonify|escapejs }}');</script>
{% for field in fields %}
    {% for agg in aggregations %}
        {% if agg == column_description|lookup_unicode:forloop.parentloop.counter0|lookup:"description" %}
            {% for ag in aggregations|lookup:agg %}
                {% if ag in sel_aggregation %}
                    <script>setFieldLabel('{{ ag }}', '{{ field }}', '{{ agg_values|lookup:ag|jsonify|escapejs }}')</script>
                {% endif %}
            {% endfor %}
        {% endif %}
    {% endfor %}
{% endfor %}
<script>select_agg_filters('{{ agg_filters|jsonify|escapejs }}');</script>
<table style="width:100%">
    <tr align="center">
        {% if request.user.is_staff %}
        <td>
            <input type="checkbox"
                   id="visible"/>
            <label class="control-label">
                {% trans "View all" %}
            </label>
        </td>
        <script>
            var visible = localStorage.getItem('visible');
            if (visible != null && visible=="true") {
               var vis = document.getElementById('visible');
               vis.checked = "checked"
            }
        </script>
        <td>
            <input type="checkbox"
                   id="debug"
            {% if debug %}
            checked="checked"
            {% endif %} />
            <label class="control-label">
                {% trans "Debug" %}
            </label>
        </td>
        {% endif %}
        <td>
            <input type="checkbox"
                   id="include_code"
            {% if include_code %}
            checked="checked"
            {% endif %} />
            <label class="control-label">
                {% trans "Include code" %}
            </label>
        </td>
    </tr>
    <tr style="width:100%">
        <td colspan=3 align="center">
            <input type="submit"
                   class="btn btn-default"
                   name="btn_close"
                   id="btn_close"
                   onclick="submit_popup('{{ obs_values|jsonify|escapejs }}',
                            '{{ values|jsonify|escapejs }}',
                            '{{ agg_values|jsonify|escapejs }}',
                            '{{ table_name }}',
                            '{% trans "The table must have at least one field in row" %}',
                            '{% trans "The table must have at least one field in column" %}',
                            '{% trans "The table must have at least one field in value" %}',
                            '{% trans "you can select only one unless you drag it in line or column" %}');"
                   value="{% trans "Submit" %}"/>
            <button class="btn btn-default" onclick="$('#popup').modal('hide');">
                {% trans "Cancel" %}
            </button>
        </td>
    </tr>
</table>
</body>
{'fraction_non_alphanumeric': 0.1371275783040489, 'fraction_numerical': 0.005020189894139474, 'mean_word_length': 1.1896768026763844, 'pattern_counts': {'":': 0, '<': 431, '<?xml version=': 0, '>': 431, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 76, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2136567', 'n_tokens_mistral': 9646, 'n_tokens_neox': 8576, 'n_words': 1923}