= 1a7134419c Refactor: Improve dependency injection for dashboard components and enhance SAML logging
- 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.
2026-06-01 13:05:59 +00:00

96 lines
2.7 KiB
PHP

<?php
use App\Data\Ui\ManageRoles\RoleData;
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 {
#[DataCollectionOf(TableHeader::class)]
public DataCollection $header;
private AdminDashboardService $service;
public function boot(AdminDashboardService $service): void
{
$this->service = $service;
}
/**
* Get roles for the manager.
*
* @return DataCollection<int, RoleData>
*/
#[Computed]
public function roles(): DataCollection
{
return $this->service->getRoles();
}
public function mount(): void
{
$this->header = TableHeader::collect([
[
"key" => "name",
"label" => "Role Name",
],
[
"key" => "users",
"label" => "User Assigned",
],
[
"key" => "services",
"label" => "Services",
],
[
"key" => "status",
"label" => "Status",
],
], DataCollection::class);
}
};
?>
<div>
<x-shared.card title="Roles" icon="lucide-shield-ellipsis" class="p-0">
<x-slot:actions>
<x-shared.button icon="lucide-plus">
{{ __('Add role') }}
</x-shared.button>
</x-slot:actions>
<x-mary-table :headers="$header->toArray()" :rows="$this->roles->items()">
@scope('cell_users', $role)
@php /** @var RoleData $role */ @endphp
<div class="flex -space-x-3">
@foreach($role->users as $user)
<x-shared.avatar class="text-blue-800" :placeholder="$user->name"/>
@endforeach
</div>
@endscope
@scope('cell_status', $role)
@php /** @var RoleData $role */ @endphp
<x-shared.badge class="bg-lime-200 text-lime-800 font-bold">
{{ ucfirst($role->status->name) }}
</x-shared.badge>
@endscope
@scope('cell_services', $role)
@php /** @var RoleData $role */ @endphp
@foreach($role->services as $service)
<x-shared.badge class="bg-indigo-200 text-indigo-800 font-bold">
{{$service->name}}
</x-shared.badge>
@endforeach
@endscope
@scope('actions', $role)
<x-shared.button icon="lucide-square-pen"/>
@endscope
</x-mary-table>
</x-shared.card>
</div>