|
- <?php
-
- use yii\helpers\Html;
- use yii\grid\GridView;
- use common\models\PointVenteUser ;
-
- /* @var $this yii\web\View */
- /* @var $dataProvider yii\data\ActiveDataProvider */
-
- $this->title = 'Points de vente';
- $this->params['breadcrumbs'][] = $this->title;
- ?>
- <div class="point-vente-index">
-
- <h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?></h1>
-
- <?= GridView::widget([
- 'dataProvider' => $dataProvider,
- 'columns' => [
- 'nom',
- 'localite',
- [
- 'attribute' => 'point_fabrication',
- 'format' => 'raw',
- 'value' => function($model) {
- if($model->point_fabrication)
- {
- return '<span class="label label-success">Oui</span>' ;
- }
- else {
- return '<span class="label label-danger">Non</span>' ;
- }
-
- }
- ],
- [
- 'label' => 'Livraison',
- 'value' => function($model) {
- $html = '' ;
- if($model->livraison_lundi) $html .= 'lundi, ' ;
- if($model->livraison_mardi) $html .= 'mardi, ' ;
- if($model->livraison_mercredi) $html .= 'mercredi, ' ;
- if($model->livraison_jeudi) $html .= 'jeudi, ' ;
- if($model->livraison_vendredi) $html .= 'vendredi, ' ;
- if($model->livraison_samedi) $html .= 'samedi, ' ;
- if($model->livraison_dimanche) $html .= 'dimanche, ' ;
-
- if(strlen($html))
- return substr ($html, 0, strlen($html)-2) ;
- else
- return '' ;
- }
- ],
- [
- 'attribute' => 'acces_restreint',
- 'format' => 'raw',
- 'value' => function($model) {
- $count = PointVenteUser::find()->where(['id_point_vente' => $model->id])->count();
- $html = '' ;
- if($model->acces_restreint)
- {
- $html .= '<span class="glyphicon glyphicon-lock"></span> ' ;
- if($count == 1)
- {
- $html .= '1 utilisateur' ;
- }
- else {
- $html .= $count.' utilisateurs' ;
- }
- }
-
- if(strlen($model->code))
- {
- if(strlen($html)) $html .= '<br />' ;
- $html .= 'Code : <strong>'.Html::encode($model->code).'</strong>' ;
- }
-
- return $html ;
-
- }
- ],
- [
- 'attribute' => 'credit_pain',
- 'label' => 'Crédit pain',
- 'format' => 'raw',
- 'value' => function($model) {
- if($model->credit_pain)
- return '<span class="glyphicon glyphicon-euro"></span>' ;
- return '' ;
- }
- ],
- [
- '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>
|