<?php //print_r($usertype);exit; ?>
    <section class="content-header">
      <h1>
        Activity 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-2">
                    <select name="year" class="form-control monthSelect">
                       <option value="">--Select Year--</option>
                      <?php for($i=date('Y');$i>2016;$i--) {
                      ?>
                            <option value="<?php echo $i; ?>" <?php if($this->input->post('year')){ if($this->input->post('year') == $i ){ echo 'selected'; } } ?>><?php echo $i; ?></option>
                      <?php 
                          }  
                      ?>
                    </select>
                  </div>
                  <div class="col-sm-2">
                    <select name="month" class="form-control monthSelect">
                       <option value="">--Select Month--</option>
                       <option value="01" <?php if($this->input->post('month')){ if($this->input->post('month') == '01' ){ echo 'selected'; } } ?>>Jan</option>
                       <option value="02" <?php if($this->input->post('month')){ if($this->input->post('month') == '02' ){ echo 'selected'; } } ?>>Feb</option>
                       <option value="03" <?php if($this->input->post('month')){ if($this->input->post('month') == '03' ){ echo 'selected'; } } ?>>Mar</option>
                       <option value="04" <?php if($this->input->post('month')){ if($this->input->post('month') == '04' ){ echo 'selected'; } } ?>>Apr</option>\
                       <option value="05" <?php if($this->input->post('month')){ if($this->input->post('month') == '05' ){ echo 'selected'; } } ?>>May</option>
                       <option value="06" <?php if($this->input->post('month')){ if($this->input->post('month') == '06' ){ echo 'selected'; } } ?>>Jun</option>
                       <option value="07" <?php if($this->input->post('month')){ if($this->input->post('month') == '07' ){ echo 'selected'; } } ?>>July</option>
                       <option value="08" <?php if($this->input->post('month')){ if($this->input->post('month') == '08' ){ echo 'selected'; } } ?>>Aug</option>
                       <option value="09" <?php if($this->input->post('month')){ if($this->input->post('month') == '09' ){ echo 'selected'; } } ?>>Sep</option>
                       <option value="10" <?php if($this->input->post('month')){ if($this->input->post('month') == '10' ){ echo 'selected'; } } ?>>Oct</option>
                       <option value="11" <?php if($this->input->post('month')){ if($this->input->post('month') == '11' ){ echo 'selected'; } } ?>>Nov</option>
                       <option value="12" <?php if($this->input->post('month')){ if($this->input->post('month') == '12' ){ echo 'selected'; } } ?>>Dec</option>
                    </select>
                 </div> 
                 <div class="col-sm-2">
                    <select name="day" class="form-control ">
                       <option value="">--Select day--</option>
                      <?php for($j=1;$j<32;$j++) {
                      ?>
                            <option value="<?php echo $j; ?>" <?php if($this->input->post('day')){ if($this->input->post('day') == $j ){ echo 'selected'; } } ?>><?php echo $j; ?></option>
                      <?php 
                          }  
                      ?>
                    </select>
                 </div>  
                 <div class="col-sm-2">
                    <select name="hour" class="form-control ">
                       <option value="">--Select hour--</option>
                      <?php for($h=0;$h<24;$h++) {
                      ?>
                            <option value="<?php echo $h; ?>" <?php if($this->input->post('hour')){ if($this->input->post('hour') == $h ){ echo 'selected'; } } ?>><?php echo $h.':00'; ?></option>
                      <?php 
                          }  
                      ?>
                    </select>
                 </div>
                 <div class="col-sm-2">
                    <div class="col-sm-8">
                        <input type="submit" class="btn btn-black " value="Search" id="add">
                    </div>
                  </div>
                  
              </div>
            </div>
            </form>
            <div class="box-body">
              <div class="row">
                <div class="col-md-12">
                  <div class="chart-responsive">
                    <canvas id="barChart" height="100"></canvas>
                  </div>
                  <!-- ./chart-responsive -->
                </div>
                <!-- /.col -->
                <div class="col-md-12">
                  <ul class="chart-legend clearfix">
                    <li><i class="fa fa-circle-o " style="color:#b3975b"></i>Total Connect Request</li>
                    <li><i class="fa fa-circle-o " style="color:lime"></i>Total Message</li>
                    <li><i class="fa fa-circle-o " style="color:red"></i>Total Privacy Request</li>
                    <li><i class="fa fa-circle-o " style="color:auqa"></i>Total Hotshot Profile</li>
                    <li><i class="fa fa-circle-o " style="color:orange"></i>Total Hotshot Picture</li>
                    <li><i class="fa fa-circle-o " style="color:purple"></i>Total Visit</li>
                    <li><i class="fa fa-circle-o " style="color:yellow"></i>Total Register</li>
                    <li><i class="fa fa-circle-o " style="color:blue"></i>Total Upload</li>
                    <li><i class="fa fa-circle-o " style="color:fuchsia"></i>Total Upgrade</li>
                    <li><i class="fa fa-circle-o " style="color:maroon"></i>Total Login</li>
                  </ul>
                </div>
                <!-- /.col -->
              </div>
              <!-- /.row -->
            </div>
              
           


          
            
          </div>
              
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>



    
<script>
  $(function () {
    $("#example1").DataTable();

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

    /****************BAR CHART***************/
    var year = [];
    var ConnectRequest = [];
    var Message = [];
    var PrivacyRequest = [];
    var HotshotProfile = [];
    var HotshotPicture = [];
    var Visit = [];
    var Register = [];
    var Upload = [];
    var Upgrade = [];
    var Login = [];
      <?php if(count($Visit)>0){ 
              foreach ($Visit as $key=>$value) {
                
         ?>
              year.push("<?php echo $value['year']; ?>"); 
              ConnectRequest.push("<?php echo $ConnectRequest[$key]['total']; ?>"); 
              Message.push("<?php echo $Message[$key]['total']; ?>");   
              PrivacyRequest.push("<?php echo $PrivacyRequest[$key]['total']; ?>");        
              HotshotProfile.push("<?php echo $HotshotProfile[$key]['total']; ?>");        
              HotshotPicture.push("<?php echo $HotshotPicture[$key]['total']; ?>");        
              Visit.push("<?php echo $value['total']; ?>");        
              Register.push("<?php echo $Register[$key]['total']; ?>");        
              Upload.push("<?php echo $Upload[$key]['total']; ?>");        
              Upgrade.push("<?php echo $Upgrade[$key]['total']; ?>");        
              Login.push("<?php echo $Login[$key]['total']; ?>");        
              
         <?php } }
            //}  ?>

        var areaChartData = {
          labels: year,
          datasets: [
            {
              label: "Membership",
              fillColor: "#b3975b",
              strokeColor: "#b3975b",
              pointColor: "#b3975b",
              pointStrokeColor: "#b3975b",
              pointHighlightFill: "#b3975b",
              pointHighlightStroke: "#b3975b",
              data: ConnectRequest
            },
            {
              label: "Booking",
              fillColor: "lime",
              strokeColor: "lime",
              pointColor: "lime",
              pointStrokeColor: "lime",
              pointHighlightFill: "lime",
              pointHighlightStroke: "lime",
              data: Message
            },
            {
              label: "Booking",
              fillColor: "red",
              strokeColor: "red",
              pointColor: "red",
              pointStrokeColor: "red",
              pointHighlightFill: "red",
              pointHighlightStroke: "red",
              data: PrivacyRequest
            },
            {
              label: "Booking",
              fillColor: "aqua",
              strokeColor: "aqua",
              pointColor: "aqua",
              pointStrokeColor: "aqua",
              pointHighlightFill: "aqua",
              pointHighlightStroke: "aqua",
              data: HotshotProfile
            },
            {
              label: "Booking",
              fillColor: "orange",
              strokeColor: "orange",
              pointColor: "orange",
              pointStrokeColor: "orange",
              pointHighlightFill: "orange",
              pointHighlightStroke: "orange",
              data: HotshotPicture
            },
            {
              label: "Booking",
              fillColor: "purple",
              strokeColor: "purple",
              pointColor: "purple",
              pointStrokeColor: "purple",
              pointHighlightFill: "purple",
              pointHighlightStroke: "purple",
              data: Visit
            },
            {
              label: "Booking",
              fillColor: "yellow",
              strokeColor: "yellow",
              pointColor: "yellow",
              pointStrokeColor: "yellow",
              pointHighlightFill: "yellow",
              pointHighlightStroke: "yellow",
              data: Register
            },
            {
              label: "Booking",
              fillColor: "blue",
              strokeColor: "blue",
              pointColor: "blue",
              pointStrokeColor: "blue",
              pointHighlightFill: "blue",
              pointHighlightStroke: "blue",
              data: Upload
            },
            {
              label: "Booking",
              fillColor: "fuchsia",
              strokeColor: "fuchsia",
              pointColor: "fuchsia",
              pointStrokeColor: "fuchsia",
              pointHighlightFill: "fuchsia",
              pointHighlightStroke: "fuchsia",
              data: Upgrade
            },
            {
              label: "Booking",
              fillColor: "maroon",
              strokeColor: "maroon",
              pointColor: "maroon",
              pointStrokeColor: "maroon",
              pointHighlightFill: "maroon",
              pointHighlightStroke: "maroon",
              data: Login
            }
          ]
        };
         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);
  });
</script>
<style type="text/css">
  .dataTables_length, .dataTables_filter{ display: none; }
</style>