{% extends 'base_embed.html' %}
{% load static %}

{% block content %}
<div class="row">
    <div class="col-sm-12">
        <a href="/">
            <span class="source"> R<small>ig</small> I<small>nformation</small> G<small>athering</small> S<small>ystem</small></span>
        </a>
    </div>

    <div class="col-sm-12">
       <span class="pull-right">
            {% if object.mic %}
                <div class="text-center">
                    <img src="{{ object.mic.profile_picture }}" class="event-mic-photo img-rounded"/>
                </div>
            {% elif object.is_rig %}
                <span class="glyphicon glyphicon-exclamation-sign"></span>
            {% endif %}
        </span>

        <h3>
            <a href="{% url 'event_detail' object.pk %}">
                {% if object.is_rig %}N{{ object.pk|stringformat:"05d" }}{% else %}{{ object.pk }}{% endif %}
                | {{ object.name }} </a>
                {% if object.venue %}
                <small>at {{ object.venue }}</small>
                {% endif %}
        <br/><small>
            {{ object.start_date|date:"D d/m/Y" }}
            {% if object.has_start_time %}
                {{ object.start_time|date:"H:i" }}
            {% endif %}
            {% if object.end_date or object.has_end_time %}
                &ndash;
            {% endif %}
            {% if object.end_date and object.end_date != object.start_date %}
                 {{ object.end_date|date:"D d/m/Y"  }}
            {% endif %}
            {% if object.has_end_time %}
                {{ object.end_time|date:"H:i" }}
            {% endif %}
            </small>
        </h3>

        <div class="row">
            <div class="col-xs-6">
                <p>
                    <strong>Status:</strong>
                    {{ object.get_status_display }}
                </p>
                <p>
                    {% if object.is_rig %}
                        <strong>Client:</strong> {{ object.person.name }}
                        {% if object.organisation %}
                        for {{ object.organisation.name }}
                        {% endif %}
                        {% if object.dry_hire %}(Dry Hire){% endif %}
                    {% else %}
                        <strong>Non-Rig</strong>
                    {% endif %}
                </p>
                <p>
                    <strong>MIC:</strong>
                    {% if object.mic %}
                        {{object.mic.name}}
                    {% else %}
                        None
                    {% endif %}
                </p>
            </div>
            <div class="col-xs-6">
                {% if object.meet_at %}
                    <p>
                        <strong>Crew meet:</strong>
                        {{ object.meet_at|date:"H:i" }} {{ object.meet_at|date:"(Y-m-d)" }}
                    </p>
                {% endif %}
                {% if object.access_at %}
                    <p>
                        <strong>Access at:</strong>
                        {{ object.access_at|date:"H:i" }} {{ object.access_at|date:"(Y-m-d)" }}
                    </p>
                {% endif %}
                <p>
                    <strong>Last updated:</strong>
                    {{ object.last_edited_at }} by "{{ object.last_edited_by.initials }}"
                </p>
            </div>
        </div>
        {% if object.description %}
            <p>
            <strong>Description: </strong>
            {{ object.description|linebreaksbr }}
            </p>
        {% endif %}
        </table>
    </div>
</div>
{% endblock %}
