<?php

namespace App\Filament\Resources\SourceFileResource\RelationManagers;

use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
use Filament\Actions\ViewAction;

class SourcePapersRelationManager extends RelationManager
{
    protected static string $relationship = 'papers';

    protected static ?string $recordTitleAttribute = 'title';

    public function table(Table $table): Table
    {
        return $table
            ->columns([
                Tables\Columns\TextColumn::make('order')->label('顺序')->sortable(),
                Tables\Columns\TextColumn::make('title')->label('卷标题')->searchable(),
                Tables\Columns\TextColumn::make('chapter')->label('章节'),
                Tables\Columns\TextColumn::make('grade')->label('年级'),
                Tables\Columns\TextColumn::make('term')->label('学期'),
            ])
            ->actions([
                ViewAction::make(),
            ])
            ->headerActions([]);
    }
}
