{% extends "base.html" %}

{% block title %}Dashboard{% endblock %}

{% block content %}

{% load humanize %}
<div id="right-panel">
	<div id="inner-right-panel">
		<h2>My Projects</h2>
	{% if perms.crm.view_project %}
		<ul class='header-actions-left'>
			<li><a href='{% url list_projects %}'>View All</a></li>
		</ul>
	{% endif %}
		<ul>
		{% ifequal projects.count 0 %}
			You don't have any projects yet.
		{% else %}
            {% regroup projects by status as status_list %}
            {% for status in status_list %}
                <li>
                    {{ status.grouper.label}}
                    <ul>
                    {% regroup status.list by type as type_list %}
                    {% for type in type_list %}
                        <li>
                            {{ type.grouper.label }}s
                            <ul class='projects person'>
                            {% for project in type.list %}
                                <li>
                                {% if perms.timepiece.view_project %}
                                    <a href='{% url view_project business_id=project.business.id,project_id=project.id %}'>{{ project.name }}</a>
                                {% else %}
                                    {{ project.name }}
                                {% endif %}
                                {% if project.trac_environment %}
                                    <span class='trac-options'>({% if project.svn_accessible %}<a href='{{ project.trac_url }}svn'>SVN</a>, {% endif %}<a href='{{ project.trac_url}}roadmap'>roadmap</a>,  <a href='{{ project.trac_url }}newticket'>create ticket</a>)</span>
                                {% endif %}
                                 
                                </li>
                            {% endfor %}
                            </ul>
                        </li>
                    {% endfor %}
                    </ul>
                </li>
            {% endfor %}
		{% endifequal %}
		</ul>
	</div>
</div>

<div id="left-panel">
	<div id="inner-left-panel">
		<h2>Upcoming Interactions</h2>
	{% if perms.crm.view_interaction %}
		<ul class='header-actions-left'>
			<li><a href='{% url list_interactions %}'>All Interactions</a></li>
		</ul>
	{% endif %}
		{% with upcoming_interactions as interactions %}
		{% include "crm/interaction/_list.html" %}
		{% endwith %}
		
		<h2>Recent Interactions</h2>
	{% if perms.crm.view_interaction %}
		<ul class='header-actions-left'>
			<li><a href='{% url list_interactions %}'>All Interactions</a></li>
		</ul>
	{% endif %}
		{% with recent_interactions as interactions %}
		{% include "crm/interaction/_list.html" %}
		{% endwith %}
	</div>
</div>

{% endblock %}
