{% extends 'timeseer.html' %}

{% from 'macros.html' import alerter, menu_back %}

{% block menu %}
{{ menu_back(url_for('.configure_kpi', kpiname=kpi.name, sourcename=source_name)) }}
{% endblock %}

{% block main %}
<div class="ts-section py-3 my-3">
    <h2 class="h4">Edit description of {{ kpi.name }}</h2>
</div>

<div class="pt-3 my-3">
    {{ alerter() }}

    <form method="POST">
        <input type="hidden" name="kpiid" value="{{ kpi.db_id }}">

        <div class="mb-3">
            <label for="kpiDescription" class="form-label">Description</label>
            <textarea id="kpiDescription" name="kpidescription" class="form-control" rows="10">{{ kpi.help_text or "" }}</textarea>
            <div class="form-text">
                The description will appear as help text wherever the KPI is used.
                For maximum effect,
                use a one-liner with a general description,
                followed by a blank line,
                followed by longer explanation of why the KPI is important.
                The longer explanation can contain HTML markup.
            </div>
        </div>

        <div class="btn-toolbar">
            <button type="submit" class="btn btn-primary me-2">Update</button>
            <a class="btn btn-secondary"
                href="{{ url_for('.configure_kpi', kpiname=kpi.name, sourcename=source_name) }}"
                role="button">
                Cancel
            </a>
        </div>
    </form>
</div>
{% endblock %}
