{% load l10n %}
{% comment %}

 	Renders a single list-item for a listgroup of action items.

 	The list-item has a popover to display details of the action item.

 	popover is contained in "data-content" attr

 {% endcomment %}


<a id="actionitem-{{action_identifier}}"
tabindex="{{ tabindex }}"
class="list-group-item list-group-item-{{ action_item_color }}"
href="javascript://" data-toggle="popover" data-placement="auto" data-html="true" title="{{ popover_title|default:'Action Item'}}" role="button"
data-content="
<div class='list-group'>
<div class='list-group-item list-group-item-default'><p><small>{{ action_identifier }}</small></p>
<span class='label label-{% if status == OPEN %}info{% else %}default{% endif %}'>{{ status }}</span>
<span class='label label-{% if priority == HIGH_PRIORITY %}danger{% else %}warning{% endif %}'>{{ priority|title }}</span>
<h6>{{ display_name|default:'alert' }}</h6>
<p class='text text-muted'>{{ action_item_reason|default:'---' }}</p>
{% if action_instructions %}<p class='text text-muted'><small>{{ action_instructions|truncatechars:250 }}</small></p>{% endif %}
<p class='text text-muted'>
	<small>Opened on {{ report_datetime }}. {{ last_updated_text }}</small>
</p>
</div>
{% if reference_url %}
<a id='referencemodel-change-{{ action_identifier }}' class='list-group-item list-group-item-{{ action_item_color }}'
	title='click to {% if reference_obj %}edit{% else %}add{% endif %}'
	href='{{ reference_url }}'>
	<span class='text text-default text-nowrap small'>{% if reference_obj %}<i class='fas fa-pencil-alt fa-fw' aria-hidden='true'></i>{% else %}<i class='fas fa-plus fa-fw' aria-hidden='true'></i>{% endif %} {{ reference_model_name }}</span>
</a>
{% endif %}

{% if parent_reference_url and parent_reference_model_name %}
	<a 'parent-reference-change-{{ parent_action_item.action_identifier }}'
		class='list-group-item list-group-item-default' href='{{ parent_reference_url }}' title='click to edit'>
		<span class='text text-default small'><i class='fas fa-pencil-alt fa-fw' aria-hidden='true'></i> Previous {{ parent_reference_model_name }}</span>
	</a>
{% endif %}

{% if related_reference_url and related_reference_model_name %}
	<a 'related-reference-change-{{ related_action_item.action_identifier }}'
		class='list-group-item list-group-item-default' href='{{ related_reference_url }}' title='click to edit'>
		<span class='text text-default small'><i class='fas fa-pencil-alt fa-fw' aria-hidden='true'></i> Related {{ related_reference_model_name }}</span>
	</a>
{% endif %}

<a 'actionitem-change-{{ action_identifier }}' class='list-group-item list-group-item-default' href='{{ href }}' title='click to edit'>
	<span class='text text-default text-nowrap small'><i class='fas fa-pencil-alt fa-fw' aria-hidden='true'></i> Action item</span>
</a>
</div>
<p><a title='close' class='btn btn-sm btn-primary pull-right'><i class='fas fa-times fa-fw' aria-hidden='true'></i></a><br></p>

">
<i class="fas fa-caret-left" aria-hidden="true"></i>
<span class="text text-{{ action_item_color }}" title="Click to see more ...">
<small>{{ display_name }} {{ action_age }}</small>
</span>
</a>
