|
|
@@ -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 ; |
|
|
|
} |
|
|
|
], |
|
|
|
] |