|
- <?php
-
- use yii\helpers\Html;
- use yii\grid\GridView;
-
- /* @var $this yii\web\View */
- /* @var $dataProvider yii\data\ActiveDataProvider */
-
- $this->title = 'Commandes automatiques';
- $this->params['breadcrumbs'][] = $this->title;
- ?>
- <div class="commande-auto-index">
-
- <h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?></h1>
-
- <?= GridView::widget([
- 'dataProvider' => $dataProvider,
- 'columns' => [
-
- [
- 'attribute' => 'id_user',
- 'format' => 'raw',
- 'value' => function($model) {
- return Html::encode($model->user->nom.' '.$model->user->prenom) ;
- }
- ],
- [
- 'attribute' => 'id_point_vente',
- 'format' => 'raw',
- 'value' => function($model) {
- return Html::encode($model->pointVente->nom) ;
- }
- ],
- [
- 'attribute' => 'produits',
- 'format' => 'raw',
- 'value' => function($model) {
- $html = '' ;
- foreach($model->commandeAutoProduit as $commande_produit)
- {
- $html .= $commande_produit->quantite . ' x '.Html::encode($commande_produit->produit->nom).'<br />' ;
- }
- return $html ;
- }
- ],
- [
- 'attribute' => 'date_debut',
- 'value' => function($model) {
- return date('d/m/Y',strtotime($model->date_debut)) ;
- }
- ],
- [
- 'attribute' => 'date_fin',
- 'value' => function($model) {
- if($model->date_fin)
- return date('d/m/Y',strtotime($model->date_fin)) ;
- else
- return 'indéterminée' ;
- }
- ],
- [
- 'attribute' => 'periodicite_semaine',
- 'value' => function($model) {
- if($model->periodicite_semaine == 1)
- return 'Toutes les semaines' ;
- else
- return 'Toutes les '.$model->periodicite_semaine.' semaines' ;
- }
- ],
- [
- 'class' => 'yii\grid\ActionColumn',
- 'template' => '{update} {delete}',
- 'headerOptions' => ['class' => 'actions'],
- 'buttons' => [
- 'update' => function ($url, $model) {
- return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [
- 'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
- ]);
- },
- 'delete' => function ($url, $model) {
- return Html::a('<span class="glyphicon glyphicon-trash"></span> Suprimer', $url, [
- 'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
- ]);
- }
- ],
- ],
- ],
- ]); ?>
- </div>
|