<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Sentiment Trending - AIL</title>
  <link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">

  <!-- Core CSS -->
  <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
  <link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
  <link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
  <script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script>
  <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
  <script src="{{ url_for('static', filename='js/FlexGauge.js') }}"></script>
  <script src="{{ url_for('static', filename='js/jquery.sparkline.min.js') }}"></script>
  <script src="{{ url_for('static', filename='js/jquery.canvasjs.min.js') }}"></script>

  <style>

      .moodtable_worst {
          background: rgba(255, 0, 0, 0.47);
          font-size: small;
      }

      .moodtable_best {
          background: rgba(132, 255, 0, 0.5);
          font-size: small;
      }

      .jqstooltip{
          box-sizing: content-box;
      }

      strong {
          font-size: 16px;
      }

      .table {
          margin-bottom: 0px;
      }

      .sparkLineStats ul {
          padding-left:0;
          list-style:none
      }

      .sparkLineStats {
          position: relative;
          margin-bottom: -4px;
      }

      .sparkLineStats ul li {
          margin-bottom: 8px;
          line-height: 90px;
          font-size: 12px;
      }

      .sparkLineStats ul li div {
          float: left;
      }

      .sparkLineStats ul li div:first-child {
          margin-right: 5px;
      }

      .panelInside {
          padding: 5px;
      }

      .fg-dial-label {
          font-size: 100%;
          font-weight: bold;
          left: 0;
          position: relative;
          text-align: center;
          top: -60px;
          margin-bottom: -10px;
          width: 100%;
      }
  </style>

</head>
<body>

   {% include 'navbar.html' %}

<div id="page-wrapper">
  <div class="row">
      <div class="col-lg-12">
          <h1 class="page-header" data-page="page-sentiment" >Sentiment analysis: Trending</h1>
      </div>
      <!-- /.col-lg-12 -->
  </div>
    <!-- /.row -->
    <div class="row">
        <button id="LoadAll" class="btn btn-info" style="margin: 5px;"><span class="glyphicon glyphicon-download"> </span> Load data from all providers </button>

    <!-- Pannel TODAY -->
    <div class="row">
        <div class="col-lg-12">
            <div class="row">
                <div class="col-lg-12">
                    <div id="panel-today" class="panel panel-default">
                        <div class="panel-heading">
                            <strong data-toggle="tooltip" data-placement="right" title="Providers displayed are in the top list in Module Statistics">Today's mood</strong>
                        </div>
                        <div class="panel-body">
                            <!-- left column -->
                            <div class="col-lg-9" style="padding-left: 0px;">
                                <!-- providers charts -->
                                <div class="col-lg-6">
                                   <div id="today_divl" class="sparkLineStats">

                                   </div>
                                </div>
                                <div class="col-lg-6">
                                   <div id="today_divr" class="sparkLineStats">

                                   </div>
                                </div>
                            </div>
                            <!-- right column -->
                            <div class="col-lg-3">
                                <div class="well text-center" style="padding: 0px;">
                                    <strong data-toggle="tooltip" data-placement="top" title="Percentage is computed over the last hour max value">Mood value</strong>
                                    <div id="gauge_today_last_hour"></div>
                                    <strong data-toggle="tooltip" data-placement="top" title="Average of the sentiments' intensity">Compound by mood</strong>
                                    <div id="bar_today_last_hour" style="height: 70px; width: 100%;"></div>
                                </div>
                                <div class="well text-center" style="padding: 0px;">
                                    <strong data-toggle="tooltip" data-placement="top" title="Percentage is computed over the today max value">Mood value</strong>
                                    <div id="gauge_today_last_days"></div>
                                    <strong data-toggle="tooltip" data-placement="top" title="Average of the of sentiments' intensity">Compound by mood</strong>
                                    <div id="bar_today_last_days" style="height: 70px; width: 100%;"></div>
                                </div>
                            </div>
                            <!-- /.row -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.panel -->
        </div>
    </div>

    <!-- Pannel WEEK -->
    <div class="row">
        <div class="col-lg-12">
            <div class="row">
                <div class="col-lg-12">
                    <div id="panel-week" class="panel panel-default">
                        <div class="panel-heading">
                            <strong>Week's mood</strong>
                        </div>
                        <div class="panel-body">
                            <!-- left column -->
                            <div class="col-lg-9" style="padding-left: 0px;">
                                <!-- providers charts -->
                                <div class="col-lg-6">
                                   <div id="week_divl" class="sparkLineStats">

                                   </div>
                                </div>
                                <div class="col-lg-6">
                                   <div id="week_divr" class="sparkLineStats">

                                   </div>
                                </div>
                            </div>
                            <!-- right column -->
                            <div class="col-lg-3">
                                <div class="well text-center" style="padding: 0px;">
                                    <strong data-toggle="tooltip" data-placement="top" title="Percentage is computed over the week max value">Mood value</strong>
                                    <div id="gauge_week"></div>
                                </div>
                                <div class="well text-center" style="padding: 0px;">
                                    <table class="table table-striped table-bordered table-hover" id="myTable">
                                        <thead>
                                             <tr>
                                                <th>Worst mood</th>
                                                <th>Best mood</th>
                                             </tr>
                                        </thead>
                                        <tbody>
                                          <tr>
                                              <td class="worst1 moodtable_worst">no data</td>
                                              <td class="best1 moodtable_best">no data</td>
                                          </tr>
                                          <tr>
                                              <td class="worst2 moodtable_worst">no data</td>
                                              <td class="best2 moodtable_best">no data</td>
                                          </tr>
                                          <tr>
                                              <td class="worst3 moodtable_worst">no data</td>
                                              <td class="best3 moodtable_best">no data</td>
                                          </tr>
                                          <tr>
                                              <td class="worst4 moodtable_worst">no data</td>
                                              <td class="best4 moodtable_best">no data</td>
                                          </tr>
                                          <tr>
                                              <td class="worst5 moodtable_worst">no data</td>
                                              <td class="best5 moodtable_best">no data</td>
                                          </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <!-- /.row -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.panel -->
        </div>
    </div>


    <!-- /.row -->
    </div>
<!-- /#page-wrapper -->
</div>


<!-- import graph function -->
<script src="{{ url_for('static', filename='js/sentiment_trending.js') }}"
    data-url_sentiment_analysis_getplotdata="{{ url_for('sentiments.sentiment_analysis_getplotdata') }}">
</script>
<script>
    $("#LoadAll").hide();

    $(document).ready(function(){
        activePage = $('h1.page-header').attr('data-page');
        $("#"+activePage).addClass("active");
        $('[data-toggle="tooltip"]').tooltip();

        $("#LoadAll").click(function(){ draw_page("True"); });
        draw_page("False");
        // Reload every 30min
        setTimeout(function(){ location.reload(); }, 30*60*1000);
   });
</script>

</body>
</html>
