{% extends "freeadmin/generic_form.html" %}
{% block form %}
    <tr>
        <td>
            <p>
                {% if scrub.status == 'IN_PROGRESS' %}
                    {{ volume.vol_name }}: {% trans "Scrub is currently running! Are you sure you want to STOP the scrub process?" %}
                {% else %}
                    {% if scrub.status == 'PAUSED' %}
                        {{ volume.vol_name }}: {% trans "Scrub is currently paused. Are you sure want to resume it?" %}
                    {% else %}
                        {{ volume.vol_name }}: {% trans "Are you sure you want to scrub?" %}
                    {% endif %}
                    <br />{% trans "This will increase system overhead while in progress" %}
                {% endif %}
            </p>
        </td>
    </tr>
{% endblock %}

{% block buttons %}
    {% if scrub.status == 'IN_PROGRESS' %}
        <button id="btn_{{ model_name }}_Pause" data-dojo-type="dijit.form.Button">
            {% trans "Pause" %}
            <script type="dojo/method" data-dojo-event="onClick" data-dojo-args="evt">
                form = getForm(this);
                doSubmit({
                    form: form,
                    event: evt,
                    url: '{{ request.path }}',
                    extraKey: "action",
                    extraValue: "pause",
                    });
            </script>
        </button>
        <button id="btn_{{ model_name }}_Stop" data-dojo-type="dijit.form.Button">
            {% trans "Stop" %}
            <script type="dojo/method" data-dojo-event="onClick" data-dojo-args="evt">
                form = getForm(this);
                doSubmit({
                    form: form,
                    event: evt,
                    url: '{{ request.path }}',
                    extraKey: "action",
                    extraValue: "stop",
                    });
            </script>
        </button>
    {% else %}
        {% if scrub.status == 'PAUSED' %}
            <button id="btn_{{ model_name }}_Resume" data-dojo-type="dijit.form.Button">
                {% trans "Resume" %}
                <script type="dojo/method" data-dojo-event="onClick" data-dojo-args="evt">
                    form = getForm(this);
                    doSubmit({
                        form: form,
                        event: evt,
                        url: '{{ request.path }}',
                        extraKey: "action",
                        extraValue: "start",
                        });
                </script>
            </button>
            <button id="btn_{{ model_name }}_Stop" data-dojo-type="dijit.form.Button">
                {% trans "Stop" %}
                <script type="dojo/method" data-dojo-event="onClick" data-dojo-args="evt">
                    form = getForm(this);
                    doSubmit({
                        form: form,
                        event: evt,
                        url: '{{ request.path }}',
                        extraKey: "action",
                        extraValue: "stop",
                        });
                </script>
            </button>
        {% else %}
            <button id="btn_{{ model_name }}_Start" data-dojo-type="dijit.form.Button">
                {% trans "Start" %}
                <script type="dojo/method" data-dojo-event="onClick" data-dojo-args="evt">
                    form = getForm(this);
                    doSubmit({
                        form: form,
                        event: evt,
                        url: '{{ request.path }}',
                        extraKey: "action",
                        extraValue: "start",
                        });
                </script>
            </button>
        {% endif %}
    {% endif %}
    {% if not inline %}
    <button id="btn_{{ model_name }}_Cancel" data-dojo-type="dijit.form.Button" type="button">
        {% block cancellabel %}{% trans "Cancel" %}{% endblock %}
        <script type="dojo/method" data-dojo-event="onClick" data-dojo-args="evt">
            cancelDialog(this);
        </script>
    </button>
    {% endif %}
{% endblock %}
