50 lines
2.1 KiB
PHP
50 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\Resources\BaselineProfileResource\RelationManagers;
|
|
|
|
use App\Support\Ui\ActionSurface\ActionSurfaceDeclaration;
|
|
use App\Support\Ui\ActionSurface\Enums\ActionSurfaceInspectAffordance;
|
|
use App\Support\Ui\ActionSurface\Enums\ActionSurfaceProfile;
|
|
use App\Support\Ui\ActionSurface\Enums\ActionSurfaceSlot;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
|
|
class BaselineTenantAssignmentsRelationManager extends RelationManager
|
|
{
|
|
protected static string $relationship = 'tenantAssignments';
|
|
|
|
protected static ?string $title = 'Tenant assignments';
|
|
|
|
public static function actionSurfaceDeclaration(): ActionSurfaceDeclaration
|
|
{
|
|
return ActionSurfaceDeclaration::forRelationManager(ActionSurfaceProfile::RelationManager)
|
|
->satisfy(ActionSurfaceSlot::ListHeader, 'Header action: Assign tenant (manage-gated).')
|
|
->satisfy(ActionSurfaceSlot::InspectAffordance, ActionSurfaceInspectAffordance::ClickableRow->value)
|
|
->exempt(ActionSurfaceSlot::ListRowMoreMenu, 'v1 assignments have no row-level actions beyond delete.')
|
|
->exempt(ActionSurfaceSlot::ListBulkMoreGroup, 'No bulk mutations for assignments in v1.')
|
|
->satisfy(ActionSurfaceSlot::ListEmptyState, 'Empty state encourages assigning a tenant.');
|
|
}
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('tenant.display_name')
|
|
->label('Tenant')
|
|
->searchable(),
|
|
Tables\Columns\TextColumn::make('assignedByUser.name')
|
|
->label('Assigned by')
|
|
->placeholder('—'),
|
|
Tables\Columns\TextColumn::make('created_at')
|
|
->label('Assigned at')
|
|
->dateTime()
|
|
->sortable(),
|
|
])
|
|
->emptyStateHeading('No tenants assigned')
|
|
->emptyStateDescription('Assign a tenant to compare its state against this baseline profile.');
|
|
}
|
|
}
|