- <?php
-
- use yii\helpers\Html;
- use yii\grid\GridView;
- use common\models\User ;
- use common\models\Etablissement ;
-
- $this->title = 'Producteurs';
- $this->params['breadcrumbs'][] = 'Administration' ;
- $this->params['breadcrumbs'][] = $this->title;
-
- ?>
-
- <h1>Producteurs</h1>
-
- <?= GridView::widget([
- 'dataProvider' => $datas_etablissements,
- 'columns' => [
- 'nom',
- [
- 'attribute' => 'date_creation',
- 'format' => 'raw',
- 'value' => function($model) {
- return date('d/m/Y', strtotime($model->date_creation)) ;
- }
- ],
- [
- 'attribute' => 'Lieu',
- 'format' => 'raw',
- 'value' => function($model) {
- return Html::encode($model->ville.' ('.$model->code_postal.')') ;
- }
- ],
- [
- 'attribute' => 'Clients',
- 'format' => 'raw',
- 'value' => function($model) {
- if(!$model->userEtablissement || !count($model->userEtablissement))
- {
- return 'Aucun client' ;
- }
- else {
- $clients = count($model->userEtablissement).' client' ;
- if(count($model->userEtablissement) > 1)
- $clients .= 's' ;
- return $clients ;
- }
-
- }
- ],
- [
- 'attribute' => 'Contact',
- 'format' => 'raw',
- 'value' => function($model) {
- if(!isset($model->user) || (isset($model->user) && count($model->user) == 0))
- {
- return 'Aucun contact' ;
- }
- else {
- foreach($model->user as $u)
- {
- if($u->status == User::STATUS_BOULANGER)
- {
- return Html::encode($u->prenom.' '.$u->nom)
- .'<br />'.Html::encode($u->email)
- .'<br />'.Html::encode($u->telephone) ;
- }
- }
-
- }
- }
- ],
- [
- 'attribute' => 'actif',
- 'format' => 'raw',
- 'value' => function($model) {
- $html = '' ;
- if($model->actif)
- $html .= '<span class="label label-success">En ligne</span>' ;
- else
- $html .= '<span class="label label-danger">Hors-ligne</span>' ;
-
- if(strlen($model->code))
- {
- $html .= ' <span class="glyphicon glyphicon-lock" data-toggle="tooltip" data-placement="bottom" data-original-title="'.Html::encode($model->code).'"></span>' ;
- }
-
- return $html ;
- }
- ],
- [
- 'attribute' => 'Gratuit',
- 'format' => 'raw',
- 'value' => function($model) {
- if($model->gratuit)
- return '<span class="label label-success">Compte gratuit</span>' ;
- else
- return '' ;
- }
- ],
- [
- 'attribute' => 'Prix libre',
- 'label' => 'Prix libre',
- 'format' => 'raw',
- 'value' => function($model) {
- if(is_null($model->prix_libre))
- return '' ;
- else
- return $model->getPrixLibre() ;
- }
- ],
- [
- 'attribute' => 'Cours',
- 'label' => 'CA mois en cours',
- 'format' => 'raw',
- 'value' => function($model) {
-
- $ca = $model->getCA(date('Y-m')) ;
-
- $html = '' ;
- $html .= 'CA : '.number_format($ca,2).' €<br />' ;
-
- return $html ;
- }
- ],
- ],
- ]); ?>
|