{% load i18n %}

{% with workflow_messages=view.workflow_messages %}
  {% if workflow_messages %}
    {{ workflow_messages|safe }}
  {% endif %}
{% endwith %}

{% if workflow_form.varname == "evaluation" %}
<div class="bo-block" id="evaluation">
 {{ workflow_form.render|safe }}
</div>
{% endif %}

<div class="bo-block" id="evolution-log">
 <ul id="evolutions" class="{% if not formdata.is_at_endpoint_status %}open{% endif %}">
  {% for evolution in formdata.get_visible_evolution_parts reversed %}
    {% with status=evolution.get_status display_parts=evolution.display_parts %}
    <li class="msg-system {{ status.extra_css_class }} {% if forloop.first %}msg-first{% endif %}">
      <span class="item"></span>
      <div>
       {% if evolution.status %}
         <div class="evolution-metadata">
           <span class="status">{{evolution.get_status_label}}</span>
           <span class="time">{{evolution.datetime}}</span>
         </div>
       {% elif forloop.first %}
         <div class="evolution-metadata">
           <span class="status">{{formdata.get_status_label}}</span>
           <span class="time">{{evolution.datetime}}</span>
         </div>
       {% endif %}
       <div class="msg">
         {% if evolution.who %}
         <span class="user">{{evolution.get_author_name|default_if_none:""}}
                 <span>{% if evolution.get_author_qualification %}({{evolution.get_author_qualification}}){% endif %}</span>
         </span>
         {% endif %}
         {% if not evolution.status and not forloop.first %}
           <span class="time">{{evolution.datetime}}</span>
         {% endif %}
         {% if evolution.comment %}
         <div class="comment">
           {{evolution.comment|linebreaks}}
         </div>
         {% endif %}
         {% for part in display_parts %}
           {{part|safe}}
         {% endfor %}
         {% if forloop.first and workflow_form.varname != "evaluation" %}

           {% with workflow_messages=view.actions_workflow_messages %}
             {% if workflow_messages %}
               {{ workflow_messages|safe }}
             {% endif %}
           {% endwith %}

         {{ workflow_form.render|safe }}
         {% endif %}
       </div>
      </div>
    </li>
    {% endwith %}
  {% endfor %}
 </ul>
</div>
