Refactor: merge SettingsController into ProfileController
Removed SettingsController and moved its logic into ProfileController, consolidating user profile, account, GDPR, network, and two-factor authentication actions. Updated routes, behaviors, and view files to reflect the new structure. Also updated composer.json to use pcrt/yii2-usuario and pcrt/yii2-select2, added 'surname' to Profile model, and added new attributes to User model. Improved user feedback by redirecting after key actions instead of rendering message views.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
use Da\User\Model\User;
|
||||
use yii\bootstrap\Nav;
|
||||
use yii\bootstrap4\Nav;
|
||||
use yii\helpers\Html;
|
||||
use yii\web\View;
|
||||
use Da\User\Module as UserModule;
|
||||
@ -36,112 +36,104 @@ $module = Yii::$app->getModule('user');
|
||||
]
|
||||
) ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?= $this->render('/shared/_menu') ?>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<?= Nav::widget(
|
||||
[
|
||||
'options' => [
|
||||
'class' => 'nav-pills nav-stacked',
|
||||
],
|
||||
'items' => [
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Account details'),
|
||||
'url' => ['/user/admin/update', 'id' => $user->id],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Profile details'),
|
||||
'url' => ['/user/admin/update-profile', 'id' => $user->id],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Information'),
|
||||
'url' => ['/user/admin/info', 'id' => $user->id],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Assignments'),
|
||||
'url' => ['/user/admin/assignments', 'id' => $user->id],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Session history'),
|
||||
'url' => ['/user/admin/session-history', 'id' => $user->id],
|
||||
'visible' => $module->enableSessionHistory,
|
||||
],
|
||||
'<hr>',
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Confirm'),
|
||||
'url' => ['/user/admin/confirm', 'id' => $user->id],
|
||||
'visible' => !$user->isConfirmed,
|
||||
'linkOptions' => [
|
||||
'class' => 'text-success',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t(
|
||||
'usuario',
|
||||
'Are you sure you want to confirm this user?'
|
||||
),
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Block'),
|
||||
'url' => ['/user/admin/block', 'id' => $user->id],
|
||||
'visible' => !$user->isBlocked,
|
||||
'linkOptions' => [
|
||||
'class' => 'text-danger',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t(
|
||||
'usuario',
|
||||
'Are you sure you want to block this user?'
|
||||
),
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Unblock'),
|
||||
'url' => ['/user/admin/block', 'id' => $user->id],
|
||||
'visible' => $user->isBlocked,
|
||||
'linkOptions' => [
|
||||
'class' => 'text-success',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t(
|
||||
'usuario',
|
||||
'Are you sure you want to unblock this user?'
|
||||
),
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Delete'),
|
||||
'url' => ['/user/admin/delete', 'id' => $user->id],
|
||||
'linkOptions' => [
|
||||
'class' => 'text-danger',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t(
|
||||
'usuario',
|
||||
'Are you sure you want to delete this user?'
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid px-0">
|
||||
<div class="tab-wrapper">
|
||||
<?= $this->render('/shared/_menu') ?>
|
||||
<div class="row p-3">
|
||||
<div class="col-12 col-md-4 col-lg-3">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?= Nav::widget([
|
||||
'options' => [
|
||||
'class' => 'nav nav-pills flex-column',
|
||||
],
|
||||
'items' => [
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Account details'),
|
||||
'url' => ['/user/admin/update', 'id' => $user->id],
|
||||
'linkOptions' => ['class' => 'nav-link'],
|
||||
'options' => ['class' => 'nav-item'],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Profile details'),
|
||||
'url' => ['/user/admin/update-profile', 'id' => $user->id],
|
||||
'linkOptions' => ['class' => 'nav-link'],
|
||||
'options' => ['class' => 'nav-item'],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Information'),
|
||||
'url' => ['/user/admin/info', 'id' => $user->id],
|
||||
'linkOptions' => ['class' => 'nav-link'],
|
||||
'options' => ['class' => 'nav-item'],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Assignments'),
|
||||
'url' => ['/user/admin/assignments', 'id' => $user->id],
|
||||
'linkOptions' => ['class' => 'nav-link'],
|
||||
'options' => ['class' => 'nav-item'],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Session history'),
|
||||
'url' => ['/user/admin/session-history', 'id' => $user->id],
|
||||
'visible' => $module->enableSessionHistory,
|
||||
'linkOptions' => ['class' => 'nav-link'],
|
||||
'options' => ['class' => 'nav-item'],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Confirm'),
|
||||
'url' => ['/user/admin/confirm', 'id' => $user->id],
|
||||
'visible' => !$user->isConfirmed,
|
||||
'linkOptions' => [
|
||||
'class' => 'nav-link text-success',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t('usuario', 'Are you sure you want to confirm this user?'),
|
||||
],
|
||||
'options' => ['class' => 'nav-item'],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Block'),
|
||||
'url' => ['/user/admin/block', 'id' => $user->id],
|
||||
'visible' => !$user->isBlocked,
|
||||
'linkOptions' => [
|
||||
'class' => 'nav-link text-danger',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t('usuario', 'Are you sure you want to block this user?'),
|
||||
],
|
||||
'options' => ['class' => 'nav-item'],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Unblock'),
|
||||
'url' => ['/user/admin/block', 'id' => $user->id],
|
||||
'visible' => $user->isBlocked,
|
||||
'linkOptions' => [
|
||||
'class' => 'nav-link text-success',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t('usuario', 'Are you sure you want to unblock this user?'),
|
||||
],
|
||||
'options' => ['class' => 'nav-item'],
|
||||
],
|
||||
[
|
||||
'label' => Yii::t('usuario', 'Delete'),
|
||||
'url' => ['/user/admin/delete', 'id' => $user->id],
|
||||
'linkOptions' => [
|
||||
'class' => 'nav-link text-danger',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t('usuario', 'Are you sure you want to delete this user?'),
|
||||
],
|
||||
'options' => ['class' => 'nav-item'],
|
||||
],
|
||||
],
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<?= $content ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-8 col-lg-9">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?= $content ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user