= Html::encode($this->title) ?>
= Html::a('Ajouter', ['create'], ['class' => 'btn btn-primary']) ?>
= Html::a(' Liste des emails', ['mail'], ['class' => 'btn btn-default']) ?>
= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'nom',
'prenom',
'telephone',
'email',
[
'attribute' => 'credit',
'format' => 'raw',
'value' => function($model) use($etablissement) {
$html = '
'.Html::a(
' Crédit',
Yii::$app->urlManager->createUrl(['user/credit','id' => $model['id']]),
[
'title' => 'Crédit',
'class' => 'btn btn-default'
]
).'
' ;
return $html ;
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update}',
'headerOptions' => ['class' => 'actions'],
'buttons' => [
'update' => function ($url, $model) {
$url = Yii::$app->urlManager->createUrl(['user/update','id' => $model['id']]) ;
$user = User::find()->with('userEtablissement')->where(['id' => $model['id']])->one() ;
if(count($user->userEtablissement) <= 1)
{
return Html::a('
Modifier', $url, [
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
]);
}
else {
return '
Non modifiable' ;
}
},
],
],
],
]); ?>