{% load staticfiles %}
{% load rowerfilters %}
<h1><a href="/rowers/sessions/">Plan</a></h1>
<ul class="cd-accordion-menu animated">
  <li class="has-children" id="plans">
    <input type="checkbox" name="group-plans" id="group-plans">
    <label for="group-plans">
      <i class="fas fa-bullseye-pointer"></i>&nbsp;Plans
    </label>
    <ul>
      <li id="plans-manage">
        <a href="/rowers/createplan/">
          <i class="fas fa-bullseye-pointer"></i>&nbsp;Manage Plans
        </a>
      </li>
      {% for plan in rower|trainingplans %}
      <li id="plan-{{ plan.id }}">
        <a href="/rowers/plan/{{ plan.id }}/">
          <i class="fal fa-calendar-alt fa-fw"></i>&nbsp;{{ plan.name }}
        </a>
      </li>
      {% endfor %}
    </ul>
  </li>
  <li class="has-children" id="sessions">
    <input type="checkbox" name="group-sessions" id="group-sessions">
    <label for="group-sessions">
      <i class="fas fa-calendar-alt fa-fw"></i>&nbsp;Sessions
    </label>
    <ul>
      <li id="sessions-list">
        <a href="/rowers/sessions/?when={{ timeperiod }}">
          <i class="far fa-calendar-alt fa-fw"></i>&nbsp;Sessions
        </a>
      </li>
      <li id="sessions-link">
        <a href="/rowers/sessions/manage/?when={{ timeperiod }}">
          <i class="fas fa-tasks fa-fw"></i>&nbsp;Link Workouts
        </a>
      </li>
      <li id="sessions-coach">
        <a href="/rowers/sessions/coach/?when={{ timeperiod }}">
          <i class="fas fa-bullhorn fa-fw"></i>&nbsp;Training Group View
        </a>
      </li>
      <li id="sessions-print">
        <a href="/rowers/sessions/print/?when={{ timeperiod }}">
          <i class="fas fa-print fa-fw"></i>&nbsp;Print View
        </a>
      </li>
    </ul>
  </li>
  <li class="has-children" id="plan">
    <input type="checkbox" name="group-plan" id="group-plan">
    <label for="group-plan">
      <i class="fas fa-calendar-plus fa-fw"></i>&nbsp;Plan Sessions
    </label>
    <ul>
      <li id="plan-session">
        <a href="/rowers/sessions/create/?when={{ timeperiod }}">
          <i class="far fa-calendar-plus fa-fw"></i>&nbsp;Add Session
        </a>
      </li>
      <li id="plan-microcycle">
        <a href="/rowers/sessions/multicreate/?when={{ timeperiod }}">
          <i class="fas fa-expand fa-fw"></i>Plan Microcycle
        </a>
      </li>
      <li id="plan-microcycle">
        <a href="/rowers/sessions/multiclone/user/{{ rower.user.id }}/?when={{ timeperiod }}">
          <i class="fas fa-layer-plus fa-fw"></i>Clone Multiple Sessions
        </a>
      </li>
    </ul>
  </li>
  {% if request.user|user_teams %}
  <li class="has-children" id="teamplan">
    <input type="checkbox" name="group-plan" id="group-teamplan">
    <label for="group-teamplan">
      <i class="fas fa-calendar-plus fa-fw"></i>&nbsp;Plan Group Sessions
    </label>
    <ul>
      <li id="plan-teamsession">
        <a href="/rowers/sessions/teamcreate/?when={{ timeperiod }}">
          <i class="fas fa-whistle fa-fw"></i>&nbsp;Add Group Session
        </a>
      </li>
      <li id="plan-microcycle">
        <a href="/rowers/sessions/multicreate/?when={{ timeperiod }}&team={{ request.user|user_team1 }}">
          <i class="fas fa-expand fa-fw"></i>Plan Group Microcycle
        </a>
      </li>
      <li id="plan-microcycle">
        <a href="/rowers/sessions/multiclone/user/{{ rower.user.id }}/?when={{ timeperiod }}">
          <i class="fas fa-layer-plus fa-fw"></i>Clone Multiple Group Sessions
        </a>
      </li>
    </ul>
  </li>
  {% endif %}
</ul><!-- cd-accordion-menu -->

<p>&nbsp;</p>

{% if user.is_authenticated and user|is_planmember %}
<p>&nbsp;</p>
{% if user|team_members %}
<ul class="cd-accordion-menu animated">
  <li class="has-children" id="athletes">
    <input type="checkbox" name="athlete-selector" id="athlete-selector">
    <label for="athlete-selector"><i class="fas fa-users fa-fw"></i>&nbsp;Group Members</label>
    <ul>
      {% for member in user|team_members %}
      <li>
        <a href={{ request.path|userurl:member }}>
          <i class="fas fa-user fa-fw"></i>
          {% if member == rower.user%}
          &bull;
          {% else %}
          &nbsp; 
          {% endif %}
          {{ member.first_name }} {{ member.last_name }}
        </a>
      </li>
      {% endfor %}
    </ul>
  </li>
</ul>
{% endif %}
{% endif %}

{% include 'menuscript.html' %}
