db3040d3
Alexey Boroda
-Order module alm...
|
1
2
3
|
<?php
use artweb\artbox\ecommerce\models\Order;
|
a1604eb2
Alexey Boroda
-In order's view ...
|
4
|
use artweb\artbox\ecommerce\models\OrderProduct;
|
b522bd6c
Alexey Boroda
-View bug fix
|
5
|
use common\components\CreditHelper;
|
db3040d3
Alexey Boroda
-Order module alm...
|
6
|
use kartik\grid\GridView;
|
3bee3445
Alexey Boroda
-Order history ready
|
7
8
|
use yii\data\ActiveDataProvider;
use yii\grid\SerialColumn;
|
db3040d3
Alexey Boroda
-Order module alm...
|
9
|
use yii\helpers\Html;
|
a1604eb2
Alexey Boroda
-In order's view ...
|
10
|
use yii\helpers\StringHelper;
|
db3040d3
Alexey Boroda
-Order module alm...
|
11
12
|
use yii\web\View;
use yii\widgets\DetailView;
|
3bee3445
Alexey Boroda
-Order history ready
|
13
|
use yii\widgets\ListView;
|
db3040d3
Alexey Boroda
-Order module alm...
|
14
15
|
/**
|
3bee3445
Alexey Boroda
-Order history ready
|
16
17
18
19
|
* @var View $this
* @var Order $model
* @var ActiveDataProvider $products
* @var ActiveDataProvider $historyData
|
db3040d3
Alexey Boroda
-Order module alm...
|
20
21
22
23
24
25
26
27
|
*/
$this->title = 'Заказ #' . $model->id;
$this->params[ 'breadcrumbs' ][] = [
'label' => \Yii::t('app', 'Заказы'),
'url' => [ 'index' ],
];
$this->params[ 'breadcrumbs' ][] = $this->title;
|
b522bd6c
Alexey Boroda
-View bug fix
|
28
29
30
31
32
33
34
35
36
|
if (empty($model->payment)) {
$payment = '';
} elseif ($model->payment == 10) {
$payment = Html::tag('h4', $model->orderPayment->lang->title, [ 'class' => 'text-navy' ]) . Html::beginTag(
'table',
[ 'class' => 'table table-bordered' ]
) . Html::tag(
'tr',
|
0b43e0d3
Alexey Boroda
-Credit informati...
|
37
38
39
40
41
42
|
Html::tag('td', $model->getAttributeLabel('credit_sum')) . Html::tag(
'td',
CreditHelper::checkSum(
$model->credit_sum
)
)
|
b522bd6c
Alexey Boroda
-View bug fix
|
43
44
|
) . Html::tag(
'tr',
|
0b43e0d3
Alexey Boroda
-Credit informati...
|
45
46
47
48
49
50
|
Html::tag('td', $model->getAttributeLabel('credit_month')) . Html::tag(
'td',
CreditHelper::checkMonth(
$model->credit_month
)
)
|
b522bd6c
Alexey Boroda
-View bug fix
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
) . Html::tag(
'tr',
Html::tag('td', 'Кредит') . Html::tag('td', $model->total - $model->credit_sum)
) . Html::tag(
'tr',
Html::tag('td', 'Оплата в месяц') . Html::tag(
'td',
CreditHelper::getCredit(
$model->total - $model->credit_sum,
$model->credit_month
) . ' грн/мес'
)
) . Html::endTag('table');
} else {
$payment = $model->orderPayment->lang->title;
}
|
cc04f587
Alexey Boroda
-Testing deadline...
|
67
68
|
$js = <<< JS
|
a1604eb2
Alexey Boroda
-In order's view ...
|
69
70
|
$('[data-toggle="popover"]').popover();
JS;
|
cc04f587
Alexey Boroda
-Testing deadline...
|
71
|
$this->registerJs($js, View::POS_READY);
|
a1604eb2
Alexey Boroda
-In order's view ...
|
72
|
|
db3040d3
Alexey Boroda
-Order module alm...
|
73
74
|
?>
<div class="order-view">
|
cc04f587
Alexey Boroda
-Testing deadline...
|
75
|
|
3bee3445
Alexey Boroda
-Order history ready
|
76
|
<h1><?= Html::encode($this->title) ?></h1>
|
cc04f587
Alexey Boroda
-Testing deadline...
|
77
|
|
3bee3445
Alexey Boroda
-Order history ready
|
78
79
80
81
82
83
84
85
86
|
<p>
<?= Html::a(
'Обновить',
[
'update',
'id' => $model->id,
],
[ 'class' => 'btn btn-primary' ]
) ?>
|
b522bd6c
Alexey Boroda
-View bug fix
|
87
|
|
ff71eeed
Alexey Boroda
-Logs ready
|
88
89
90
91
92
93
94
95
|
<?= Html::a(
'История',
[
'log',
'id' => $model->id,
],
[ 'class' => 'btn bg-orange' ]
) ?>
|
3bee3445
Alexey Boroda
-Order history ready
|
96
|
</p>
|
cc04f587
Alexey Boroda
-Testing deadline...
|
97
|
|
3bee3445
Alexey Boroda
-Order history ready
|
98
99
100
101
102
103
104
105
106
|
<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">
<?= DetailView::widget(
|
db3040d3
Alexey Boroda
-Order module alm...
|
107
|
[
|
3bee3445
Alexey Boroda
-Order history ready
|
108
109
|
'model' => $model,
'attributes' => [
|
db3040d3
Alexey Boroda
-Order module alm...
|
110
|
'id',
|
cc04f587
Alexey Boroda
-Testing deadline...
|
111
|
'deadline:date',
|
3bee3445
Alexey Boroda
-Order history ready
|
112
|
'pay',
|
ff71eeed
Alexey Boroda
-Logs ready
|
113
114
|
[
'label' => 'Причина',
|
b522bd6c
Alexey Boroda
-View bug fix
|
115
|
'value' => empty($model->reason) ? '' : Order::REASONS[ $model->reason ],
|
ff71eeed
Alexey Boroda
-Logs ready
|
116
|
],
|
3bee3445
Alexey Boroda
-Order history ready
|
117
118
|
[
'label' => 'Статус',
|
ddbd75a1
Alexey Boroda
-View bug fix
|
119
|
'value' => empty($model->label) ? '' : $model->orderLabel->lang->title,
|
3bee3445
Alexey Boroda
-Order history ready
|
120
|
],
|
db3040d3
Alexey Boroda
-Order module alm...
|
121
|
'name',
|
3bee3445
Alexey Boroda
-Order history ready
|
122
123
124
125
126
|
'phone',
'email',
'comment',
[
'label' => 'Способ доставки',
|
ddbd75a1
Alexey Boroda
-View bug fix
|
127
|
'value' => empty($model->delivery) ? '' : $model->orderDelivery->lang->title,
|
3bee3445
Alexey Boroda
-Order history ready
|
128
129
130
131
|
],
'declaration',
'stock',
[
|
b522bd6c
Alexey Boroda
-View bug fix
|
132
133
134
|
'label' => 'Способ оплаты',
'value' => $payment,
'format' => 'html',
|
3bee3445
Alexey Boroda
-Order history ready
|
135
136
137
138
139
140
141
|
],
'insurance',
'city',
'adress',
'body',
'check',
'sms',
|
db3040d3
Alexey Boroda
-Order module alm...
|
142
143
|
],
]
|
3bee3445
Alexey Boroda
-Order history ready
|
144
145
146
|
) ?>
</div><!-- /.box-body -->
</div><!-- /.box -->
|
cc04f587
Alexey Boroda
-Testing deadline...
|
147
148
|
|
3bee3445
Alexey Boroda
-Order history ready
|
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
<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">
<?php
echo GridView::widget(
[
'dataProvider' => $products,
'columns' => [
[
'class' => SerialColumn::className(),
],
|
3bee3445
Alexey Boroda
-Order history ready
|
165
|
'sku',
|
a1604eb2
Alexey Boroda
-In order's view ...
|
166
167
168
|
[
'attribute' => 'product_name',
'content' => function (OrderProduct $model) {
|
cc04f587
Alexey Boroda
-Testing deadline...
|
169
170
171
|
if (!empty($model->product_name)) {
if (empty($model->productVariant)) {
|
a1604eb2
Alexey Boroda
-In order's view ...
|
172
173
|
return '';
}
|
cc04f587
Alexey Boroda
-Testing deadline...
|
174
|
|
a1604eb2
Alexey Boroda
-In order's view ...
|
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
return Html::a(
StringHelper::truncate($model->product_name, 10, '...'),
'#',
[
'onclick' => 'event.preventDefault();',
'data-toggle' => 'popover',
'data-placement' => 'right',
'data-html' => 'true',
'data-content' => Html::img(
$model->productVariant->imageUrl,
[
'class' => 'img-rounded',
]
) . Html::tag('p', $model->product_name),
]
);
} else {
return '';
}
},
],
[
'attribute' => 'productVariant.product.brand.lang.title',
'label' => 'Брэнд',
],
[
'attribute' => 'productVariant.lang.title',
'label' => \Yii::t('app', 'Цвет'),
'content' => function (OrderProduct $model) {
|
cc04f587
Alexey Boroda
-Testing deadline...
|
204
205
|
if (empty($model->productVariant)) {
|
a1604eb2
Alexey Boroda
-In order's view ...
|
206
207
|
return '';
}
|
cc04f587
Alexey Boroda
-Testing deadline...
|
208
|
|
a1604eb2
Alexey Boroda
-In order's view ...
|
209
210
211
212
213
214
215
216
217
218
219
|
if (preg_match('@.*\.(png|jpg|gif)@i', $model->productVariant->lang->title)) {
return '';
} else {
return $model->productVariant->lang->title;
}
},
],
[
'attribute' => 'productVariant.size',
'label' => 'Размер',
],
|
3bee3445
Alexey Boroda
-Order history ready
|
220
221
222
|
'price',
'count',
'sum_cost',
|
a1604eb2
Alexey Boroda
-In order's view ...
|
223
224
225
226
227
|
'booking',
'status',
'return',
[
'content' => function (OrderProduct $model) {
|
cc04f587
Alexey Boroda
-Testing deadline...
|
228
229
|
if (empty($model->productVariant)) {
|
a1604eb2
Alexey Boroda
-In order's view ...
|
230
231
|
return '<i class="glyphicon glyphicon-remove"></i>';
}
|
cc04f587
Alexey Boroda
-Testing deadline...
|
232
|
|
a1604eb2
Alexey Boroda
-In order's view ...
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
$content = '<table class="table"><tbody><tr><th>Склад</th><th>кол.</th></tr>';
foreach ($model->productVariant->variantStocks as $stock) {
$content .= '<tr><td>' . $stock->stock->title . '</td><td>' . $stock->quantity . '</td></tr>';
}
return Html::a(
'<i class="glyphicon glyphicon-home"></i>',
'#',
[
'onclick' => 'event.preventDefault();',
'data-toggle' => 'popover',
'data-placement' => 'left',
'data-html' => 'true',
'data-content' => $content . '</tbody></table>',
]
);
},
],
|
3bee3445
Alexey Boroda
-Order history ready
|
250
251
252
253
254
255
|
],
]
);
?>
</div><!-- /.box-body -->
</div><!-- /.box -->
|
cc04f587
Alexey Boroda
-Testing deadline...
|
256
|
|
3bee3445
Alexey Boroda
-Order history ready
|
257
258
259
260
261
262
263
264
|
<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">
|
b522bd6c
Alexey Boroda
-View bug fix
|
265
266
267
268
269
270
271
272
273
|
<?php
echo ListView::widget(
[
'dataProvider' => $historyData,
'layout' => '{items}',
'itemView' => '_timeline_item',
'itemOptions' => [
|
3bee3445
Alexey Boroda
-Order history ready
|
274
|
'tag' => false,
|
b522bd6c
Alexey Boroda
-View bug fix
|
275
276
277
278
279
280
281
282
283
284
285
286
|
],
'options' => [
'tag' => $historyData->totalCount == 0 ? 'div' : 'ul',
'class' => $historyData->totalCount == 0 ? 'list-view' : 'list-view timeline',
],
'emptyText' => 'У этого заказа пока нет истории',
'emptyTextOptions' => [
'class' => 'callout callout-info',
],
]
);
?>
|
cc04f587
Alexey Boroda
-Testing deadline...
|
287
288
|
|
3bee3445
Alexey Boroda
-Order history ready
|
289
290
|
</div><!-- /.box-body -->
</div><!-- /.box -->
|
db3040d3
Alexey Boroda
-Order module alm...
|
291
292
|
</div>
|