Commit d8203a8c8c8cabe7f2a416d3e563688e64fc307a

Authored by Alexey Boroda
1 parent 31df2ba6

-Updated at bug fix

Showing 2 changed files with 10 additions and 14 deletions   Show diff stats
models/Order.php
... ... @@ -311,10 +311,9 @@
311 311  
312 312 public function afterSave($insert, $changedAttributes)
313 313 {
314   -// VarDumper::dump($changedAttributes, 10, true);die();
315 314 $data = [];
316 315 foreach ($changedAttributes as $key => $attribute) {
317   - if ($this->oldAttributes[ $key ] != $attribute) {
  316 + if ($this->oldAttributes[ $key ] != $attribute && $key != 'updated_at') {
318 317 $data[ $key ] = $this->getLogAttributes(
319 318 $key,
320 319 [
... ...
views/order/_log_item.php
... ... @@ -5,6 +5,7 @@
5 5 */
6 6 use artweb\artbox\ecommerce\models\Order;
7 7 use artweb\artbox\ecommerce\models\OrderLog;
  8 + use yii\helpers\Html;
8 9 use yii\helpers\Json;
9 10  
10 11 ?>
... ... @@ -16,7 +17,7 @@
16 17 <div class="timeline-item">
17 18 <span class="time"><i class="fa fa-calendar"></i> <?= Yii::$app->formatter->asDatetime($model->created_at) ?></span>
18 19  
19   - <h3 class="timeline-header">Пользователь: <span class="text-orange"><?=$model->user->username?></span></h3>
  20 + <h3 class="timeline-header">Пользователь: <span class="text-orange"><?= $model->user->username ?></span></h3>
20 21  
21 22 <div class="timeline-body">
22 23 <table class="table table-bordered table-striped">
... ... @@ -27,17 +28,13 @@
27 28 </tr>
28 29 <?php
29 30 foreach (Json::decode($model->data) as $key => $item) {
30   - /**
31   - * @todo refactor this continue
32   - */
33   - if ($key == 'updated_at') continue;
34   - ?>
35   - <tr>
36   - <td><?=$order->attributeLabels()[$key]?></td>
37   - <td><?=$item['old']?></td>
38   - <td><?=$item['new']?></td>
39   - </tr>
40   - <?php
  31 + echo Html::tag(
  32 + 'tr',
  33 + Html::tag('td', $order->attributeLabels()[ $key ]) . Html::tag('td', $item[ 'old' ]) . Html::tag(
  34 + 'td',
  35 + $item[ 'new' ]
  36 + )
  37 + );
41 38 }
42 39 ?>
43 40 </table>
... ...