title = 'Commandes récurrentes'; $this->params['breadcrumbs'][] = $this->title; ?>

title) ?> 'btn btn-success']) ?>

$dataProvider, 'columns' => [ [ 'attribute' => 'id_user', 'format' => 'raw', 'value' => function($model) { if(strlen($model->username)) { return Html::encode($model->username) ; } else { if(isset($model->user)) 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).'
' ; } // aucun produit if(!count($model->commandeAutoProduit)) { $html .= ' Aucun produit' ; } 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' => 'lundi', 'label' => 'Jours', 'format' => 'raw', 'value' => function($model) { $html = '' ; if($model->lundi) $html .= 'lundi, ' ; if($model->mardi) $html .= 'mardi, ' ; if($model->mercredi) $html .= 'mercredi, ' ; if($model->jeudi) $html .= 'jeudi, ' ; if($model->vendredi) $html .= 'vendredi, ' ; if($model->samedi) $html .= 'samedi, ' ; if($model->dimanche) $html .= 'dimanche, ' ; if(strlen($html)) return substr ($html, 0, strlen($html) - 2) ; else return ' Aucun jour' ; } ], [ 'attribute' => 'periodicite_semaine', 'value' => function($model) { if($model->periodicite_semaine == 1) return 'Toutes les semaines' ; else return 'Toutes les '.$model->periodicite_semaine.' semaines' ; } ], [ 'attribute' => 'paiement_automatique', 'format' => 'raw', 'value' => function($model) { if($model->paiement_automatique) return 'Oui' ; else return 'Non' ; } ], [ 'class' => 'yii\grid\ActionColumn', 'template' => '{update} {delete}', 'headerOptions' => ['class' => 'actions'], 'buttons' => [ 'update' => function ($url, $model) { return Html::a(' Modifier', $url, [ 'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default' ]); }, 'delete' => function ($url, $model) { return Html::a(' Suprimer', $url, [ 'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default' ]); } ], ], ], ]); ?>