Quellcode durchsuchen

Mes commandes : distinction des commandes passées et à venir via deux onglets.

Affichage des commandes à venir par défaut.
dev
Guillaume Bourgeois vor 5 Jahren
Ursprung
Commit
08764dbc37
4 geänderte Dateien mit 57 neuen und 4 gelöschten Zeilen
  1. +16
    -4
      producer/controllers/OrderController.php
  2. +15
    -0
      producer/views/order/history.php
  3. +12
    -0
      producer/web/css/screen.css
  4. +14
    -0
      producer/web/sass/order/_history.scss

+ 16
- 4
producer/controllers/OrderController.php Datei anzeigen

@@ -85,17 +85,26 @@ class OrderController extends ProducerBaseController
*
* @return ProducerView
*/
public function actionHistory()
public function actionHistory($type = 'incoming')
{
$dataProviderOrders = new ActiveDataProvider([
'query' => Order::find()
$query = Order::find()
->with('productOrder', 'pointSale', 'creditHistory')
->joinWith('distribution', 'distribution.producer')
->where([
'id_user' => Yii::$app->user->id,
'distribution.id_producer' => Producer::getId()
])
->orderBy('distribution.date DESC'),
->params([':date_today' => date('Y-m-d')]);
$queryIncoming = clone $query ;
$queryIncoming->andWhere('distribution.date >= :date_today')->orderBy('distribution.date ASC');
$queryPassed = clone $query ;
$queryPassed->andWhere('distribution.date < :date_today')->orderBy('distribution.date DESC');
$dataProviderOrders = new ActiveDataProvider([
'query' => ($type == 'incoming') ? $queryIncoming : $queryPassed,
'pagination' => [
'pageSize' => 10,
],
@@ -105,6 +114,9 @@ class OrderController extends ProducerBaseController
'dataProviderOrders' => $dataProviderOrders,
'orderOk' => Yii::$app->getRequest()->get('orderOk', false),
'cancelOk' => Yii::$app->getRequest()->get('cancelOk', false),
'type' => $type,
'countIncoming' => $queryIncoming->count(),
'countPassed' => $queryPassed->count(),
]);
}


+ 15
- 0
producer/views/order/history.php Datei anzeigen

@@ -56,6 +56,21 @@ $this->setTitle('Mes commandes') ;
<div class="alert alert-success"><div class="icon"></div>Votre commande a bien été annulée.</div>
<?php endif; ?>

<ul id="tabs-orders-history" class="nav nav-tabs" role="tablist">
<li class="<?php if($type == 'incoming'): ?>active<?php endif; ?>">
<a href="<?= Yii::$app->urlManagerProducer->createUrl(['order/history', 'type' => 'incoming']); ?>">
À venir
<span class="label <?php if($countIncoming): ?>label-success<?php else: ?>label-default<?php endif; ?>"><?= $countIncoming ?></span>
</a>
</li>
<li class="<?php if($type == 'passed'): ?>active<?php endif; ?>">
<a href="<?= Yii::$app->urlManagerProducer->createUrl(['order/history', 'type' => 'passed']); ?>">
Passées
<span class="label label-default"><?= $countPassed ?></span>
</a>
</li>
</ul>
<?=

GridView::widget([

+ 12
- 0
producer/web/css/screen.css Datei anzeigen

@@ -1178,6 +1178,18 @@ termes.
.order-history #list-producers {
display: none;
}
/* line 44, ../sass/order/_history.scss */
.order-history #tabs-orders-history {
margin-bottom: 20px;
}
/* line 48, ../sass/order/_history.scss */
.order-history #tabs-orders-history li a {
color: #BB8757;
}
/* line 52, ../sass/order/_history.scss */
.order-history #tabs-orders-history li.active a {
color: #333;
}

/* line 3, ../sass/order/_order.scss */
.order-order #app-order-order {

+ 14
- 0
producer/web/sass/order/_history.scss Datei anzeigen

@@ -41,4 +41,18 @@ termes.
display: none ;
}
#tabs-orders-history {
margin-bottom: 20px ;
li {
a {
color: $color1 ;
}

&.active a {
color: #333 ;
}
}
}
}

Laden…
Abbrechen
Speichern