Subversion Repositories SmartDukaan

Rev

Rev 15403 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<h1>Admin Dashboard</h1>
<!--
<div id="registrations_chart_div" style="width:1200; height:300"></div>
<div id="clicks_chart_div" style="width:1200px; height:300px"></div>
<div id="orders_chart_div" style="width:1200px; height:300px"></div>
<div id="brand_preferences_chart_div" style="width:1200px; height:300px"></div>
<div class="row">
  <div id="devices_chart_div" class="col-xs-6" style="width:400px; height:300px"></div>
  <div id="preferences_chart_div" class="col-xs-6" style="width:400px; height:300px"></div>
</div>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
        var dailysignups = [];
        <?php foreach ($userbase as $key => $value):?>
                var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
                dailysignups.push(temp);
        <?php endforeach;?>
        var dailyclicks = [];
        <?php foreach ($clicks as $key => $value):?>
                var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
                dailyclicks.push(temp);
        <?php endforeach;?>
        var dailyorders = [];
        <?php foreach ($orders as $key => $value):?>
                var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
                dailyorders.push(temp);
        <?php endforeach;?>
        var devices = [];
        devices.push(['Version Code','Number of Devices']);     
        <?php foreach ($devices as $key => $value):?>
                var temp = ["<?php echo $value['devices']['versioncode'];?>" , <?php echo $value[0]['count'];?>];
                devices.push(temp);
        <?php endforeach;?>  
  var brandpreferences = [];
  <?php foreach ($preferences_set as $key => $value):?>
    var temp = [new Date("<?php echo $value[0]['date'];?>") , <?php echo $value[0]['count'];?>];
    brandpreferences.push(temp);
  <?php endforeach;?>
  var preferences = [];
  preferences.push(['Brand Preferences Set','Number of Users']); 
  preferences.push(['Yes','<?php echo $usersWithBrandPreferencesSet[0][0]['count'];?>']); 
  preferences.push(['No','<?php echo ($totalUsers[0][0]['count'] - $usersWithBrandPreferencesSet[0][0]['count']);?>']); 
        
  google.load('visualization', '1', {packages: ['corechart', 'line']});
        google.setOnLoadCallback(drawBasic);

        function drawBasic() {
      var data = new google.visualization.DataTable();
      data.addColumn('date', 'Date');
      data.addColumn('number', 'Signups');
      data.addRows(dailysignups);
      var options1 = {
        hAxis: {
          title: 'Date',
        },
        vAxis: {
          title: 'Daily User activations'
        }
      };

      var chart1 = new google.visualization.LineChart(document.getElementById('registrations_chart_div'));
      chart1.draw(data, options1);

      var clicksdata = new google.visualization.DataTable();      
      clicksdata.addColumn('date', 'Date');
      clicksdata.addColumn('number', 'Clicks');      
      clicksdata.addRows(dailyclicks);
      var options2 = {
        hAxis: {
          title: 'Date',
        },
        vAxis: {
          title: 'Daily clicks'
        }
      };

      var chart2 = new google.visualization.LineChart(document.getElementById('clicks_chart_div'));
      chart2.draw(clicksdata, options2);

      var ordersdata = new google.visualization.DataTable();      
      ordersdata.addColumn('date', 'Date');
      ordersdata.addColumn('number', 'Orders');      
      ordersdata.addRows(dailyorders);
      var options3 = {
        hAxis: {
          title: 'Date',
        },
        vAxis: {
          title: 'Daily orders'
        }
      };

      var chart3 = new google.visualization.LineChart(document.getElementById('orders_chart_div'));
      chart3.draw(ordersdata, options3);


      var brandpreferencesdata = new google.visualization.DataTable();      
      brandpreferencesdata.addColumn('date', 'Date');
      brandpreferencesdata.addColumn('number', 'Brand Preferences Set');      
      brandpreferencesdata.addRows(brandpreferences);
      var options5 = {
        hAxis: {
          title: 'Date',
        },
        vAxis: {
          title: 'Daily brand preferences'
        }
      };

      var chart5 = new google.visualization.LineChart(document.getElementById('brand_preferences_chart_div'));
      chart5.draw(brandpreferencesdata, options5);


                var devicesdata = google.visualization.arrayToDataTable(devices);
                var options4 = {
                        title: 'Version Codes'
                };
                var chart4 = new google.visualization.PieChart(document.getElementById('devices_chart_div'));
                chart4.draw(devicesdata, options4);

      var preferencesdata = google.visualization.arrayToDataTable(preferences);
      var options6 = {
        title: 'Brand Preferences'
      };
      var chart6 = new google.visualization.PieChart(document.getElementById('preferences_chart_div'));
      chart6.draw(preferencesdata, options6);
    }
    </script>
-->