columns(1) ->schema([ Forms\Components\TextInput::make('name') ->label('Name') ->required() ->maxLength(255), Forms\Components\TextInput::make('description') ->label('Description') ->nullable() ->maxLength(255), Toggle::make('is_public') ->label('Is public?') ->required(), DateTimePicker::make('public_until') ->label('Public until') ->nullable(), Forms\Components\Select::make('organization_id') ->label('Organization') ->relationship(name: 'organization', titleAttribute: 'name') ->searchable(['name']) ->disabled() ->required(), Forms\Components\TextInput::make('share_secret') ->label('Share Secret') ->nullable(), PrettyJson::make('properties') ->formatStateUsing(function (ReportPropertiesDto $state, Report $record): string { return $record->getRawOriginal('properties'); }) ->disabled(), Forms\Components\DateTimePicker::make('created_at') ->label('Created At') ->hiddenOn(['create']) ->disabled(), Forms\Components\DateTimePicker::make('updated_at') ->label('Updated At') ->hiddenOn(['create']) ->disabled(), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('name') ->searchable() ->sortable(), Tables\Columns\TextColumn::make('description') ->searchable() ->sortable(), ToggleColumn::make('is_public') ->label('Is public?') ->sortable(), TextColumn::make('organization.name') ->searchable() ->sortable(), Tables\Columns\TextColumn::make('created_at') ->dateTime() ->sortable(), Tables\Columns\TextColumn::make('updated_at') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), ]) ->defaultSort('created_at', 'desc') ->filters([ SelectFilter::make('organization') ->label('Organization') ->relationship('organization', 'name') ->searchable(), SelectFilter::make('organization_id') ->label('Organization ID') ->relationship('organization', 'id') ->searchable(), ]) ->actions([ Action::make('public-view') ->label('Public') ->icon('heroicon-o-eye') ->color('gray') ->hidden(fn (Report $record): bool => $record->getShareableLink() === null) ->url(fn (Report $record): string => $record->getShareableLink(), true), Tables\Actions\ViewAction::make(), Tables\Actions\EditAction::make(), Tables\Actions\DeleteAction::make(), ]) ->bulkActions([ ]); } public static function getRelations(): array { return [ ]; } public static function getPages(): array { return [ 'index' => Pages\ListReports::route('/'), 'edit' => Pages\EditReport::route('/{record}/edit'), 'view' => Pages\ViewReport::route('/{record}'), ]; } }