{% extends base %}

{% block body_left %}
{% include system/component/db_nav.html %}

<script src="{{_server_home}}/_static/js/admin.js"></script>

{% init table_name = "" %}
{% init kv_table_name = None %}
{% init dbpath = "" %}

<div class="card">
    <div class="row bottom-offset-1">
        <span>表名称: {{table_name}}</span>
        <a href="{{_server_home}}/system/db/struct?table_name={{table_name}}&dbpath={{quote(dbpath)}}">查看表结构</a>
        <a href="{{_server_home}}/system/sqldb_operate?table_name={{table_name}}&dbpath={{quote(dbpath)}}">通过SQL查询</a>
    </div>

    <table class="table">
        <tr>
            <th style="width:20%">ID</th>
            <th style="width:60%">详情</th>
            <th style="width:20%">操作</th>
        </tr>
        {% for row in db_rows %}
        <tr class="hover-tr">
            <td>{{row.get(pk_name)}}</td>
            <td>{{row}}</td>
            <td>
                {% if kv_table_name != None %}
                    <a data-url="/system/sqldb_detail?method=get_kv_detail&key={{kv_table_name}}:{{row.get(pk_name)}}" 
                        onclick="xnote.admin.viewMainRecord(this)">查看主数据</a>
                {% end %}
            </td>
        </tr>
        {% end %}
    </table>
</div>

<div class="card">
    {% include common/pagination.html %}
</div>

{% end %}

{% block body_right %}
    {% include system/component/admin_nav.html %}
{% end %}