label('Admin Notes'), ]; } // Infolists public static function getInfolistSchema(): array { return [ TextEntry::make('client') ->label('Client') ->state(fn (AccountDeletionRequest $record) => $record?->user?->name ?? '—'), TextEntry::make('email') ->label('Email') ->state(fn (AccountDeletionRequest $record) => $record?->user?->email ?? '—') ->copyable(), TextEntry::make('status') ->label('Status') ->badge() ->color(fn (AccountDeletionRequest $record) => match ($record->status) { AccountDeletionRequest::STATUS_COMPLETED => 'success', AccountDeletionRequest::STATUS_DENIED => 'danger', AccountDeletionRequest::STATUS_APPROVED => 'warning', default => 'info', }), TextEntry::make('reason') ->label('Reason') ->state(fn (AccountDeletionRequest $record) => $record->reason ?? '—') ->columnSpanFull() ->extraAttributes(['class' => 'whitespace-pre-wrap']), TextEntry::make('requested_at') ->label('Requested at') ->state(fn (AccountDeletionRequest $record) => optional($record->created_at)?->toDayDateTimeString() ?? '—'), TextEntry::make('processed_at') ->label('Processed at') ->state(fn (AccountDeletionRequest $record) => optional($record->processed_at)?->toDayDateTimeString() ?? '—'), TextEntry::make('processed_by') ->label('Processed by') ->state(fn (AccountDeletionRequest $record) => $record?->processor?->name ?? '—'), TextEntry::make('admin_notes') ->label('Admin notes') ->state(fn (AccountDeletionRequest $record) => $record->admin_notes ?? '—') ->columnSpanFull() ->extraAttributes(['class' => 'whitespace-pre-wrap']), ViewEntry::make('metadata') ->label('Request metadata') ->view('admin.infolists.components.json') ->state(fn (AccountDeletionRequest $record) => $record->metadata) ->columnSpanFull(), ViewEntry::make('snapshot') ->label('Snapshot') ->view('admin.infolists.components.json') ->state(fn (AccountDeletionRequest $record) => $record->snapshot) ->columnSpanFull(), ]; } // Table public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('user.name') ->label('Client') ->searchable() ->sortable(), TextColumn::make('user.email') ->label('Email') ->searchable() ->sortable(), TextColumn::make('status') ->label('Status') ->badge() ->color(fn (string $state) => match ($state) { AccountDeletionRequest::STATUS_COMPLETED => 'success', AccountDeletionRequest::STATUS_DENIED => 'danger', AccountDeletionRequest::STATUS_APPROVED => 'warning', default => 'info', }) ->icon(fn (string $state) => match ($state) { AccountDeletionRequest::STATUS_COMPLETED => 'heroicon-o-check-circle', AccountDeletionRequest::STATUS_DENIED => 'heroicon-o-x-circle', AccountDeletionRequest::STATUS_APPROVED => 'heroicon-o-hand-raised', default => 'heroicon-o-clock', }) ->sortable(), TextColumn::make('created_at') ->label('Requested') ->dateTime() ->sortable(), TextColumn::make('processed_at') ->label('Processed') ->dateTime() ->sortable(), ]) ->filters([ SelectFilter::make('status') ->options([ AccountDeletionRequest::STATUS_PENDING => 'Pending', AccountDeletionRequest::STATUS_APPROVED => 'Approved', AccountDeletionRequest::STATUS_COMPLETED => 'Completed', AccountDeletionRequest::STATUS_DENIED => 'Denied', ]), ]) ->actions([ TableAction::make('view') ->label('View') ->icon('heroicon-o-eye') ->url(fn (AccountDeletionRequest $record): string => static::getUrl('view', ['record' => $record])) ->visible(fn () => static::getPages()['view'] ?? false), ]); } // Pages public static function getPages(): array { return [ 'index' => ListDeletionRequests::route('/'), 'view' => ViewDeletionRequest::route('/{record}'), ]; } }