{% load rowerfilters %}
<h1><a href="/rowers/list-workouts/">Workout</a></h1>
<ul class="cd-accordion-menu animated">
  <li class="has-children" id="workout">
    <input type="checkbox" name="group-workout" id="group-workout" checked>
    <label for="group-workout">Workout</label>
    <ul>
      <li id="workout-dashboard">
        {% if user.is_authenticated and workout|may_edit:request %}
        <a href="/rowers/workout/{{ workout.id|encode }}/workflow/">
          <i class="fas fa-tachometer-alt fa-fw"></i>&nbsp;View
        </a>
        {% else %}
        <a href="/rowers/workout/{{ workout.id|encode }}/workflow/">
          <i class="fas fa-tachometer-alt fa-fw"></i>&nbsp;View
        </a>
        {% endif %}
      </li>
      {% if user.is_authenticated and workout|may_edit:request %}
      <li id="workout-edit">
        <a href="/rowers/workout/{{ workout.id|encode }}/edit/">
          <i class="fas fa-pencil-alt fa-fw"></i>&nbsp;Edit
        </a>
      </li>
        <a href="/rowers/workout/{{ workout.id|encode }}/editintervals/">
          <i class="fas fa-pause fa-fw"></i>&nbsp;Intervals
        </a>
      </li>
      {% endif %}
      {% if user.is_authenticated %}
      <li id="workout-comments">
        <a href="/rowers/workout/{{ workout.id|encode }}/comment/">
          <i class="fas fa-comments fa-fw"></i>&nbsp;Comments
          ({{ workout|aantalcomments }})
        </a>
      </li>
      {% endif %}
      <li id="workout-stats">
        <a href="/rowers/workout/{{ workout.id|encode }}/stats/">
          <i class="fal fa-table fa-fw"></i>&nbsp;Statistics
        </a>
      </li>
      <li id="compare">
        <a href="/rowers/team-compare-select/workout/{{ workout.id|encode }}/">
          <i class="fas fa-balance-scale fa-fw"></i>&nbsp;Compare
        </a>
      </li>
      <li id="video-analysis">
        <a href="/rowers/workout/{{ workout.id|encode }}/video/">
          <i class="fas fa-video-plus fa-fw"></i>&nbsp;Video Analysis
        </a>
      </li>
      {% if user.is_authenticated and workout|may_edit:request %}
      <li id="chart-image">
        <a href="/rowers/workout/{{ workout.id|encode }}/image/">
          <i class="fas fa-file-image fa-fw"></i>&nbsp;Upload Image
        </a>
      </li>
      <li id="workout-delete">
        <a href="/rowers/workout/{{ workout.id|encode }}/delete/">
          <i class="fas fa-trash-alt fa-fw"></i>&nbsp;Delete
        </a>
      </li>
      {% endif %}
    </ul>
  </li>
  <li class="has-children" id="flexchart">
    <input type="checkbox" name="group-flexchart" id="group-flexchart">
    <label for="group-flexchart">Interactive Charts</label>
    <ul>
      <li id="chart-flexchart">
        <a href="/rowers/workout/{{ workout.id|encode }}/flexchart/">
          <i class="fas fa-chart-line fa-fw"></i>&nbsp;Flex Chart
        </a>
      </li>
      {% if workout|water %}
      <li id="chart-map">
        <a href="/rowers/workout/{{ workout.id|encode }}/map/">
          <i class="fas fa-map-marked-alt fa-fw"></i>&nbsp;Map
        </a>
      </li>
      <li id="chart-empower">
        <a href="/rowers/workout/{{ workout.id|encode }}/forcecurve/">
          <i class="fas fa-dumbbell fa-fw"></i>&nbsp;Force Curve
        </a>
      </li>
      <li id="chart-otwpower">
        <a href="/rowers/workout/{{ workout.id|encode }}/interactiveotwplot/">
          <i class="fal fa-calculator-alt fa-fw"></i>&nbsp;Corrected Pace Plot
        </a>
      </li>
      {% endif %}
    </ul>
  </li>
  {% if user.is_authenticated and workout|may_edit:request %}
  <li class="has-children" id="chart">
    <input type="checkbox" name="group-chart" id="group-chart">
    <label for="group-chart">Static Charts</label>
    <ul>
      <li id="chart-time">
        <a href="/rowers/workout/{{ workout.id|encode }}/addstatic/1/">
          <i class="fas fa-stopwatch fa-fw"></i>&nbsp;Time
        </a>
      </li>
      <li id="chart-distance">
        <a href="/rowers/workout/{{ workout.id|encode }}/addstatic/2/">
          <i class="fas fa-ruler fa-fw"></i>&nbsp;Distance
        </a>
      </li>
      <li id="chart-powerpie">
        <a href="/rowers/workout/{{ workout.id|encode }}/addstatic/13/">
          <i class="far fa-chart-pie fa-fw"></i>&nbsp;Power (Pie)
        </a>
      </li>
      <li id="chart-hrpie">
        <a href="/rowers/workout/{{ workout.id|encode }}/addstatic/3/">
          <i class="fas fa-heartbeat fa-fw"></i>&nbsp;Heart Rate (Pie)
        </a>
      </li>
      {% if workout|water %}
      <li id="chart-otwpower">
        <a href="/rowers/workout/{{ workout.id|encode }}/addstatic/9/">
          <i class="fas fa-chart-area fa-fw"></i>&nbsp;OTW Power
        </a>
      </li>
      {% endif %}
    </ul>
  </li>
  <li class="has-children" id="export">
    <input type="checkbox" name="group-export" id="group-export">
    <label for="group-export">Export</label>
    <ul>
      <li id="export-c2">
        {% if workout.uploadedtoc2 %}
        <a href="http://log.concept2.com/profile/{{ user|c2userid }}/log/{{ workout.uploadedtoc2 }}">
          Concept2 <i class="fas fa-check"></i>
        </a>
        {% elif user.rower.c2token == None or user.rower.c2token == '' %}
        <a href="/rowers/me/c2authorize">
          Connect to Concept2
        </a>
        {% else %}
        <a href="/rowers/workout/{{ workout.id|encode }}/c2uploadw/">
          Concept2
        </a>
        {% endif %}
      </li>
      <li id="export-strava">
        {% if workout.uploadedtostrava %}
        <a href="https://www.strava.com/activities/{{ workout.uploadedtostrava }}">
          Strava <i class="fas fa-check"></i>
        </a>
        {% elif user.rower.stravatoken == None or user.rower.stravatoken == '' %}
        <a href="/rowers/me/stravaauthorize">
          Connect to Strava
        </a>
        {% else %}
        <a href="/rowers/workout/{{ workout.id|encode }}/stravauploadw/">
          Strava
        </a>
        {% endif %}
      </li>
      <li id="export-st">
        {% if workout.uploadedtosporttracks %}
        <a href="https://sporttracks.mobi/activity/{{ workout.uploadedtosporttracks }}">
          SportTracks  <i class="fas fa-check"></i>
        </a>
        {% elif user.rower.sporttrackstoken == None or user.rower.sporttrackstoken == '' %}
        <a href="/rowers/me/sporttracksauthorize">
          Connect to SportTracks
        </a>
        {% else %}
        <a href="/rowers/workout/{{ workout.id|encode }}/sporttracksuploadw/">
          SportTracks
        </a>
        {% endif %}
      </li>
      <li id="export-rk">
        {% if workout.uploadedtorunkeeper %}
        <a href="https://runkeeper.com/user/{{ user|rkuserid }}/activity/{{ workout.uploadedtorunkeeper }}">
          Runkeeper   <i class="fas fa-check"></i>
        </a>
        {% elif user.rower.runkeepertoken == None or user.rower.runkeepertoken == '' %}
        <a href="/rowers/me/runkeeperauthorize">
          Connect to Runkeeper
        </a>
        {% else %}
        <a href="/rowers/workout/{{ workout.id|encode }}/runkeeperuploadw/">
          Runkeeper
        </a>
        {% endif %}
      </li>
      <li id="export-mmf">
        {% if workout.uploadedtounderarmour %}
        <a href="https://www.mapmyfitness.com/workout/{{ workout.uploadedtounderarmour }}">
          MapMyFitness  <i class="fas fa-check"></i>
        </a>
        {% elif user.rower.underarmourtoken == None or user.rower.underarmourtoken == '' %}
        <a href="/rowers/me/underarmourauthorize">
          Connect to MapMyFitness
        </a>
        {% else %}
        <a href="/rowers/workout/{{ workout.id|encode }}/underarmouruploadw/">
          MapMyFitness
        </a>
        {% endif %}
      </li>
      <li id="export-tp">
        {% if workout.uploadedtotp %}
        <a href="https://app.trainingpeaks.com">
          TrainingPeaks  <i class="fas fa-check"></i>
        </a>
        {% elif user.rower.tptoken == None or user.rower.tptoken == '' %}
        <a href="/rowers/me/tpauthorize">
          Connect to TrainingPeaks
        </a>
        {% else %}
        <a href="/rowers/workout/{{ workout.id|encode }}/tpuploadw/">
          TrainingPeaks
        </a>
        {% endif %}
      </li>
      <li id="export-csv">
        <a href="/rowers/workout/{{ workout.id|encode }}/emailcsv/">
          CSV
        </a>
      </li>
      <li id="export-gpx">
        <a href="/rowers/workout/{{ workout.id|encode }}/emailgpx/">
          GPX
        </a>
      </li>
      <li id="export-tcx">
        <a href="/rowers/workout/{{ workout.id|encode }}/emailtcx/">
          TCX
        </a>
      </li>
    </ul>
  </li>
  <li class="has-children" id="data">
    <input type="checkbox" name="group-data" id="group-data">
    <label for="group-data">Data</label>
    <ul>
      <li id="data-smoothen">
        <a href="/rowers/workout/{{ workout.id|encode }}/smoothenpace/">
          <i class="fas fa-magic fa-fw"></i>&nbsp;Smoothen
        </a>
      </li>
      <li id="data-raw">
        <a href="/rowers/workout/{{ workout.id|encode }}/undosmoothenpace/">
          <i class="fas fa-undo fa-fw"></i>&nbsp;Restore Raw
        </a>
      </li>
      <li id="data-fusion">
        <a href="/rowers/workout/fusion/{{ workout.id|encode }}/">
          <i class="fas fa-blender fa-fw"></i>&nbsp;Sensor Fusion
        </a>
      </li>
      <li id="data-split">
        <a href="/rowers/workout/{{ workout.id|encode }}/split/">
          <i class="fas fa-cut fa-fw"></i>&nbsp;Split Workout
        </a>
      </li>
      <li id="data-view">
        <a href="/rowers/workout/{{ workout.id|encode }}/data/">
          <i class="fal fa-table fa-fw"></i>&nbsp;Explore Raw Data
        </a>
    </ul>
  </li>
  <li class="has-children" id="advanced">
    <input type="checkbox" name="group-advanced" id="group-advanced">
    <label for="group-advanced">Advanced</label>
    <ul>
      {% if workout|water %}
      <li id="advanced-wind">
        <a href="/rowers/workout/{{ workout.id|encode }}/wind/">
          <i class="fas fa-pennant fa-fw"></i>&nbsp;Wind
        </a>
      </li>
      <li id="advanced-stream">
        <a href="/rowers/workout/{{ workout.id|encode }}/stream/">
          <i class="fas fa-stream fa-fw"></i>&nbsp;Stream
        </a>
      </li>
      <li id="advanced-otwpower">
        <a href="/rowers/workout/{{ workout.id|encode }}/otwsetpower/">
          <i class="fas fa-calculator-alt fa-fw"></i>&nbsp;OTW Power
        </a>
      </li>
      {% if 'speedcoach2' in workout.workoutsource %}
      <li id="advanced-usegps">
        <a href="/rowers/workout/{{ workout.id|encode }}/otwusegps/">
          <i class="fas fa-satellite"></i>
          {% if workout.impeller %}&nbsp;{% else %}&bull;&nbsp;{% endif %}Use GPS data
        </a>
      </li>
      <li id="advanced-useimpeller">
        <a href="/rowers/workout/{{ workout.id|encode }}/otwuseimpeller/">
          <i class="fas fa-wind-turbine fa-rotate-180"></i>
          {% if workout.impeller %}&bull;&nbsp;{% else %}&nbsp;{% endif %}Use Impeller data
        </a>
      </li>
      {% endif %}
      {% endif %}
      <li id="advanced-instroke">
        <a href="/rowers/workout/{{ workout.id|encode }}/instroke/">
          <i class="fas fa-search-plus fa-fw"></i>
          In-Stroke Metrics
        </a>
      </li>
      <li id="advanced-recalcsummary">
        <a href="/rowers/workout/{{ workout.id|encode }}/recalcsummary/">
          <i class="fas fa-window-restore fa-fw"></i>&nbsp;Update Summary
        </a>
      </li>
    </ul>
  </li>
  {% endif %}
</ul><!-- cd-accordion-menu -->

{% include 'menuscript.html' %}
