index.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. use app\models\Bills;
  3. use app\models\Lots;
  4. use yii\helpers\Html;
  5. use yii\helpers\Url;
  6. use yii\grid\GridView;
  7. /* @var $this yii\web\View */
  8. /* @var $searchModel app\models\BillsSearch */
  9. /* @var $dataProvider yii\data\ActiveDataProvider */
  10. $this->title = Yii::t('app', 'Bills');
  11. $this->params['breadcrumbs'][] = $this->title;
  12. $this->registerJs(<<<JS
  13. $('.payed-radio input[type="radio"]').on('change', function(e){
  14. var radio = $(this);
  15. $.get(
  16. radio.parents('.payed-radio').data('url') + '&payed=' + radio.val());
  17. });
  18. JS
  19. );
  20. ?>
  21. <div class="panel panel-primary">
  22. <div class="panel-heading"><span
  23. class="glyphicon glyphicon-stats"></span><strong> <?= Html::encode($this->title) ?></strong></div>
  24. <div class="panel-body">
  25. <?= GridView::widget([
  26. 'dataProvider' => $dataProvider,
  27. 'filterModel' => $searchModel,
  28. 'columns' => [
  29. [
  30. 'attribute' => 'id',
  31. 'value' => 'id',
  32. ],
  33. [
  34. 'attribute' => 'user_at_org',
  35. 'value' => 'user.at_org',
  36. 'visible' => Yii::$app->user->can('admin'),
  37. ],
  38. [
  39. 'attribute' => 'bid_id',
  40. 'value' => function ($model) {
  41. return Html::a($model->bid_id,
  42. [
  43. '/bidding/view',
  44. 'id' => $model->bid_id,
  45. ],
  46. ['target' => '_blank']
  47. );
  48. },
  49. 'format' => 'raw',
  50. ],
  51. [
  52. 'attribute' => 'auction_id',
  53. 'value' => function ($model) {
  54. return Html::a(isset($model->auction->id) ? $model->auction->id : 0,
  55. [
  56. '/publishing/view',
  57. 'id' => isset($model->auction->id) ? $model->auction->id : 0
  58. ],
  59. ['target' => '_blank']
  60. );
  61. },
  62. 'format' => 'raw',
  63. ],
  64. [
  65. 'attribute' => 'type',
  66. 'value' => function ($model) {
  67. return getValue(Bills::types(), $model->type);
  68. },
  69. 'filter' => Bills::types(),
  70. ],
  71. [
  72. 'attribute' => 'payed',
  73. 'filter' => Bills::payStatuses(),
  74. 'format' => 'raw',
  75. 'value' => function ($model) {
  76. if (!Yii::$app->user->can('admin')) {
  77. return getValue(Bills::payStatuses(), $model->payed);
  78. } else {
  79. return Html::radioList('payed' . $model->id,
  80. [$model->payed],
  81. Bills::payStatuses(),
  82. [
  83. 'class' => 'payed-radio',
  84. 'data-url' => Url::to([
  85. '/bills/payed',
  86. 'id' => $model->id
  87. ])
  88. ]
  89. );
  90. }
  91. }
  92. ],
  93. [
  94. 'class' => 'yii\grid\ActionColumn',
  95. 'template' => '{edit}{download}',
  96. 'buttons' => [
  97. 'download' => function ($url, $model, $key) {
  98. return Html::a(
  99. '<i class="glyphicon glyphicon-circle-arrow-down"></i>',
  100. [
  101. '/bills/download-requisites',
  102. 'id' => $model->id
  103. ],
  104. [
  105. 'target' => '_blank',
  106. 'title' => Yii::t('app', 'Download bill')
  107. ]
  108. );
  109. },
  110. ]
  111. ],
  112. ],
  113. ]); ?>
  114. </div>
  115. </div>