- Removed inline data definitions from multiple dashboard components for roles, users, and connected apps, replacing them with service-based computed properties. - Added comprehensive debug and error-level logging throughout `SamlIdpService` and related controllers to improve traceability of SAML flows. - Cleaned up and centralized SAML-related logic, improving maintainability and error handling consistency. - Deleted unused `hr-permission.blade.php` component to reduce code redundancy.
72 lines
2.2 KiB
PHP
72 lines
2.2 KiB
PHP
<?php
|
|
|
|
use App\Data\Ui\Dashboard\LatestUserData;
|
|
use App\Data\Ui\TableHeader;
|
|
use App\Services\AdminDashboardService;
|
|
use Livewire\Attributes\Computed;
|
|
use Livewire\Component;
|
|
use Spatie\LaravelData\Attributes\DataCollectionOf;
|
|
use Spatie\LaravelData\DataCollection;
|
|
|
|
new class extends Component {
|
|
/** @var DataCollection<int, TableHeader> */
|
|
#[DataCollectionOf(TableHeader::class)]
|
|
public DataCollection $header;
|
|
|
|
private AdminDashboardService $service;
|
|
|
|
public function boot(AdminDashboardService $service): void
|
|
{
|
|
$this->service = $service;
|
|
}
|
|
|
|
/**
|
|
* Get the latest users.
|
|
*
|
|
* @return DataCollection<int, LatestUserData>
|
|
*/
|
|
#[Computed]
|
|
public function users(): DataCollection
|
|
{
|
|
return $this->service->getLatestUsers();
|
|
}
|
|
|
|
public function mount(): void
|
|
{
|
|
$this->header = TableHeader::collect([
|
|
new TableHeader('name', 'User'),
|
|
new TableHeader('registeredAt', 'Registered'),
|
|
new TableHeader('roles', 'Roles'),
|
|
], DataCollection::class);
|
|
}
|
|
};
|
|
?>
|
|
|
|
<div>
|
|
<x-shared.card title="Latest Users" icon="lucide-user-plus" class="p-0">
|
|
<x-mary-table :headers="$header->toArray()" :rows="$this->users->items()">
|
|
@scope('cell_name', $row)
|
|
<x-shared.avatar :placeholder="$row->name" :title="$row->name" :subtitle="$row->email"/>
|
|
@endscope
|
|
|
|
@scope('cell_registeredAt', $row)
|
|
<span class="text-sm font-medium text-gray-600 dark:text-gray-400">
|
|
{{ $row->registeredAt }}
|
|
</span>
|
|
@endscope
|
|
|
|
@scope('cell_roles', $row)
|
|
<div class="flex space-x-1.5 flex-wrap gap-y-1">
|
|
@forelse ($row->roles as $role)
|
|
<x-shared.badge class="bg-indigo-50 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-400 border border-indigo-100 dark:border-indigo-800/40 text-xs font-semibold">
|
|
{{ $role->name }}
|
|
</x-shared.badge>
|
|
@empty
|
|
<span class="text-xs text-gray-400 italic">No roles assigned</span>
|
|
@endforelse
|
|
</div>
|
|
@endscope
|
|
</x-mary-table>
|
|
</x-shared.card>
|
|
</div>
|