= 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

92 lines
2.7 KiB
PHP

<?php
use App\Data\Ui\TableHeader;
use App\Data\Users\UserData;
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 user assignments.
*
* @return DataCollection<int, UserData>
*/
#[Computed]
public function users(): DataCollection
{
return $this->service->getUserAssignments();
}
public function mount(): void
{
$this->header = TableHeader::collect([
new TableHeader('name', 'User'),
new TableHeader('role.name', 'Role'),
new TableHeader('role.service', 'Service Access'),
new TableHeader('status', 'Status'),
], DataCollection::class);
}
};
?>
<div>
<x-shared.card title="User Assignments" icon="lucide-users" class="p-0">
<x-slot:actions>
<x-shared.button icon="lucide-plus">
{{ __('Assign user') }}
</x-shared.button>
</x-slot:actions>
<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_role.name', $row)
<div class="flex space-x-2">
@foreach ($row->roles as $role)
<x-shared.badge>
{{$role->name}}
</x-shared.badge>
@endforeach
</div>
@endscope
@scope('cell_role.service', $row)
<div class="flex space-x-2 text-sm">
@foreach ($row->roles as $role)
@foreach($role->services as $service)
{{$service->name}},
@endforeach
@endforeach
</div>
@endscope
@scope('cell_status', $row)
@if($row->active)
<x-shared.badge class="bg-lime-200 text-lime-800 font-bold">Active</x-shared.badge>
@else
<x-shared.badge class="bg-orange-200 text-orange-800 font-bold">Not Active</x-shared.badge>
@endif
@endscope
@scope('actions', $row)
<x-shared.button icon="lucide-square-pen"/>
@endscope
</x-mary-table>
</x-shared.card>
</div>