view.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\grid\GridView;
  4. use yii\data\ActiveDataProvider;
  5. use app\models\Auctions;
  6. /* @var $this yii\web\View */
  7. /* @var $model app\models\Auctions */
  8. $this->title = $model->lot->name;
  9. $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Auction ID'), 'url' => ['index']];
  10. $this->params['breadcrumbs'][] = $this->title;
  11. $aukname = Yii::t('app', 'AukName ID');
  12. $lot_label = Yii::t('app', 'Predmet ID');
  13. $lot_number_label = Yii::t('app', 'LotNumber ID');
  14. $org_name_label = Yii::t('app', 'OrgName ID');
  15. if ($model->type_id=="1") { $type_label = Yii::t('app', 'AuctionUp ID'); } else { $type_label = Yii::t('app', 'Concurs ID'); }
  16. $type_action = Yii::t('app', 'AuctionType ID');
  17. // $dataProvider = new ActiveDataProvider(['query' => \app\models\Trade::find()->where(['auk_id' => $model->id])->limit('5')]);
  18. ?>
  19. <!-- <script type="text/javascript">
  20. window.onfocus = function(){
  21. window.location.reload();
  22. }
  23. </script> -->
  24. <div class="container-fluid">
  25. <div class="col-sm-12">
  26. <div class="auctions-view">
  27. <div class="panel panel-primary">
  28. <div class="panel-heading"><span class="glyphicon glyphicon-tower"></span><strong> <?= Html::encode($aukname . ": #". $model->id . " " . $model->name) ?></strong></div>
  29. <div class="panel-body">
  30. <dl class="dl-horizontal">
  31. <dt><?= Html::encode($type_action) ?>:</dt><dd><?= Html::encode($type_label) ?></dd>
  32. <dt><?= Html::encode($org_name_label) ?>:</dt><dd><?= Html::encode($model->user->at_org) ?></dd>
  33. <!--ivakhnov<dt><?/*= Html::encode($lot_number_label) */?>:</dt><dd><?/*= Html::encode($model->lot_num) */?></dd>-->
  34. <dt><?= Html::encode($lot_label) ?>:</dt><dd><?= Html::encode($this->title) ?></dd>
  35. <?php
  36. // trade_log php
  37. /*
  38. GridView::widget([
  39. 'dataProvider' => $dataProvider,
  40. 'columns' => [
  41. ['class' => 'yii\grid\SerialColumn'],
  42. [
  43. 'id',
  44. 'auk_id',
  45. 'date',
  46. 'comment',
  47. 'user_id',
  48. ]
  49. ]]);*/
  50. ?>
  51. <?php
  52. if(Yii::$app->user->can('admin') || Yii::$app->user->can('org'))
  53. {
  54. if($model->status >= "2") // && $model->type_id=="1")
  55. {
  56. //$auction = Auctions::find()->with('winners')->where(['id' => 48])->one();
  57. //$winners = $auction->winners;
  58. //print_r($winners[0]->at_org);
  59. $winners = $model->winners;
  60. if($winners)
  61. {
  62. if(count($winners)==2)
  63. {
  64. ?>
  65. <dt><?= Html::encode(Yii::t('app', 'Winner1 ID')) ?>:</dt><dd><?= Html::encode($model->winners['0']->at_org." / ".$model->winners['0']->date." / ".$model->winners['0']->comment) ?></dd>
  66. <dt><?= Html::encode(Yii::t('app', 'Winner2 ID')) ?>:</dt><dd><?= Html::encode($model->winners['1']->at_org." / ".$model->winners['1']->date." / ".$model->winners['1']->comment) ?></dd>
  67. <?php
  68. }
  69. if(count($winners)==1)
  70. {
  71. ?>
  72. <dt><?= Html::encode(Yii::t('app', 'Winner1 ID')) ?>:</dt><dd><?= Html::encode($model->winners['0']->at_org . " / " . $model->winners['0']['date'] . " / " . $model->winners['0']['comment']) ?></dd>
  73. <?php
  74. }
  75. }
  76. }
  77. }
  78. ?>
  79. </dl>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. <?php
  86. if(Yii::$app->user->can('admin') || Yii::$app->user->can('member') || Yii::$app->user->can('watcher'))
  87. {
  88. echo $this->render('../../web/ws.html',['model' => $model]);
  89. //echo Html::a(Yii::t('app','Завантажити повний лог торгiв'), ['/auctions/tradelog', 'id' => $model->id], ['class' => 'glyphicon glyphicon-circle-arrow-down row1']);
  90. }
  91. elseif(Yii::$app->user->can('org'))
  92. {
  93. // echo $this->render('../../web/ws.html',['model' => $model]);
  94. echo $this->render('../../web/ws_org.html',['model' => $model]);
  95. }
  96. ?>