title = 'Producteurs';
$this->params['breadcrumbs'][] = 'Administration' ;
$this->params['breadcrumbs'][] = $this->title;
?>
Producteurs
= 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)
.'
'.Html::encode($u->email)
.'
'.Html::encode($u->telephone) ;
}
}
}
}
],
[
'attribute' => 'actif',
'format' => 'raw',
'value' => function($model) {
$html = '' ;
if($model->actif)
$html .= 'En ligne' ;
else
$html .= 'Hors-ligne' ;
if(strlen($model->code))
{
$html .= ' ' ;
}
return $html ;
}
],
[
'attribute' => 'Gratuit',
'format' => 'raw',
'value' => function($model) {
if($model->gratuit)
return 'Compte gratuit' ;
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).' €
' ;
return $html ;
}
],
],
]); ?>