index.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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' => 'user_at_org',
  31. 'value' => 'user.at_org',
  32. 'visible' => Yii::$app->user->can('admin'),
  33. ],
  34. [
  35. 'attribute' => 'bid_id',
  36. 'value' => function ($model) {
  37. return Html::a($model->bid_id,
  38. [
  39. '/bidding/view',
  40. 'id' => $model->bid_id,
  41. ],
  42. ['target' => '_blank']
  43. );
  44. },
  45. 'format' => 'raw',
  46. ],
  47. [
  48. 'attribute' => 'auction_id',
  49. 'value' => function ($model) {
  50. return Html::a($model->auction->id,
  51. [
  52. '/publishing/view',
  53. 'id' => $model->auction->id,
  54. ],
  55. ['target' => '_blank']
  56. );
  57. },
  58. 'format' => 'raw',
  59. ],
  60. [
  61. 'attribute' => 'type',
  62. 'value' => function ($model) {
  63. return getValue(Bills::types(), $model->type);
  64. },
  65. 'filter' => Bills::types(),
  66. ],
  67. [
  68. 'attribute' => 'payed',
  69. 'filter' => Bills::payStatuses(),
  70. 'format' => 'raw',
  71. 'value' => function ($model) {
  72. if (!Yii::$app->user->can('admin')) {
  73. return getValue(Bills::payStatuses(), $model->payed);
  74. } else {
  75. return Html::radioList('payed' . $model->id,
  76. [$model->payed],
  77. Bills::payStatuses(),
  78. [
  79. 'class' => 'payed-radio',
  80. 'data-url' => Url::to([
  81. '/bills/payed',
  82. 'id' => $model->id
  83. ])
  84. ]
  85. );
  86. }
  87. }
  88. ],
  89. [
  90. 'class' => 'yii\grid\ActionColumn',
  91. 'template' => '{edit}{download}',
  92. 'buttons' => [
  93. 'download' => function ($url, $model, $key) {
  94. return Html::a(
  95. '<i class="glyphicon glyphicon-circle-arrow-down"></i>',
  96. [
  97. '/bills/download-requisites',
  98. 'id' => $model->id
  99. ],
  100. [
  101. 'target' => '_blank',
  102. 'title' => Yii::t('app', 'Download bill')
  103. ]
  104. );
  105. },
  106. ]
  107. ],
  108. ],
  109. ]); ?>
  110. </div>
  111. </div>