index.php
4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
use artweb\artbox\ecommerce\models\Label;
use kartik\daterange\DateRangePicker;
use kartik\grid\GridView;
use kartik\select2\Select2;
use yii\data\ActiveDataProvider;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\web\View;
/**
* @var View $this
* @var Label[] $labels
* @var array $labelStatistics
* @var array $rejectionStatistics
* @var ActiveDataProvider $dataProvider
*/
?>
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">Collapsable</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div><!-- /.box-tools -->
</div><!-- /.box-header -->
<div class="box-body">
<?= Html::beginForm(
[ '/ecommerce/statistics' ],
'get'
) ?>
<div class="row">
<div class="col-md-4">
<?= DateRangePicker::widget(
[
'name' => 'date_range',
'pluginOptions' => [
'locale' => [
'format' => 'DD-MM-Y',
'separator' => ' : ',
],
],
]
) ?>
</div>
<div class="col-md-6">
<?= Select2::widget(
[
'name' => 'label',
'data' => ArrayHelper::map(
$labels,
function($model) {
return $model->id;
},
function($model) {
return $model->lang->title;
}
),
'options' => [
'placeholder' => 'Все',
],
]
) ?>
</div>
<div class="col-md-2">
<?= Html::submitButton(
'Go',
[
'class' => 'btn btn-success',
]
) ?>
</div>
</div>
<?= Html::endForm() ?>
</div><!-- /.box-body -->
</div><!-- /.box -->
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">Метки, статистика за </h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div><!-- /.box-tools -->
</div><!-- /.box-header -->
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tr>
<td><b>Метка</b></td>
<td><b>Заказов, шт.</b></td>
<td><b>На сумму, грн.</b></td>
<td><b>Заказано товаров, шт.</b></td>
<td><b>Уникальных товаров, шт.</b></td>
</tr>
<?php
foreach ($labelStatistics as $name => $statistic) {
?>
<tr>
<td><?= $name ?></td>
<td><?= $statistic[ 'count' ] ?></td>
<td><?= $statistic[ 'sum' ] ?></td>
<td><?= $statistic[ 'products' ] ?></td>
<td><?= $statistic[ 'unique' ] ?></td>
</tr>
<?php } ?>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">Метки, статистика за </h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div><!-- /.box-tools -->
</div><!-- /.box-header -->
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tr>
<td><b>Причина</b></td>
<td><b>Заказов, шт.</b></td>
<td><b>На сумму, грн.</b></td>
</tr>
<?php
foreach ($rejectionStatistics as $name => $statistic) {
?>
<tr>
<td><?= $name ?></td>
<td><?= $statistic[ 'count' ] ?></td>
<td><?= $statistic[ 'sum' ] ?></td>
</tr>
<?php } ?>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
<?=GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id',
'created_at:datetime',
'name',
'city',
],
])?>