Advertisement
pmtpenza22

Untitled

Feb 19th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. <?php
  2.  
  3. use yii\helpers\Html;
  4. use yii\widgets\DetailView;
  5. use backend\models\Order;
  6. use backend\models\OrderStatus;
  7. use backend\models\Users;
  8. use common\models\User;
  9. use backend\models\Product;
  10. use \yii\helpers\ArrayHelper;
  11. use \yii\helpers\Helpers;
  12.  
  13. /* @var $this yii\web\View */
  14. /* @var $model backend\models\Order */
  15.  
  16. $this->title = $model->id;
  17. $this->params['breadcrumbs'][] = ['label' => 'Orders', 'url' => ['index']];
  18. $this->params['breadcrumbs'][] = $this->title;
  19. \yii\web\YiiAsset::register($this);
  20. ?>
  21. <div class="order-view">
  22.  
  23. <p>
  24. <?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  25. <?= Html::a('Удалить', ['delete', 'id' => $model->id], [
  26. 'class' => 'btn btn-danger',
  27. 'data' => [
  28. 'confirm' => 'Вы действительно хотите удалить заказ?',
  29. 'method' => 'post',
  30. ],
  31. ]) ?>
  32. </p>
  33.  
  34. <?= DetailView::widget([
  35. 'model' => $model,
  36. 'attributes' => [
  37. 'id',
  38. [
  39. 'attribute'=>'status_id',
  40. 'value'=>function($data){
  41. return $data->status->name;
  42. },
  43. ],
  44. 'kolichestvo',
  45. 'summ',
  46. [
  47. 'attribute'=>'user_id',
  48. 'value'=>function($data){
  49. return $data->users->username;
  50. },
  51. ],
  52. [
  53. 'attribute'=>'fio',
  54. 'label' => 'Фамилия',
  55. 'value'=>function($data){
  56. return $data->users->fio;
  57. },
  58. ],
  59. [
  60. 'attribute'=>'phone',
  61. 'label' => 'Телефон',
  62. 'value'=>function($data){
  63. return $data->users->phone;
  64. },
  65. ],
  66. [
  67. 'attribute'=>'email',
  68. 'label' => 'E-mail',
  69. 'value'=>function($data){
  70. return $data->users->email;
  71. },
  72. ],
  73. [
  74. 'attribute'=>'company',
  75. 'label' => 'Компания',
  76. 'value'=>function($data){
  77. return $data->users->company;
  78. },
  79. ],
  80. [
  81. 'attribute'=>'city',
  82. 'label' => 'Город',
  83. 'value'=>function($data){
  84. return $data->users->city;
  85. },
  86. ],
  87. [
  88. 'attribute'=>'Категория цен',
  89. 'value' => function($data){
  90. return $data->users->klass_pokupat ? 'Опт' : 'Розница';
  91. }
  92. ],
  93. 'create_at',
  94. 'update_at',
  95. ],
  96. ]) ?>
  97. <?php $items=$model->orderItems;?>
  98. <div class="table-responsive">
  99. <table class="table table-hover table-striped">
  100. <thead>
  101. <tr>
  102. <th>Наименование</th>
  103. <th>Цена</th>
  104. <th>Количество</th>
  105. <th>Сумма</th>
  106. </tr>
  107. </thead>
  108. <tbody>
  109. <?php foreach($items as $item):?>
  110. <tr>
  111. <td><?=\yii\helpers\Html::a($item['name'], ['product/view', 'id'=>$item['id']])?></td>
  112. <td><?=$item['price_old']?></td>
  113. <td><?=$item['kolichestvo_item']?></td>
  114. <td><?=$item['kolichestvo_item'] * $item['price_old'] ?></td>
  115. </tr>
  116. <?php endforeach?>
  117. <tr>
  118. <td colspan="4">Итого: </td>
  119. <td>ЗДЕСЬ количесвто всего товара т.е. поля kolichestvo_item сложить </td>
  120. </tr>
  121. <tr>
  122. <td colspan="4">На сумму: </td>
  123. <td> ЗДЕСЬ сумма всего заказа поле summ_item в базе данных только не пойму как его туда записывать </td>
  124. </tr>
  125. </tbody>
  126. </table>
  127. </div>
  128. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement