{% extends 'base.html' %}
{% load buttons %}
{% load custom_links %}
{% load helpers %}
{% load plugins %}

{% block header %}
    <div class="row noprint">
        <div class="col-sm-12 col-md-12">
            <ol class="breadcrumb">
                <li><a href="{% url 'plugins:lifecycles:lifecycles' %}">Lifecycles</a></li>
                <li>{{ lifecycle }}</li>
            </ol>
        </div>
    </div>
    <div class="pull-right noprint">
	<a href={% url 'plugins:lifecycles:lifecycle_edit' pk=lifecycle.id %} class="btn btn-warning">
           <span class="fa fa-pencil" aria-hidden="true"></span> Edit
        </a>
        <a href={% url 'plugins:lifecycles:lifecycle_delete' pk=lifecycle.id %} class="btn btn-danger">
           <span class="fa fa-trash" aria-hidden="true"></span> Delete
        </a>
    </div>
    <h1>{% block title %}{{ lifecycle }}{% endblock %}</h1>
    {% include 'inc/created_updated.html' with obj=lifecycle %}
    <div class="pull-right noprint">
        {% custom_links lifecycle %}
    </div>
    <ul class="nav nav-tabs">
        <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
            <a href="{% url 'plugins:lifecycles:lifecycle' pk=lifecycle.id %}">Lifecycle</a>
        </li>
        {% if perms.extras.view_objectchange %}
            <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
                <a href="{% url 'plugins:lifecycles:lifecycle_changelog' pk=lifecycle.id %}">Change Log</a>
            </li>
        {% endif %}
    </ul>
{% endblock %}

{% block content %}
<div class="row">
        <div class="col-md-7">
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Lifecycle</strong>
            </div>
            <table class="table table-hover panel-body attr-table">
                <tr>
                    <td>Device</td>
                    <td>
                        {% if lifecycle.device %}
                            <a href="{{ lifecycle.device.get_absolute_url }}">{{ lifecycle.device }}</a>
                        {% else %}
                            <span class="text-muted">None</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>Date</td>
                    <td>{{ lifecycle.date|placeholder }}</td>
                </tr>
                <tr>
		    <td>User</td>
                    <td>
                        {% if lifecycle.user %}
                            <a href="{{ lifecycle.user.get_absolute_url }}">{{ lifecycle.user }}</a>
                        {% else %}
                            <span class="text-muted">None</span>
                        {% endif %}

                    </td>
                </tr>
                <tr>
                    <td>Action type</td>
                    <td> {{ lifecycle.action_type }} </td>
		</tr>

            </table>
        </div>
        {% include 'inc/custom_fields_panel.html' with obj=lifecycle %}
        {% include 'extras/inc/tags_panel.html' with tags=lifecycle.tags.all url='plugins:lifecycles:lifecycles' %}
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Comments</strong>
            </div>
            <div class="panel-body rendered-markdown">
                {% if lifecycle.comments %}
                    {{ lifecycle.comments|render_markdown }}
                {% else %}
                    <span class="text-muted">None</span>
                {% endif %}
            </div>
        </div>
        {% plugin_left_page lifecycle %}
	</div>
        {% plugin_right_page lifecycle %}
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        {% plugin_full_width_page lifecycle %}
    </div>
</div>
{% endblock %}
