Kaynağa Gözat

Afficher les commandes annulées dans l'historique client

refactoring
Guillaume Bourgeois 6 yıl önce
ebeveyn
işleme
b3c6609df2
2 değiştirilmiş dosya ile 29 ekleme ve 17 silme
  1. +0
    -1
      producer/controllers/CommandeController.php
  2. +29
    -16
      producer/views/commande/historique.php

+ 0
- 1
producer/controllers/CommandeController.php Dosyayı Görüntüle

@@ -233,7 +233,6 @@ class CommandeController extends ProducerBaseController
'id_user' => Yii::$app->user->id,
'production.id_etablissement' => $this->getProducer()->id
])
->andWhere('date_delete IS NULL')
->orderBy('production.date DESC'),
'pagination' => [
'pageSize' => 10,

+ 29
- 16
producer/views/commande/historique.php Dosyayı Görüntüle

@@ -96,24 +96,37 @@ GridView::widget([
'label' => 'Statut',
'format' => 'raw',
'value' => function($c) {
if($c->getEtat() == Commande::ETAT_LIVREE) {
return 'Livrée' ;
$html = '' ;
if($c->date_delete) {
$html .= '<span class="label label-danger">Annulée</span><br />' ;
if($c->getEtat() == Commande::ETAT_MODIFIABLE) {
$html .= '<a href="'.Yii::$app->urlManager->createUrl(['commande/update','id'=>$c->id, 'id_etablissement'=>$c->production->etablissement->id]).'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Modifier</a>' ;
}
}
elseif($c->getEtat() == Commande::ETAT_PREPARATION) {
return 'En préparation' ;
}
elseif($c->getEtat() == Commande::ETAT_MODIFIABLE) {
return '<div class="btn-group">
<a href="'.Yii::$app->urlManager->createUrl(['commande/update','id'=>$c->id, 'id_etablissement'=>$c->production->etablissement->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(['commande/annuler','id'=>$c->id]).'"><span class="glyphicon glyphicon-trash"></span> Annuler la commande</a></li>
</ul>
</div>' ;
else {
if($c->getEtat() == Commande::ETAT_LIVREE) {
$html .= '<span class="label label-success">Livrée</span>' ;
}
elseif($c->getEtat() == Commande::ETAT_PREPARATION) {
$html .= '<span class="label label-warning">En préparation</span>' ;
}
elseif($c->getEtat() == Commande::ETAT_MODIFIABLE) {
$html .= '<span class="label label-default">Ouverte</span><br />' ;
$html .= '<div class="btn-group">
<a href="'.Yii::$app->urlManager->createUrl(['commande/update','id'=>$c->id, 'id_etablissement'=>$c->production->etablissement->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(['commande/annuler','id'=>$c->id]).'"><span class="glyphicon glyphicon-trash"></span> Annuler la commande</a></li>
</ul>
</div>' ;
}
}
return $html ;
}
],
]

Yükleniyor…
İptal
Kaydet