index.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\grid\GridView;
  4. use yii\helpers\Url;
  5. use yii\widgets\ActiveForm;
  6. use yii\helpers\ArrayHelper;
  7. /* @var $this yii\web\View */
  8. /* @var $searchModel app\models\LotSearch */
  9. /* @var $dataProvider yii\data\ActiveDataProvider */
  10. $this->title = Yii::t('app', 'YouLots ID');
  11. $this->params['breadcrumbs'][] = $this->title;
  12. ?>
  13. <div class="lots-index">
  14. <div class="panel panel-primary">
  15. <div class="panel-heading"><span class="glyphicon glyphicon-th"></span><strong> <?= Html::encode($this->title) ?></strong></div>
  16. <div class="panel-body">
  17. <ul class="nav nav-tabs">
  18. <li role="presentation">
  19. <?= Html::a(\Yii::t('app', 'Template ID'), ['auclots/index'], ['class' => 'presentation active']) ?>
  20. </li><li role="presentation" class="active">
  21. <?= Html::a(\Yii::t('app', 'Lots ID'), ['/lots/index'], ['class' => 'presentation active']) ?>
  22. </li>
  23. </ul>
  24. <?php // echo $this->render('_search', ['model' => $searchModel]);
  25. /*
  26. if ($model->status==1) {
  27. return Html::a(Yii::t('app', 'Waiting ID'), ['id' => Yii::$app->user->identity->id], ['class' => 'btn btn-xs btn-warning btn-block']);
  28. }
  29. if ($model->status==2) {
  30. return Html::a(Yii::t('app', 'Success ID'), ['id' => Yii::$app->user->identity->id], ['class' => 'btn btn-xs btn-success btn-block']);
  31. }
  32. else {
  33. return Html::a(Yii::t('app', 'Rejected ID'), ['id' => Yii::$app->user->identity->id], ['class' => 'btn btn-xs btn-danger btn-block']);
  34. }*/
  35. ?>
  36. <br>
  37. <p>
  38. <?= Html::a(Yii::t('app', 'CreateLot ID'), ['create'], ['class' => 'btn btn-success']) ?>
  39. </p>
  40. <?= $this->render('_alert.php') ?>
  41. <?php
  42. if(Yii::$app->user->can('admin') || (Yii::$app->user->can('org')))
  43. {
  44. $actions = '{clone} {view} {update} {delete}';
  45. }
  46. else
  47. {
  48. $actions = '{view} {update} {delete}';
  49. }
  50. ?>
  51. <?= GridView::widget([
  52. 'dataProvider' => $dataProvider,
  53. 'filterModel' => $searchModel,
  54. 'columns' => [
  55. [
  56. 'class' => 'yii\grid\SerialColumn',
  57. 'contentOptions' => ['width' => '70px'],
  58. ],
  59. //'id',
  60. //'user_id',
  61. 'aukname',
  62. //'num',
  63. 'name',
  64. //'description',
  65. 'start_price',
  66. //'step',
  67. // 'docs_id',
  68. // 'address',
  69. //'delivery_time:datetime',
  70. // 'delivery_term',
  71. // 'requires',
  72. //'payment_term',
  73. // 'payment_order',
  74. // 'category_id',
  75. // 'member_require',
  76. // 'member_docs',
  77. // 'requisites_id',
  78. // 'notes',
  79. // 'dogovor_id',
  80. //'date',
  81. //'auction_date',
  82. 'date:datetime',
  83. /*[
  84. 'attribute'=>'date',
  85. 'format'=>'datetime', // ��������� ������������ - date:datetime:time
  86. 'headerOptions' => ['width' => '120'],
  87. ],*/
  88. [
  89. 'attribute'=>'status',
  90. //'header' => Yii::t('app', 'Status ID'),
  91. 'value' => function($model){
  92. if ($model->status==1)
  93. {
  94. //return Yii::t('app', 'Waiting ID');
  95. return Html::a(Yii::t('app', 'Waiting ID'), ['#'], ['class' => 'label label-warning']);
  96. }
  97. if ($model->status==2)
  98. {
  99. //return Yii::t('app', 'Success ID');
  100. return Html::a(Yii::t('app', 'Success ID'), ['#'], ['class' => 'label label-success']);
  101. }
  102. if ($model->status==3)
  103. {
  104. //return Yii::t('app', 'Rejected ID');
  105. return Html::a(Yii::t('app', 'Rejected ID'), ['#'], ['class' => 'label label-danger']);
  106. }
  107. if ($model->status==4)
  108. {
  109. //return Yii::t('app', 'Rejected ID');
  110. return Html::a(Yii::t('app', 'Agree by organizer'), ['#'], ['class' => 'label label-info']);
  111. }
  112. },
  113. 'format' => 'raw',
  114. ],
  115. ['class' => 'yii\grid\ActionColumn',
  116. 'template' => $actions,
  117. 'buttons' => [
  118. /*'auction' => function ($url,$model,$key) {
  119. return Html::a('', $url,['class' => 'glyphicon glyphicon-plus']);
  120. },*/
  121. 'clone' => function ($url,$model,$key) {
  122. return Html::a('', $url,['class' => 'glyphicon glyphicon-duplicate','title' => 'Клонувати']);
  123. },
  124. 'delete' => function($url, $model){
  125. return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete', 'id' => $model->id], [
  126. 'data' => [
  127. 'confirm' => $model->auction
  128. ? 'Видаляючи цей лот, ви видалите і опублікований аукціон. Ви впевнені?'
  129. : 'Ви впевнені, що хочете видалити лот',
  130. 'method' => 'post',
  131. ],
  132. ]);
  133. }
  134. ],
  135. ],
  136. ],
  137. ]); ?>
  138. </div>
  139. </div>
  140. </div>