<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Help - Environment data query</title>
    <link rel="stylesheet" href="{{tabcontrol_css}}">
    <link rel="stylesheet" href="{{env_css}}">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.0/dist/jquery.min.js"></script>
    <script src="{{tabcontrol_js}}"></script>
    <script src="{{env_js}}"></script>
</head>

<body>
<h1>Environment data query</h1>
<p>This page can query environment data.</p>
<br />


<div style="display: flex; flex-flow: row; height: 30px; width: 100%; margin: 0; padding: 0; border-bottom: 1px solid black;">
    {% for item in database_data %}
    <div id="tabnavigation_1_{{ loop.index }}" class="tabnavigation_1 tabitem-deactivated" style="height: 100%; padding-left: 20px; padding-right: 20px;" onclick="tabControlSwitcher(1, {{ loop.index }});"><b>{{ item.name }}</b></div>
    {% endfor %}
</div>

{% for item in database_data %}
<div id="tabpanel_1_{{ loop.index }}" class="tabpanel_1" style="display: none;">
    <p>Query field:</p>
    <table id="queryTable_{{ loop.index }}" border="1" cellspacing="0" cellpadding="5" style="margin: 10px;">
        <tr>
          <td><b>Use this</b></td>
          <td><b>Field name</b></td>
          <td style="width: 150px;"><b>Value</b></td>
          <td><b>Example</b></td>
          <td><b>Description</b></td>
        </tr>

        {% for innerItem in item.data %}
        <tr>
            <td><input type="checkbox" value="1"></input></td>
            <td queryName="{{ innerItem[0]|e }}">{{ innerItem[0]|e }}</td>
            <td><input type="text"></input></td>
            <td>{{ innerItem[1]|e }}</td>
            <td>{{ innerItem[2]|e }}</td>
        </tr>
        {% endfor %}
    </table>

    <button style="padding: 5px;" onclick="doQuery({{ loop.index }}, &quot;{{ item.queryKey }}&quot;);">Query</button>
    <p>Query result:</p>
    <p id="resultTableOverflow_{{ loop.index }}" style="color: red; display: none;">The count of query result is more than 100 items(Only the first 100 items will be shown). Please give more limitation.</p>

    <table id="resultTable_{{ loop.index }}" class="envOutput" cellspacing="0" cellpadding="5" style="margin: 10px;">
        <tr>
            {% for innerItem in item.data %}
            <td>{{ innerItem[0]|e }}</td>
            {% endfor %}
        </tr>
    </table>
</div>
{% endfor %}

</body>

</html>