index.php 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. <!-- <?= GridView::widget([
  117. 'dataProvider' => $dataProvider,
  118. 'filterModel' => $searchModel,
  119. 'columns' => [
  120. //lot name
  121. [
  122. 'header' => 'Назва аукціону',
  123. 'attribute' => 'lot',
  124. 'value' => 'lot.name'
  125. ],
  126. //auc id
  127. [
  128. 'attribute' => 'Номер аукціону',
  129. 'value' => 'id'
  130. ],
  131. //lot id
  132. [
  133. 'attribute' => 'lot_num',
  134. 'header' => Yii::t('app','LotNumber ID'),
  135. ],
  136. //auc status
  137. [
  138. 'attribute'=>'status',
  139. //'header' => Yii::t('app', 'Status ID'),
  140. 'value' => function($model){
  141. if ($model->status==0)
  142. {
  143. //return Yii::t('app', 'Waiting ID');
  144. return Yii::t('app', 'pMakeBidding ID');
  145. }
  146. if ($model->status==1)
  147. {
  148. //return Yii::t('app', 'Success ID');
  149. return Yii::t('app', 'pWaitAuction ID');
  150. }
  151. if ($model->status==2)
  152. {
  153. //return Yii::t('app', 'Rejected ID');
  154. return Yii::t('app', 'pMakeAuction ID');
  155. }
  156. if ($model->status==3)
  157. {
  158. //return Yii::t('app', 'Rejected ID');
  159. return Yii::t('app', 'pMakeFinal ID');
  160. }
  161. if ($model->status==4)
  162. {
  163. //return Yii::t('app', 'Rejected ID');
  164. return Yii::t('app', 'pEndTorg ID');
  165. }
  166. },
  167. 'format' => 'raw',
  168. ],
  169. // 'lot.date',
  170. 'date_start:datetime',
  171. 'bidding_date:datetime',
  172. 'date_stop:datetime',
  173. [
  174. 'header' => Yii::t('app', 'StartPrice ID'),
  175. 'value' => 'lot.start_price',
  176. ],
  177. [
  178. 'header' => 'Гарантійний внесок',
  179. 'value' => function($model){
  180. return $model->lot->start_price * 0.015;
  181. },
  182. ],
  183. [
  184. 'header' => 'Крок аукціону %',
  185. 'value' => function($model){
  186. return $model->lot->step;
  187. },
  188. ],
  189. // 'last_price',
  190. // 'last_user',
  191. // 'last_date',
  192. // 'lot.start_price',
  193. //['class' => 'yii\grid\ActionColumn'],
  194. [
  195. 'class' => 'yii\grid\ActionColumn',
  196. 'template' => '{publishing}',//$actions,
  197. 'buttons' => [
  198. // 'view' => function ($url,$model,$key) {
  199. // return Html::a('', $url,['title'=>Yii::t('app','GoAuction ID'),'class' => 'glyphicon glyphicon-log-in']);
  200. // },
  201. // 'bid' => function ($url,$model,$key) {
  202. // return Html::a('', '/lots/view?id='.$model->lot_id,['title'=>Yii::t('app','CreateBid ID'),'class' => 'glyphicon glyphicon-th-list']);
  203. // },
  204. 'publishing' => function ($url, $model, $key)
  205. {
  206. return Html::a('', '/publishing/view?id='.$model->id,['title' => Yii::t('app', 'PublishingLot ID'), 'class' => 'glyphicon glyphicon-eye-open']);
  207. }
  208. ],
  209. ],
  210. ],
  211. ]); ?> -->
  212. </div>
  213. </div>
  214. </div>