{% extends "keydetail/base.html" %}
{% block keydetail %}
<div class="card-body">
    <table class="table table-striped" id="data-table">
        <thead>
            <tr>
                <th class="text-center" style="width: 30%">Index</th>
                <th class="text-center" style="width: 60%">Value</th>
                <th class="text-center nosort"></th>
            </tr>
        </thead>
        <tbody>
            {% for index, value in key_details.data %}
            <tr>
                <td class="text-center">{{index}}</td>
                <td class="text-center">
                    {% set url=url_for('redisboard.hash_edit_value', db=db, key=key_details.name|quote_plus) %}
                    <a href="#" class="keydetail-editable" data-name="{{index}}" data-type="text"
                        data-url="{{url}}">{{value}}</a>
                </td>
                <td class="text-center">
                    <a href="#" onclick="hash_del('{{index}}')" class="btn btn-danger"><i class="fas fa-trash"></i></a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>

<form class="modal-part" id="hash-add-value">
    <input type="hidden" value="{{url_for('redisboard.hash_add_value', db=db, key=key_details.name|quote_plus)}}"
        id="target-url">
    <div class="form-group">
        <label>Index</label>
        <input type="text" class="form-control" name="index">
    </div>
    <div class="form-group">
        <label>Value</label>
        <div class="input-group">
            <input type="text" class="form-control" name="value">
        </div>
    </div>
</form>
{% endblock %}

{% block js %}
{{ super() }}
<script src="{{ url_for('redisboard.static', filename='dist/pages/keydetail_hash.js') }}"></script>
{% endblock %}