{% load i18n %}

<h2 class="first-heading">{% trans "Transitions" %}</h2>

{% for transition in workflow.transitions.all %}
    <h3>
        <a class="delete-link" href="{% url 'lfc_manage_delete_workflow_transition' transition.id %}">
            <img class="icon" src="{{ STATIC_URL }}icons/cancel.png" />
        </a>

        <a class="ajax-link" href="{% url 'lfc_manage_transition' transition.id %}">
            {% trans transition.name %}
        </a>
    </h3>
    <div style="padding: 0 0 10px 20px">
        <table>
            <tr>
                <td style="padding-right:20px">
                    {% trans "Destination state" %}:
                </td>
                <td>
                    {% if transition.destination %}
                        <a class="ajax-link" href="{% url 'lfc_manage_state' transition.destination.id %}">
                            {% trans transition.destination.name %}
                        </a>
                    {% else %}
                        {% trans "None" %}
                    {% endif %}
                </td>
            </tr>
            <tr>
                <td>
                    {% trans "Permission" %}:
                </td>
                <td>
                    {% if transition.permission %}
                        {% trans transition.permission.name %}
                    {% else %}
                        {% trans "None" %}
                    {% endif %}
                </td>
            </tr>
            <tr>
                <td>
                    {% trans "Condition" %}:
                </td>
                <td>
                    {% if transition.condition %}
                        {{ transition.condition }}
                    {% else %}
                        {% trans "None" %}
                    {% endif %}
                </td>
            </tr>
        </table>
    </div>
{% endfor %}

<h2 class="middle-heading">{% trans "Add transition" %}</h2>

<form action="{% url 'lfc_manage_add_workflow_transition' workflow.id %}"
      method="POST">
    {% csrf_token %}
    <input name="name" type="text" />
    <input class="ajax-submit"
           type="submit" value='{% trans "Add transition" %}' />
</form>
