index.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <?php
  2. /* @var $this yii\web\View */
  3. use yii\helpers\Html;
  4. use yii\grid\GridView;
  5. use yii\widgets\Pjax;
  6. use app\models\Auctions;
  7. $this->title = Yii::t('app', 'Bidding ID');
  8. $this->params['breadcrumbs'][] = $this->title;
  9. ?>
  10. <div class="auctions-index">
  11. <div class="panel panel-primary">
  12. <div class="panel-heading"><span class="glyphicon glyphicon-th-large"></span><strong> <?= Html::encode($this->title) ?></strong></div>
  13. <div class="panel-body">
  14. <style>
  15. .action-button{
  16. display:flex;
  17. }
  18. .action-button .glyphicon{
  19. font-size: 15px !important;
  20. padding: 4px !important;
  21. border: 1px solid;
  22. margin: 1px;
  23. border-radius: 3px;
  24. }
  25. </style>
  26. <?php //Pjax::begin(); ?>
  27. <!-- <?= GridView::widget([
  28. 'dataProvider' => $dataProvider,
  29. 'columns' => [
  30. ['class' => 'yii\grid\SerialColumn'],
  31. //'id',
  32. [
  33. 'attribute' => 'created_at',
  34. 'header' => Yii::t('app', 'Date ID'),
  35. //'attribute' => 'date_start',
  36. //'header' => Yii::t('app', 'AuctionDate ID'),
  37. ],
  38. [
  39. 'attribute' => 'auction.name',
  40. 'header' => Yii::t('app', 'AukName ID'),
  41. ],
  42. [
  43. 'attribute' => 'lot.name',
  44. 'header' => Yii::t('app', 'Lot ID'),
  45. ],
  46. [
  47. 'attribute' => 'user.at_org',
  48. 'header' => Yii::t('app', 'BidFrom ID'),
  49. ],
  50. 'special_price',
  51. [
  52. 'header' => Yii::t('app', 'Status ID'),
  53. 'value' => function($model){
  54. if ($model['status']==0)
  55. {
  56. return Html::a(Yii::t('app', 'WaitConfirm ID'), ['#'], ['class' => 'label label-warning']);
  57. }
  58. if ($model['status']==1)
  59. {
  60. return Html::a(Yii::t('app', 'Success ID'), ['#'], ['class' => 'label label-success']);
  61. }
  62. if ($model['status']==2)
  63. {
  64. return Html::a(Yii::t('app', 'Rejected ID'), ['#'], ['class' => 'label label-danger']);
  65. }
  66. },
  67. 'format' => 'raw',
  68. ],
  69. [
  70. 'class' => 'yii\grid\ActionColumn',
  71. 'template' => '{confirm} {reject} {download}',
  72. 'buttons' => [
  73. 'confirm' => function ($url,$model,$key) {
  74. return Html::a('', ['confirm','id'=> $model['id']],['title'=>Yii::t('app','Confirm ID'),'class' => 'glyphicon glyphicon-ok-circle', 'style'=>'font-size: 25px;']);
  75. },
  76. 'reject' => function ($url,$model,$key) {
  77. return Html::a('', ['reject','id'=> $model['id']],['title'=>Yii::t('app','Reject ID'),'class' => 'glyphicon glyphicon-remove-circle', 'style'=>'font-size: 25px;']);
  78. },
  79. 'delete' => function ($url,$model,$key) {
  80. return Html::a('', 'delete?id=' . $model['id'], ['title' => Yii::t('app', 'Delete ID'), 'class' => 'glyphicon glyphicon-trash' , 'style'=>'font-size: 25px;']);
  81. },
  82. 'download' => function ($url,$model,$key) {
  83. return Html::a('', '/files/download?id='.$model['file_id'],['title'=>Yii::t('app','Download ID'),'class' => 'glyphicon glyphicon-circle-arrow-down', 'style'=>'font-size: 25px;']);
  84. }
  85. ],
  86. ],
  87. ],
  88. ]); ?> -->
  89. <?php //Pjax::end(); ?>
  90. <?= GridView::widget([
  91. 'dataProvider' => $dataProvider,
  92. // 'filterModel' => $searchModel,
  93. 'columns' => [
  94. [
  95. 'header'=>'#id',
  96. 'attribute'=>'id',
  97. 'value'=>'id'
  98. ],
  99. [
  100. 'attribute' => 'user.at_org',
  101. 'header' => Yii::t('app', 'BidFrom ID'),
  102. ],
  103. [
  104. 'attribute'=>'status',
  105. //'header' => Yii::t('app', 'Status ID'),
  106. 'value' => function($model){
  107. $auction = $model->auction ? $model->auction->status : false;
  108. if($auction){
  109. $status_name = Auctions::statusNames()[$model->auction->status];
  110. if($model->auction->status == 1){
  111. return Html::a($status_name, ['#'], ['class' => 'label label-warning']);
  112. }
  113. if($model->auction->status == 2){
  114. return Html::a($status_name, ['#'], ['class' => 'label label-danger']);
  115. }
  116. if($model->auction->status == 3){
  117. return Html::a($status_name, ['#'], ['class' => 'label label-default']);
  118. }
  119. if($model->auction->status == 4){
  120. return Html::a($status_name, ['#'], ['class' => 'label label-primary']);
  121. }
  122. }
  123. if ($model->status==1)
  124. {
  125. //return Yii::t('app', 'Waiting ID');
  126. return Html::a(Yii::t('app', 'Waiting ID'), ['#'], ['class' => 'label label-warning']);
  127. }
  128. if ($model->status==2)
  129. {
  130. //return Yii::t('app', 'Success ID');
  131. return Html::a(Yii::t('app', 'Success ID'). ($model->auction ? ' | ' . (string)Auctions::statusNames()[$model->auction->status] : ''), ['#'], ['class' => 'label label-success']);
  132. }
  133. if ($model->status==3)
  134. {
  135. //return Yii::t('app', 'Rejected ID');
  136. return Html::a(Yii::t('app', 'Rejected ID'), ['#'], ['class' => 'label label-danger']);
  137. }
  138. if ($model->status==4)
  139. {
  140. //return Yii::t('app', 'Rejected ID');
  141. return Html::a(Yii::t('app', 'Agree by organizer'), ['#'], ['class' => 'label label-info']);
  142. }
  143. },
  144. 'format' => 'raw',
  145. ],
  146. [
  147. 'header'=>'Номер лоту',
  148. 'attribute'=>'lot.id',
  149. 'value'=>'lot.id'
  150. ],
  151. [
  152. 'header'=>'Номер аукціону',
  153. 'attribute'=>'auction.id',
  154. 'value'=>'auction.id'
  155. ],
  156. [
  157. 'attribute' => 'created_at',
  158. 'header' => Yii::t('app', 'Date ID'),
  159. //'attribute' => 'date_start',
  160. //'header' => Yii::t('app', 'AuctionDate ID'),
  161. ],
  162. 'special_price',
  163. [
  164. 'header' => Yii::t('app', 'Status ID'),
  165. 'value' => function($model){
  166. if ($model['status']==0)
  167. {
  168. return Html::a(Yii::t('app', 'WaitConfirm ID'), ['#'], ['class' => 'label label-warning']);
  169. }
  170. if ($model['status']==1)
  171. {
  172. return Html::a(Yii::t('app', 'Success ID'), ['#'], ['class' => 'label label-success']);
  173. }
  174. if ($model['status']==2)
  175. {
  176. return Html::a(Yii::t('app', 'Rejected ID'), ['#'], ['class' => 'label label-danger']);
  177. }
  178. },
  179. 'format' => 'raw',
  180. ],
  181. [
  182. 'class' => 'yii\grid\ActionColumn',
  183. 'header' => 'Дії з заявкою',
  184. 'template' => '<div class="action-button">{confirm} {reject} {download}</div>',
  185. 'buttons' => [
  186. 'confirm' => function ($url,$model,$key) {
  187. return Html::a('<span class="glyphicon glyphicon-ok-circle"></span>', ['confirm','id'=> $model['id']],['title'=>Yii::t('app','Confirm ID')]);
  188. },
  189. 'reject' => function ($url,$model,$key) {
  190. return Html::a('<span class="glyphicon glyphicon-remove-circle"></span>', ['reject','id'=> $model['id']],['title'=>Yii::t('app','Reject ID')]);
  191. },
  192. 'delete' => function ($url,$model,$key) {
  193. return Html::a('<span class="glyphicon glyphicon-trash"></span>', 'delete?id=' . $model['id'], ['title' => Yii::t('app', 'Delete ID')]);
  194. },
  195. 'download' => function ($url,$model,$key) {
  196. return Html::a('<span class="glyphicon glyphicon-circle-arrow-down"></span>', '/files/download?id='.$model['file_id'],['title'=>Yii::t('app','Download ID')]);
  197. }
  198. ],
  199. ],
  200. [
  201. 'header' => Yii::t('app', 'Назва аукціону'),
  202. 'attribute' => 'lot.name',
  203. ],
  204. ['class' => 'yii\grid\ActionColumn',
  205. 'template' => '<div class="action-button">{auctions}</div>',
  206. 'buttons' => [
  207. 'auctions' => function ($url, $model, $key) {
  208. if (!$model->auction) {
  209. return null;
  210. }
  211. if ($model->auction->status != 2) {
  212. // return null;
  213. }
  214. return Html::a(
  215. '<span class="glyphicon glyphicon-log-in"></span>',
  216. ['/auctions/view', 'id' => $model->auction->id],
  217. [
  218. 'title' => 'Перейти до торгів'
  219. ]
  220. );
  221. },
  222. ],
  223. ],
  224. ],
  225. ]); ?>
  226. </div>
  227. </div>
  228. </div>