|
- <?php
-
-
-
- use yii\bootstrap\ActiveForm;
- use common\models\Order ;
-
- $this->setTitle('Historique de mes commandes') ;
-
- ?>
-
- <div id="index-order">
-
- <?php if($orderOk): ?>
- <div class="alert alert-success">
- <div class="icon"></div>
- Votre commande a bien été prise en compte.
- </div>
- <?php endif; ?>
-
- <?php if($cancelOk): ?>
- <div class="alert alert-success"><div class="icon"></div>Votre commande a bien été annulée.</div>
- <?php endif; ?>
-
- <?=
-
- GridView::widget([
- 'dataProvider' => $dataProviderOrders,
- 'summary' => '',
- 'beforeRow' => function($model) {
- $model->init() ;
- },
- 'columns' => [
- [
- 'attribute' => 'distribution.date',
- 'label' => 'Date de livraison',
- 'value' => function($model) {
- return date('d/m/Y', strtotime($model->distribution->date)) ;
- }
- ],
- [
- 'label' => 'Résumé',
- 'format' => 'raw',
- 'value' => function($model) {
- return $model->getCartSummary();
- }
- ],
- [
- 'label' => 'Point de vente',
- 'format' => 'raw',
- 'value' => function($model) {
- return $model->getPointSaleSummary();
- }
- ],
- [
- 'label' => 'Montant',
- 'format' => 'raw',
- 'value' => function($model) {
- return $model->getAmountSummary();
- }
- ],
- [
- 'label' => 'Statut',
- 'format' => 'raw',
- 'value' => function($c) {
- $html = '' ;
-
- if($c->date_delete) {
- $html .= '<span class="label label-danger">Annulée</span><br />' ;
- if($c->getState() == Order::STATE_OPEN) {
- $html .= '<a href="'.Yii::$app->urlManager->createUrl(['order/update','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Modifier</a>' ;
- }
- }
- else {
- if($c->getState() == Order::STATE_DELIVERED) {
- $html .= 'Livrée' ;
- }
- elseif($c->getState() == Order::STATE_PREPARATION) {
- $html .= 'En préparation' ;
- }
- elseif($c->getState() == Order::STATE_OPEN) {
- $html .= '<div class="btn-group">
- <a href="'.Yii::$app->urlManager->createUrl(['order/update','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Modifier</a>
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
- <span class="caret"></span>
- <span class="sr-only">Toggle Dropdown</span>
- </button>
- <ul class="dropdown-menu" role="menu">
- <li><a href="'.Yii::$app->urlManager->createUrl(['order/cancel','id'=>$c->id]).'"><span class="glyphicon glyphicon-trash"></span> Annuler la commande</a></li>
- </ul>
- </div>' ;
- }
- }
-
- return $html ;
- }
- ],
- ]
- ]);
-
- ?>
|