phpist

Untitled

Dec 26th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. <?php
  2.  
  3. use common\models\HistoryBalance;
  4. use yii\data\ActiveDataProvider;
  5. use yii\grid\GridView;
  6. use yii\helpers\Html;
  7. use yii\widgets\DetailView;
  8. use yii\widgets\ListView;
  9.  
  10. /* @var $this yii\web\View */
  11. /* @var $model common\models\user\Person */
  12.  
  13. $this->title = $model->id;
  14. $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'People'), 'url' => ['index']];
  15. $this->params['breadcrumbs'][] = $this->title;
  16. \yii\web\YiiAsset::register($this);
  17. ?>
  18. <div class="person-view">
  19.  
  20. <h1><?= Html::encode($this->title) ?></h1>
  21.  
  22.  
  23. <?= DetailView::widget([
  24. 'model' => $model,
  25. 'attributes' => [
  26. 'id',
  27. 'user_id',
  28. 'balance',
  29. 'balance_in',
  30. 'balance_out',
  31. 'credit',
  32. 'refovod',
  33. 'rating',
  34. 'referrer:ntext',
  35. 'bonus_count',
  36. 'autoriz',
  37. ],
  38.  
  39. ]) ?>
  40.  
  41.  
  42. <!-- --><?//= ListView::widget([
  43. // 'dataProvider' => $dataProvider,
  44. // 'pager' => [
  45. // 'hideOnSinglePage' => true,
  46. // 'firstPageLabel' => Yii::t('main', 'First'),
  47. // 'lastPageLabel' => Yii::t('main', 'Last'),
  48. // ],
  49. // 'itemView' => '_history_balance',
  50. // 'layout' => '<div class="box box-solid"><div class="box-header"><div class="pull-right">{summary}</div></div></div><div class="row">{items}</div>{pager}',
  51. // ])?>
  52.  
  53. </div>
  54.  
  55. <div class="history-balance-index">
  56.  
  57. <!--<h1>--><?//= Html::encode($this->title) ?><!--</h1>-->
  58.  
  59.  
  60. <?= GridView::widget([
  61. 'dataProvider' => $dataProvider,
  62. 'query' => HistoryBalance::find()
  63. ->andWhere(['user_id' => $username])
  64. ->orderBy(['id' => SORT_DESC])
  65. ->limit(30)
  66. ->all(),
  67. // 'filterModel' => $searchModel,
  68. 'columns' => [
  69. ['class' => 'yii\grid\SerialColumn'],
  70.  
  71. ['attribute' => 'user_id',
  72. 'value' => function ($model) {
  73. return $model->user->username;
  74. }
  75. ],
  76. [
  77. 'attribute' => 'balance',
  78. 'format' => 'raw',
  79. 'value' => function ($model) {
  80. return $model->balance . '<br>
  81. <span class="text-success">' . $model->credit . '</span>';
  82. }
  83. ],
  84. [
  85. 'attribute' => 'balance_up',
  86. 'format' => 'raw',
  87. 'value' => function($model) {
  88. return \yii\helpers\Html::tag('span', $model->balance_up . '<br>' . $model->credit_up . (($model->credit_up >= 0)), [
  89. 'class' => ($model->credit_up >= 0) ? 'text-success' : 'text-danger'
  90. ]);
  91. }
  92. ],
  93. [
  94. 'attribute' => 'type',
  95. 'filter' => Html::activeDropDownList(
  96. $searchModel,
  97. 'type',
  98. HistoryBalance::getSortLabels(),
  99. [
  100. 'everyday' => 'каждый день',
  101. 'class' =>
  102. 'form-control form-control-sm'
  103. ]
  104. ),
  105. ],
  106. 'comment',
  107.  
  108. ],
  109. ]); ?>
  110. </div>
Advertisement
Add Comment
Please, Sign In to add comment