Bladeren bron

newversion

Sergey Kazanskiy 3 maanden geleden
bovenliggende
commit
4af39e57cf

+ 36 - 21
controllers/BillsController.php

@@ -170,35 +170,50 @@ class BillsController extends Controller
         $percent_g = 0.015;
         $percent_r = 0.0015;
         $amount_vat = $amount = $type == 'guarantee'
-            ? $percent_g*$model->auction->lot->start_price
-            : $percent_r*$model->auction->lot->start_price;
-        if ($model->auction->lot->nds) {
+            ? $percent_g*(isset($model->auction->lot) ? $model->auction->lot->start_price : 0 )
+            : $percent_r*(isset($model->auction->lot) ? $model->auction->lot->start_price : 0 );
+        if (isset($model->auction->lot) ? $model->auction->lot->nds : 0) {
             $amount = $amount/1.2*1;
         } else {
             $amount_vat *= 1.2;
         }
         
+        $data = [
+            'billid' => $model->id,
+            'date' => date('m.d.Y'),
+            'userfio' => (empty($model->profile->fio) ? 'Не знайдено' : $model->profile->fio),
+            'summ' => $amount_vat,
+            'letters' => Yii::$app->num2text->moneyFormatted($amount_vat),
+            'letterpdv' => Yii::$app->num2text->moneyFormatted(($amount_vat / 100 * 20)),
+            'aukinfo' => "№" . (empty($model->auction) ? 'Не знайдено' : $model->auction->id) . " " . (empty($model->auction) ? 'Не знайдено' : $model->auction->name),
+            'nopdv' => ($amount_vat - ($amount_vat / 100 * 20)),
+            'ypdv' => ($amount_vat / 100 * 20)
+            
+            // 'auctionID' => $model->auction->id,
+            // 'date' => date('d-m-Y'),
+            // 'inn' => $model->profile->inn,
+            // 'zkpo' => $model->profile->zkpo,
+            // 'uAddress' => $model->profile->u_address,
+            // 'bank' => $model->requisite->bank,
+            // 'payAccount' => $model->requisite->account,
+            // 'phone' => $model->profile->phone,
+            // 'fax' => $model->profile->fax,
+            // 'firmaFull' => $model->profile->firma_full,
+            // 'billType' => $type == 'guarantee'? 'Гарантійний внесок': 'Регістраційний внесок',
+            // 'amountString' => num2str($amount_vat),
+            // 'amountVat' => $amount_vat,
+            // 'amount' => $amount,
+            // 'vat' => $model->auction->lot->nds ? 'з ПДВ' : 'без ПДВ',
+        ];
+
+        // print_r($data);
+        // exit;
+
         $filename = templater()->process(
-            [
-                'billID' => $model->id,
-                'auctionID' => $model->auction->id,
-                'date' => date('d-m-Y'),
-                'inn' => $model->profile->inn,
-                'zkpo' => $model->profile->zkpo,
-                'uAddress' => $model->profile->u_address,
-                'bank' => $model->requisite->bank,
-                'payAccount' => $model->requisite->account,
-                'phone' => $model->profile->phone,
-                'fax' => $model->profile->fax,
-                'firmaFull' => $model->profile->firma_full,
-                'billType' => $type == 'guarantee'? 'Гарантійний внесок': 'Регістраційний внесок',
-                'amountString' => num2str($amount_vat),
-                'amountVat' => $amount_vat,
-                'amount' => $amount,
-                'vat' => $model->auction->lot->nds ? 'з ПДВ' : 'без ПДВ',
-            ],
+            $data,
             $type
         );
+
         return Yii::$app->response->sendFile($filename);
 
     }

+ 10 - 10
controllers/CategoriesblogController.php

@@ -113,7 +113,8 @@ class CategoriesblogController extends Controller
     public function actionCategory($slug, $lang = null)
     {
         $this->layout = '@app/views/layouts/public';
-        $query = Categoriesblog::findOne(['slug' => $slug]);
+        $query = BlogPosts::findOne(['slug' => $slug]);
+
         //метатеги для категорий
 
         $title = $query->title;
@@ -134,19 +135,18 @@ class CategoriesblogController extends Controller
         }
         //-----
 
-        $searchModel = new BlogPostsSearch();
-
-        $searchModel->categorySlug = $slug;
-        $dataProvider = $searchModel->search(Yii::$app->request->queryParams, '');
-
-        //if($lang === null) unset($lang);
-
         return $this->render('blog',[
-            'searchModel'=>$searchModel,
-            'dataProvider' => $dataProvider,
+            'model'=>$query,
             'lang' => $lang,
         ]);
 
+        // //if($lang === null) unset($lang);
+
+        // return $this->render('blog',[
+        //     'searchModel'=>$searchModel,
+        //     'dataProvider' => $dataProvider,
+        //     'lang' => $lang,
+        // ]);
 
     }
 

+ 8 - 0
controllers/LotsController.php

@@ -148,7 +148,11 @@ class LotsController extends Controller
                     'user_id'=>Yii::$app->user->identity->id,
                     'auction_id'=>'null',
                     'lot_id'=>$model->id,
+<<<<<<< HEAD
+                    'type'  =>  'project_dogovor'
+=======
                     'type'  =>  'NULL'
+>>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                 ]);
                 $model->updateAttributes(['dogovor_id' => $dogovor_id]);
             }
@@ -240,7 +244,11 @@ class LotsController extends Controller
                     'user_id'=>Yii::$app->user->identity->id,
                     'auction_id'=>'null',
                     'lot_id'=>$model->id,
+<<<<<<< HEAD
+                    'type'  =>  'project_dogovor'
+=======
                     'type'  =>  'NULL'
+>>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                 ]);
                 $model->updateAttributes(['dogovor_id' => $dogovor_id]);
             }

+ 18 - 10
controllers/PublishingController.php

@@ -115,21 +115,23 @@ class PublishingController extends Controller
         }
         
 
-        $fio = "";
-        if(empty($model->profile->fio)){
-            $fio = $model->user->fio;
-            if(empty($fio)){
-                $fio = "name name name";
-            }
-        } else {
-            $fio = $model->profile->fio;
-        }
+        // $fio = "";
+        // if(empty($model->profile->fio)){
+        //     $fio = $model->user->fio;
+        //     if(empty($fio)){
+        //         $fio = "name name name";
+        //     }
+        // } else {
+        //     $fio = $model->profile->fio;
+        // }
+
+        $fio = $model->profile->member;
         
         $fio = explode(" ", $fio);
         if(count($fio) > 2){
             $iof = mb_substr($fio[1], 0, 1) . ". " . mb_substr($fio[2], 0, 1) . ". " . $fio[0];
         } else {
-            $iof = (string)$fio[0];
+            $iof = (string)$fio[0] ." ". (string)$fio[1];
         }
 
         $winner_proposition = 0;
@@ -174,6 +176,12 @@ class PublishingController extends Controller
             
         ];
 
+        // echo '<pre>';
+        // print_r($model->profile->attributes);
+        // print_r($data);
+        // echo '</pre>';
+        // exit;
+
         $file = Yii::$app->templater->process($data);
         return Yii::$app->response->sendFile($file);
 

+ 107 - 4
views/auctions/index.php

@@ -48,10 +48,10 @@ $this->params['breadcrumbs'][] = $this->title;
                 'dataProvider' => $dataProvider,
                 'filterModel' => $searchModel,
                 'columns' => [
-                    [
-                        'class' => 'yii\grid\SerialColumn',
-                        'contentOptions' => ['width' => '70px'],
-                    ],
+                    // [
+                    //     'class' => 'yii\grid\SerialColumn',
+                    //     'contentOptions' => ['width' => '70px'],
+                    // ],
 
                     //'name',
                     //'userName',
@@ -130,6 +130,109 @@ $this->params['breadcrumbs'][] = $this->title;
                 ],
             ]); ?>
 
+            <!-- <?= GridView::widget([
+                'dataProvider' => $dataProvider,
+                'filterModel' => $searchModel,
+                'columns' => [
+                    //lot name
+                    [
+                        'header' => 'Назва аукціону',
+                        'attribute' => 'lot',
+                        'value' => 'lot.name'
+                    ],
+                    //auc id
+                    [
+                        'attribute' => 'Номер аукціону',
+                        'value' => 'id'
+                    ],
+                    //lot id
+                    [
+                        'attribute' => 'lot_num',
+                        'header'    =>  Yii::t('app','LotNumber ID'),
+                    ],
+                    //auc status
+                    [
+                        'attribute'=>'status',
+                        //'header' => Yii::t('app', 'Status ID'),
+                        'value' => function($model){
+                            if ($model->status==0)
+                            {
+                                //return Yii::t('app', 'Waiting ID');
+                                return Yii::t('app', 'pMakeBidding ID');
+                            }
+                            if ($model->status==1)
+                            {
+                                //return Yii::t('app', 'Success ID');
+                                return Yii::t('app', 'pWaitAuction ID');
+                            }
+                            if ($model->status==2)
+                            {
+                                //return Yii::t('app', 'Rejected ID');
+                                return Yii::t('app', 'pMakeAuction ID');
+                            }
+                            if ($model->status==3)
+                            {
+                                //return Yii::t('app', 'Rejected ID');
+                                return Yii::t('app', 'pMakeFinal ID');
+                            }
+                             if ($model->status==4)
+                            {
+                                //return Yii::t('app', 'Rejected ID');
+                                return Yii::t('app', 'pEndTorg ID');
+                            }
+                        },
+                        'format' => 'raw',
+                    ],                    
+
+                    // 'lot.date',
+                    'date_start:datetime',
+                    'bidding_date:datetime',
+                    'date_stop:datetime',
+
+                    [
+                            'header' => Yii::t('app', 'StartPrice ID'),
+                            'value' => 'lot.start_price',
+                    ],
+
+                    [
+                        'header' => 'Гарантійний внесок',
+                        'value' => function($model){
+                            return $model->lot->start_price * 0.015;
+                        },
+                    ],
+                    
+                    [
+                        'header' => 'Крок аукціону %',
+                        'value' => function($model){
+                            return $model->lot->step;
+                        },
+                    ],                    
+                    // 'last_price',
+                    // 'last_user',
+                    // 'last_date',
+                    // 'lot.start_price',
+
+                    //['class' => 'yii\grid\ActionColumn'],
+                    [
+                        'class' => 'yii\grid\ActionColumn',
+                        'template' => '{publishing}',//$actions,
+                        'buttons' => [
+                            // 'view' => function ($url,$model,$key) {
+                            //     return Html::a('', $url,['title'=>Yii::t('app','GoAuction ID'),'class' => 'glyphicon glyphicon-log-in']);
+                            // },
+                            // 'bid' => function ($url,$model,$key) {
+                            //     return Html::a('', '/lots/view?id='.$model->lot_id,['title'=>Yii::t('app','CreateBid ID'),'class' => 'glyphicon glyphicon-th-list']);
+                            // },
+                            'publishing' => function ($url, $model, $key)
+                            {
+                                return Html::a('', '/publishing/view?id='.$model->id,['title' => Yii::t('app', 'PublishingLot ID'), 'class' => 'glyphicon glyphicon-eye-open']);
+                            }
+
+                        ],
+                    ],
+                ],
+            ]); ?> -->
+
         </div>
     </div>
 </div>

+ 14 - 11
views/auctions/view.php

@@ -62,23 +62,23 @@ $type_action = Yii::t('app', 'AuctionType ID');
                             if($model->status >= "2") // && $model->type_id=="1")
                             {
                                 //$auction = Auctions::find()->with('winners')->where(['id' => 48])->one();
-                                //$winners = $auction->winners;
-                                //print_r($winners[0]->at_org);
+                                //$winners = $auction->winners;                                
 
                                 $winners = $model->winners;
+                                // print_r(count($winners));
                                 if($winners)
                                 {
                                     if(count($winners)==2)
                                     {
                                         ?>
-                                        <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>
-                                        <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>
+                                        <!-- <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> -->
+                                        <!-- <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> -->
                                         <?php
                                     }
                                     if(count($winners)==1)
                                     {
                                         ?>
-                                        <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>
+                                        <!-- <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> -->
                                         <?php
                                     }
                                 }
@@ -98,15 +98,18 @@ $type_action = Yii::t('app', 'AuctionType ID');
 
 if(Yii::$app->user->can('admin') || Yii::$app->user->can('member') || Yii::$app->user->can('watcher'))
 {
-    echo $this->render('../../web/ws.html',['model' => $model]);
+    //echo $this->render('../../web/ws.html',['model' => $model]);
 
     //echo Html::a(Yii::t('app','Завантажити повний лог торгiв'), ['/auctions/tradelog', 'id' => $model->id], ['class' => 'glyphicon glyphicon-circle-arrow-down row1']);
 }
-elseif(Yii::$app->user->can('org'))
-{
-    // echo $this->render('../../web/ws.html',['model' => $model]);
-    echo $this->render('../../web/ws_org.html',['model' => $model]);
-}
+
+echo $this->render('../../web/ws.html',['model' => $model]);
+
+// elseif(Yii::$app->user->can('org'))
+// {
+//     // echo $this->render('../../web/ws.html',['model' => $model]);
+//     echo $this->render('../../web/ws_org.html',['model' => $model]);
+// }
 ?>
 
 

+ 157 - 2
views/bidding/index.php

@@ -3,6 +3,7 @@
 use yii\helpers\Html;
 use yii\grid\GridView;
 use yii\widgets\Pjax;
+use app\models\Auctions;
 
 
 
@@ -15,8 +16,21 @@ $this->params['breadcrumbs'][] = $this->title;
         <div class="panel-heading"><span class="glyphicon glyphicon-th-large"></span><strong> <?= Html::encode($this->title) ?></strong></div>
         <div class="panel-body">
 
+            <style>
+                .action-button{
+                    display:flex;
+                }
+                .action-button .glyphicon{
+                    font-size: 15px !important;
+                    padding: 4px !important;
+                    border: 1px solid;
+                    margin: 1px;
+                    border-radius: 3px;
+                }
+            </style>
+
             <?php //Pjax::begin(); ?>
-            <?= GridView::widget([
+            <!-- <?= GridView::widget([
                 'dataProvider' => $dataProvider,
                 'columns' => [
                     ['class' => 'yii\grid\SerialColumn'],
@@ -78,8 +92,149 @@ $this->params['breadcrumbs'][] = $this->title;
                         ],
                     ],
                 ],
-            ]); ?>
+            ]); ?> -->
             <?php //Pjax::end(); ?>
+
+            <?= GridView::widget([
+                'dataProvider' => $dataProvider,
+                // 'filterModel' => $searchModel,
+                'columns' => [
+                    [
+                        'header'=>'#id',
+                        'attribute'=>'id',
+                        'value'=>'id'
+                    ],                    
+                    [
+                        'attribute' =>  'user.at_org',
+                        'header' => Yii::t('app', 'BidFrom ID'),
+                    ],
+                    [
+                        'attribute'=>'status',
+                        //'header' => Yii::t('app', 'Status ID'),
+                        'value' => function($model){ 
+                            $auction = $model->auction ? $model->auction->status : false;                            
+                            if($auction){
+                                $status_name = Auctions::statusNames()[$model->auction->status]; 
+                                if($model->auction->status == 1){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-warning']); 
+                                }
+                                if($model->auction->status == 2){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-danger']); 
+                                }
+                                if($model->auction->status == 3){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-default']);
+                                }
+                                if($model->auction->status == 4){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-primary']);
+                                }                                
+                            }
+                            if ($model->status==1)
+                            {
+                                //return Yii::t('app', 'Waiting ID');
+                                return Html::a(Yii::t('app', 'Waiting ID'), ['#'], ['class' => 'label label-warning']);
+                            }
+                            if ($model->status==2)
+                            {
+                                //return Yii::t('app', 'Success ID');
+                                return Html::a(Yii::t('app', 'Success ID'). ($model->auction ? ' | ' . (string)Auctions::statusNames()[$model->auction->status] : ''), ['#'], ['class' => 'label label-success']);
+                            }
+                            if ($model->status==3)
+                            {
+                                //return Yii::t('app', 'Rejected ID');
+                                return Html::a(Yii::t('app', 'Rejected ID'), ['#'], ['class' => 'label label-danger']);
+                            }
+                            if ($model->status==4)
+                            {
+                                //return Yii::t('app', 'Rejected ID');
+                                return Html::a(Yii::t('app', 'Agree by organizer'), ['#'], ['class' => 'label label-info']);
+                            }
+                        },
+                        'format' => 'raw',
+                    ],
+                    [
+                        'header'=>'Номер лоту',
+                        'attribute'=>'lot.id',
+                        'value'=>'lot.id'
+                    ],
+                    [
+                        'header'=>'Номер аукціону',
+                        'attribute'=>'auction.id',
+                        'value'=>'auction.id'
+                    ],                    
+                    [
+                        'attribute'    =>  'created_at',
+                        'header' => Yii::t('app', 'Date ID'),
+                        //'attribute' =>  'date_start',
+                        //'header' => Yii::t('app', 'AuctionDate ID'),
+                    ],
+                    'special_price',
+                    [
+                        'header' => Yii::t('app', 'Status ID'),
+                        'value' => function($model){
+                            if ($model['status']==0)
+                            {
+                                return Html::a(Yii::t('app', 'WaitConfirm ID'), ['#'], ['class' => 'label label-warning']);
+                            }
+                            if ($model['status']==1)
+                            {
+                                return Html::a(Yii::t('app', 'Success ID'), ['#'], ['class' => 'label label-success']);
+                            }
+                            if ($model['status']==2)
+                            {
+                                return Html::a(Yii::t('app', 'Rejected ID'), ['#'], ['class' => 'label label-danger']);
+                            }
+                        },
+                        'format' => 'raw',
+                    ],
+                    [
+                        'class' => 'yii\grid\ActionColumn',
+                        'header' => 'Дії з заявкою',
+                        'template' => '<div class="action-button">{confirm} {reject} {download}</div>',
+                        'buttons' => [
+                            'confirm' => function ($url,$model,$key) {
+                                return Html::a('<span class="glyphicon glyphicon-ok-circle"></span>', ['confirm','id'=> $model['id']],['title'=>Yii::t('app','Confirm ID')]);
+                            },
+                            'reject' => function ($url,$model,$key) {
+                                return Html::a('<span class="glyphicon glyphicon-remove-circle"></span>', ['reject','id'=> $model['id']],['title'=>Yii::t('app','Reject ID')]);
+                            },
+                            'delete' => function ($url,$model,$key) {
+                                return Html::a('<span class="glyphicon glyphicon-trash"></span>', 'delete?id=' . $model['id'], ['title' => Yii::t('app', 'Delete ID')]);
+                            },
+                            'download' => function ($url,$model,$key) {
+
+                                return Html::a('<span class="glyphicon glyphicon-circle-arrow-down"></span>', '/files/download?id='.$model['file_id'],['title'=>Yii::t('app','Download ID')]);
+                            }
+                        ],
+                    ],
+                    [
+                        'header' => Yii::t('app', 'Назва аукціону'),
+                        'attribute' =>  'lot.name',                        
+                    ],
+                    ['class' => 'yii\grid\ActionColumn',                        
+                        'template' => '<div class="action-button">{auctions}</div>',
+                        'buttons' => [
+                            'auctions' => function ($url, $model, $key) {
+
+                                if (!$model->auction) {
+                                    return null;
+                                }
+
+                                if ($model->auction->status != 2) {
+                                    // return null;
+                                }
+                            
+                                return Html::a(
+                                    '<span class="glyphicon glyphicon-log-in"></span>',
+                                    ['/auctions/view', 'id' => $model->auction->id],
+                                    [
+                                        'title' => 'Перейти до торгів'
+                                    ]
+                                );
+                            },
+                        ],
+                    ],
+                ],
+            ]); ?>
         </div>
     </div>
 </div>

+ 160 - 2
views/bidding/view.php

@@ -8,6 +8,7 @@
 use yii\helpers\Html;
 use yii\grid\GridView;
 use yii\helpers\ArrayHelper;
+use app\models\Auctions;
 
 /* @var $this yii\web\View */
 /* @var $dataProvider yii\data\ActiveDataProvider */
@@ -19,8 +20,20 @@ $this->params['breadcrumbs'][] = $this->title;
     <div class="panel-heading"><span class="glyphicon glyphicon-list"></span><strong> <?= Html::encode($this->title) ?></strong></div>
     <div class="panel-body">
         <div class="bidding-index">
+            <style>
+                .action-button{
+                    display:flex;
+                }
+                .action-button .glyphicon{
+                    font-size: 15px !important;
+                    padding: 4px !important;
+                    border: 1px solid;
+                    margin: 1px;
+                    border-radius: 3px;
+                }
+            </style>            
 
-            <?= GridView::widget([
+            <!-- <?= GridView::widget([
                 'dataProvider' => $dataProvider,
                 'columns' => [
                     ['class' => 'yii\grid\SerialColumn'],
@@ -97,7 +110,152 @@ $this->params['breadcrumbs'][] = $this->title;
                         ],
                     ],
                 ],
-            ]); ?>
+            ]); ?> -->
+
+            <?= GridView::widget([
+                'dataProvider' => $dataProvider,
+                // 'filterModel' => $searchModel,
+                'columns' => [
+                    [
+                        'header'=>'#id',
+                        'attribute'=>'id',
+                        'value'=>'id'
+                    ],                    
+                    [
+                        'attribute' =>  'user.at_org',
+                        'header' => Yii::t('app', 'BidFrom ID'),
+                    ],
+                    [
+                        'attribute'=>'status',
+                        //'header' => Yii::t('app', 'Status ID'),
+                        'value' => function($model){ 
+                            $auction = $model->auction ? $model->auction->status : false;                            
+                            if($auction){
+                                $status_name = Auctions::statusNames()[$model->auction->status]; 
+                                if($model->auction->status == 1){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-warning']); 
+                                }
+                                if($model->auction->status == 2){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-danger']); 
+                                }
+                                if($model->auction->status == 3){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-default']);
+                                }
+                                if($model->auction->status == 4){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-primary']);
+                                }                                
+                            }
+                            if ($model->status==1)
+                            {
+                                //return Yii::t('app', 'Waiting ID');
+                                return Html::a(Yii::t('app', 'Waiting ID'), ['#'], ['class' => 'label label-warning']);
+                            }
+                            if ($model->status==2)
+                            {
+                                //return Yii::t('app', 'Success ID');
+                                return Html::a(Yii::t('app', 'Success ID'). ($model->auction ? ' | ' . (string)Auctions::statusNames()[$model->auction->status] : ''), ['#'], ['class' => 'label label-success']);
+                            }
+                            if ($model->status==3)
+                            {
+                                //return Yii::t('app', 'Rejected ID');
+                                return Html::a(Yii::t('app', 'Rejected ID'), ['#'], ['class' => 'label label-danger']);
+                            }
+                            if ($model->status==4)
+                            {
+                                //return Yii::t('app', 'Rejected ID');
+                                return Html::a(Yii::t('app', 'Agree by organizer'), ['#'], ['class' => 'label label-info']);
+                            }
+                        },
+                        'format' => 'raw',
+                    ],
+                    [
+                        'header'=>'Номер лоту',
+                        'attribute'=>'lot.id',
+                        'value'=>'lot.id'
+                    ],
+                    [
+                        'header'=>'Номер аукціону',
+                        'attribute'=>'auction.id',
+                        'value'=>'auction.id'
+                    ],                    
+                    [
+                        'attribute'    =>  'created_at',
+                        'header' => Yii::t('app', 'Date ID'),
+                        //'attribute' =>  'date_start',
+                        //'header' => Yii::t('app', 'AuctionDate ID'),
+                    ],
+                    [
+                        'attribute' =>  'auction.date_start',
+                        'header' => Yii::t('app', 'AuctionDate ID'),
+                    ],                    
+                    'special_price',
+                    [
+                        'header' => Yii::t('app', 'Рахунки'),
+                        'value' => function($model){
+                            $status = true;
+                            foreach($model->bills as $bill){                                
+                                if( $bill->payed == 0 || $bill->payed == 2 ){
+                                    $status = false;
+                                    break;
+                                }
+                            }
+                            if ($status)
+                            {
+                                return Html::a('Сплачено', ['view'], ['class' => 'label label-success']);
+                                ///return Html::a(Yii::t('app', 'WaitConfirm ID'), ['view'], ['class' => 'label label-warning']);
+                            } else {
+                                return Html::a('Не сплачено', ['/bills'], ['class' => 'label label-danger']);
+                            }
+                        },
+                        'format' => 'raw',
+                    ],                    
+                    [
+                        'header' => Yii::t('app', 'Status ID'),
+                        'value' => function($model){
+                            if ($model['status']==0)
+                            {
+                                return Html::a(Yii::t('app', 'WaitConfirm ID'), ['#'], ['class' => 'label label-warning']);
+                            }
+                            if ($model['status']==1)
+                            {
+                                return Html::a(Yii::t('app', 'Success ID'), ['#'], ['class' => 'label label-success']);
+                            }
+                            if ($model['status']==2)
+                            {
+                                return Html::a(Yii::t('app', 'Rejected ID'), ['#'], ['class' => 'label label-danger']);
+                            }
+                        },
+                        'format' => 'raw',
+                    ],
+                    [
+                        'header' => Yii::t('app', 'Назва аукціону'),
+                        'attribute' =>  'lot.name',                        
+                    ],
+                    ['class' => 'yii\grid\ActionColumn',                        
+                        'template' => '<div class="action-button">{auctions}</div>',
+                        'buttons' => [
+                            'auctions' => function ($url, $model, $key) {
+
+                                if (!$model->auction) {
+                                    return null;
+                                }
+
+                                if ($model->auction->status != 2) {
+                                    // return null;
+                                }
+                            
+                                return Html::a(
+                                    '<span class="glyphicon glyphicon-log-in"></span>',
+                                    ['/auctions/view', 'id' => $model->auction->id],
+                                    [
+                                        'title' => 'Перейти до торгів'
+                                    ]
+                                );
+                            },
+                        ],
+                    ],
+                ],
+            ]); ?>            
         </div>
     </div>
 </div>

+ 0 - 28
views/blog-posts/_form.php

@@ -31,40 +31,12 @@ use kartik\file\FileInput;
 
     ]) ?>
 
-    <?= $form->field($model, 'cat_id')->widget(Select2::className(),[
-        'data' => ArrayHelper::map(Categoriesblog::find()->all(), 'id', 'title')
-    ]) ?>
-
-    <?= $form->field($model, 'picture')->widget(FileInput::classname(), [
-        'options' => ['accept' => 'image/*'],
-    ]);?>
-
     <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>
 
     <?= $form->field($model, 'key_words')->textInput(['maxlength' => true]) ?>
 
     <?= $form->field($model, 'slug')->textInput() ?>
 
-    <div class="row">
-        <h1>Для русского перевода</h1>
-    </div>
-    <?= $form->field($model, 'title_ru')->textInput(['maxlength' => true]) ?>
-    <?= $form->field($model, 'h1_ru')->textInput(['maxlength' => true]) ?>
-
-    <?= $form->field($model,'short_text_ru')->widget(CKEditor::className(),[
-        'editorOptions' => ElFinder::ckeditorOptions(['elfinder','path' => 'uploads'])
-    ])?>
-
-    <?= $form->field($model, 'text_ru')->widget(CKEditor::className(), [
-        'editorOptions' => ElFinder::ckeditorOptions(['elfinder','path' => 'uploads'])
-
-    ]) ?>
-
-    <?= $form->field($model, 'description_ru')->textInput(['maxlength' => true]) ?>
-
-    <?= $form->field($model, 'key_words_ru')->textInput(['maxlength' => true]) ?>
-
-
     <div class="form-group">
         <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
     </div>

+ 24 - 23
views/blog-posts/index.php

@@ -11,7 +11,7 @@ use kartik\select2\Select2;
 /* @var $searchModel app\models\BlogPostsSearch */
 /* @var $dataProvider yii\data\ActiveDataProvider */
 
-$this->title = Yii::t('app', 'BlogPosts');
+$this->title = Yii::t('app', 'Сторінки сайту');
 $this->params['breadcrumbs'][] = $this->title;
 ?>
 <div class="posts-index">
@@ -19,7 +19,7 @@ $this->params['breadcrumbs'][] = $this->title;
     <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
 
     <p>
-        <?= Html::a(Yii::t('app', 'Create BlogPosts'), ['create'], ['class' => 'btn btn-success']) ?>
+        <?= Html::a(Yii::t('app', 'Створити сторінку'), ['create'], ['class' => 'btn btn-success']) ?>
     </p>
 <?php Pjax::begin(); ?>
     <?= GridView::widget([
@@ -32,29 +32,30 @@ $this->params['breadcrumbs'][] = $this->title;
             //'id',
             'title',
             //'text:ntext',
-            [
-                'attribute' => 'Picture',
-                'format' => 'raw',
-                'value' => function($model){
-                    return Html::img($model->getPicture(),['class' => 'img-responsive', 'style' => 'max-width : 150px ']);
-                }
-            ],
-
-            [
-                'attribute' => 'cat_id',
-                'value' => 'category.title',
-                'filter' => Select2::widget([
-                    'model' => $searchModel,
-                    'attribute' => 'cat_id',
-                    'data' => ArrayHelper::map(Categoriesblog::find()->all(), 'id', 'title'),
-                    'options' => [
-                        'placeholder' => Yii::t('app','Choose category'),
-                        'allowClear' => true,
-                    ],
-                ])
-            ] ,
+            // [
+            //     'attribute' => 'Picture',
+            //     'format' => 'raw',
+            //     'value' => function($model){
+            //         return Html::img($model->getPicture(),['class' => 'img-responsive', 'style' => 'max-width : 150px ']);
+            //     }
+            // ],
+
+            // [
+            //     'attribute' => 'cat_id',
+            //     'value' => 'category.title',
+            //     'filter' => Select2::widget([
+            //         'model' => $searchModel,
+            //         'attribute' => 'cat_id',
+            //         'data' => ArrayHelper::map(Categoriesblog::find()->all(), 'id', 'title'),
+            //         'options' => [
+            //             'placeholder' => Yii::t('app','Choose category'),
+            //             'allowClear' => true,
+            //         ],
+            //     ])
+            // ] ,
             'description',
             'key_words',
+            'slug',
 
             ['class' => 'yii\grid\ActionColumn'],
         ],

+ 6 - 25
views/categoriesblog/blog.php

@@ -9,31 +9,12 @@ use app\widgets\pagesOut;
 ?>
     <section class="news">
         <div class="container">
-            <h2 class="news-title">Новини</h2>
-
-            <!--Виджет вывода записей-->
-            <?= ListView::widget([
-                'dataProvider'=>$dataProvider ,
-                'itemView' => 'items/posts_item',
-                'layout' => "{items}\n",
-                'viewParams' => [
-                    'lang' => $lang
-                ]
-            ]) ?>
+            <?php            
+                echo $this->render('items/posts_item',[
+                    'model'=>$model,
+                    'lang' => $lang,
+                ]);            
+            ?>
         </div>
-        <?= \yii\widgets\LinkPager::widget([
-            'pagination'=>$dataProvider->pagination,
-            'prevPageLabel' => '&larr;',
-            'nextPageLabel' => '&rarr;',
-            'options' => [
-                'class' => 'pagination justify-content-center',
-            ],
-
-            // Customzing CSS class for pager link
-            'linkOptions' => ['class' => 'page-link'],
-            'activePageCssClass' => 'page-item active',
-            'disabledPageCssClass' => 'page-item',
 
-            'lastPageCssClass' => 'mylast',
-        ]); ?>
     </section>

+ 8 - 11
views/categoriesblog/items/posts_item.php

@@ -3,24 +3,21 @@ use yii\helpers\Html;
 ?>
 <div class="news-item mb-4">
   <div class="row align-items-center">
-      <div class="col-md-3">
+      <!-- <div class="col-md-3">
           <?php if($model->picture){
               echo Html::img(['/uploads/posts/' . $model->picture], ['class' => 'img-fluid my-2']);
           }else{
               echo Html::img(['/images/img-article.jpg'], ['class' => 'img-fluid my-2']);
           }?>
-      </div>
-      <div class="col-md-9">
+      </div> -->
+      <div class="col-md-12">
           <div class="row">
               <div class="col-12">
-                <h3 class="news-item-title"><?= Html::a($model->h1_ru && $lang == 'ru'? $model->h1_ru : $model->h1,
-                        ['/site/view', 'name' => $model->slug, 'lang' => $lang], ['class' => 'link-primary'])?></h3>
-                <time class="news-date"><?= date('d/m/Y', $model->created_at)?></time>
-
-                <p><?=$model->short_text_ru && $lang == 'ru'? $model->short_text_ru : $model->short_text?></p>
-
-                <?= Html::a(Yii::t('app','Detail'),
-                    ['/site/view', 'name' => $model->slug,'lang' => $lang ], ['class' =>'btn btn-outline-primary'])?>
+                <h3 class="news-item-title"><?= $model->h1?></h3>
+                <!-- <time class="news-date"><?= date('d/m/Y', $model->created_at)?></time> -->
+                <p><?=$model->short_text?></p>
+                <hr>
+                <p><?=$model->text?></p>
               </div>
           </div>
       </div>

+ 182 - 129
views/layouts/backend/left.php

@@ -22,10 +22,10 @@ if (Yii::$app->user->can('admin')) {
                     "icon" => "folder-open",
                 ],
                 [
-                    "label" => Yii::t('app', 'News'),
-                    "url" => ['/blog-posts'],
-                    "icon" => "folder-open",
-                ],
+                    "label" => Yii::t('app', 'Користувачі'),
+                    "url" => ["/user/admin"],
+                    "icon" => "user"
+                ],                
                 [
                     "label" => Yii::t('app', 'Bidding ID'),
                     "url" => ['/bidding'],
@@ -35,8 +35,24 @@ if (Yii::$app->user->can('admin')) {
                 ],
                 [
                     "label" => Yii::t('app', 'Аукціони'),
-                    "url" => '#',
+                    "url" => ["/lots"],
                     "icon" => "money",
+<<<<<<< HEAD
+                    // "items" => [
+                    //     [
+                    //         "label" => Yii::t('app', 'AukName ID'),
+                    //         "url" => ["/auctions"],
+                    //     ],
+                    //     // [
+                    //     //     "label" => Yii::t('app', 'Template ID'),
+                    //     //     "url" => ["/auclots"],
+                    //     // ],
+                    //     [
+                    //         "label" => Yii::t('app', 'Lots ID'),
+                    //         "url" => ["/lots"],
+                    //     ],
+                    // ],
+=======
                     "items" => [
                         [
                             "label" => Yii::t('app', 'AukName ID'),
@@ -61,13 +77,34 @@ if (Yii::$app->user->can('admin')) {
                     "label" => Yii::t('app', 'Файли'),
                     "url" => ['/files'],
                     "icon" => "database",
+>>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                 ],
+                // [
+                //     "label" => Yii::t('app', 'Subscriptions'),
+                //     "url" => ['/subscriptions'],
+                //     "icon" => "plane",
+                // ],
+                // [
+                //     "label" => Yii::t('app', 'Файли'),
+                //     "url" => ['/files'],
+                //     "icon" => "database",
+                // ],
                 [
                     "label" => Yii::t('app', 'Bills'),
                     "url" => ['/bills'],
                     "icon" => "credit-card",
                 ],
                 [
+                    "label" => Yii::t('app', 'Сторінки сайту'),
+                    "url" => ['/blog-posts'],
+                    "icon" => "folder-open",
+                ],
+                [
+                    "label" => Yii::t('app', 'Меню Учасникам'),
+                    "url" => ["/documents-to-the-user"],
+                    "icon" => "align-justify"
+                ],                
+                [
                     "label" => Yii::t('app', 'Settings ID'),
                     "url" => '#',
                     "icon" => "cog",
@@ -76,10 +113,10 @@ if (Yii::$app->user->can('admin')) {
                             "label" => Yii::t('app', 'Profile'),
                             "url" => ["/settings/profile"],
                         ],
-                        [
-                            "label" => Yii::t('app', 'Manage users'),
-                            "url" => ["/user/admin"],
-                        ],
+                        // [
+                        //     "label" => Yii::t('app', 'Manage users'),
+                        //     "url" => ["/user/admin"],
+                        // ],
                         [
                             "label" => Yii::t('app', 'Одиниці виміру'),
                             "url" => ["/units"],
@@ -88,48 +125,48 @@ if (Yii::$app->user->can('admin')) {
                             "label" => Yii::t('app', 'Categories ID'),
                             "url" => ["/category"],
                         ],
-                        [
-                            "label" => Yii::t('app', 'Requisites'),
-                            "url" => ["/requisites"],
-                        ],
-                        [
-                            "label" => Yii::t('app', 'Bills'),
-                            "url" => ["/settings/bills-template"],
-                        ],
-                        [
-                            "label" => Yii::t('app', 'DocumentsToTheUser ID'),
-                            "url" => ["/documents-to-the-user"],
-                        ],
-                    ],
-                ],
-                [
-                    "label" => Yii::t('app', 'EventLog ID'),
-                    "url" => ["/eventlog"],
-                    "icon" => "list",
-                ],
-                [
-                    "label" => Yii::t('app', 'Довідка'),
-                    "url" => ['#'],
-                    "icon" => "comment",
-                    "items" => [
-                        [
-                            "label" => Yii::t('app', 'Керівництва'),
-                            "url" => ["#"],
-                        ],
-                        [
-                            "label" => Yii::t('app', 'Правила проведення торгів'),
-                            "url" => ["#"],
-                        ],
-                        [
-                            "label" => Yii::t('app', 'Зразки заяв'),
-                            "url" => ["#"],
-                        ],
-                        [
-                            "label" => Yii::t('app', 'Регламент'),
-                            "url" => ["#"],
-                        ],
+                        // [
+                        //     "label" => Yii::t('app', 'Requisites'),
+                        //     "url" => ["/requisites"],
+                        // ],
+                        // [
+                        //     "label" => Yii::t('app', 'Bills'),
+                        //     "url" => ["/settings/bills-template"],
+                        // ],
+                        // [
+                        //     "label" => Yii::t('app', 'DocumentsToTheUser ID'),
+                        //     "url" => ["/documents-to-the-user"],
+                        // ],
                     ],
                 ],
+                // [
+                //     "label" => Yii::t('app', 'EventLog ID'),
+                //     "url" => ["/eventlog"],
+                //     "icon" => "list",
+                // ],
+                // [
+                //     "label" => Yii::t('app', 'Довідка'),
+                //     "url" => ['#'],
+                //     "icon" => "comment",
+                //     "items" => [
+                //         [
+                //             "label" => Yii::t('app', 'Керівництва'),
+                //             "url" => ["#"],
+                //         ],
+                //         [
+                //             "label" => Yii::t('app', 'Правила проведення торгів'),
+                //             "url" => ["#"],
+                //         ],
+                //         [
+                //             "label" => Yii::t('app', 'Зразки заяв'),
+                //             "url" => ["#"],
+                //         ],
+                //         [
+                //             "label" => Yii::t('app', 'Регламент'),
+                //             "url" => ["#"],
+                //         ],
+                //     ],
+                // ],
             ],
         ]
     );
@@ -141,11 +178,11 @@ if (Yii::$app->user->can('member')) {
     <?= Menu::widget(
         [
             "items" => [
-                [
-                    "label" => Yii::t('app', 'Статистика'),
-                    "url" => '/statistics/user',
-                    "icon" => "bar-chart",
-                ],
+                // [
+                //     "label" => Yii::t('app', 'Статистика'),
+                //     "url" => '/statistics/user',
+                //     "icon" => "bar-chart",
+                // ],
                 [
                     "label" => Yii::t('app', 'Publishing ID'),
                     "url" => ['/publishing'],
@@ -169,11 +206,11 @@ if (Yii::$app->user->can('member')) {
                     "icon" => "credit-card",
 
                 ],
-                [
-                    "label" => Yii::t('app', 'Subscriptions'),
-                    "url" => ['/subscriptions'],
-                    "icon" => "plane",
-                ],
+                // [
+                //     "label" => Yii::t('app', 'Subscriptions'),
+                //     "url" => ['/subscriptions'],
+                //     "icon" => "plane",
+                // ],
                 [
                     "label" => Yii::t('app', 'Settings ID'),
                     "url" => '#',
@@ -189,29 +226,29 @@ if (Yii::$app->user->can('member')) {
                         ],
                     ],
                 ],
-                [
-                    "label" => Yii::t('app', 'Довідка'),
-                    "url" => ['#'],
-                    "icon" => "comment",
-                    "items" => [
-                        [
-                            "label" => Yii::t('app', 'Керівництва'),
-                            "url" => ["#"],
-                        ],
-                        [
-                            "label" => Yii::t('app', 'Правила проведення торгів'),
-                            "url" => ["#"],
-                        ],
-                        [
-                            "label" => Yii::t('app', 'Зразки заяв'),
-                            "url" => ["#"],
-                        ],
-                        [
-                            "label" => Yii::t('app', 'Регламент'),
-                            "url" => ["#"],
-                        ],
-                    ],
-                ],
+                // [
+                //     "label" => Yii::t('app', 'Довідка'),
+                //     "url" => ['#'],
+                //     "icon" => "comment",
+                //     "items" => [
+                //         [
+                //             "label" => Yii::t('app', 'Керівництва'),
+                //             "url" => ["#"],
+                //         ],
+                //         [
+                //             "label" => Yii::t('app', 'Правила проведення торгів'),
+                //             "url" => ["#"],
+                //         ],
+                //         [
+                //             "label" => Yii::t('app', 'Зразки заяв'),
+                //             "url" => ["#"],
+                //         ],
+                //         [
+                //             "label" => Yii::t('app', 'Регламент'),
+                //             "url" => ["#"],
+                //         ],
+                //     ],
+                // ],
             ]
         ]
     );
@@ -223,32 +260,48 @@ if (Yii::$app->user->can('org')) {
     <?= Menu::widget(
         [
             "items" => [
-                [
-                    "label" => Yii::t('app', 'Статистика'),
-                    "url" => '/statistics/user',
-                    "icon" => "bar-chart",
-                ],
+                // [
+                //     "label" => Yii::t('app', 'Статистика'),
+                //     "url" => '/statistics/user',
+                //     "icon" => "bar-chart",
+                // ],
                 [
                     "label" => Yii::t('app', 'Publishing ID'),
                     "url" => ['/publishing'],
                     "icon" => "folder-open",
                 ],
-                [
-                    "label" => Yii::t('app', 'Bidding ID'),
-                    "url" => ['/bidding/view'],
-                    "icon" => "envelope",
-                    "badge" => $bids_count,
-                    "badgeOptions" => ["class" => $bids_count ? "label-danger" : 'hidden'],
-                ],
-                [
-                    "label" => Yii::t('app', 'Прийняти участь'),
-                    "url" => ['/auctions'],
-                    "icon" => "money",
-                ],
+                // [
+                //     "label" => Yii::t('app', 'Bidding ID'),
+                //     "url" => ['/bidding/view'],
+                //     "icon" => "envelope",
+                //     "badge" => $bids_count,
+                //     "badgeOptions" => ["class" => $bids_count ? "label-danger" : 'hidden'],
+                // ],
+                // [
+                //     "label" => Yii::t('app', 'Прийняти участь'),
+                //     "url" => ['/auctions'],
+                //     "icon" => "money",
+                // ],
                 [
                     "label" => Yii::t('app', 'Аукціони'),
-                    "url" => '#',
+                    "url" => ["/lots"],
                     "icon" => "money",
+<<<<<<< HEAD
+                    // "items" => [
+                    //     [
+                    //         "label" => Yii::t('app', 'AukName ID'),
+                    //         "url" => ["/auctions"],
+                    //     ],
+                    //     // [
+                    //     //     "label" => Yii::t('app', 'Template ID'),
+                    //     //     "url" => ["/auclots"],
+                    //     // ],
+                    //     [
+                    //         "label" => Yii::t('app', 'Lots ID'),
+                    //         "url" => ["/lots"],
+                    //     ],
+                    // ],
+=======
                     "items" => [
                         [
                             "label" => Yii::t('app', 'AukName ID'),
@@ -263,18 +316,18 @@ if (Yii::$app->user->can('org')) {
                             "url" => ["/lots"],
                         ],
                     ],
+>>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                 ],
                 [
                     "label" => Yii::t('app', 'Bills'),
                     "url" => ['/bills'],
                     "icon" => "credit-card",
-
-                ],
-                [
-                    "label" => Yii::t('app', 'Subscriptions'),
-                    "url" => ['/subscriptions'],
-                    "icon" => "plane",
                 ],
+                // [
+                //     "label" => Yii::t('app', 'Subscriptions'),
+                //     "url" => ['/subscriptions'],
+                //     "icon" => "plane",
+                // ],
                 [
                     "label" => Yii::t('app', 'Settings ID'),
                     "url" => '#',
@@ -290,29 +343,29 @@ if (Yii::$app->user->can('org')) {
                         ],
                     ],
                 ],
-                [
-                    "label" => Yii::t('app', 'Довідка'),
-                    "url" => ['#'],
-                    "icon" => "comment",
-                    "items" => [
-                        [
-                            "label" => Yii::t('app', 'Керівництва'),
-                            "url" => ["#"],
-                        ],
-                        [
-                            "label" => Yii::t('app', 'Правила проведення торгів'),
-                            "url" => ["#"],
-                        ],
-                        [
-                            "label" => Yii::t('app', 'Зразки заяв'),
-                            "url" => ["#"],
-                        ],
-                        [
-                            "label" => Yii::t('app', 'Регламент'),
-                            "url" => ["#"],
-                        ],
-                    ],
-                ],
+                // [
+                //     "label" => Yii::t('app', 'Довідка'),
+                //     "url" => ['#'],
+                //     "icon" => "comment",
+                //     "items" => [
+                //         [
+                //             "label" => Yii::t('app', 'Керівництва'),
+                //             "url" => ["#"],
+                //         ],
+                //         [
+                //             "label" => Yii::t('app', 'Правила проведення торгів'),
+                //             "url" => ["#"],
+                //         ],
+                //         [
+                //             "label" => Yii::t('app', 'Зразки заяв'),
+                //             "url" => ["#"],
+                //         ],
+                //         [
+                //             "label" => Yii::t('app', 'Регламент'),
+                //             "url" => ["#"],
+                //         ],
+                //     ],
+                // ],
             ]
         ]
     );

+ 1 - 1
views/layouts/backend/user.php

@@ -76,7 +76,7 @@ BackendAsset::register($this);
                     <ul class="nav navbar-nav navbar-right">
                         <li class="">
                             <a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
-                                <img src="//placehold.it/128x128" alt=""><?= \Yii::$app->user->identity->username; ?>
+                                <img src="https://placehold.net/avatar.svg" alt=""><?= \Yii::$app->user->identity->username; ?>
                                 <span class=" fa fa-angle-down"></span>
                             </a>
                             <?= $this->render('@app/views/layouts/backend/top'); ?>

File diff suppressed because it is too large
+ 19 - 29
views/layouts/public.php


+ 110 - 41
views/lots/index.php

@@ -5,13 +5,14 @@ use yii\grid\GridView;
 use yii\helpers\Url;
 use yii\widgets\ActiveForm;
 use yii\helpers\ArrayHelper;
+use app\models\Auctions;
 
 /* @var $this yii\web\View */
 /* @var $searchModel app\models\LotSearch */
 /* @var $dataProvider yii\data\ActiveDataProvider */
 
-$this->title = Yii::t('app', 'YouLots ID');
-$this->params['breadcrumbs'][] = $this->title;
+$this->title = Yii::t('app', 'Аукціони');
+$this->params['breadcrumbs'][] = 'Аукціони';//$this->title;
 ?>
 <div class="lots-index">
 
@@ -19,14 +20,21 @@ $this->params['breadcrumbs'][] = $this->title;
     <div class="panel-heading"><span class="glyphicon glyphicon-th"></span><strong> <?= Html::encode($this->title) ?></strong></div>
     <div class="panel-body">
 
+<<<<<<< HEAD
+            <!-- <ul class="nav nav-tabs">
+                <li role="presentation">
+                    <?= Html::a(\Yii::t('app', 'Template ID'), ['auclots/index'], ['class' => 'presentation active']) ?>
+                </li>
+=======
             <ul class="nav nav-tabs">
                 <!-- <li role="presentation">
                     <?= Html::a(\Yii::t('app', 'Template ID'), ['auclots/index'], ['class' => 'presentation active']) ?>
                 </li> -->
+>>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                 <li role="presentation"  class="active">
                     <?= Html::a(\Yii::t('app', 'Lots ID'), ['/lots/index'], ['class' => 'presentation active']) ?>
                 </li>
-            </ul>
+            </ul> -->
 
             <?php // echo $this->render('_search', ['model' => $searchModel]);
             /*
@@ -42,20 +50,32 @@ $this->params['breadcrumbs'][] = $this->title;
             ?>
         <br>
             <p>
-                <?= Html::a(Yii::t('app', 'CreateLot ID'), ['create'], ['class' => 'btn btn-success']) ?>
+                <?= Html::a(Yii::t('app', 'CreateAuction ID'), ['create'], ['class' => 'btn btn-success']) ?>
             </p>
 
             <?= $this->render('_alert.php') ?>
 
+            <style>
+                .action-button{
+                    display:flex;
+                }
+                .action-button .glyphicon{
+                    font-size: 15px !important;
+                    padding: 4px !important;
+                    border: 1px solid;
+                    margin: 1px;
+                    border-radius: 3px;
+                }
+            </style>
 
             <?php
             if(Yii::$app->user->can('admin') || (Yii::$app->user->can('org')))
             {
-                $actions = '{clone} {view} {update} {delete}';
+                $actions = '<div class="action-button">{auctions} {clone} {view} {update} {delete}</div>';
             }
             else
             {
-                $actions = '{view} {update} {delete}';
+                $actions = '<div class="action-button">{auctions} {view} {update} {delete}</div>';
             }
 
             ?>
@@ -63,44 +83,45 @@ $this->params['breadcrumbs'][] = $this->title;
                 'dataProvider' => $dataProvider,
                 'filterModel' => $searchModel,
                 'columns' => [
-                    [
-                        'class' => 'yii\grid\SerialColumn',
-                        'contentOptions' => ['width' => '70px'],
-                    ],
+                    // [
+                    //     'class' => 'yii\grid\SerialColumn',
+                    //     'contentOptions' => ['width' => '70px'],
+                    // ],
 
                     //'id',
                     //'user_id',
                     'aukname',
                     //'num',
-                    'name',
-                    //'description',
-                    'start_price',
-                    //'step',
-                    // 'docs_id',
-                    // 'address',
-                    //'delivery_time:datetime',
-                    // 'delivery_term',
-                    // 'requires',
-                    //'payment_term',
-                    // 'payment_order',
-                    // 'category_id',
-                    // 'member_require',
-                    // 'member_docs',
-                    // 'requisites_id',
-                    // 'notes',
-                    // 'dogovor_id',
-                    //'date',
-                    //'auction_date',
-                    'date:datetime',
-                    /*[
-                        'attribute'=>'date',
-                        'format'=>'datetime', // ��������� ������������ - date:datetime:time
-                        'headerOptions' => ['width' => '120'],
-                    ],*/
+                    [
+                        'header'=>'Номер аукціону',
+                        'attribute'=>'auction.id',
+                        'value'=>'auction.id'
+                    ],                    
+                    [
+                        'header'=>'Номер лоту',
+                        'attribute'=>'id',
+                        'value'=>'id'
+                    ],
                     [
                         'attribute'=>'status',
                         //'header' => Yii::t('app', 'Status ID'),
-                        'value' => function($model){
+                        'value' => function($model){ 
+                            $auction = $model->auction ? $model->auction->status : false;                            
+                            if($auction){
+                                $status_name = Auctions::statusNames()[$model->auction->status]; 
+                                if($model->auction->status == 1){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-warning']); 
+                                }
+                                if($model->auction->status == 2){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-danger']); 
+                                }
+                                if($model->auction->status == 3){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-default']);
+                                }
+                                if($model->auction->status == 4){
+                                    return Html::a($status_name, ['#'], ['class' => 'label label-primary']);
+                                }                                
+                            }
                             if ($model->status==1)
                             {
                                 //return Yii::t('app', 'Waiting ID');
@@ -109,7 +130,7 @@ $this->params['breadcrumbs'][] = $this->title;
                             if ($model->status==2)
                             {
                                 //return Yii::t('app', 'Success ID');
-                                return Html::a(Yii::t('app', 'Success ID'), ['#'], ['class' => 'label label-success']);
+                                return Html::a(Yii::t('app', 'Success ID'). ($model->auction ? ' | ' . (string)Auctions::statusNames()[$model->auction->status] : ''), ['#'], ['class' => 'label label-success']);
                             }
                             if ($model->status==3)
                             {
@@ -124,15 +145,63 @@ $this->params['breadcrumbs'][] = $this->title;
                         },
                         'format' => 'raw',
                     ],
+                    'date:datetime',
+
+                    //'description',
+                    'start_price',
+                    [
+                        'header' => 'Гарантійний внесок',
+                        'value' => function($model){
+                            return $model->start_price * 0.015;
+                        },
+                    ],                    
+                    'step',
+                    // 'docs_id',
+                    // 'address',
+                    //'delivery_time:datetime',
+                    // 'delivery_term',
+                    // 'requires',
+                    //'payment_term',
+                    // 'payment_order',
+                    // 'category_id',
+                    // 'member_require',
+                    // 'member_docs',
+                    // 'requisites_id',
+                    // 'notes',
+                    // 'dogovor_id',
+                    //'date',
+                    //'auction_date',
+                                        
+                    /*[
+                        'attribute'=>'date',
+                        'format'=>'datetime', // ��������� ������������ - date:datetime:time
+                        'headerOptions' => ['width' => '120'],
+                    ],*/
+
 
                     ['class' => 'yii\grid\ActionColumn',
                         'template' => $actions,
                         'buttons' => [
-                            /*'auction' => function ($url,$model,$key) {
-                                return Html::a('', $url,['class' => 'glyphicon glyphicon-plus']);
-                            },*/
+                            'auctions' => function ($url, $model, $key) {
+
+                                if (!$model->auction) {
+                                    return null;
+                                }
+
+                                if ($model->auction->status != 2) {
+                                    return null;
+                                }
+                            
+                                return Html::a(
+                                    '<span class="glyphicon glyphicon-log-in" style="color: #d9534f;"></span>',
+                                    ['/auctions/view', 'id' => $model->auction->id],
+                                    [
+                                        'title' => 'Перейти'
+                                    ]
+                                );
+                            },
                             'clone' => function ($url,$model,$key) {
-                                return Html::a('', $url,['class' => 'glyphicon glyphicon-duplicate','title' => 'Клонувати']);
+                                return Html::a('<span class="glyphicon glyphicon-duplicate"></span>', $url,['title' => 'Клонувати']);
                             },
                             'delete' => function($url, $model){
                                 return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete', 'id' => $model->id], [

+ 63 - 17
views/lots/view.php

@@ -93,7 +93,11 @@ $timeStepFormat = sprintf(
 <div class="panel panel-primary">
     <div class="panel-heading">
         <span class="glyphicon glyphicon-stats"></span>
+<<<<<<< HEAD
+        <strong><?= Html::encode("(#" . $model->id . ") - " . $this->title) ?></strong>
+=======
         <strong><?= Html::encode($this->title) ?></strong>
+>>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
         
         <?php if(Yii::$app->user->id == $model->user_id || Yii::$app->user->can('admin')): ?>
             <?= Html::a(Yii::t('app', 'Update ID'), ['update', 'id' => $model->id], [
@@ -132,6 +136,14 @@ $timeStepFormat = sprintf(
                             'attributes' =>
                                 [
                                     [
+<<<<<<< HEAD
+                                        'label' => 'Організатор аукціону',
+                                        'value' => isset($model->auction) ? $model->auction->user->at_org : $model->user->at_org,
+                                        'format' => 'raw',
+                                    ],                                    
+                                    [
+=======
+>>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                                         'label' => 'Тип аукціону',
                                         'value' => function ($model){
                                             if($model->type == 1){
@@ -172,12 +184,21 @@ $timeStepFormat = sprintf(
                                         'label' => 'Крок',
                                         'value' => $serialize_data->step_change,
                                         'format' => 'raw',
+<<<<<<< HEAD
+                                    ],
+                                    [
+                                        'label' => 'Час',
+                                        'value' => $timeStepFormat,
+                                        'format' => 'raw',
+                                    ],
+=======
                                     ],
                                     [
                                         'label' => 'Час',
                                         'value' => $timeStepFormat,
                                         'format' => 'raw',
                                     ],
+>>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                                 ],
                         ]); ?>
                         <?php endif; ?>
@@ -294,36 +315,61 @@ $timeStepFormat = sprintf(
                             ],
                             [
                                 'attribute' => Yii::t('app', 'Registration fee'),
-                                'value' =>  $registration_fee .
-                                    Html::a('<i class="glyphicon glyphicon-circle-arrow-down"></i>',
+                                'value' =>  
+                                    Html::a('<i class="glyphicon glyphicon-circle-arrow-down"></i> Завантажити рахунок ',
                                         [
                                             '/bills/download-requisites',
-                                            'id' => $model->billPayRegistration,
+                                            'id' => $model->getBillPayDocument(),
                                         ],
                                         [
                                             'target' => '_blank',
                                             'title' => Yii::t('app', 'Download bill')
                                         ]
-                                    ),
+                                    ) . $registration_fee,
                                 'format' =>  'raw',
                             ],
                             [
                                 'attribute' => Yii::t('app', 'Guaranteed payment'),
-                                'value' =>  $guarantee_fee .
-                                    Html::a('<i class="glyphicon glyphicon-circle-arrow-down"></i>',
-                                        [
-                                            '/bills/download-requisites',
-                                            'id' => $model->billPayGuarantee,
-                                        ],
-                                        [
-                                            'target' => '_blank',
-                                            'title' => Yii::t('app', 'Download bill')
-                                        ]
-                                    ),
+                                'value' => function($model) use ($guarantee_fee){
+                                    $id = $model->getBillPayDocument("guarantee");
+                                    if(!$id){
+                                        return Html::a(
+                                            '<i class="glyphicon glyphicon-circle-arrow-down"></i> Завантажити рахунок ', '#', [
+                                            'title' => 'Завантажити рахунок',
+                                            'onclick' => "alert('Для завантаження рахунку, треба подати заявку на лот/аукціон'); return false;",
+                                        ]) . $guarantee_fee . 'грн ' . Yii::t('app', 'zNDS ID');
+                                    } else {
+                                        return Html::a('<i class="glyphicon glyphicon-circle-arrow-down"></i> Завантажити рахунок ',
+                                            [
+                                                '/bills/download-requisites',
+                                                'id' => $id,
+                                            ],
+                                            [
+                                                'target' => '_blank',
+                                                'title' => 'Завантажити рахунок'
+                                            ]
+                                        ) . $guarantee_fee . 'грн ' . Yii::t('app', 'zNDS ID');
+                                    }
+                                },
                                 'format' =>  'raw',
-                            ],
+                            ],                                                        
+                            // [
+                            //     'attribute' => Yii::t('app', 'Guaranteed payment'),
+                            //     'value' =>  $guarantee_fee .
+                            //         Html::a('<i class="glyphicon glyphicon-circle-arrow-down"></i>',
+                            //             [
+                            //                 '/bills/download-requisites',
+                            //                 'id' => $model->getBillPayDocument("guarantee"),
+                            //             ],
+                            //             [
+                            //                 'target' => '_blank',
+                            //                 'title' => Yii::t('app', 'Download bill')
+                            //             ]
+                            //         ),
+                            //     'format' =>  'raw',
+                            // ],
                         ],
                 ]) ?>
             </div>
         </div>
-    </div>
+    </div>

+ 31 - 28
views/publishing/view.php

@@ -128,9 +128,9 @@ $this->params['breadcrumbs'][] = $this->title;
                                 ],
                             ]) ?>
 
-                            <h5><strong><?= Yii::t('app','PublishFiles ID') ?></strong></h5>
+                            <!-- <h5><strong><?= Yii::t('app','PublishFiles ID') ?></strong></h5> -->
 
-                            <?= $this->render('_alert.php') ?>
+                            <?php //echo $this->render('_alert.php') ?>
                             <?php
                             if(isset($model->lot->docs_id))
                             {
@@ -156,42 +156,45 @@ $this->params['breadcrumbs'][] = $this->title;
                             ]) ?>
                             <?php
 
-                            $protocol = $model->getProtocol();
-
-                            if(Yii::$app->user->can('admin'))
-                            {
-                                if(!$protocol&&$model->status==3)
-                                {
-                                    echo Html::a(Yii::t('app','CreateDoc ID'), ['/publishing/doc','id'=> $model->id], ['class' => 'glyphicon glyphicon-circle-arrow-up']);
-                                    $form = ActiveForm::begin([
-                                        'options'=>['enctype'=>'multipart/form-data'] // important
-                                    ]);
-                                    $files = new \app\models\Files();
-                                    echo $form->field($files, 'file')->widget(FileInput::classname(),[
-                                        'model' => $files,
-                                        'options' => ['multiple' => false],
-                                        'pluginOptions' => ['showPreview' => false,],
-                                    ])->label(Yii::t('app','DownloadProtocol ID'));
-                                    ActiveForm::end();
-                                }
-                            }
-                            if($protocol)
-                            {
-                                //echo Html::a($protocol['name'],'/files/download?id='.$protocol['id'],['class'=>'btn btn-link']);
-                                echo Html::a(Yii::t('app','DownloadProtocol ID'), ['/files/download','id'=> $protocol['id']], ['class' => 'glyphicon glyphicon-circle-arrow-down']);
+                            // $protocol = $model->getProtocol();
+                            if(Yii::$app->user->can('admin')){
+                                echo Html::a(Yii::t('app','CreateDoc ID'), ['/publishing/doc','id'=> $model->id], ['class' => 'glyphicon glyphicon-circle-arrow-up']);
                             }
+                            
+                            // if(Yii::$app->user->can('admin'))
+                            // {
+                            //     if(!$protocol&&$model->status==3)
+                            //     {
+                            //         echo Html::a(Yii::t('app','CreateDoc ID'), ['/publishing/doc','id'=> $model->id], ['class' => 'glyphicon glyphicon-circle-arrow-up']);
+                            //         $form = ActiveForm::begin([
+                            //             'options'=>['enctype'=>'multipart/form-data'] // important
+                            //         ]);
+                            //         $files = new \app\models\Files();
+                            //         echo $form->field($files, 'file')->widget(FileInput::classname(),[
+                            //             'model' => $files,
+                            //             'options' => ['multiple' => false],
+                            //             'pluginOptions' => ['showPreview' => false,],
+                            //         ])->label(Yii::t('app','DownloadProtocol ID'));
+                            //         ActiveForm::end();
+                            //     }
+                            // }
+                            // if($protocol)
+                            // {
+                            //     //echo Html::a($protocol['name'],'/files/download?id='.$protocol['id'],['class'=>'btn btn-link']);
+                            //     echo Html::a(Yii::t('app','DownloadProtocol ID'), ['/files/download','id'=> $protocol['id']], ['class' => 'glyphicon glyphicon-circle-arrow-down']);
+                            // }
 
                             ?>
                         </div>
                     </div>
                 </div>
-                <div class="row"><div class="col-md-12">
-                        <!-- <button id="" type="button" class="btn btn-primary" href="javascript:/" onclick="window.close();" role="button"><span class="glyphicon glyphicon-eye-close"></span> Закрити вікно</button> -->
+                <!-- <div class="row"><div class="col-md-12">
+                        <button id="" type="button" class="btn btn-primary" href="javascript:/" onclick="window.close();" role="button"><span class="glyphicon glyphicon-eye-close"></span> Закрити вікно</button>
 
                         <a id="btnPubLot" type="button" class="btn btn-primary" href="/lots/view?id=<?php echo $model->lot->id;?>" role="button"><?= Yii::t('app','GoToBid ID')?><span class="glyphicon glyphicon-chevron-right"></span></a>
                         <a id="btnPubLot" type="button" class="btn btn-success" href="/auctions/view?id=<?php echo $model->id;?>" role="button"><?= Yii::t('app','GoToAuction ID')?><span class="glyphicon glyphicon-chevron-right"></span></a>
                     </div>
-                </div>
+                </div> -->
             </div>
         </div>
     </div>

+ 10 - 2
views/site/_forms/_auctions.php

@@ -68,8 +68,16 @@ use yii\widgets\DetailView;
                             <p class="subtitle-secondary mb-2">Початкова ціна</p>
                             <p class="publications-starting-price-value"><?= $model->lot->start_price . ' грн.'?></p>
                         </div>
-                        <?= Html::a(Yii::t('app', 'Взяти участь'), ['/lots/view','id' => $model->lot->id],
-                            ['class' => 'btn btn-primary mt-3 btn-block'])?>
+                        <?php
+                                $diff = strtotime ($model->date_start) - time();
+                                if($diff < 0){
+                                    echo Html::a(Yii::t('app', 'Взяти участь'), ['#'], ['class' => 'btn btn-primary mt-3 btn-block disabled']);
+                                }else{
+                                    echo Html::a(Yii::t('app', 'Взяти участь'), ['/lots/view','id' => $model->lot->id],
+                                    ['class' => 'btn btn-primary mt-3 btn-block']);
+                                }
+
+                        ?>                        
                         <?= Html::a(Yii::t('app', 'Детальніше'), ['/publishing/view','id' => $model->id],
                             ['class' => 'btn link-secondary btn-block'])?>
                     </div>