{% load custom_tags_and_filters %}
<form method="POST" action="{% url 'customize' 'tool_qualification' %}" class="form-horizontal">
    <div class="panel-body">
        {% csrf_token %}
        <h3 class="customization-section-title">Tool qualification expiration</h3>
        <p>If active, this feature will remove tool qualification from a user if the user has not used the tool after a while or never used it since qualified (configured separately).
        <p>The <a href="{% url 'customization' 'templates' %}?#tool_qualification_expiration_email_id">user tool qualification expiration email</a> need to be set to enable this feature.</p><br/>
        <div class="form-group {% if errors.tool_qualification_reminder_days %}has-error{% endif %}">
            <label class="control-label col-md-2" for="tool_qualification_reminder_days">Reminder days</label>
            <div class="col-md-4">
                <input type="text" id="tool_qualification_reminder_days" name="tool_qualification_reminder_days" class="form-control" value="{% if errors.tool_qualification_reminder_days %}{{ errors.tool_qualification_reminder_days.value }}{% else %}{{ tool_qualification_reminder_days }}{% endif %}"/>
            </div>
            <div class="col-md-6 help-block light-grey">
                {% if errors.tool_qualification_reminder_days %}
                    {{ errors.tool_qualification_reminder_days.error }}
                {% else %}
                    The (optional) number of days to send a reminder prior to the user's tool qualification expiration (below). A comma-separated list can be used for multiple reminders. This applies to both expiration cases.
                {% endif %}
            </div>
        </div>
        <div class="form-group {% if errors.tool_qualification_expiration_days %}has-error{% endif %}">
            <label class="control-label col-md-2" for="tool_qualification_expiration_days">Expiration days<br>(previous tool usage)</label>
            <div class="col-md-4">
                <input type="number" step="1" id="tool_qualification_expiration_days" name="tool_qualification_expiration_days" class="form-control" value="{% if errors.tool_qualification_expiration_days %}{{ errors.tool_qualification_expiration_days.value }}{% else %}{{ tool_qualification_expiration_days }}{% endif %}"/>
            </div>
            <div class="col-md-6 help-block light-grey">
                {% if errors.tool_qualification_expiration_days %}
                    {{ errors.tool_qualification_expiration_days.error }}
                {% else %}
                    The number of days before the user's tool qualification expires since the user last used the tool.
                {% endif %}
            </div>
        </div>
        <div class="form-group {% if errors.tool_qualification_expiration_never_used_days %}has-error{% endif %}">
            <label class="control-label col-md-2" for="tool_qualification_expiration_never_used_days">Expiration days<br>(no tool usage)</label>
            <div class="col-md-4">
                <input type="number" step="1" id="tool_qualification_expiration_never_used_days" name="tool_qualification_expiration_never_used_days" class="form-control" value="{% if errors.tool_qualification_expiration_never_used_days %}{{ errors.tool_qualification_expiration_never_used_days.value }}{% else %}{{ tool_qualification_expiration_never_used_days }}{% endif %}"/>
            </div>
            <div class="col-md-6 help-block light-grey">
                {% if errors.tool_qualification_expiration_never_used_days %}
                    {{ errors.tool_qualification_expiration_never_used_days.error }}
                {% else %}
                    The number of days before the user's tool qualification expires since the user qualified for the first time.
                {% endif %}
            </div>
        </div>
        <div class="form-group {% if errors.tool_qualification_cc %}has-error{% endif %}">
            <label class="control-label col-md-2" for="tool_qualification_cc">Reminder/expiration CC</label>
            <div class="col-md-4">
                <input type="text" id="tool_qualification_cc" name="tool_qualification_cc" class="form-control" value="{% if errors.tool_qualification_cc %}{{ errors.tool_qualification_cc.value }}{% else %}{{ tool_qualification_cc }}{% endif %}" placeholder="information@example.org"/>
            </div>
            <div class="col-md-6 help-block light-grey">
                {% if errors.tool_qualification_cc %}
                    {{ errors.tool_qualification_cc.error }}
                {% else %}
                    Extra email address to copy when a user's tool qualification reminder/expiration email is sent. A comma-separated list can be used.
                {% endif %}
            </div>
        </div>
    </div>
    <div class="panel-body">
        <div class="col-md-offset-2">
            {% button type="save" value="Save settings" %}
        </div>
    </div>
</form>