index.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\grid\GridView;
  4. use app\models\Auctions;
  5. /* @var $this yii\web\View */
  6. /* @var $searchModel app\models\AuctionsSearch */
  7. /* @var $dataProvider yii\data\ActiveDataProvider */
  8. $this->title = Yii::t('app', 'Torgi ID');
  9. $this->params['breadcrumbs'][] = $this->title;
  10. ?>
  11. <div class="panel panel-primary">
  12. <div class="panel-heading"><span class="glyphicon glyphicon-stats"></span><strong> <?= Html::encode($this->title) ?></strong></div>
  13. <div class="panel-body">
  14. <div class="auctions-index">
  15. <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  16. <p>
  17. <?= $this->render('_alert.php') ?>
  18. <?php
  19. if(Yii::$app->user->can('admin'))
  20. {
  21. $actions = '{view} {delete} {publishing}';
  22. //echo Html::a(Yii::t('app', 'Create Auctions'), ['create'], ['class' => 'btn btn-success']);
  23. }
  24. elseif(Yii::$app->user->can('member'))
  25. {
  26. $actions = '{view} {bid} {publishing}';
  27. }
  28. elseif(Yii::$app->user->can('org'))
  29. {
  30. $actions = '{view} {bid} {publishing}';
  31. }
  32. else
  33. {
  34. $actions = '{view}';
  35. }
  36. ?>
  37. </p>
  38. <?= GridView::widget([
  39. 'dataProvider' => $dataProvider,
  40. 'filterModel' => $searchModel,
  41. 'columns' => [
  42. [
  43. 'class' => 'yii\grid\SerialColumn',
  44. 'contentOptions' => ['width' => '70px'],
  45. ],
  46. //'name',
  47. //'userName',
  48. [
  49. 'attribute' => 'lot_num',
  50. 'header' => Yii::t('app','LotNumber ID'),
  51. ],
  52. [
  53. 'attribute' => 'lot',
  54. 'value' => 'lot.name'
  55. ],
  56. 'date_start:datetime',
  57. 'bidding_date:datetime',
  58. [
  59. 'attribute'=>'status',
  60. //'header' => Yii::t('app', 'Status ID'),
  61. 'value' => function($model){
  62. if ($model->status==0)
  63. {
  64. //return Yii::t('app', 'Waiting ID');
  65. return Yii::t('app', 'pMakeBidding ID');
  66. }
  67. if ($model->status==1)
  68. {
  69. //return Yii::t('app', 'Success ID');
  70. return Yii::t('app', 'pWaitAuction ID');
  71. }
  72. if ($model->status==2)
  73. {
  74. //return Yii::t('app', 'Rejected ID');
  75. return Yii::t('app', 'pMakeAuction ID');
  76. }
  77. if ($model->status==3)
  78. {
  79. //return Yii::t('app', 'Rejected ID');
  80. return Yii::t('app', 'pMakeFinal ID');
  81. }
  82. if ($model->status==4)
  83. {
  84. //return Yii::t('app', 'Rejected ID');
  85. return Yii::t('app', 'pEndTorg ID');
  86. }
  87. },
  88. 'format' => 'raw',
  89. ],
  90. [
  91. 'header' => Yii::t('app', 'StartPrice ID'),
  92. 'value' => 'lot.start_price',
  93. ],
  94. // 'last_price',
  95. // 'last_user',
  96. // 'last_date',
  97. //['class' => 'yii\grid\ActionColumn'],
  98. [
  99. 'class' => 'yii\grid\ActionColumn',
  100. 'template' => $actions,
  101. 'buttons' => [
  102. 'view' => function ($url,$model,$key) {
  103. return Html::a('', $url,['title'=>Yii::t('app','GoAuction ID'),'class' => 'glyphicon glyphicon-log-in']);
  104. },
  105. 'bid' => function ($url,$model,$key) {
  106. return Html::a('', '/lots/view?id='.$model->lot_id,['title'=>Yii::t('app','CreateBid ID'),'class' => 'glyphicon glyphicon-th-list']);
  107. },
  108. 'publishing' => function ($url, $model, $key)
  109. {
  110. return Html::a('', '/publishing/view?id='.$model->id,['title' => Yii::t('app', 'PublishingLot ID'), 'class' => 'glyphicon glyphicon-eye-open']);
  111. }
  112. ],
  113. ],
  114. ],
  115. ]); ?>
  116. </div>
  117. </div>
  118. </div>