<!DOCTYPE html>
<title>Welcome</title>
{% extends "layout.html" %}

{% block body %}
	<div class=page>
  		<h1>Welcome</h1>
  		<div class=metanav>
  			{% if current_user.is_authenticated() %}
    			Welcome, {{ current_user.name }} to the new Literature Review Curation tool.
    			
    			  	<head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
      	var history_data = ({{ history_data|safe }})
      	var history_labels = ({{ history_labels|safe }})

        var data = google.visualization.arrayToDataTable([
          ['Day', 'Discarded', 'Added to Database'],
          [history_labels[0],  history_data[0][0],      history_data[0][1]],
          [history_labels[1],  history_data[1][0],      history_data[1][1]],
          [history_labels[2],  history_data[2][0],      history_data[2][1]],
          [history_labels[3],  history_data[3][0],      history_data[3][1]],
          [history_labels[4],  history_data[4][0],      history_data[4][1]],
          [history_labels[5],  history_data[5][0],      history_data[5][1]],
          [history_labels[6],  history_data[6][0],      history_data[6][1]],
          [history_labels[7],  history_data[7][0],      history_data[7][1]],
          [history_labels[8],  history_data[8][0],      history_data[8][1]],
          [history_labels[9],  history_data[9][0],      history_data[9][1]]
        ]);

        var options = {
          title: 'Recent Activity',
          hAxis: {title: 'Date', count:10},
          vAxis:{title: 'References'},
          isStacked: true,
          colors: ['firebrick', 'forestgreen'],
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width:100%; height: 500px;"></div>
  </body>
  
  			{% else %}
    			Welcome to the new Literature Review Curation tool. You are not logged in. Please <a href="{{ url_for('reference') }}">log in</a>.
  			{% endif %}


  		</div>
  </div>

{% endblock body %}
