<?php //print_r($usertype);exit; ?>
    <section class="content-header">
      <h1>
        Log
      </h1>
      <ol class="breadcrumb">
        <li><a href="<?php echo base_url().'admin';?>"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">List</li>
      </ol>
    </section>

    <section class="content">
      <div class="row">
        <?php echo $this->utility->showMsg();?>
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">Management</h3>
              </div>
               
              <div></div>
            <!-- /.box-header -->
            <div class="box-body">
            <form action="" method="post">
              <div class="form-group">
                <div class="row">
                 <div class="col-sm-4">
                    <label class="col-sm-4 control-label">Select Date</label>

                    <div class="col-sm-8">
                        <input type="text" name="fromDate" id="fromDate" value="<?php if($this->input->post('fromDate')){ echo date('Y/m/d', strtotime($this->input->post('fromDate'))); }?>">

                    </div>
                 </div> 
                 <div class="col-sm-4">
                            <div class="col-sm-8">
                                <input type="submit" class="btn btn-black " value="Search" id="add">
                            </div>
                         </div>
                        </div>
                      </div>
            </form>
              <div class="chart-responsive">
                <canvas id="barChart" height="100"></canvas>
              </div> 
              
              
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>



    
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/12.1.6/css/intlTelInput.css">
<script src="<?php echo base_url(); ?>assets/js/intlTelInput.js"></script>    
<script>
  $(function () {
    $("#example1").DataTable();
    $("#example2").DataTable();

    $("#fromDate").datetimepicker();

    /****************BAR CHART***************/
    var barChartCanvas = $("#barChart").get(0).getContext("2d");
        var barChart = new Chart(barChartCanvas);
        var barChartData = areaChartData;
        barChartData.datasets[1].fillColor = "#00a65a";
        barChartData.datasets[1].strokeColor = "#00a65a";
        barChartData.datasets[1].pointColor = "#00a65a";
        var barChartOptions = {
          //Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
          scaleBeginAtZero: true,
          //Boolean - Whether grid lines are shown across the chart
          scaleShowGridLines: true,
          //String - Colour of the grid lines
          scaleGridLineColor: "rgba(0,0,0,.05)",
          //Number - Width of the grid lines
          scaleGridLineWidth: 1,
          //Boolean - Whether to show horizontal lines (except X axis)
          scaleShowHorizontalLines: true,
          //Boolean - Whether to show vertical lines (except Y axis)
          scaleShowVerticalLines: true,
          //Boolean - If there is a stroke on each bar
          barShowStroke: true,
          //Number - Pixel width of the bar stroke
          barStrokeWidth: 2,
          //Number - Spacing between each of the X value sets
          barValueSpacing: 5,
          //Number - Spacing between data sets within X values
          barDatasetSpacing: 1,
          //String - A legend template
          //legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].fillColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>",
          //Boolean - whether to make the chart responsive
          responsive: true,
          maintainAspectRatio: true
        };

        barChartOptions.datasetFill = false;
        barChart.Bar(barChartData, barChartOptions);
    /****************BAR CHART***************/
    var year = [];
    var UserLog = [];
    var MessageLog = [];
      <?php if(count($users['yearly'])>0){ 
              foreach ($users['yearly'] as $key=>$value) {
         ?>
              year.push("<?php echo $value['year']; ?>"); 
              MembershipRevenue.push("<?php echo $value['total']; ?>");   
              BookingRevenue.push("<?php echo $messages['yearly'][$key]['bookTotal']; ?>");        
         <?php }
            }  ?>

        var areaChartData = {
          labels: year,
          datasets: [
            {
              label: "Membership",
              fillColor: "#b3975b",
              strokeColor: "#b3975b",
              pointColor: "#b3975b",
              pointStrokeColor: "#b3975b",
              pointHighlightFill: "#b3975b",
              pointHighlightStroke: "#b3975b",
              data: MembershipRevenue
            },
            {
              label: "Booking",
              fillColor: "rgba(60,141,188,0.9)",
              strokeColor: "rgba(60,141,188,0.8)",
              pointColor: "#3b8bba",
              pointStrokeColor: "rgba(60,141,188,1)",
              pointHighlightFill: "#fff",
              pointHighlightStroke: "rgba(60,141,188,1)",
              data: BookingRevenue
            }
          ]
        };

  });
</script>
<style type="text/css">
  .dataTables_length, .dataTables_filter{ display: none; }
</style>