<!-- mountainbikel_index.html -->
{% extends "layouts/base.html" %}

{% block title %} Seht mal an, da kommt der Mikel {% endblock %} 

<!-- Specific Page CSS goes HERE  -->
{% block stylesheets %}{% endblock stylesheets %}

{% block content %}

    <div class="content">
        <div class="row">
            <div class="col-lg-4">
                <div class="card card-chart">
                    <div class="card-header">
                        <h5 class="card-category">Höhenmeter</h5>
                        <h3 class="card-title"><i class="tim-icons icon-bell-55 text-primary"></i>{{elevationtotal}}m</h3>
                    </div>
                </div>
            </div>
            <div class="col-lg-4">
                <div class="card card-chart">
                    <div class="card-header">
                        <h5 class="card-category">Strecke</h5>
                        <h3 class="card-title"><i class="tim-icons icon-delivery-fast text-info"></i>{{distancetotal}}km</h3>
                    </div>
                </div>
            </div>
            <div class="col-lg-4">
                <div class="card card-chart">
                    <div class="card-header">
                        <h5 class="card-category">Zeit</h5>
                        <h3 class="card-title"><i class="tim-icons icon-send text-success"></i>{{durationtotal}}</h3>
                    </div>
                </div>
            </div>
        </div>
      <div class="row">
        <div class="col-12">
          <div class="card card-chart">
            <div class="card-header ">
              <div class="row">
                <div class="col-sm-6 text-left">
                  <h5 class="card-category">Alle Jahre</h5>
                  <h2 class="card-title">Mountainbike</h2>
                </div>
                <div class="col-sm-6">
                  <div class="btn-group btn-group-toggle float-right" data-toggle="buttons">
                    <label class="btn btn-sm btn-primary btn-simple active" id="0" onclick="graphtoggle('mochart')">
                      <input type="radio" name="options" checked>
                      <span class="d-none d-sm-block d-md-block d-lg-block d-xl-block">Höhenmeter</span>
                    </label>
                    <label class="btn btn-sm btn-primary btn-simple" id="1" onclick="graphtoggle('distchart')">
                      <input type="radio" class="d-none d-sm-none" name="options">
                      <span class="d-none d-sm-block d-md-block d-lg-block d-xl-block">Entfernung</span>
                    </label>
                    <label class="btn btn-sm btn-primary btn-simple" id="2" onclick="graphtoggle('timechart')">
                      <input type="radio" class="d-none" name="options">
                      <span class="d-none d-sm-block d-md-block d-lg-block d-xl-block">Zeit</span>
                    </label>
                  </div>
                </div>
              </div>
            </div>
            <div class="card-body" style="height:450px;">
              <div class="chart-area">
                <div id="mochart" style="visibility:visible"></div>
                <div id="distchart" style="visibility:visible"></div>
                <div id="timechart" style="visibility:visible"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
        <div class="row">
          <!-- ------------------------------------------- neue tabelle --- -->
            <div class="card-body" style="width:80%;">
                        <table style="width:100%; padding-left:5%">
                            <tbody>
                                <tr>
                                    <th></th>
                                    <th>Höhenmeter</th>
                                    <th>Entfernung</th>
                                    <th>Zeit</th>
                                    <th>Puls</th>
                                    <th>Puls (max)</th>
                                    <th>Intensitätsminuten</th>
                                </tr><tr>
                                    <td><span title="">diese Woche</span></td>
                                    <td>{{elevation0w}}</td>
                                    <td>{{distance0w}}</td>
                                    <td>{{duration0w}}</td>
                                    <td>{{averageHR0w}}</td>
                                    <td>{{maxHR0w}}</td>
                                    <td>{{intensityMinutes0w}}</td>
                                </tr><tr>
                                </tr><tr>
                                    <td>letzte Woche</td>
                                    <td>{{elevation1w}}</td>
                                    <td>{{distance1w}}</td>
                                    <td>{{duration1w}}</td>
                                    <td>{{averageHR1w}}</td>
                                    <td>{{maxHR1w}}</td>
                                    <td>{{intensityMinutes1w}}</td>
                                </tr><tr>
                                    <td>dieser Monat</td>
                                    <td>{{elevation0m}}</td>
                                    <td>{{distance0m}}</td>
                                    <td>{{duration0m}}</td>
                                    <td>{{averageHR0m}}</td>
                                    <td>{{maxHR0m}}</td>
                                    <td>{{intensityMinutes0m}}</td>
                                </tr><tr>
                                    <td>letzter Monat</td>
                                    <td>{{elevation1m}}</td>
                                    <td>{{distance1m}}</td>
                                    <td>{{duration1m}}</td>
                                    <td>{{averageHR1m}}</td>
                                    <td>{{maxHR1m}}</td>
                                    <td>{{intensityMinutes1m}}</td>
                                </tr><tr>
                                    <td>dieses Jahr</td>
                                    <td>{{elevation0y}}</td>
                                    <td>{{distance0y}}</td>
                                    <td>{{duration0y}}</td>
                                    <td>{{averageHR0y}}</td>
                                    <td>{{maxHR0y}}</td>
                                    <td>{{intensityMinutes0y}}</td>
                                </tr><tr>
                                    <td>letztes Jahr</td>
                                    <td>{{elevation1y}}</td>
                                    <td>{{distance1y}}</td>
                                    <td>{{duration1y}}</td>
                                    <td>{{averageHR1y}}</td>
                                    <td>{{maxHR1y}}</td>
                                    <td>{{intensityMinutes1y}}</td>
                                </tr><tr>
                                    <td>Total</td>
                                    <td>{{elevationtotal}}</td>
                                    <td>{{distancetotal}}</td>
                                    <td>{{durationtotal}}</td>
                                    <td>{{averageHRtotal}}</td>
                                    <td>{{maxHRtotal}}</td>
                                    <td>{{intensityMinutestotal}}</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>          
          <!-- -------------------------------------- ende neue tabelle --- -->
        </div>
    </div>

{% endblock content %}

<!-- Specific Page JS goes HERE  -->
{% block javascripts %}
<script>
    $(document).ready(function () {
        // Javascript method's body can be found in assets/js/demos.js
        //demo.initDashboardPageCharts();

    });
</script>

<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script type="text/javascript">
  $(document).ready(function () {
      var graphs = {{mosum|safe}};
      Plotly.plot('mochart',graphs,{});
      
      var distgraphs = {{distsum|safe}};
      Plotly.plot('distchart',distgraphs,{});
      
      var timegraphs = {{timesum|safe}};
      Plotly.plot('timechart',timegraphs,{});
  });
  
  function graphtoggle( graph ) {
      $('#mochart').hide();
      $('#distchart').hide();
      $('#timechart').hide();
      // console.log('#'+graph);
      $('#' + graph).show();
  }
</script>
  <!-- Apex Chart -->
  <!-- <script src="{{ url_for('static', filename='assets/js/plugins/apexcharts.min.js') }}"></script> -->
  <!-- <script src="{{ url_for('static', filename='assets/js/pages/dashboard-default.js') }}"></script> -->
{% endblock javascripts %}
