|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
-
- use yii\helpers\Html;
- use yii\grid\GridView;
-
- /* @var $this yii\web\View */
- /* @var $dataProvider yii\data\ActiveDataProvider */
-
- $this->title = 'Commandes récurrentes';
- $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) {
- 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).'<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' => 'lundi',
- 'label' => 'Jours',
- '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 '' ;
- }
- ],
- [
- '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>
|