Permalink
Browse files

Restructure analytics views, partials and linechart files

  • Loading branch information...
bpocallaghan committed Jul 3, 2017
1 parent 3f5a58e commit c0b4cab75472844f3592de3fe38734adbdc65314
Showing with 100 additions and 31 deletions.
  1. +2 −2 resources/views/admin/analytics/demographics.blade.php
  2. +3 −3 resources/views/admin/analytics/devices.blade.php
  3. +3 −3 resources/views/admin/analytics/interests.blade.php
  4. +3 −3 resources/views/admin/analytics/summary.blade.php
  5. +3 −3 resources/views/admin/analytics/visits_referrals.blade.php
  6. 0 resources/views/admin/partials/{boxes → analytics}/age.blade.php
  7. 0 ...es/views/admin/partials/{boxes/dashboard_header.blade.php → analytics/analytics_header.blade.php}
  8. 0 resources/views/admin/partials/{boxes → analytics}/browsers.blade.php
  9. 0 resources/views/admin/partials/{boxes → analytics}/devices.blade.php
  10. 0 resources/views/admin/partials/{boxes → analytics}/devices_category.blade.php
  11. 0 resources/views/admin/partials/{boxes → analytics}/gender.blade.php
  12. 0 resources/views/admin/partials/{boxes → analytics}/interests_affinity.blade.php
  13. 0 resources/views/admin/partials/{boxes → analytics}/interests_market.blade.php
  14. 0 resources/views/admin/partials/{boxes → analytics}/interests_other.blade.php
  15. 0 resources/views/admin/partials/{boxes → analytics}/keywords.blade.php
  16. 0 resources/views/admin/partials/{boxes → analytics}/referrers.blade.php
  17. 0 resources/views/admin/partials/{boxes → analytics}/visited_pages.blade.php
  18. 0 resources/views/admin/partials/{boxes → analytics}/visitors_views.blade.php
  19. +40 −0 resources/views/admin/partials/boxes/datatable_toolbar.blade.php
  20. +1 −1 resources/views/admin/partials/boxes/toolbar.blade.php
  21. +21 −14 resources/views/admin/partials/{reports → charts}/linechart.blade.php
  22. +16 −0 resources/views/admin/partials/charts/linechart_box.blade.php
  23. +8 −2 resources/views/admin/reports/contactus.blade.php
@@ -4,11 +4,11 @@
{{-- demographics --}}
<div class="row">
<div class="col-md-6">
@include('admin.partials.boxes.gender')
@include('admin.partials.analytics.gender')
</div>
<div class="col-md-6">
@include('admin.partials.boxes.age')
@include('admin.partials.analytics.age')
</div>
</div>
@endsection
@@ -4,17 +4,17 @@
{{-- devices + browsers --}}
<div class="row">
<div class="col-md-6">
@include('admin.partials.boxes.devices_category')
@include('admin.partials.analytics.devices_category')
</div>
<div class="col-md-6">
@include('admin.partials.boxes.browsers')
@include('admin.partials.analytics.browsers')
</div>
</div>
<div class="row">
<div class="col-sm-6">
@include('admin.partials.boxes.devices')
@include('admin.partials.analytics.devices')
</div>
</div>
@endsection
@@ -4,16 +4,16 @@
{{-- interests --}}
<div class="row">
<div class="col-md-6">
@include('admin.partials.boxes.interests_affinity')
@include('admin.partials.analytics.interests_affinity')
</div>
<div class="col-md-6">
@include('admin.partials.boxes.interests_market')
@include('admin.partials.analytics.interests_market')
</div>
</div>
<div class="row">
<div class="col-md-6">
@include('admin.partials.boxes.interests_other')
@include('admin.partials.analytics.interests_other')
</div>
</div>
@endsection
@@ -1,18 +1,18 @@
@extends('layouts.admin')
@section('content')
@include('admin.partials.boxes.dashboard_header', ['pageLoad' => true])
@include('admin.partials.analytics.analytics_header', ['pageLoad' => true])
<div class="row">
<div class="col-sm-12">
@include('admin.partials.boxes.visitors_views')
@include('admin.partials.analytics.visitors_views')
</div>
</div>
{{-- devices + browsers --}}
<div class="row">
<div class="col-md-6">
@include('admin.partials.boxes.devices_category')
@include('admin.partials.analytics.devices_category')
</div>
</div>
@endsection
@@ -4,17 +4,17 @@
{{-- most visited and referrers --}}
<div class="row">
<div class="col-md-6">
@include('admin.partials.boxes.visited_pages')
@include('admin.partials.analytics.visited_pages')
</div>
<div class="col-md-6">
@include('admin.partials.boxes.referrers')
@include('admin.partials.analytics.referrers')
</div>
</div>
<div class="row">
<div class="col-sm-6">
@include('admin.partials.boxes.keywords')
@include('admin.partials.analytics.keywords')
</div>
<div class="col-sm-6">
@@ -0,0 +1,40 @@
<h3 class="box-title">
<span><i class="fa fa-table"></i></span>
<span>{{ isset($title)? $title:'DataTable' }}
({{ $fromDate->format('l, d F') }} - {{ $toDate->format('l, d F') }})
</span>
</h3>
<div class="pull-right box-tools">
<a href="{{ request()->url() }}/datatable/reset" class="btn btn-primary btn-sm" data-toggle="tooltip" title="Reset Date Filter">
<i class="fa fa-refresh"></i>
</a>
<button type="button" class="btn btn-primary btn-sm daterange" data-toggle="tooltip" title="Date range">
<i class="fa fa-calendar"></i>
</button>
<button type="button" class="btn btn-default btn-sm" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i>
</button>
</div>
@section('scripts')
@parent
<script type="text/javascript" charset="utf-8">
$(function ()
{
initDateRangeLatest('#js-box-datatable .daterange', updateDatatables);
function updateDatatables(start, end)
{
doAjax('{{ request()->url() }}/datatable/dates', {
'date_from': start, 'date_to': end,
}, function ()
{
location.reload();
});
}
})
</script>
@endsection
@@ -1,5 +1,5 @@
<div class="pull-right box-tools">
<button type="button" class="btn btn-primary btn-sm daterange" data-toggle="tooltip" title="Date range">
<button type="button" class="btn {{ isset($btnDateClass)? $btnDateClass: 'btn-primary' }} btn-sm daterange" data-toggle="tooltip" title="Date Range">
<i class="fa fa-calendar"></i>
</button>
@@ -1,10 +1,10 @@
<div class="loading-widget text-primary" style="top: 20%;">
<div class="loading-widget text-primary">
<i class="fa fa-fw fa-spinner fa-spin"></i>
</div>
<div id="main-chart-legend" class="chart-legend"></div>
<div class="chart-legend"></div>
<canvas id="main-chart"></canvas>
<canvas class="line-chart"></canvas>
@section('scripts')
@parent
@@ -14,47 +14,54 @@
{
var chart;
initToolbarDateRange('#box-main-chart .daterange', updateChart);
initToolbarDateRange('#{{ $id }} .daterange', updateChart);
/**
* Get the chart's data
* @param view
*/
function updateChart(start, end)
{
if (chart) { chart.destroy(); }
if (datatable) { datatable.destroy(); }
if (chart) {
chart.destroy();
}
if (datatable) {
datatable.destroy();
}
if (!start) {
start = moment().subtract(29, 'days').format('YYYY-MM-DD');
end = moment().format('YYYY-MM-DD');
}
$('#box-main-chart .loading-widget').show();
$('#{{ $id }} .loading-widget').show();
doAjax("{{ Request::url() }}" + '/chart', {
doAjax("{{ isset($url)? $url : Request::url() . '/chart' }}", {
'date_from': start, 'date_to': end,
}, createLineChart);
if(onUpdate && isFunction(onUpdate))
{
// if there is an update function in parent to notify about date change
if (typeof onUpdate != 'undefined' && isFunction(onUpdate)) {
onUpdate(start, end);
}
}
function createLineChart(data)
{
// total page views and visitors line chart
var ctx = document.getElementById("main-chart").getContext("2d");
var ctx = document.getElementById("{{ $id }}").getElementsByClassName("line-chart")[0].getContext("2d");
chart = new Chart(ctx).Line(data, {
tooltipTemplate: "<%= value %> - <%= datasetLabel %>",
//tooltipTemplate: "<%= value %> - <%= datasetLabel %>",
multiTooltipTemplate: "<%= value %> - <%= datasetLabel %>"
});
$('#box-main-chart .loading-widget').slideUp();
$('#{{ $id }} .loading-widget').slideUp();
$('#main-chart').html(chart.generateLegend());
@if(isset($legend) && $legend == true || !isset($legend))
$('#{{ $id }} .chart-legend').html(chart.generateLegend());
@endif
}
setTimeout(function ()
@@ -0,0 +1,16 @@
<div class="box box-success {{ isset($boxClass)? $boxClass:'' }} " id="{{ $id }}">
<div class="box-header with-border">
<h3 class="box-title">
<span><i class="fa fa-{{ isset($icon)? $icon:'line-chart' }}"></i></span>
<span>{{ isset($title)? $title:'Title' }}</span>
</h3>
@include('admin.partials.boxes.toolbar')
{{-- , ['btnDateClass' => 'btn-default'] --}}
</div>
<div class="box-body">
@include('admin.partials.charts.linechart')
</div>
</div>
@@ -15,16 +15,20 @@
<div class="box-body">
@include('admin.partials.reports.linechart')
@include('admin.partials.charts.linechart', [
'id' => 'box-main-chart',
])
<hr/>
<table data-order-by="4|desc" id="main-datatable" class="table table-striped table-bordered" width="100%">
<table data-order-by="5|desc" id="main-datatable" class="table table-striped table-bordered" width="100%">
<thead>
<tr>
<th>Category</th>
<th>Fullname</th>
<th>Phone</th>
<th>Email</th>
<th>Subject</th>
<th>Content</th>
<th>Created On</th>
</tr>
@@ -42,9 +46,11 @@
function onUpdate(start, end)
{
datatable = initDatatablesAjax('#main-datatable', "{{ Request::url() }}" + "/datatable?date_from=" + start + '&date_to=' + end, [
{data: 'category', name: 'category'},
{data: 'fullname', name: 'fullname'},
{data: 'phone', name: 'phone'},
{data: 'email', name: 'email'},
{data: 'subject', name: 'subject'},
{data: 'content', name: 'content'},
{data: 'date', name: 'date'},
]);

0 comments on commit c0b4cab

Please sign in to comment.