view.php 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: NeiroN
  5. * Date: 19.11.2015
  6. * Time: 9:27
  7. */
  8. use yii\helpers\Html;
  9. use yii\grid\GridView;
  10. use yii\helpers\ArrayHelper;
  11. /* @var $this yii\web\View */
  12. /* @var $dataProvider yii\data\ActiveDataProvider */
  13. $this->title = Yii::t('app', 'Bidding ID');
  14. $this->params['breadcrumbs'][] = $this->title;
  15. ?>
  16. <div class="panel panel-primary">
  17. <div class="panel-heading"><span class="glyphicon glyphicon-list"></span><strong> <?= Html::encode($this->title) ?></strong></div>
  18. <div class="panel-body">
  19. <div class="bidding-index">
  20. <?= GridView::widget([
  21. 'dataProvider' => $dataProvider,
  22. 'columns' => [
  23. ['class' => 'yii\grid\SerialColumn'],
  24. 'auctionName',
  25. [
  26. 'header' => Yii::t('app','LotName ID'),
  27. 'value' => function($model)
  28. {
  29. if(ArrayHelper::getValue($model->auction,'lot_id')) {
  30. $lot = app\models\Lots::find()->where(['id' => $model->auction->lot_id])->one();
  31. return $lot->name;
  32. }
  33. return false;
  34. }
  35. ],
  36. //'fileName',
  37. [
  38. 'header' => Yii::t('app', 'BiddingDate ID'),
  39. 'value' => function($model){
  40. if(ArrayHelper::getValue($model->auction,'bidding_date')) {
  41. return $model->auction->bidding_date;
  42. }
  43. return false;
  44. }
  45. ],
  46. [
  47. 'header' => Yii::t('app', 'Status ID'),
  48. 'value' => function($model){
  49. if ($model['status']==0)
  50. {
  51. return Html::a(Yii::t('app', 'WaitConfirm ID'), ['view'], ['class' => 'label label-warning']);
  52. }
  53. if ($model['status']==1)
  54. {
  55. return Html::a(Yii::t('app', 'Success ID'), ['view'], ['class' => 'label label-success']);
  56. }
  57. if ($model['status']==2)
  58. {
  59. return Html::a(Yii::t('app', 'Rejected ID'), ['view'], ['class' => 'label label-danger']);
  60. }
  61. },
  62. 'format' => 'raw',
  63. ],
  64. [
  65. 'class' => 'yii\grid\ActionColumn',
  66. 'template' => '{enter} {download} {delete}',
  67. 'buttons' => [
  68. 'enter' => function ($url,$model,$key) {
  69. return Html::a('', '/auctions/view?id='.$model->auction_id,['title'=>Yii::t('app','GoAuction ID'),'class' => 'glyphicon glyphicon-log-in']);
  70. },
  71. 'download' => function ($url,$model,$key) {
  72. return Html::a('', '/files/download?id='.$model->file_id,['title'=>Yii::t('app','Download ID'),'class' => 'glyphicon glyphicon-circle-arrow-down']);
  73. }
  74. ],
  75. ],
  76. ],
  77. ]); ?>
  78. </div>
  79. </div>
  80. </div>