|
|
@@ -153,13 +153,9 @@ $this->render('_menu', [ |
|
|
|
'update' => function ($url, $model) { |
|
|
|
$url = Yii::$app->urlManager->createUrl(['user/update', 'id' => $model->id]); |
|
|
|
$user = User::find()->with('userProducer')->where(['id' => $model->id])->one(); |
|
|
|
if (count($user->userProducer) <= 1) { |
|
|
|
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ |
|
|
|
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default' |
|
|
|
]); |
|
|
|
} else { |
|
|
|
return '<span data-toggle="tooltip" data-placement="top" title="Vous ne pouvez pas modifier les utilisateurs qui sont liés à plusieurs producteurs."><span class="glyphicon glyphicon-remove-sign"></span> Non modifiable</span>'; |
|
|
|
} |
|
|
|
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ |
|
|
|
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default' |
|
|
|
]); |
|
|
|
}, |
|
|
|
'delete' => function ($url, $model) { |
|
|
|
return Html::a('<span class="glyphicon glyphicon-trash"></span>', Yii::$app->urlManager->createUrl(array_merge(['user/delete', 'id' => $model->id], Yii::$app->getRequest()->getQueryParams())), [ |