big restructure
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
use MintyPHP\Router;
|
||||
use MintyPHP\Session;
|
||||
use MintyPHP\Service\UserAvatarService;
|
||||
use MintyPHP\Service\User\UserAvatarService;
|
||||
|
||||
$values = $form ?? $user ?? [];
|
||||
$avatarUuid = (string) ($values['uuid'] ?? '');
|
||||
@@ -17,6 +17,10 @@ $currentUserId = (int) ($_SESSION['user']['id'] ?? 0);
|
||||
$isOwnAccount = $currentUserId > 0 && $currentUserId === (int) ($values['id'] ?? 0);
|
||||
$titleText = $isOwnAccount ? t('My account') : t('Edit user');
|
||||
$canViewUsers = can('users.view');
|
||||
$canViewAddressBook = can('address_book.view');
|
||||
$canViewUserMeta = can('users.view_meta');
|
||||
$canViewUserAudit = can('users.view_audit');
|
||||
$hasDetailsActions = $canViewAddressBook || !empty($canEditUser) || can('users.delete');
|
||||
$hideNavigation = $isOwnAccount && !$canViewUsers;
|
||||
|
||||
?>
|
||||
@@ -24,10 +28,14 @@ $hideNavigation = $isOwnAccount && !$canViewUsers;
|
||||
<div class="app-details-container">
|
||||
<section>
|
||||
<?php if (!$hideNavigation): ?>
|
||||
<div class="app-breadcrumb">
|
||||
<a href="/admin">Startseite</a><i class="bi bi-chevron-right"></i><a
|
||||
href="/admin/users"><?php e(t('Users')); ?></a><i class="bi bi-chevron-right"></i><?php e($titleText); ?>
|
||||
</div>
|
||||
<?php
|
||||
$breadcrumbs = [
|
||||
['label' => t('Home'), 'path' => 'admin'],
|
||||
['label' => t('Users'), 'path' => 'admin/users'],
|
||||
['label' => $titleText],
|
||||
];
|
||||
require templatePath('partials/app-breadcrumb.phtml');
|
||||
?>
|
||||
<?php endif; ?>
|
||||
<div class="app-details-titlebar">
|
||||
<h1>
|
||||
@@ -37,10 +45,17 @@ $hideNavigation = $isOwnAccount && !$canViewUsers;
|
||||
<?php e($titleText); ?>
|
||||
</h1>
|
||||
<div class="app-details-titlebar-actions">
|
||||
<?php if (can('users.delete')): ?>
|
||||
<?php if ($hasDetailsActions): ?>
|
||||
<details class="dropdown">
|
||||
<summary role="button" class="outline secondary"><i class="bi bi-three-dots"></i></summary>
|
||||
<ul dir="rtl">
|
||||
<?php if ($canViewAddressBook): ?>
|
||||
<li>
|
||||
<a role="button" class="transparent" href="<?php e(lurl('address-book/view/' . ($values['uuid'] ?? ''))); ?>">
|
||||
<?php e(t('View in address book')); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<li>
|
||||
<?php if (!empty($canEditUser)): ?>
|
||||
<form method="post" action="admin/users/send-access/<?php e($values['uuid'] ?? ''); ?>"
|
||||
@@ -119,6 +134,10 @@ $hideNavigation = $isOwnAccount && !$canViewUsers;
|
||||
$canEditAssignments = $canEditAssignments ?? false;
|
||||
$permissionRows = $permissionRows ?? [];
|
||||
$showPermissions = !empty($permissionRows) && can('permissions.view');
|
||||
$passwordResets = $passwordResets ?? [];
|
||||
$showPasswordResets = !empty($passwordResets);
|
||||
$rememberTokens = $rememberTokens ?? [];
|
||||
$showRememberTokens = !empty($rememberTokens);
|
||||
require __DIR__ . '/_form.phtml';
|
||||
?>
|
||||
</section>
|
||||
@@ -169,57 +188,59 @@ $hideNavigation = $isOwnAccount && !$canViewUsers;
|
||||
</details>
|
||||
<?php endif; ?>
|
||||
<hr>
|
||||
<details name="user-meta" open>
|
||||
<summary><?php e(t('Status & meta')); ?></summary>
|
||||
<?php if ($canViewUserMeta): ?>
|
||||
<details name="user-meta" open>
|
||||
<summary><?php e(t('Status & meta')); ?></summary>
|
||||
<hr>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('ID')); ?></small>
|
||||
<p>
|
||||
<span class="badge" data-variant="neutral" data-copy="true"
|
||||
data-copy-value="<?php e($values['id'] ?? ''); ?>">
|
||||
<?php e($values['id'] ?? '-'); ?>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Status')); ?></small>
|
||||
<p>
|
||||
<?php if (!empty($values['active'])): ?>
|
||||
<span class="badge" data-variant="success"><?php e(t('Active')); ?></span>
|
||||
<?php else: ?>
|
||||
<span class="badge" data-variant="danger"><?php e(t('Inactive')); ?></span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Email')); ?></small>
|
||||
<p>
|
||||
<?php if (!empty($values['email_verified_at'])): ?>
|
||||
<span class="badge" data-variant="success"><?php e(t('Verified')); ?> <?php e(dt($values['email_verified_at'])); ?></span>
|
||||
<?php else: ?>
|
||||
<span class="badge" data-variant="warning"><?php e(t('Not verified')); ?></span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<small>
|
||||
<?php e(t('UUID')); ?>
|
||||
</small>
|
||||
<p>
|
||||
<span class="badge" data-variant="neutral" data-copy="true"
|
||||
data-copy-value="<?php e($values['uuid'] ?? ''); ?>">
|
||||
<?php
|
||||
$uuidValue = (string) ($values['uuid'] ?? '');
|
||||
$uuidDisplay = $uuidValue !== '' ? substr($uuidValue, 0, 10) : '-';
|
||||
e($uuidDisplay);
|
||||
?>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</details>
|
||||
<hr>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('ID')); ?></small>
|
||||
<p>
|
||||
<span class="badge" data-variant="neutral" data-copy="true"
|
||||
data-copy-value="<?php e($values['id'] ?? ''); ?>">
|
||||
<?php e($values['id'] ?? '-'); ?>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Status')); ?></small>
|
||||
<p>
|
||||
<?php if (!empty($values['active'])): ?>
|
||||
<span class="badge" data-variant="success"><?php e(t('Active')); ?></span>
|
||||
<?php else: ?>
|
||||
<span class="badge" data-variant="danger"><?php e(t('Inactive')); ?></span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<small><?php e(t('Email')); ?></small>
|
||||
<p>
|
||||
<?php if (!empty($values['email_verified_at'])): ?>
|
||||
<span class="badge" data-variant="success"><?php e(t('Verified')); ?> <?php e(dt($values['email_verified_at'])); ?></span>
|
||||
<?php else: ?>
|
||||
<span class="badge" data-variant="warning"><?php e(t('Not verified')); ?></span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<small>
|
||||
<?php e(t('UUID')); ?>
|
||||
</small>
|
||||
<p>
|
||||
<span class="badge" data-variant="neutral" data-copy="true"
|
||||
data-copy-value="<?php e($values['uuid'] ?? ''); ?>">
|
||||
<?php
|
||||
$uuidValue = (string) ($values['uuid'] ?? '');
|
||||
$uuidDisplay = $uuidValue !== '' ? substr($uuidValue, 0, 10) : '-';
|
||||
e($uuidDisplay);
|
||||
?>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</details>
|
||||
<hr>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
$createdByLabel = $values['created_by_label'] ?? '';
|
||||
$createdById = $values['created_by'] ?? null;
|
||||
@@ -231,82 +252,84 @@ $hideNavigation = $isOwnAccount && !$canViewUsers;
|
||||
$activeChangedById = $values['active_changed_by'] ?? null;
|
||||
$activeChangedByUuid = $values['active_changed_by_uuid'] ?? null;
|
||||
?>
|
||||
<details name="user-audit">
|
||||
<summary><?php e(t('Audit')); ?></summary>
|
||||
<hr>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('Created')); ?></small>
|
||||
<p><?php e(dt($values['created'] ?? '') ?: '-'); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<small>
|
||||
<?php e(t('Created by')); ?>
|
||||
</small>
|
||||
<p>
|
||||
<?php if ($createdByLabel !== ''): ?>
|
||||
<?php if ($createdByUuid): ?>
|
||||
<a href="admin/users/edit/<?php e($createdByUuid); ?>"><?php e($createdByLabel); ?></a>
|
||||
<?php if ($canViewUserAudit): ?>
|
||||
<details name="user-audit">
|
||||
<summary><?php e(t('Audit')); ?></summary>
|
||||
<hr>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('Created')); ?></small>
|
||||
<p><?php e(dt($values['created'] ?? '') ?: '-'); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<small>
|
||||
<?php e(t('Created by')); ?>
|
||||
</small>
|
||||
<p>
|
||||
<?php if ($createdByLabel !== ''): ?>
|
||||
<?php if ($createdByUuid): ?>
|
||||
<a href="admin/users/edit/<?php e($createdByUuid); ?>"><?php e($createdByLabel); ?></a>
|
||||
<?php else: ?>
|
||||
<?php e($createdByLabel); ?>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($createdById): ?>
|
||||
<?php e('#' . $createdById); ?>
|
||||
<?php else: ?>
|
||||
<?php e($createdByLabel); ?>
|
||||
-
|
||||
<?php endif; ?>
|
||||
<?php elseif ($createdById): ?>
|
||||
<?php e('#' . $createdById); ?>
|
||||
<?php else: ?>
|
||||
-
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('Modified')); ?></small>
|
||||
<p><?php e(dt($values['modified'] ?? '') ?: '-'); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<small>
|
||||
<?php e(t('Modified by')); ?>
|
||||
</small>
|
||||
<p>
|
||||
<?php if ($modifiedByLabel !== ''): ?>
|
||||
<?php if ($modifiedByUuid): ?>
|
||||
<a href="admin/users/edit/<?php e($modifiedByUuid); ?>"><?php e($modifiedByLabel); ?></a>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('Modified')); ?></small>
|
||||
<p><?php e(dt($values['modified'] ?? '') ?: '-'); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<small>
|
||||
<?php e(t('Modified by')); ?>
|
||||
</small>
|
||||
<p>
|
||||
<?php if ($modifiedByLabel !== ''): ?>
|
||||
<?php if ($modifiedByUuid): ?>
|
||||
<a href="admin/users/edit/<?php e($modifiedByUuid); ?>"><?php e($modifiedByLabel); ?></a>
|
||||
<?php else: ?>
|
||||
<?php e($modifiedByLabel); ?>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($modifiedById): ?>
|
||||
<?php e('#' . $modifiedById); ?>
|
||||
<?php else: ?>
|
||||
<?php e($modifiedByLabel); ?>
|
||||
-
|
||||
<?php endif; ?>
|
||||
<?php elseif ($modifiedById): ?>
|
||||
<?php e('#' . $modifiedById); ?>
|
||||
<?php else: ?>
|
||||
-
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('Status changed')); ?></small>
|
||||
<p><?php e(dt($values['active_changed_at'] ?? '') ?: '-'); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<small>
|
||||
<?php e(t('Status changed by')); ?>
|
||||
</small>
|
||||
<p>
|
||||
<?php if ($activeChangedByLabel !== ''): ?>
|
||||
<?php if ($activeChangedByUuid): ?>
|
||||
<a href="admin/users/edit/<?php e($activeChangedByUuid); ?>"><?php e($activeChangedByLabel); ?></a>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<small><?php e(t('Status changed')); ?></small>
|
||||
<p><?php e(dt($values['active_changed_at'] ?? '') ?: '-'); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<small>
|
||||
<?php e(t('Status changed by')); ?>
|
||||
</small>
|
||||
<p>
|
||||
<?php if ($activeChangedByLabel !== ''): ?>
|
||||
<?php if ($activeChangedByUuid): ?>
|
||||
<a href="admin/users/edit/<?php e($activeChangedByUuid); ?>"><?php e($activeChangedByLabel); ?></a>
|
||||
<?php else: ?>
|
||||
<?php e($activeChangedByLabel); ?>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($activeChangedById): ?>
|
||||
<?php e('#' . $activeChangedById); ?>
|
||||
<?php else: ?>
|
||||
<?php e($activeChangedByLabel); ?>
|
||||
-
|
||||
<?php endif; ?>
|
||||
<?php elseif ($activeChangedById): ?>
|
||||
<?php e('#' . $activeChangedById); ?>
|
||||
<?php else: ?>
|
||||
-
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</details>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user