2016-08-28 10:05:21 +08:00
|
|
|
@extends('admin.master')
|
|
|
|
|
2016-09-15 23:03:58 +08:00
|
|
|
@section('title', trans('general.dashboard'))
|
2016-08-28 10:05:21 +08:00
|
|
|
|
|
|
|
@section('content')
|
|
|
|
|
|
|
|
<!-- Content Wrapper. Contains page content -->
|
|
|
|
<div class="content-wrapper">
|
|
|
|
<!-- Content Header (Page header) -->
|
|
|
|
<section class="content-header">
|
|
|
|
<h1>
|
2016-09-15 23:03:58 +08:00
|
|
|
{{ trans('general.dashboard') }}
|
2016-08-28 10:05:21 +08:00
|
|
|
</h1>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<!-- Main content -->
|
|
|
|
<section class="content">
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="info-box">
|
2016-09-10 17:02:47 +08:00
|
|
|
<a href="{{ url('admin/users') }}">
|
2016-08-28 10:05:21 +08:00
|
|
|
<span class="info-box-icon bg-aqua"><i class="fa fa-users"></i></span>
|
|
|
|
<div class="info-box-content">
|
2016-12-30 20:37:27 +08:00
|
|
|
<span class="info-box-text">{{ trans('admin.index.total-users') }}</span>
|
2016-10-23 11:41:52 +08:00
|
|
|
<span class="info-box-number">{{ App\Models\User::all()->count() }}</span>
|
2016-08-28 10:05:21 +08:00
|
|
|
</div><!-- /.info-box-content -->
|
|
|
|
</a>
|
|
|
|
</div><!-- /.info-box -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="info-box">
|
2016-09-10 17:02:47 +08:00
|
|
|
<a href="{{ url('admin/players') }}">
|
2016-10-17 09:54:55 +08:00
|
|
|
<span class="info-box-icon bg-green"><i class="fa fa-gamepad"></i></span>
|
|
|
|
<div class="info-box-content">
|
2016-12-30 20:37:27 +08:00
|
|
|
<span class="info-box-text">{{ trans('admin.index.total-players') }}</span>
|
2016-10-16 18:16:15 +08:00
|
|
|
<span class="info-box-number">{{ App\Models\Player::all()->count() }}</span>
|
2016-08-28 10:05:21 +08:00
|
|
|
</div><!-- /.info-box-content -->
|
|
|
|
</a>
|
|
|
|
</div><!-- /.info-box -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="info-box">
|
2016-10-17 09:54:55 +08:00
|
|
|
<span class="info-box-icon bg-aqua" style="background-color: #605ca8 !important;"><i class="fa fa-files-o"></i></span>
|
2016-08-28 10:05:21 +08:00
|
|
|
<div class="info-box-content">
|
2016-12-30 20:37:27 +08:00
|
|
|
<span class="info-box-text">{{ trans('admin.index.total-textures') }}</span>
|
2016-08-28 10:05:21 +08:00
|
|
|
<span class="info-box-number">{{ \Database::table('textures')->getRecordNum() }}</span>
|
|
|
|
</div><!-- /.info-box-content -->
|
|
|
|
</div><!-- /.info-box -->
|
|
|
|
|
|
|
|
<div class="info-box">
|
|
|
|
<span class="info-box-icon bg-yellow"><i class="fa fa-hdd-o"></i></span>
|
|
|
|
<div class="info-box-content">
|
2016-12-30 20:37:27 +08:00
|
|
|
<span class="info-box-text">{{ trans('admin.index.disk-usage') }}</span>
|
2016-08-28 10:05:21 +08:00
|
|
|
<?php $size = \Database::table('textures')->fetchArray("SELECT SUM(`size`) AS total_size FROM `{table}` WHERE 1")['total_size'] ?: 0; ?>
|
|
|
|
<span class="info-box-number">{{ $size > 1024 ? round($size / 1024, 1)."MB" : $size."KB" }}</span>
|
|
|
|
</div><!-- /.info-box-content -->
|
|
|
|
</div><!-- /.info-box -->
|
|
|
|
</div>
|
2016-10-16 21:21:37 +08:00
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="box box-primary">
|
|
|
|
<div class="box-header with-border">
|
2016-12-30 15:01:34 +08:00
|
|
|
<h3 class="box-title">{{ trans('admin.index.overview') }}</h3>
|
2016-10-16 21:21:37 +08:00
|
|
|
<div class="box-tools pull-right">
|
|
|
|
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
|
|
|
<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="box-body">
|
|
|
|
<div class="chart">
|
|
|
|
<canvas id="areaChart" style="height:250px"></canvas>
|
|
|
|
</div>
|
|
|
|
</div><!-- /.box-body -->
|
|
|
|
</div><!-- /.box -->
|
|
|
|
</div>
|
2016-08-28 10:05:21 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</section><!-- /.content -->
|
|
|
|
</div><!-- /.content-wrapper -->
|
|
|
|
|
2017-07-03 20:54:19 +08:00
|
|
|
<script type="text/javascript" src="{{ assets('js/Chart.min.js') }}"></script>
|
2016-10-16 21:21:37 +08:00
|
|
|
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
@section('script')
|
|
|
|
<script>
|
|
|
|
<?php
|
|
|
|
$today = Carbon\Carbon::today()->timestamp;
|
|
|
|
|
|
|
|
$labels = [];
|
|
|
|
$data = [];
|
|
|
|
|
|
|
|
for ($i = 6; $i >= 0; $i--) {
|
|
|
|
$time = Carbon\Carbon::createFromTimestamp($today - $i * 86400);
|
|
|
|
|
|
|
|
$labels[] = $time->format('m-d');
|
2016-10-23 11:41:52 +08:00
|
|
|
$data['user_register'][] = App\Models\User::like('register_at', $time->toDateString())->count();
|
2016-10-16 21:21:37 +08:00
|
|
|
$data['texture_upload'][] = App\Models\Texture::like('upload_at', $time->toDateString())->count();
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
$(function() {
|
|
|
|
// Get context with jQuery - using jQuery's .get() method.
|
|
|
|
var areaChartCanvas = $("#areaChart").get(0).getContext("2d");
|
|
|
|
// This will get the first returned node in the jQuery collection.
|
|
|
|
var areaChart = new Chart(areaChartCanvas);
|
|
|
|
|
|
|
|
var areaChartData = {
|
|
|
|
labels: {!! json_encode($labels) !!},
|
|
|
|
datasets: [
|
|
|
|
{
|
2016-12-30 20:37:27 +08:00
|
|
|
label: trans("admin.textureUploads"),
|
2016-10-16 21:21:37 +08:00
|
|
|
fillColor: "rgba(210, 214, 222, 1)",
|
|
|
|
strokeColor: "rgba(210, 214, 222, 1)",
|
|
|
|
pointColor: "rgba(210, 214, 222, 1)",
|
|
|
|
pointStrokeColor: "#c1c7d1",
|
|
|
|
pointHighlightFill: "#fff",
|
|
|
|
pointHighlightStroke: "rgba(220,220,220,1)",
|
|
|
|
data: {!! json_encode($data['texture_upload']) !!}
|
|
|
|
},
|
|
|
|
{
|
2016-12-30 20:37:27 +08:00
|
|
|
label: trans("admin.userRegistration"),
|
2016-10-16 21:21:37 +08:00
|
|
|
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: {!! json_encode($data['user_register']) !!}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
var areaChartOptions = {
|
|
|
|
//Boolean - If we should show the scale at all
|
|
|
|
showScale: true,
|
|
|
|
//Boolean - Whether grid lines are shown across the chart
|
|
|
|
scaleShowGridLines: false,
|
|
|
|
//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 - Whether the line is curved between points
|
|
|
|
bezierCurve: true,
|
|
|
|
//Number - Tension of the bezier curve between points
|
|
|
|
bezierCurveTension: 0.3,
|
|
|
|
//Boolean - Whether to show a dot for each point
|
|
|
|
pointDot: false,
|
|
|
|
//Number - Radius of each point dot in pixels
|
|
|
|
pointDotRadius: 4,
|
|
|
|
//Number - Pixel width of point dot stroke
|
|
|
|
pointDotStrokeWidth: 1,
|
|
|
|
//Number - amount extra to add to the radius to cater for hit detection outside the drawn point
|
|
|
|
pointHitDetectionRadius: 20,
|
|
|
|
//Boolean - Whether to show a stroke for datasets
|
|
|
|
datasetStroke: true,
|
|
|
|
//Number - Pixel width of dataset stroke
|
|
|
|
datasetStrokeWidth: 2,
|
|
|
|
//Boolean - Whether to fill the dataset with a color
|
|
|
|
datasetFill: true,
|
|
|
|
//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].lineColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>",
|
|
|
|
//Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
|
|
|
|
maintainAspectRatio: true,
|
|
|
|
//Boolean - whether to make the chart responsive to window resizing
|
|
|
|
responsive: true
|
|
|
|
};
|
|
|
|
|
|
|
|
//Create the line chart
|
|
|
|
areaChart.Line(areaChartData, areaChartOptions);
|
|
|
|
});
|
|
|
|
</script>
|
2016-08-28 10:05:21 +08:00
|
|
|
@endsection
|