{% extends "committees/base.html" %}
{% block page-class %}gov{% endblock %}
{% load humanize markup typogrify committee_tags %}
{% block title %}{{object.title}} meeting of {{object.start|naturalday}} at {% endblock %}

{% block body %}
  <div class="grid_12 last">
    <h2>Governance</h2>
  </div>

  <div class="grid_8" >
  {% get_committee_minutes for object as minutes %}
  {% if object %}
  <h3>{{object.title}} {% if minutes and board_member %}{% if minutes.draft %}DRAFT{% endif %} Minutes{% else %}Agenda{% endif %} of the {{object.group}}</h3>
  <h3>{{object.start|naturalday}} {{object.start|time:"f a"}}</h3>

  {% if minutes and board_member %}  
  {% if minutes.call_to_order %}<p>Meeting called to order at {{minutes.call_to_order|time:"f a"}} in {{object.location}}.</p>{% endif%}

  {{minutes.rendered_content|typogrify}}
  {% if object.get_next_meeting %}
  <p><a href="{{object.get_next_meeting.get_absolute_url}}">Next meeting at {{ object.get_next_meeting.start|naturalday }} at {{ object.get_next_meeting.start|time:"f a" }}</a></p>
  {% endif %}
  {% if minutes.adjournment %}<p>Meeting adjourned at {{minutes.adjournment|time:"f a"}}.</p>{% endif %}

  {% if minutes.signed %}
  <p>Respectfully submitted,</p>
  <p>{{ minutes.signed }} {% if minutes.signed.term_set.all %}{% for t in minutes.signed.term_set.all %}{% if forloop.first %}, {{t.office.title}}{% endif %}{% endfor %}{% endif %}</p>
  <p>{{ minutes.signed_date|naturalday }}</p>
  {% endif %}

  {% else %}
  {% if object.meeting.agenda %}
  <div class="agenda">
  {% if object.meeting.agenda %}
  <h4>Proposed agenda</h4>
  {{object.meeting.agenda|typogrify|markdown}}
  {% else %}
  <p>This meeintg does not yet have an agenda set.</p>
  {% endif %}
  </div>
  {% endif %}
  {% endif %}
  {% endif %}
</div>

<div class="grid_4 last">
    {% if minutes and board_member %}
  <div class="box">
  <h3>Members present</h3>
  <ul>
  {% for t in minutes.members_present.all %}
  <li>{{t.person}}{% if t.office %}, {{t.office.title}}{%endif %}</li>
  {% endfor %}
  </ul>

  {% if minutes.others_present %}
  <h3>Others present</h3>
  <ul>
  {% for g in minutes.others_present.all %}
  <li>{{g}}</li>
  {% endfor %}
  </ul>
  <hr />
  </div>
  {% else %}
  <hr />
  </div>
  {% endif %}
  {% endif %}
</div>

{% endblock %}

