feat(admin-users): dedicated admin profile drawer with own tabs
The first pass had admin/users sharing the address book profile partial, which surfaced Contact/Address/Organization/About tabs that ignored the admin-specific context. Separates the admin quick-view so it mirrors the edit-page tab structure while staying read-only. - `UserProfileViewService::buildAdminProfile()` extends the base profile with `admin_extras` (active, email_verified_at, last_login_at, last_login_provider, created, modified). - `templates/partials/app-admin-user-profile.phtml` is the admin-only render path: Master data · Organization · Security · About. Status badge under the name; timestamps locale-formatted. - `pages/admin/users/view-fragment($id).php` / `(none).phtml` switched to the admin service method + partial. - Drawer CSS aligns the aside with the main section's inline padding so the content strip does not visually step in/out. Address book is unchanged — still uses `buildProfile()` + the base partial. Two i18n keys added (`Login provider`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -124,6 +124,37 @@ class UserProfileViewService
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Extended profile for admin contexts. Returns the same shape as
|
||||
* buildProfile() plus `$user['admin_extras']` with operational fields
|
||||
* that are inappropriate for non-admin views (email verification state,
|
||||
* last login, active status, created/modified timestamps).
|
||||
*
|
||||
* @api Called from pages/admin/users/view-fragment($id).php via app(...).
|
||||
*
|
||||
* @return array{status: string, user?: array<string, mixed>}
|
||||
*/
|
||||
public function buildAdminProfile(int $currentUserId, string $uuid): array
|
||||
{
|
||||
$profile = $this->buildProfile($currentUserId, $uuid);
|
||||
if ($profile['status'] !== 'ok' || !isset($profile['user'])) {
|
||||
return $profile;
|
||||
}
|
||||
|
||||
$user = $profile['user'];
|
||||
$user['admin_extras'] = [
|
||||
'active' => (bool) ($user['active'] ?? false),
|
||||
'email_verified_at' => (string) ($user['email_verified_at'] ?? ''),
|
||||
'last_login_at' => (string) ($user['last_login_at'] ?? ''),
|
||||
'last_login_provider' => (string) ($user['last_login_provider'] ?? ''),
|
||||
'created' => (string) ($user['created'] ?? ''),
|
||||
'modified' => (string) ($user['modified'] ?? ''),
|
||||
];
|
||||
$profile['user'] = $user;
|
||||
|
||||
return $profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, int|string> $values
|
||||
* @return list<int>
|
||||
|
||||
Reference in New Issue
Block a user