view.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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', 'Рахунки'),
  48. 'value' => function($model){
  49. $status = true;
  50. foreach($model->bills as $bill){
  51. if( $bill->payed == 0 || $bill->payed == 2 ){
  52. $status = false;
  53. break;
  54. }
  55. }
  56. if ($status)
  57. {
  58. return Html::a('Сплачено', ['view'], ['class' => 'label label-success']);
  59. ///return Html::a(Yii::t('app', 'WaitConfirm ID'), ['view'], ['class' => 'label label-warning']);
  60. } else {
  61. return Html::a('Не сплачено', ['/bills'], ['class' => 'label label-danger']);
  62. }
  63. },
  64. 'format' => 'raw',
  65. ],
  66. [
  67. 'header' => Yii::t('app', 'Заявка'),//'header' => Yii::t('app', 'Status ID'),
  68. 'value' => function($model){
  69. if ($model['status']==0)
  70. {
  71. return Html::a(Yii::t('app', 'WaitConfirm ID'), ['view'], ['class' => 'label label-warning']);
  72. }
  73. if ($model['status']==1)
  74. {
  75. return Html::a(Yii::t('app', 'Success ID'), ['view'], ['class' => 'label label-success']);
  76. }
  77. if ($model['status']==2)
  78. {
  79. return Html::a(Yii::t('app', 'Rejected ID'), ['view'], ['class' => 'label label-danger']);
  80. }
  81. },
  82. 'format' => 'raw',
  83. ],
  84. [
  85. 'class' => 'yii\grid\ActionColumn',
  86. 'template' => '{enter} {download} {delete}',
  87. 'buttons' => [
  88. 'enter' => function ($url,$model,$key) {
  89. return Html::a('', '/auctions/view?id='.$model->auction_id,['title'=>Yii::t('app','GoAuction ID'),'class' => 'glyphicon glyphicon-log-in']);
  90. },
  91. 'download' => function ($url,$model,$key) {
  92. return Html::a('', '/files/download?id='.$model->file_id,['title'=>Yii::t('app','Download ID'),'class' => 'glyphicon glyphicon-circle-arrow-down']);
  93. }
  94. ],
  95. ],
  96. ],
  97. ]); ?>
  98. </div>
  99. </div>
  100. </div>