|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?php
-
-
-
- use yii\bootstrap\ActiveForm;
- use common\models\Order ;
-
- $producer = $this->context->getProducer();
- $this->setTitle('Mes commandes') ;
- $this->addButton(['label' => '<span class="glyphicon glyphicon-plus"></span> Ajouter', 'url' => 'order/order', 'class' => 'btn btn-primary']) ;
-
- ?>
-
- <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; ?>
-
- <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([
- 'dataProvider' => $dataProviderOrders,
- 'summary' => '',
- 'beforeRow' => function($model) {
- $model->init() ;
- },
- 'columns' => [
- [
- 'attribute' => 'distribution.date',
- 'label' => 'Date de livraison',
- 'format' => 'raw',
- 'value' => function($model) {
- return $model->getBlockDate() ;
- }
- ],
- [
- 'label' => 'Point de vente',
- 'format' => 'raw',
- 'value' => function($model) {
- return $model->getPointSaleSummary();
- }
- ],
- [
- 'label' => 'Résumé',
- 'format' => 'raw',
- 'value' => function($model) {
- return $model->getCartSummary();
- }
- ],
- [
- '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 />' ;
- }
- else {
- if($c->getState() == Order::STATE_DELIVERED) {
- $html .= '<span class="label label-success">Livrée</span>' ;
- }
- elseif($c->getState() == Order::STATE_PREPARATION) {
- $html .= '<span class="label label-warning">En préparation</span>' ;
- }
- elseif($c->getState() == Order::STATE_OPEN) {
- $html .= '<span class="label label-default">À venir</span>' ;
- }
- }
-
- return $html ;
- }
- ],
- [
- 'label' => 'Actions',
- 'format' => 'raw',
- 'value' => function($c) use ($producer) {
- $html = '' ;
- if($c->getState() == Order::STATE_OPEN) {
- if ($producer->isOnlinePaymentActiveAndTypeOrder()) {
- $paymentStatus = $c->getPaymentStatus();
- if($paymentStatus == Order::PAYMENT_UNPAID && $c->online_payment_url) {
- $html .= '<a href="'.$c->online_payment_url.'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Payer en ligne</a>';
- }
- }
- else {
- $html .= '<a href="'.Yii::$app->urlManager->createUrl(['order/order','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></a> '.
- '<a href="'.Yii::$app->urlManager->createUrl(['order/cancel','id'=>$c->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-trash"></span></a> '.
- (($c->id_subscription) ? '<a href="'.Yii::$app->urlManagerProducer->createUrl(['subscription/form','id'=>$c->id_subscription]).'" class="btn btn-default"><span class="glyphicon glyphicon-repeat"></span></a>' : '') ;
- }
- }
- return $html ;
- }
- ]
- ]
- ]);
-
- ?>
|